diff --git a/src/mesh/MeshData.hpp b/src/mesh/MeshData.hpp index 5c4a6068add4fbf8e3969ee8d698890985bcabca..099cc06aa8c4a85f8f5042a9ac45bdb504f76924 100644 --- a/src/mesh/MeshData.hpp +++ b/src/mesh/MeshData.hpp @@ -217,6 +217,24 @@ class MeshData static_assert((Dimension <= 3), "only 1d, 2d and 3d are implemented"); } + void + _checkCellVolume() const + { + bool is_valid = [&] { + for (CellId j = 0; j < m_mesh.numberOfCells(); ++j) { + if (m_Vj[j] <= 0) { + return false; + } + } + return true; + }(); + +#warning add parallel reduction + // if (not parallel::allReduceMin(is_valid)) { + // throw NormalError("mesh contains cells of non-positive volume"); + // } + } + public: PUGS_INLINE const MeshType& @@ -266,6 +284,7 @@ class MeshData this->_updateCjr(); this->_updateCenter(); this->_updateVolume(); + this->_checkCellVolume(); } MeshData(const MeshType& mesh) : m_mesh(mesh)