OGS 6.2.1-97-g73d1aeda3
MeshLib::Node Class Reference

Detailed Description

A mesh node with coordinates in 3D space.

Definition at line 36 of file Node.h.

#include <Node.h>

Inheritance diagram for MeshLib::Node:
Collaboration diagram for MeshLib::Node:

Public Member Functions

 Node (const double coords[3], std::size_t id=std::numeric_limits< std::size_t >::max())
 Constructor using a coordinate array. More...
 
 Node (std::array< double, 3 > const &coords, std::size_t id=std::numeric_limits< std::size_t >::max())
 Constructor using a coordinate array. More...
 
 Node (double x, double y, double z, std::size_t id=std::numeric_limits< std::size_t >::max())
 Constructor using single coordinates. More...
 
 Node (const Node &node)
 Copy constructor. More...
 
const std::vector< MeshLib::Node * > & getConnectedNodes () const
 Return all the nodes connected to this one. More...
 
const ElementgetElement (std::size_t idx) const
 Get an element the node is part of. More...
 
const std::vector< Element * > & getElements () const
 Get all elements the node is part of. More...
 
std::size_t getNumberOfElements () const
 Get number of elements the node is part of. More...
 
Node operator- (MathLib::Vector3 const &v) const
 Shift the node according to the displacement vector v. More...
 
- Public Member Functions inherited from MathLib::Point3dWithID
 Point3dWithID (double x0, double x1, double x2, std::size_t id=std::numeric_limits< std::size_t >::max())
 
 Point3dWithID (std::array< double, 3 > const &coords, std::size_t id=std::numeric_limits< std::size_t >::max())
 
 Point3dWithID (MathLib::Point3d const &pnt, std::size_t id=std::numeric_limits< std::size_t >::max())
 
 Point3dWithID ()
 
std::size_t getID () const
 
- Public Member Functions inherited from MathLib::TemplatePoint< T, DIM >
 TemplatePoint ()
 
 TemplatePoint (std::array< T, DIM > x)
 
virtual ~TemplatePoint ()=default
 
 TemplatePoint (TemplatePoint const &)=default
 
TemplatePointoperator= (TemplatePoint const &)=default
 
const T & operator[] (std::size_t idx) const
 const access operator The access to the point coordinates is like the access to a field. Code example: More...
 
T & operator[] (std::size_t idx)
 access operator (see book Effektiv C++ programmieren - subsection 1.3.2 ). More...
 
const T * getCoords () const
 
virtual void write (std::ostream &os) const
 
virtual void read (std::istream &is)
 

Protected Member Functions

void updateCoordinates (double x, double y, double z)
 
void addElement (Element *elem)
 
void clearElements ()
 clear stored elements connecting to this node More...
 
void setConnectedNodes (std::vector< Node *> &connected_nodes)
 
void setID (std::size_t id)
 Sets the ID of a node to the given value. More...
 

Protected Attributes

std::vector< Node * > _connected_nodes
 
std::vector< Element * > _elements
 
- Protected Attributes inherited from MathLib::Point3dWithID
std::size_t _id
 
- Protected Attributes inherited from MathLib::TemplatePoint< T, DIM >
std::array< T, DIM > _x
 

Friends

class Mesh
 
class NodePartitionedMesh
 
class MeshRevision
 
class MeshLayerMapper
 
class ApplicationUtils::NodeWiseMeshPartitioner
 

Additional Inherited Members

- Public Types inherited from MathLib::TemplatePoint< T, DIM >
using FP_T = T
 

Constructor & Destructor Documentation

◆ Node() [1/4]

MeshLib::Node::Node ( const double  coords[3],
std::size_t  id = std::numeric_limits<std::size_t>::max() 
)
explicit

Constructor using a coordinate array.

Definition at line 20 of file Node.cpp.

22  std::array<double,3>{{coords[0], coords[1], coords[2]}}, id)
23 {
24 }

◆ Node() [2/4]

MeshLib::Node::Node ( std::array< double, 3 > const &  coords,
std::size_t  id = std::numeric_limits<std::size_t>::max() 
)
explicit

Constructor using a coordinate array.

Definition at line 26 of file Node.cpp.

27  : MathLib::Point3dWithID(coords, id)
28 {
29 }

◆ Node() [3/4]

MeshLib::Node::Node ( double  x,
double  y,
double  z,
std::size_t  id = std::numeric_limits<std::size_t>::max() 
)

Constructor using single coordinates.

Definition at line 31 of file Node.cpp.

32  : MathLib::Point3dWithID(std::array<double,3>({{x, y, z}}), id)
33 {
34 }

◆ Node() [4/4]

MeshLib::Node::Node ( const Node node)

Copy constructor.

Definition at line 36 of file Node.cpp.

37  : MathLib::Point3dWithID(node._x, node.getID())
38 {
39 }

Member Function Documentation

◆ addElement()

