15#include <dolfinx/common/types.h>
16#include <dolfinx/mesh/EntityMap.h>
17#include <dolfinx/mesh/Mesh.h>
26template <dolfinx::scalar T, std::
floating_po
int U>
41template <dolfinx::scalar T, std::
floating_po
int U = dolfinx::scalar_value_t<T>>
75 const std::vector<std::shared_ptr<
79 std::span<const geometry_type>
X, std::array<std::size_t, 2> Xshape,
85 const std::vector<std::reference_wrapper<const dolfinx::mesh::EntityMap>>&
107 return _argument_space;
113 std::shared_ptr<const Function<scalar_type, geometry_type>>>&
116 return _coefficients;
122 const std::vector<std::shared_ptr<const Constant<scalar_type>>>&
135 std::vector<int> n{0};
136 for (
auto& c : _coefficients)
139 throw std::runtime_error(
"Not all form coefficients have been set.");
140 n.push_back(n.back() + c->function_space()->element()->space_dimension());
157 return std::reduce(_value_shape.begin(), _value_shape.end(), 1,
162 const std::vector<std::size_t>&
value_shape()
const {
return _value_shape; }
165 std::pair<std::vector<geometry_type>, std::array<std::size_t, 2>>
X()
const
171 const std::vector<std::reference_wrapper<const dolfinx::mesh::EntityMap>>&
180 return _coordinate_element_hash;
185 std::shared_ptr<const FunctionSpace<geometry_type>> _argument_space;
188 std::vector<std::shared_ptr<const Function<scalar_type, geometry_type>>>
192 std::vector<std::shared_ptr<const Constant<scalar_type>>> _constants;
200 std::vector<std::size_t> _value_shape;
203 std::pair<std::vector<geometry_type>, std::array<std::size_t, 2>> _x_ref;
207 std::vector<std::reference_wrapper<const dolfinx::mesh::EntityMap>>
211 std::uint64_t _coordinate_element_hash;
Constant (in space) value which can be attached to a Form.
Definition Constant.h:22
U geometry_type
Geometry type of the points.
Definition Expression.h:52
std::pair< std::vector< geometry_type >, std::array< std::size_t, 2 > > X() const
Evaluation point coordinates on the reference cell.
Definition Expression.h:165
const std::vector< std::shared_ptr< const Function< scalar_type, geometry_type > > > & coefficients() const
Expression coefficients.
Definition Expression.h:114
Expression(const std::vector< std::shared_ptr< const Function< scalar_type, geometry_type > > > &coefficients, const std::vector< std::shared_ptr< const Constant< scalar_type > > > &constants, std::span< const geometry_type > X, std::array< std::size_t, 2 > Xshape, std::function< void(scalar_type *, const scalar_type *, const scalar_type *, const geometry_type *, const int *, const uint8_t *, void *)> fn, const std::vector< std::size_t > &value_shape, const std::vector< std::reference_wrapper< const dolfinx::mesh::EntityMap > > &entity_maps, std::uint64_t coordinate_element_hash, std::shared_ptr< const FunctionSpace< geometry_type > > argument_space=nullptr)
Create an Expression.
Definition Expression.h:74
std::shared_ptr< const FunctionSpace< geometry_type > > argument_space() const
Argument function space.
Definition Expression.h:105
std::uint64_t coordinate_element_hash() const
Hash for coordinate element used to create the expression.
Definition Expression.h:178
const std::function< void(scalar_type *, const scalar_type *, const scalar_type *, const geometry_type *, const int *, const uint8_t *, void *)> & kernel() const
Function for tabulating the Expression.
Definition Expression.h:149
const std::vector< std::shared_ptr< const Constant< scalar_type > > > & constants() const
Expression constants.
Definition Expression.h:123
std::vector< int > coefficient_offsets() const
Offset for each coefficient expansion array on a cell.
Definition Expression.h:133
int value_size() const
Value size of the Expression result.
Definition Expression.h:155
Expression(Expression &&e)=default
Move constructor.
virtual ~Expression()=default
Destructor.
T scalar_type
Scalar type.
Definition Expression.h:49
const std::vector< std::reference_wrapper< const dolfinx::mesh::EntityMap > > & entity_maps() const
Maps between entities of different meshes.
Definition Expression.h:172
const std::vector< std::size_t > & value_shape() const
Value shape of of Expression result (at a point),.
Definition Expression.h:162
This class represents a finite element function space defined by a mesh, a finite element,...
Definition FunctionSpace.h:34
Finite element method functionality.
Definition assemble_expression_impl.h:23