34 #include <source_location>
43 template <
class NodeType>
225 #include "common/abstract/HoldsNodes.tpp"
std::vector< _Type, _Alloc > CepsVector
C++ vector.
size_t CepsSize
Size unsigned.
CepsIndex CepsGlobalIndex
Many uses. Has to be signed for PETSc.
std::make_unsigned_t< CepsInt > CepsUInt
Unsigned version on CepsInt.
CepsBool hasOneOfNodes(const CepsVector< NodeType * > &nodes)
Tells if object has one of the given nodes.
void removeNodes(const CepsVector< NodeType * > &nodes)
Removes several nodes from the list.
CepsVector< NodeType * > & getNodes()
Reference to the node pointers array.
void setNodeAt(const CepsUInt &i, NodeType *neigh)
Set the i-th node. If i>nNodes, nullptrs fill the vector.
CepsVector< NodeType * > m_nodes
The node pointers.
CepsVector< CepsGlobalIndex > getNodeIndices() const
Get indices of all nodes.
CepsGlobalIndex getNodeIndex(CepsUInt i) const
Get the index of i-th node.
CepsUInt getNumberOfNodes() const
Returns the total number of nodes.
void removeNode(NodeType *&name)
Removes the given node from the list.
void clearNodes()
Wipes the vector of nodes.
void addNodes(const CepsVector< NodeType * > &nodes)
Add several nodes to the vector.
void reset()
Equivalent to HoldsNodes::clearNodes.
CepsUInt countValidNodes()
Returns the number of nodes that are not nullptr.
CepsVector< NodeType * > getValidNodes() const
Get pointers on all valid nodes.
NodeType * m_dummyNode
An empty node to be returned after abort when testing.
HoldsNodes(NodeType **nodes, const CepsUInt &n)
Constructor with nodes.
HoldsNodes()=default
Default constructor.
void errorOnNodeIndex(CepsUInt i, std::source_location loc=std::source_location::current()) const
Aborts if requesting node with wrong index.
NodeType * getNodeAt(const CepsUInt &i)
Pointer to the i-th node.
CepsBool hasNode(NodeType *&neigh)
Tells if object has the given node.
void setNodes(const CepsVector< NodeType * > &nodes)
Assign all nodes.
void addNode(NodeType *name)
Add a single node to the vector.
CepsBool hasAllNodes(const CepsVector< NodeType * > &nodes)
Tells if object has all the given nodes.
HoldsNodes(HoldsNodes &&) noexcept=default
Copy constructor.
HoldsNodes(const CepsVector< NodeType * > &nodes)
Constructor with nodes.
HoldsNodes(const HoldsNodes &)=default
Copy constructor.
A namespace for all utility methods.