void MeshLib::Node::addElement ( Element elem)
inlineprotected

Add an element the node is part of. This method is called by Mesh::addElement(Element*), see friend definition.

Definition at line 87 of file Node.h.

Referenced by MeshLib::Mesh::addElement().

87 { _elements.push_back(elem); }
std::vector< Element * > _elements
Definition: Node.h:104

◆ clearElements()

void MeshLib::Node::clearElements ( )
inlineprotected

clear stored elements connecting to this node

Definition at line 90 of file Node.h.

90 { _elements.clear(); }
std::vector< Element * > _elements
Definition: Node.h:104

◆ getConnectedNodes()

const std::vector<MeshLib::Node*>& MeshLib::Node::getConnectedNodes ( ) const
inline

Return all the nodes connected to this one.

Definition at line 61 of file Node.h.

Referenced by MeshLib::NodePartitionedMesh::getMaximumNConnectedNodesToNode(), and main().

61 { return _connected_nodes; }
std::vector< Node * > _connected_nodes
Definition: Node.h:103

◆ getElement()

const Element* MeshLib::Node::getElement ( std::size_t  idx) const
inline

Get an element the node is part of.

Definition at line 64 of file Node.h.

Referenced by ProcessLib::LIE::getFractureMatrixDataInMesh(), and MeshLib::isBaseNode().

64 { return _elements[idx]; }
std::vector< Element * > _elements
Definition: Node.h:104

◆ getElements()

◆ getNumberOfElements()

std::size_t MeshLib::Node::getNumberOfElements ( ) const
inline

Get number of elements the node is part of.

Definition at line 70 of file Node.h.

Referenced by MeshLib::ElementStatus::ElementStatus(), ProcessLib::LIE::getFractureMatrixDataInMesh(), MeshLib::isBaseNode(), and main().

70 { return _elements.size(); }
std::vector< Element * > _elements
Definition: Node.h:104

◆ operator-()

Node MeshLib::Node::operator- ( MathLib::Vector3 const &  v) const
inline

Shift the node according to the displacement vector v.

Definition at line 73 of file Node.h.

74  {
75  return Node(_x[0]-v[0], _x[1]-v[1], _x[2]-v[2]);
76  }
std::array< T, DIM > _x
Definition: TemplatePoint.h:97
Node(const double coords[3], std::size_t id=std::numeric_limits< std::size_t >::max())
Constructor using a coordinate array.
Definition: Node.cpp:20

◆ setConnectedNodes()

void MeshLib::Node::setConnectedNodes ( std::vector< Node *> &  connected_nodes)
inlineprotected

Resets the connected nodes of this node. The connected nodes are generated by Mesh::setNodesConnectedByEdges() and Mesh::setNodesConnectedByElements().

Definition at line 95 of file Node.h.

Referenced by MeshLib::Mesh::setNodesConnectedByEdges(), and MeshLib::Mesh::setNodesConnectedByElements().

96  {
97  _connected_nodes = connected_nodes;
98  }
std::vector< Node * > _connected_nodes
Definition: Node.h:103

◆ setID()

void MeshLib::Node::setID ( std::size_t  id)
inlineprotected

Sets the ID of a node to the given value.

Definition at line 101 of file Node.h.

101 { _id = id; }

◆ updateCoordinates()

void MeshLib::Node::updateCoordinates ( double  x,
double  y,
double  z 
)
protected

Update coordinates of a node. This method automatically also updates the areas/volumes of all connected elements.

Definition at line 41 of file Node.cpp.

References _elements, and MathLib::TemplatePoint< T, DIM >::_x.

42 {
43  _x[0] = x;
44  _x[1] = y;
45  _x[2] = z;
46 
47  const std::size_t nElements (this->_elements.size());
48  for (std::size_t i = 0; i < nElements; i++)
49  {
50  _elements[i]->computeVolume();
51  }
52 }
std::array< T, DIM > _x
Definition: TemplatePoint.h:97
std::vector< Element * > _elements
Definition: Node.h:104

Friends And Related Function Documentation

◆ ApplicationUtils::NodeWiseMeshPartitioner

Definition at line 43 of file Node.h.

◆ Mesh

friend class Mesh
friend

Definition at line 39 of file Node.h.

◆ MeshLayerMapper

friend class MeshLayerMapper
friend

Definition at line 42 of file Node.h.

◆ MeshRevision

friend class MeshRevision
friend

Definition at line 41 of file Node.h.

◆ NodePartitionedMesh

friend class NodePartitionedMesh
friend

Definition at line 40 of file Node.h.

Member Data Documentation

◆ _connected_nodes

std::vector<Node*> MeshLib::Node::_connected_nodes
protected

Definition at line 103 of file Node.h.

◆ _elements

std::vector<Element*> MeshLib::Node::_elements
protected

Definition at line 104 of file Node.h.

Referenced by updateCoordinates().


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