diff --git a/MeshLib/ElementStatus.cpp b/MeshLib/ElementStatus.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b87cf58939f73391a269c87a6a1dcdb24a106c87 --- /dev/null +++ b/MeshLib/ElementStatus.cpp @@ -0,0 +1,24 @@ +/** + * Copyright (c) 2012, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + * + * \file ElementStatus.cpp + * + * Created on 2012-12-18 by Karsten Rink + */ + +#include "ElementStatus.h" + +namespace MeshLib { + +ElementStatus::ElementStatus(Mesh const*const mesh) +: _mesh(mesh), _status(mesh->getNElements(), true) +{ +} + + +} + diff --git a/MeshLib/ElementStatus.h b/MeshLib/ElementStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..ad41759b0fc449b7fed524aad89dac4cc3a6acde --- /dev/null +++ b/MeshLib/ElementStatus.h @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2012, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + * + * \file ElementStatus.h + * + * Created on 2012-12-18 by Karsten Rink + */ + +#ifndef ELEMENTSTATUS_H_ +#define ELEMENTSTATUS_H_ + +#include "Mesh.h" + +namespace MeshLib { + +/** + * An object to store which elements of the mesh are active and which are inactive + */ +class ElementStatus +{ + +public: + /// Constructor using mesh + ElementStatus(Mesh const*const mesh); + + bool getElementStatus(unsigned i) { return _status[i]; }; + + bool isActive(unsigned i) { return _status[i]; }; + + void setActive(unsigned i) { _status[i] = true; }; + + void setInactive(unsigned i) { _status[i] = false; }; + + void setElementStatus(unsigned i, bool status) { _status[i] = status; }; + + ~ElementStatus() {}; + +protected: + Mesh const*const _mesh; + std::vector<bool> _status; + +}; /* class */ + +} /* namespace */ + +#endif /* ELEMENTSTATUS_H_ */ +