OGS
ElementStatus.h
Go to the documentation of this file.
1
15#pragma once
16
17#include <vector>
18
19namespace MeshLib
20{
21class Mesh;
22class Element;
23class Node;
24
25class ElementStatus final
26{
27
28public:
30 explicit ElementStatus(MeshLib::Mesh const* const mesh,
31 bool hasAnyInactive = false);
32
34 ElementStatus(MeshLib::Mesh const* const mesh,
35 std::vector<int> const& vec_inactive_matIDs);
36
38 std::vector<MeshLib::Element*> const& getActiveElements() const;
39
41 std::vector<MeshLib::Node*> const& getActiveNodes() const;
42
44 bool isActive(std::size_t i) const { return _element_status[i]; }
45
47 bool isActiveNode(MeshLib::Node const* node) const;
48
50 std::size_t getNumberOfActiveNodes() const;
51
53 std::size_t getNumberOfActiveElements() const;
54
55private:
57 void setElementStatus(std::size_t i, bool status);
58
60 MeshLib::Mesh const*const _mesh;
62 std::vector<bool> _element_status;
64 std::vector<unsigned char> _active_nodes;
65
66 bool const _hasAnyInactive;
67 std::vector<MeshLib::Node*> _vec_active_nodes;
68 std::vector<MeshLib::Element*> _vec_active_eles;
69}; /* class */
70
71} // namespace MeshLib
std::vector< MeshLib::Element * > _vec_active_eles
bool isActiveNode(MeshLib::Node const *node) const
Returns the status of the given node.
void setElementStatus(std::size_t i, bool status)
Sets the status of element i.
MeshLib::Mesh const *const _mesh
The mesh for which the element status is administrated.
std::vector< bool > _element_status
Element status for each mesh element (active/inactive = true/false)
ElementStatus(MeshLib::Mesh const *const mesh, bool hasAnyInactive=false)
Constructor assuming all nodes and elements.
std::size_t getNumberOfActiveElements() const
Returns the total number of active elements.
std::vector< MeshLib::Node * > const & getActiveNodes() const
Returns a vector of active node IDs.
std::vector< MeshLib::Element * > const & getActiveElements() const
Returns a vector of active element IDs.
std::size_t getNumberOfActiveNodes() const
Returns the total number of active nodes.
bool isActive(std::size_t i) const
Returns the status of element i.
std::vector< MeshLib::Node * > _vec_active_nodes
std::vector< unsigned char > _active_nodes
Node status for each mesh node (value = number of active elements connected to node,...