12 #include <Eigen/Dense>
13 #include <dolfinx/fem/utils.h>
14 #include <dolfinx/mesh/Mesh.h>
27 Eigen::Ref<Eigen::Array<T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>>
30 const std::vector<std::int32_t>& active_cells)
37 Eigen::Array<T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> coeffs
41 const Eigen::Array<T, Eigen::Dynamic, 1> constant_values
48 = mesh->geometry().dofmap();
51 const int num_dofs_g = x_dofmap.
num_links(0);
52 const Eigen::Array<double, Eigen::Dynamic, 3, Eigen::RowMajor>& x_g
53 = mesh->geometry().x();
56 const int gdim = mesh->geometry().dim();
57 Eigen::Array<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
58 coordinate_dofs(num_dofs_g, gdim);
60 Eigen::Array<T, Eigen::Dynamic, 1> values_e;
61 const Eigen::Index num_points = e.
num_points();
62 const Eigen::Index value_size = e.
value_size();
63 const Eigen::Index size = num_points * value_size;
64 values_e.setZero(size);
68 for (std::int32_t c : active_cells)
70 auto x_dofs = x_dofmap.
links(c);
71 for (Eigen::Index j = 0; j < num_dofs_g; ++j)
73 const auto x_dof = x_dofs[j];
74 for (Eigen::Index k = 0; k < gdim; ++k)
75 coordinate_dofs(j, k) = x_g(x_dof, k);
78 auto coeff_cell = coeffs.row(c);
81 for (Eigen::Index j = 0; j < size; j++)
84 fn(values_e.data(), coeff_cell.data(), constant_values.data(),
85 coordinate_dofs.data());
87 values.row(i) = values_e;
Represents a mathematical expression evaluated at a pre-defined set of points on the reference cell....
Definition: Expression.h:39
const Eigen::Index num_points() const
Get number of points.
Definition: Expression.h:143
const std::function< void(T *, const T *, const T *, const double *)> & get_tabulate_expression() const
Get function for tabulate_expression.
Definition: Expression.h:110
std::shared_ptr< const mesh::Mesh > mesh() const
Get mesh.
Definition: Expression.h:127
const std::size_t value_size() const
Get value size.
Definition: Expression.h:139
This class provides a static adjacency list data structure. It is commonly used to store directed gra...
Definition: AdjacencyList.h:28
Eigen::Array< T, Eigen::Dynamic, 1 >::SegmentReturnType links(int node)
Links (edges) for given node.
Definition: AdjacencyList.h:153
int num_links(int node) const
Number of connections for given node.
Definition: AdjacencyList.h:143
Eigen::Array< typename U::scalar_type, Eigen::Dynamic, 1 > pack_constants(const U &u)
Pack constants of u of generic type U ready for assembly.
Definition: utils.h:456
Eigen::Array< typename U::scalar_type, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > pack_coefficients(const U &u)
Pack coefficients of u of generic type U ready for assembly.
Definition: utils.h:407
Functions tools, including FEM functions and pointwise defined functions.
Definition: assembler.h:19
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