10 #include <dolfinx/fem/evaluate.h>
53 const std::shared_ptr<const mesh::Mesh>&
mesh,
54 const Eigen::Ref<
const Eigen::Array<
double, Eigen::Dynamic,
55 Eigen::Dynamic, Eigen::RowMajor>>&
x,
56 const std::function<
void(T*,
const T*,
const T*,
const double*)> fn,
71 const std::vector<std::shared_ptr<const fem::Function<T>>>&
82 std::vector<int> n{0};
83 for (
const auto& c : _coefficients)
86 throw std::runtime_error(
"Not all form coefficients have been set.");
87 n.push_back(n.back() + c->function_space()->element()->space_dimension());
97 eval(
const std::vector<std::int32_t>& active_cells,
99 Eigen::Array<T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>>
107 const std::function<void(T*,
const T*,
const T*,
const double*)>&
117 const std::vector<std::shared_ptr<const fem::Constant<T>>>&
constants()
const
124 std::shared_ptr<const mesh::Mesh>
mesh()
const {
return _mesh; }
128 const Eigen::Array<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>&
147 std::vector<std::shared_ptr<const fem::Function<T>>> _coefficients;
150 std::vector<std::shared_ptr<const fem::Constant<T>>> _constants;
153 std::function<void(T*,
const T*,
const T*,
const double*)> _fn;
156 Eigen::Array<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> _x;
159 std::shared_ptr<const mesh::Mesh> _mesh;
162 std::size_t _value_size;
A constant value which can be attached to a Form. Constants may be scalar (rank 0),...
Definition: Constant.h:19
Represents a mathematical expression evaluated at a pre-defined set of points on the reference cell....
Definition: Expression.h:39
const std::size_t value_size() const
Get value size.
Definition: Expression.h:136
const std::vector< std::shared_ptr< const fem::Constant< T > > > & constants() const
Access constants.
Definition: Expression.h:117
Expression(Expression &&form)=default
Move constructor.
const std::vector< std::shared_ptr< const fem::Function< T > > > & coefficients() const
Access coefficients.
Definition: Expression.h:72
std::shared_ptr< const mesh::Mesh > mesh() const
Get mesh.
Definition: Expression.h:124
Expression(const std::vector< std::shared_ptr< const fem::Function< T >>> &coefficients, const std::vector< std::shared_ptr< const fem::Constant< T >>> &constants, const std::shared_ptr< const mesh::Mesh > &mesh, const Eigen::Ref< const Eigen::Array< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor >> &x, const std::function< void(T *, const T *, const T *, const double *)> fn, const std::size_t value_size)
Create Expression.
Definition: Expression.h:50
const Eigen::Array< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > & x() const
Get evaluation points on reference cell.
Definition: Expression.h:129
void eval(const std::vector< std::int32_t > &active_cells, Eigen::Ref< Eigen::Array< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor >> values) const
Evaluate the expression on cells.
Definition: Expression.h:97
std::vector< int > coefficient_offsets() const
Offset for each coefficient expansion array on a cell. Used to pack data for multiple coefficients in...
Definition: Expression.h:80
virtual ~Expression()=default
Destructor.
const std::function< void(T *, const T *, const T *, const double *)> & get_tabulate_expression() const
Get function for tabulate_expression.
Definition: Expression.h:108
T scalar_type
Scalar type (T).
Definition: Expression.h:143
const Eigen::Index num_points() const
Get number of points.
Definition: Expression.h:140
This class represents a function in a finite element function space , given by.
Definition: Function.h:43
void eval(Eigen::Ref< Eigen::Array< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor >> values, const fem::Expression< T > &e, const std::vector< std::int32_t > &active_cells)
Evaluate a UFC expression.
Definition: evaluate.h:25