OGS
anonymous_namespace{CollectAndInterpolateNodalDof.cpp} Namespace Reference

Functions

void collectDofsToMatrixSingleComponentForSomeNodes (MeshLib::Element const &element, std::size_t const mesh_id, NumLib::LocalToGlobalIndexMap const &dof_table, GlobalVector const &x, int const variable, int const component, unsigned const num_nodes, Eigen::Ref< Eigen::VectorXd > all_nodal_dof_for_this_component)

Function Documentation

◆ collectDofsToMatrixSingleComponentForSomeNodes()

void anonymous_namespace{CollectAndInterpolateNodalDof.cpp}::collectDofsToMatrixSingleComponentForSomeNodes ( MeshLib::Element const & element,
std::size_t const mesh_id,
NumLib::LocalToGlobalIndexMap const & dof_table,
GlobalVector const & x,
int const variable,
int const component,
unsigned const num_nodes,
Eigen::Ref< Eigen::VectorXd > all_nodal_dof_for_this_component )

Collects the degrees of freedom of the passed element from the passed global vector into a vector.

Note
num_nodes can be set "arbitrarily", e.g., to only collect d.o.f. on the base nodes of the passed mesh element.

Definition at line 15 of file CollectAndInterpolateNodalDof.cpp.

20{
21 bool dof_not_found = false;
22
23 for (unsigned element_node_id = 0; element_node_id < num_nodes;
24 ++element_node_id)
25 {
26 auto const& node = *element.getNode(element_node_id);
27 auto const node_id = node.getID();
29 node_id};
30 auto const dof_idx = dof_table.getGlobalIndex(loc, variable, component);
31
32 if (dof_idx == NumLib::MeshComponentMap::nop)
33 {
34 // We just skip this d.o.f. Actually we will also skip
35 // all other nodes of this mesh element for this (var,
36 // comp), because we assume that all linear nodes have a
37 // lower node id than any higher order node.
38 dof_not_found = true;
39 }
40 else
41 {
42 if (dof_not_found)
43 {
44 // We expect that for all mesh elements all linear
45 // nodes have a lower node id than any higher order
46 // node. I.e., there are no "holes" in the
47 // primary_variables_mat. We rely on there being no
48 // "holes" later on when interpolating the nodal
49 // d.o.f. to the integration points.
51 "This d.o.f. has been found in the d.o.f. "
52 "table, but before some d.o.f. has not been "
53 "found. Something has gone terribly wrong. "
54 "Some assumption in the implementation is "
55 "wrong.");
56 }
57 all_nodal_dof_for_this_component[element_node_id] = x[dof_idx];
58 }
59 }
60}
#define OGS_FATAL(...)
Definition Error.h:19
static constexpr NUMLIB_EXPORT GlobalIndexType const nop

References NumLib::LocalToGlobalIndexMap::getGlobalIndex(), MathLib::Point3dWithID::getID(), MeshLib::Element::getNode(), MeshLib::Node, NumLib::MeshComponentMap::nop, and OGS_FATAL.