diff --git a/MeshLib/Elements/MapBulkElementPoint.cpp b/MeshLib/Elements/MapBulkElementPoint.cpp index f0deb125afcb23c7fc688ac74dd852578d93e589..abc5029e1a1d718d6aa72858aa1fbe60eb719f3a 100644 --- a/MeshLib/Elements/MapBulkElementPoint.cpp +++ b/MeshLib/Elements/MapBulkElementPoint.cpp @@ -14,6 +14,25 @@ namespace MeshLib { +MathLib::Point3d getBulkElementPoint(MeshLib::Tri const& /*tri*/, + std::size_t const face_id, + MathLib::WeightedPoint1D const& wp) +{ + switch (face_id) + { + case 0: + return MathLib::Point3d{std::array<double, 3>{{wp[0], 0.0, 0.0}}}; + case 1: + return MathLib::Point3d{ + std::array<double, 3>{{1 - wp[0], wp[0], 0.0}}}; + case 2: + return MathLib::Point3d{ + std::array<double, 3>{{0.0, 1 - wp[0], 0.0}}}; + default: + OGS_FATAL("Invalid face id '{:d}' for the tri.", face_id); + } +} + MathLib::Point3d getBulkElementPoint(MeshLib::Quad const& /*quad*/, std::size_t const face_id, MathLib::WeightedPoint1D const& wp) @@ -117,6 +136,11 @@ MathLib::Point3d getBulkElementPoint(MeshLib::Mesh const& mesh, MeshLib::Quad const& quad(*dynamic_cast<MeshLib::Quad const*>(element)); return getBulkElementPoint(quad, bulk_face_id, wp); } + if (element->getCellType() == MeshLib::CellType::TRI3) + { + MeshLib::Tri const& tri = *static_cast<MeshLib::Tri const*>(element); + return getBulkElementPoint(tri, bulk_face_id, wp); + } OGS_FATAL("Wrong cell type '{:s}' or functionality not yet implemented.", MeshLib::CellType2String(element->getCellType())); } diff --git a/MeshLib/Elements/MapBulkElementPoint.h b/MeshLib/Elements/MapBulkElementPoint.h index 6f902717de198c552ab7c22b67eb8d9be73df706..560888bbbeb27e911339e068afb453806d8492e7 100644 --- a/MeshLib/Elements/MapBulkElementPoint.h +++ b/MeshLib/Elements/MapBulkElementPoint.h @@ -17,13 +17,25 @@ namespace MeshLib { +/// Maps the given lower dimensional boundary point \c wp of a line, i.e. the 1d +/// integration point given in local coordinates of a line, to higher +/// dimensional point of the triangle face (defined by the triangle element and +/// the face id) also in local coordinates of the triangle element. +/// \param tri the triangle element +/// \param face_id the id of the triangle face the point will be mapped on +/// \param wp the integration point of the lower dimensional element +/// \return the mapped point +MathLib::Point3d getBulkElementPoint(MeshLib::Tri const& tri, + std::size_t const face_id, + MathLib::WeightedPoint1D const& wp); + /// Maps the given lower dimensional boundary point \c wp of a line, i.e. the 1d /// gauss point given in local coordinates of a line, to higher dimensional /// point of the quad face (defined by the quad element and the face id) also in /// local coordinates of the quad face. /// \param quad the quad element /// \param face_id the id of the quad face the point will be mapped on -/// \param wp the gauss point of the lower dimensional element +/// \param wp the integration point of the lower dimensional element /// \return the mapped point MathLib::Point3d getBulkElementPoint(MeshLib::Quad const& quad, std::size_t const face_id,