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 22 of file CollectAndInterpolateNodalDof.cpp.

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