DOLFIN-X
DOLFIN-X C++ interface
|
10 #include <dolfinx/function/evaluate.h>
55 const std::shared_ptr<const mesh::Mesh>&
mesh,
56 const Eigen::Ref<
const Eigen::Array<
double, Eigen::Dynamic,
57 Eigen::Dynamic, Eigen::RowMajor>>&
x,
58 const std::function<
void(T*,
const T*,
const T*,
const double*)> fn,
73 const std::vector<std::shared_ptr<const function::Function<T>>>&
84 std::vector<int> n{0};
85 for (
const auto& c : _coefficients)
88 throw std::runtime_error(
"Not all form coefficients have been set.");
89 n.push_back(n.back() + c->function_space()->element()->space_dimension());
99 eval(
const std::vector<std::int32_t>& active_cells,
101 Eigen::Array<T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>>
109 const std::function<void(T*,
const T*,
const T*,
const double*)>&
119 const std::vector<std::shared_ptr<const function::Constant<T>>>&
127 std::shared_ptr<const mesh::Mesh>
mesh()
const {
return _mesh; }
131 const Eigen::Array<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>&
150 std::vector<std::shared_ptr<const function::Function<T>>> _coefficients;
153 std::vector<std::shared_ptr<const function::Constant<T>>> _constants;
156 std::function<void(T*,
const T*,
const T*,
const double*)> _fn;
159 Eigen::Array<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> _x;
162 std::shared_ptr<const mesh::Mesh> _mesh;
165 std::size_t _value_size;
Expression(Expression &&form)=default
Move constructor.
const std::size_t value_size() const
Get value size.
Definition: Expression.h:139
const Eigen::Array< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > & x() const
Get evaluation points on reference cell.
Definition: Expression.h:132
T scalar_type
Scalar type (T).
Definition: Expression.h:146
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:82
void eval(Eigen::Ref< Eigen::Array< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor >> values, const function::Expression< T > &e, const std::vector< std::int32_t > &active_cells)
Evaluate a UFC expression.
Definition: evaluate.h:26
const std::function< void(T *, const T *, const T *, const double *)> & get_tabulate_expression() const
Get function for tabulate_expression.
Definition: Expression.h:110
Expression(const std::vector< std::shared_ptr< const function::Function< T >>> &coefficients, const std::vector< std::shared_ptr< const function::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
std::shared_ptr< const mesh::Mesh > mesh() const
Get mesh.
Definition: Expression.h:127
const std::vector< std::shared_ptr< const function::Function< T > > > & coefficients() const
Access coefficients.
Definition: Expression.h:74
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::vector< std::shared_ptr< const function::Constant< T > > > & constants() const
Access constants.
Definition: Expression.h:120
This class represents a function in a finite element function space , given by.
Definition: Function.h:42
virtual ~Expression()=default
Destructor.
const Eigen::Index num_points() const
Get number of points.
Definition: Expression.h:143
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:99