diff --git a/src/patchkernel/patch_kernel.cpp b/src/patchkernel/patch_kernel.cpp index c9a0d7de92..6bc5c77c7b 100644 --- a/src/patchkernel/patch_kernel.cpp +++ b/src/patchkernel/patch_kernel.cpp @@ -5643,17 +5643,66 @@ std::array PatchKernel::evalElementCentroid(const Element &element) c */ void PatchKernel::evalElementBoundingBox(const Element &element, std::array *minPoint, std::array *maxPoint) const { - ConstProxyVector elementVertexIds = element.getVertexIds(); - const int nElementVertices = elementVertexIds.size(); + ElementType elementType = element.getType(); + switch (elementType) + { + + case ElementType::VERTEX: + { + const long *elementConnect = element.getConnect(); + *minPoint = getVertexCoords(elementConnect[0]); + *maxPoint = *minPoint; + break; + } + + case ElementType::PIXEL: + { + const long *elementConnect = element.getConnect(); + + const std::array &vertexCoord_0 = getVertexCoords(elementConnect[0]); + const std::array &vertexCoord_3 = getVertexCoords(elementConnect[3]); + + for (int d = 0; d < 3; ++d) { + (*minPoint)[d] = std::min(vertexCoord_0[d], vertexCoord_3[d]); + (*maxPoint)[d] = std::max(vertexCoord_0[d], vertexCoord_3[d]); + } + + break; + } + + case ElementType::VOXEL: + { + const long *elementConnect = element.getConnect(); + + const std::array &vertexCoord_0 = getVertexCoords(elementConnect[0]); + const std::array &vertexCoord_7 = getVertexCoords(elementConnect[7]); - *minPoint = getVertexCoords(elementVertexIds[0]); - *maxPoint = *minPoint; - for (int i = 1; i < nElementVertices; ++i) { - const std::array &vertexCoord = getVertexCoords(elementVertexIds[i]); for (int d = 0; d < 3; ++d) { - (*minPoint)[d] = std::min(vertexCoord[d], (*minPoint)[d]); - (*maxPoint)[d] = std::max(vertexCoord[d], (*maxPoint)[d]); + (*minPoint)[d] = std::min(vertexCoord_0[d], vertexCoord_7[d]); + (*maxPoint)[d] = std::max(vertexCoord_0[d], vertexCoord_7[d]); } + + break; + } + + default: + { + ConstProxyVector elementVertexIds = element.getVertexIds(); + const int nElementVertices = elementVertexIds.size(); + + *minPoint = getVertexCoords(elementVertexIds[0]); + *maxPoint = *minPoint; + for (int i = 1; i < nElementVertices; ++i) { + const std::array &vertexCoord = getVertexCoords(elementVertexIds[i]); + for (int d = 0; d < 3; ++d) { + (*minPoint)[d] = std::min(vertexCoord[d], (*minPoint)[d]); + (*maxPoint)[d] = std::max(vertexCoord[d], (*maxPoint)[d]); + } + } + + break; + } + } } diff --git a/src/voloctree/voloctree.cpp b/src/voloctree/voloctree.cpp index 29140ed9b6..4a95a6a1b0 100644 --- a/src/voloctree/voloctree.cpp +++ b/src/voloctree/voloctree.cpp @@ -720,22 +720,6 @@ std::array VolOctree::evalCellCentroid(long id) const return m_tree->getCenter(octant); } -/*! - Evaluates the bounding box of the specified cell. - - \param id is the id of the cell - \param[out] minPoint is the minimum point of the bounding box - \param[out] maxPoint is the maximum point of the bounding box -*/ -void VolOctree::evalCellBoundingBox(long id, std::array *minPoint, std::array *maxPoint) const -{ - OctantInfo octantInfo = getCellOctant(id); - const Octant *octant = getOctantPointer(octantInfo); - - *minPoint = m_tree->getNode(octant, 0); - *maxPoint = m_tree->getNode(octant, m_cellTypeInfo->nVertices - 1); -} - /*! Evaluates the characteristic size of the specified cell. diff --git a/src/voloctree/voloctree.hpp b/src/voloctree/voloctree.hpp index 93bf018d15..52fe391594 100644 --- a/src/voloctree/voloctree.hpp +++ b/src/voloctree/voloctree.hpp @@ -98,8 +98,6 @@ class VolOctree : public VolumeKernel { void simulateCellUpdate(long id, adaption::Marker marker, std::vector *virtualCells, PiercedVector *virtualVertices) const override; - void evalCellBoundingBox(long id, std::array *minPoint, std::array *maxPoint) const override; - double evalInterfaceArea(long id) const override; std::array evalInterfaceNormal(long id) const override;