diff --git a/MeshLib/Elements/MapBulkElementPoint.cpp b/MeshLib/Elements/MapBulkElementPoint.cpp index c5ab31d53781aa841d2e38fd7534ab6b8e3ec90e..7958e3ed2eed4ed4a28b090a315cc78941e4ac51 100644 --- a/MeshLib/Elements/MapBulkElementPoint.cpp +++ b/MeshLib/Elements/MapBulkElementPoint.cpp @@ -78,28 +78,33 @@ MathLib::Point3d getBulkElementPoint(MeshLib::Hex const& /*hex*/, } } -MathLib::Point3d getBulkElementPoint(MeshLib::Tet const& /*tet*/, +MathLib::Point3d getBulkElementPoint(MeshLib::Prism const& /*prism*/, std::size_t const face_id, MathLib::WeightedPoint2D const& wp) { switch (face_id) { case 0: - return MathLib::Point3d{std::array<double, 3>{{wp[1], wp[0], 0.0}}}; + return MathLib::Point3d{ + std::array<double, 3>{{wp[1], wp[0], -1.0}}}; case 1: - return MathLib::Point3d{std::array<double, 3>{{wp[0], 0.0, wp[1]}}}; + return MathLib::Point3d{ + std::array<double, 3>{{wp[0]/2.0 + 0.5, 0.0, wp[1]}}}; case 2: return MathLib::Point3d{ - std::array<double, 3>{{1 - wp[0] - wp[1], wp[0], wp[1]}}}; + std::array<double, 3>{{0.5 - wp[0]/2.0, 0.5 + wp[0]/2.0, wp[1]}}}; case 3: return MathLib::Point3d{ - std::array<double, 3>{{0, wp[1], wp[0]}}}; + std::array<double, 3>{{0, -wp[0]/2.0 + 0.5, wp[1]}}}; + case 4: + return MathLib::Point3d{ + std::array<double, 3>{{wp[0], wp[1], 1.0}}}; default: - OGS_FATAL("Invalid face id '{:d}' for the tetrahedron.", face_id); + OGS_FATAL("Invalid face id '{:d}' for the prism.", face_id); } } -MathLib::Point3d getBulkElementPoint(MeshLib::Prism const& /*prism*/, +MathLib::Point3d getBulkElementPoint(MeshLib::Pyramid const& /*pyramid*/, std::size_t const face_id, MathLib::WeightedPoint2D const& wp) { @@ -107,21 +112,42 @@ MathLib::Point3d getBulkElementPoint(MeshLib::Prism const& /*prism*/, { case 0: return MathLib::Point3d{ - std::array<double, 3>{{wp[1], wp[0], -1.0}}}; + std::array<double, 3>{{2 * wp[0] - 1, -1.0, 2 * wp[1] - 1}}}; case 1: return MathLib::Point3d{ - std::array<double, 3>{{wp[0]/2.0 + 0.5, 0.0, wp[1]}}}; + std::array<double, 3>{{1.0, 2 * wp[0] - 1, 2 * wp[1] - 1}}}; case 2: return MathLib::Point3d{ - std::array<double, 3>{{0.5 - wp[0]/2.0, 0.5 + wp[0]/2.0, wp[1]}}}; + std::array<double, 3>{{1 - 2 * wp[0], 1.0, 2 * wp[1] - 1}}}; case 3: - return MathLib::Point3d{ - std::array<double, 3>{{0, -wp[0]/2.0 + 0.5, wp[1]}}}; + return MathLib::Point3d{std::array<double, 3>{ + {-1.0, 2 * wp[1] - 1, 2 * wp[0] - 1}}}; case 4: return MathLib::Point3d{ - std::array<double, 3>{{wp[0], wp[1], 1.0}}}; + std::array<double, 3>{{-wp[0], wp[1], -1.0}}}; default: - OGS_FATAL("Invalid face id '{:d}' for the prism.", face_id); + OGS_FATAL("Invalid face id '{:d}' for the pyramid.", face_id); + } +} + +MathLib::Point3d getBulkElementPoint(MeshLib::Tet const& /*tet*/, + std::size_t const face_id, + MathLib::WeightedPoint2D const& wp) +{ + switch (face_id) + { + case 0: + return MathLib::Point3d{std::array<double, 3>{{wp[1], wp[0], 0.0}}}; + case 1: + return MathLib::Point3d{std::array<double, 3>{{wp[0], 0.0, wp[1]}}}; + case 2: + return MathLib::Point3d{ + std::array<double, 3>{{1 - wp[0] - wp[1], wp[0], wp[1]}}}; + case 3: + return MathLib::Point3d{ + std::array<double, 3>{{0, wp[1], wp[0]}}}; + default: + OGS_FATAL("Invalid face id '{:d}' for the tetrahedron.", face_id); } } @@ -162,6 +188,12 @@ MathLib::Point3d getBulkElementPoint(MeshLib::Mesh const& mesh, *static_cast<MeshLib::Prism const*>(element); return getBulkElementPoint(prism, bulk_face_id, wp); } + if (element->getCellType() == MeshLib::CellType::PYRAMID5) + { + MeshLib::Pyramid const& pyramid = + *static_cast<MeshLib::Pyramid const*>(element); + return getBulkElementPoint(pyramid, bulk_face_id, wp); + } if (element->getCellType() == MeshLib::CellType::TET4) { MeshLib::Tet const& tet = *static_cast<MeshLib::Tet const*>(element); diff --git a/MeshLib/Elements/MapBulkElementPoint.h b/MeshLib/Elements/MapBulkElementPoint.h index eed2edbc1bd4ea8191164594d84a9dad10a28e92..33e8cebee344746b09e8d60e689cd8a1bd3ce882 100644 --- a/MeshLib/Elements/MapBulkElementPoint.h +++ b/MeshLib/Elements/MapBulkElementPoint.h @@ -67,6 +67,13 @@ MathLib::Point3d getBulkElementPoint(MeshLib::Prism const& prism, std::size_t const face_id, MathLib::WeightedPoint2D const& wp); +/// Maps the given lower dimensional 2d boundary point \c wp of a quad or +/// triangle element, given in local coordinates of the quad or triangle, to a +/// 3d point existing on a pyramid face also in local coordinates. +MathLib::Point3d getBulkElementPoint(MeshLib::Pyramid const& pyramid, + std::size_t const face_id, + MathLib::WeightedPoint2D const& wp); + /// Maps the given 1d boundary point \c wp of a boundary element, given in local /// coordinates of the boundary element, to 3d point existing on a bulk element /// also in local coordinates.