OGS
MeshLib::NodeAdjacencyTable Class Referencefinal

Detailed Description

Representation of topological node adjacency.

The topological sparsity pattern in the context of FEM is defined in terms of supports of the nodal functions. Especially, two nodes i and j are called adjacent if and only if there is a mesh element E including nodes i and j. This information is represented by the NodeAdjacenceTable.

The topological adjacency of nodes is created by MeshLib::calculateNodesConnectedByElements().

Definition at line 30 of file NodeAdjacencyTable.h.

#include <NodeAdjacencyTable.h>

Public Member Functions

 NodeAdjacencyTable (Mesh const &mesh)
 
std::size_t size () const
 
std::size_t getNodeDegree (std::size_t const node_id) const
 
std::vector< std::size_t > const & getAdjacentNodes (std::size_t const node_id) const
 
void createTable (Mesh const &mesh)
 

Private Attributes

std::vector< std::vector< std::size_t > > _data
 

Constructor & Destructor Documentation

◆ NodeAdjacencyTable()

MeshLib::NodeAdjacencyTable::NodeAdjacencyTable ( Mesh const & mesh)
inlineexplicit

Definition at line 33 of file NodeAdjacencyTable.h.

34 {
35 _data.resize(mesh.getNodes().size());
36
37 createTable(mesh);
38 }
void createTable(Mesh const &mesh)
std::vector< std::vector< std::size_t > > _data

References _data, createTable(), and MeshLib::Mesh::getNodes().

Member Function Documentation

◆ createTable()

void MeshLib::NodeAdjacencyTable::createTable ( Mesh const & mesh)
inline

Definition at line 53 of file NodeAdjacencyTable.h.

54 {
55 auto const& nodes = mesh.getNodes();
56 if (_data.size() != nodes.size())
57 {
58 _data.resize(nodes.size());
59 }
60
61 auto const& connections =
63 for (auto const* node : nodes)
64 {
65 auto const node_id = node->getID();
66 auto const& connected_nodes = connections[node_id];
67 std::vector<std::size_t>& row = _data[node_id];
68 row.reserve(connected_nodes.size());
69 std::transform(connected_nodes.cbegin(), connected_nodes.cend(),
70 std::back_inserter(row),
71 [](Node const* const n) { return n->getID(); });
72 }
73 }
std::vector< std::vector< Node * > > calculateNodesConnectedByElements(Mesh const &mesh)
Definition Mesh.cpp:308

References _data, MeshLib::calculateNodesConnectedByElements(), and MeshLib::Mesh::getNodes().

Referenced by NodeAdjacencyTable().

◆ getAdjacentNodes()

std::vector< std::size_t > const & MeshLib::NodeAdjacencyTable::getAdjacentNodes ( std::size_t const node_id) const
inline

Definition at line 47 of file NodeAdjacencyTable.h.

49 {
50 return _data[node_id];
51 }

References _data.

◆ getNodeDegree()

std::size_t MeshLib::NodeAdjacencyTable::getNodeDegree ( std::size_t const node_id) const
inline

Definition at line 42 of file NodeAdjacencyTable.h.

43 {
44 return _data[node_id].size();
45 }

References _data.

◆ size()

std::size_t MeshLib::NodeAdjacencyTable::size ( ) const
inline

Definition at line 40 of file NodeAdjacencyTable.h.

40{ return _data.size(); }

References _data.

Member Data Documentation

◆ _data

std::vector<std::vector<std::size_t> > MeshLib::NodeAdjacencyTable::_data
private

The documentation for this class was generated from the following file: