OGS
ElementStatus.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <vector>
7
8namespace MeshLib
9{
10class Mesh;
11class Element;
12class Node;
13
14class ElementStatus final
15{
16
17public:
19 explicit ElementStatus(MeshLib::Mesh const* const mesh,
20 bool hasAnyInactive = false);
21
23 ElementStatus(MeshLib::Mesh const* const mesh,
24 std::vector<int> const& vec_inactive_matIDs);
25
27 std::vector<MeshLib::Element*> const& getActiveElements() const;
28
30 std::vector<MeshLib::Node*> const& getActiveNodes() const;
31
33 bool isActive(std::size_t i) const { return _element_status[i]; }
34
36 bool isActiveNode(MeshLib::Node const* node) const;
37
39 std::size_t getNumberOfActiveNodes() const;
40
42 std::size_t getNumberOfActiveElements() const;
43
44private:
46 void setElementStatus(std::size_t i, bool status);
47
49 MeshLib::Mesh const*const _mesh;
51 std::vector<bool> _element_status;
53 std::vector<unsigned char> _active_nodes;
54
55 bool const _hasAnyInactive;
56 std::vector<MeshLib::Node*> _vec_active_nodes;
57 std::vector<MeshLib::Element*> _vec_active_eles;
58}; /* class */
59
60} // 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,...