14#include <dolfinx/common/types.h>
15#include <dolfinx/mesh/Mesh.h>
24template <dolfinx::scalar T, std::
floating_po
int U>
39template <dolfinx::scalar T, std::
floating_po
int U = dolfinx::scalar_value_t<T>>
73 std::span<const geometry_type>
X,
74 std::array<std::size_t, 2> Xshape,
77 const int*,
const uint8_t*,
void*)>
87 for (
auto& c : _coefficients)
90 if (c->function_space()->mesh()
91 != _coefficients.front()->function_space()->mesh())
93 throw std::runtime_error(
"Coefficients not all defined on same mesh.");
108 return _argument_space;
114 std::shared_ptr<const Function<scalar_type, geometry_type>>>&
117 return _coefficients;
123 const std::vector<std::shared_ptr<const Constant<scalar_type>>>&
136 std::vector<int> n{0};
137 for (
auto& c : _coefficients)
140 throw std::runtime_error(
"Not all form coefficients have been set.");
141 n.push_back(n.back() + c->function_space()->element()->space_dimension());
158 return std::reduce(_value_shape.begin(), _value_shape.end(), 1,
163 const std::vector<std::size_t>&
value_shape()
const {
return _value_shape; }
166 std::pair<std::vector<geometry_type>, std::array<std::size_t, 2>>
X()
const
173 std::shared_ptr<const FunctionSpace<geometry_type>> _argument_space;
176 std::vector<std::shared_ptr<const Function<scalar_type, geometry_type>>>
180 std::vector<std::shared_ptr<const Constant<scalar_type>>> _constants;
188 std::vector<std::size_t> _value_shape;
191 std::pair<std::vector<geometry_type>, std::array<std::size_t, 2>> _x_ref;
Constant value which can be attached to a Form.
Definition Constant.h:23
U geometry_type
Geometry type of the points.
Definition Expression.h:50
std::pair< std::vector< geometry_type >, std::array< std::size_t, 2 > > X() const
Evaluation point coordinates on the reference cell.
Definition Expression.h:166
const std::vector< std::shared_ptr< const Function< scalar_type, geometry_type > > > & coefficients() const
Expression coefficients.
Definition Expression.h:115
std::shared_ptr< const FunctionSpace< geometry_type > > argument_space() const
Argument function space.
Definition Expression.h:106
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:150
const std::vector< std::shared_ptr< const Constant< scalar_type > > > & constants() const
Expression constants.
Definition Expression.h:124
std::vector< int > coefficient_offsets() const
Offset for each coefficient expansion array on a cell.
Definition Expression.h:134
int value_size() const
Value size of the Expression result.
Definition Expression.h:156
Expression(Expression &&e)=default
Move constructor.
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, std::shared_ptr< const FunctionSpace< geometry_type > > argument_space=nullptr)
Create an Expression.
Definition Expression.h:69
virtual ~Expression()=default
Destructor.
T scalar_type
Scalar type.
Definition Expression.h:47
const std::vector< std::size_t > & value_shape() const
Value shape of of Expression result (at a point),.
Definition Expression.h:163
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