17#include <dolfinx/common/types.h>
18#include <dolfinx/mesh/EntityMap.h>
19#include <dolfinx/mesh/Mesh.h>
28template <dolfinx::scalar T, std::
floating_po
int U>
43template <dolfinx::scalar T, std::
floating_po
int U = dolfinx::scalar_value_t<T>>
79 const std::vector<std::shared_ptr<
83 std::span<const geometry_type>
X, std::array<std::size_t, 2> Xshape,
89 const std::vector<std::reference_wrapper<const dolfinx::mesh::EntityMap>>&
120 return _argument_space;
126 std::shared_ptr<const Function<scalar_type, geometry_type>>>&
129 return _coefficients;
135 const std::vector<std::shared_ptr<const Constant<scalar_type>>>&
148 std::vector<int> n{0};
149 for (
auto& c : _coefficients)
152 throw std::runtime_error(
"Not all form coefficients have been set.");
153 n.push_back(n.back() + c->function_space()->element()->space_dimension());
161 const std::uint8_t*,
void*)>&
170 return std::reduce(_value_shape.begin(), _value_shape.end(), 1,
175 const std::vector<std::size_t>&
value_shape()
const {
return _value_shape; }
180 const std::pair<std::vector<geometry_type>, std::array<std::size_t, 2>>&
195 int entity_dim()
const {
return static_cast<int>(_x_ref.second[1]); }
198 const std::vector<std::reference_wrapper<const dolfinx::mesh::EntityMap>>&
207 return _coordinate_element_hash;
212 std::shared_ptr<const FunctionSpace<geometry_type>> _argument_space;
215 std::vector<std::shared_ptr<const Function<scalar_type, geometry_type>>>
219 std::vector<std::shared_ptr<const Constant<scalar_type>>> _constants;
228 std::vector<std::size_t> _value_shape;
231 std::pair<std::vector<geometry_type>, std::array<std::size_t, 2>> _x_ref;
235 std::vector<std::reference_wrapper<const dolfinx::mesh::EntityMap>>
239 std::uint64_t _coordinate_element_hash;
Constant (in space) value which can be attached to a Form.
Definition Constant.h:22
An Expression represents a mathematical expression evaluated at a pre-defined points on a reference c...
Definition Expression.h:45
U geometry_type
Geometry type of the points.
Definition Expression.h:54
const std::vector< std::shared_ptr< const Function< scalar_type, geometry_type > > > & coefficients() const
Expression coefficients.
Definition Expression.h:127
std::shared_ptr< const FunctionSpace< geometry_type > > argument_space() const
Argument function space.
Definition Expression.h:118
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 std::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:78
std::uint64_t coordinate_element_hash() const
Hash for coordinate element used to create the expression.
Definition Expression.h:205
const std::vector< std::shared_ptr< const Constant< scalar_type > > > & constants() const
Expression constants.
Definition Expression.h:136
std::vector< int > coefficient_offsets() const
Offset for each coefficient expansion array on a cell.
Definition Expression.h:146
std::size_t num_points() const
Number of evaluation points (X).
Definition Expression.h:187
const std::pair< std::vector< geometry_type >, std::array< std::size_t, 2 > > & X() const
Evaluation point coordinates on the reference entity.
Definition Expression.h:181
int value_size() const
Value size of the Expression result.
Definition Expression.h:168
Expression & operator=(Expression &&e)=default
Move assignment.
Expression(Expression &&e)=default
Move constructor.
int entity_dim() const
Topological dimension of the entities the Expression is evaluated on.
Definition Expression.h:195
~Expression()=default
Destructor.
const std::function< void(scalar_type *, const scalar_type *, const scalar_type *, const geometry_type *, const int *, const std::uint8_t *, void *)> & kernel() const
Function for tabulating the Expression.
Definition Expression.h:162
T scalar_type
Scalar type.
Definition Expression.h:51
const std::vector< std::reference_wrapper< const dolfinx::mesh::EntityMap > > & entity_maps() const
Maps between entities of different meshes.
Definition Expression.h:199
const std::vector< std::size_t > & value_shape() const
Value shape of Expression result (at a point),.
Definition Expression.h:175
This class represents a finite element function space defined by a mesh, a finite element,...
Definition FunctionSpace.h:36
Finite element method functionality.
Definition assemble_expression_impl.h:28