61template <ShapeMatrixType FIELD_TYPE>
66template <
class T_SHAPE_FUNC,
class T_SHAPE_MATRICES>
69 const double* natural_pt,
71 T_SHAPE_MATRICES& shapemat,
74 T_SHAPE_FUNC::computeShapeFunction(natural_pt, shapemat.N);
77template <
class T_SHAPE_FUNC,
class T_SHAPE_MATRICES>
80 [[maybe_unused]]
const double* natural_pt,
82 [[maybe_unused]] T_SHAPE_MATRICES& shapemat,
85 if constexpr (T_SHAPE_FUNC::DIM != 0)
87 double*
const dNdr = shapemat.dNdr.data();
88 T_SHAPE_FUNC::computeGradShapeFunction(natural_pt, dNdr);
102 ERR(
"det J = {:g} is negative for element {:d}.",
106 std::cerr << element <<
"\n";
109 "Please check whether the node numbering of the element is correct,"
110 "or additional elements (like boundary elements) are still present "
116 ERR(
"det J is zero for element {:d}.", element.
getID());
118 std::cerr << element <<
"\n";
121 "Please check whether:\n"
122 "\t the element nodes may have the same coordinates,\n"
123 "\t or the coordinates of all nodes are not given on the x-axis "
124 "for a 1D problem or in the xy-plane in the 2D case.\n"
125 "The first case can occur, if not all boundary elements"
126 "were removed from the bulk mesh.");
130template <
class T_SHAPE_FUNC,
class T_SHAPE_MATRICES>
133 [[maybe_unused]]
const double* natural_pt,
135 T_SHAPE_MATRICES& shapemat,
138 if constexpr (T_SHAPE_FUNC::DIM != 0)
147 auto const dim = T_SHAPE_FUNC::DIM;
148 auto const nnodes = T_SHAPE_FUNC::NPOINTS;
151 for (
auto k =
decltype(nnodes){0}; k < nnodes; k++)
156 for (
auto i_r =
decltype(dim){0}; i_r < dim; i_r++)
158 for (
auto j_x =
decltype(dim){0}; j_x < dim; j_x++)
160 shapemat.J(i_r, j_x) +=
161 shapemat.dNdr(i_r, k) * mapped_pt[j_x];
166 shapemat.detJ = shapemat.J.determinant();
175template <
class T_SHAPE_FUNC,
class T_SHAPE_MATRICES>
178 const double* natural_pt,
180 T_SHAPE_MATRICES& shapemat,
197template <
class T_SHAPE_FUNC,
class T_SHAPE_MATRICES>
200 const double* natural_pt,
202 T_SHAPE_MATRICES& shapemat,
211 if constexpr (T_SHAPE_FUNC::DIM != 0)
216 shapemat.invJ.noalias() = shapemat.J.inverse();
220 if (global_dim == T_SHAPE_FUNC::DIM)
223 .template topLeftCorner<T_SHAPE_FUNC::DIM,
224 T_SHAPE_FUNC::NPOINTS>()
225 .noalias() = shapemat.invJ * shapemat.dNdr;
231 global_dim, T_SHAPE_FUNC::DIM))
234 auto const invJ_dNdr = shapemat.invJ * shapemat.dNdr;
235 auto const dshape_global = matR * invJ_dNdr;
237 dshape_global.topLeftCorner(global_dim, T_SHAPE_FUNC::NPOINTS);
242template <
class T_SHAPE_FUNC,
class T_SHAPE_MATRICES>
245 const double* natural_pt,
247 T_SHAPE_MATRICES& shapemat,
264template <
class T_SHAPE_FUNC,
265 class T_SHAPE_MATRICES,
268 const double* natural_pt,
269 T_SHAPE_MATRICES& shapemat,
270 const unsigned global_dim)
283#define OGS_INSTANTIATE_NATURAL_COORDINATES_MAPPING_PART( \
284 SHAPE, DIM, WHICHPART, SHAPEMATRIXPOLICY) \
285 template void naturalCoordinatesMappingComputeShapeMatrices< \
287 SHAPEMATRIXPOLICY<NumLib::SHAPE, DIM>::ShapeMatrices, \
288 ShapeMatrixType::WHICHPART>( \
289 MeshLib::Element const&, \
291 SHAPEMATRIXPOLICY<NumLib::SHAPE, DIM>::ShapeMatrices&, \
292 const unsigned global_dim)
294#define OGS_INSTANTIATE_NATURAL_COORDINATES_MAPPING_DYN(SHAPE) \
295 OGS_INSTANTIATE_NATURAL_COORDINATES_MAPPING_PART( \
296 SHAPE, 0, ALL, EigenDynamicShapeMatrixPolicy); \
298 OGS_INSTANTIATE_NATURAL_COORDINATES_MAPPING_PART( \
299 SHAPE, 0, N, EigenDynamicShapeMatrixPolicy); \
300 OGS_INSTANTIATE_NATURAL_COORDINATES_MAPPING_PART( \
301 SHAPE, 0, DNDR, EigenDynamicShapeMatrixPolicy); \
302 OGS_INSTANTIATE_NATURAL_COORDINATES_MAPPING_PART( \
303 SHAPE, 0, N_J, EigenDynamicShapeMatrixPolicy); \
304 OGS_INSTANTIATE_NATURAL_COORDINATES_MAPPING_PART( \
305 SHAPE, 0, DNDR_J, EigenDynamicShapeMatrixPolicy); \
306 OGS_INSTANTIATE_NATURAL_COORDINATES_MAPPING_PART( \
307 SHAPE, 0, DNDX, EigenDynamicShapeMatrixPolicy)
309#define OGS_INSTANTIATE_NATURAL_COORDINATES_MAPPING_FIX(SHAPE, DIM) \
310 OGS_INSTANTIATE_NATURAL_COORDINATES_MAPPING_PART( \
311 SHAPE, DIM, ALL, EigenFixedShapeMatrixPolicy); \
313 OGS_INSTANTIATE_NATURAL_COORDINATES_MAPPING_PART( \
314 SHAPE, DIM, N, EigenFixedShapeMatrixPolicy); \
315 OGS_INSTANTIATE_NATURAL_COORDINATES_MAPPING_PART( \
316 SHAPE, DIM, DNDR, EigenFixedShapeMatrixPolicy); \
317 OGS_INSTANTIATE_NATURAL_COORDINATES_MAPPING_PART( \
318 SHAPE, DIM, N_J, EigenFixedShapeMatrixPolicy); \
319 OGS_INSTANTIATE_NATURAL_COORDINATES_MAPPING_PART( \
320 SHAPE, DIM, DNDR_J, EigenFixedShapeMatrixPolicy); \
321 OGS_INSTANTIATE_NATURAL_COORDINATES_MAPPING_PART( \
322 SHAPE, DIM, DNDX, EigenFixedShapeMatrixPolicy)
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
#define OGS_INSTANTIATE_NATURAL_COORDINATES_MAPPING_FIX(SHAPE, DIM)
#define OGS_INSTANTIATE_NATURAL_COORDINATES_MAPPING_DYN(SHAPE)
const RotationMatrix & getRotationMatrixToGlobal() const
return a rotation matrix converting to global coordinates
MathLib::Point3d const & getMappedCoordinates(std::size_t node_id) const
return mapped coordinates of the node
unsigned getGlobalDimension() const
return the global dimension
virtual constexpr unsigned getDimension() const =0
Get dimension of the mesh element.
std::size_t getID() const
Returns the ID of the element.
Shape function for a point element in natural coordinates.
void naturalCoordinatesMappingComputeShapeMatrices(const MeshLib::Element &ele, const double *natural_pt, T_SHAPE_MATRICES &shapemat, const unsigned global_dim)
Used to explicitly instantiate the NaturalCoordinatesMapping class template.
void computeMappingMatrices(const MeshLib::Element &, const double *natural_pt, const MeshLib::ElementCoordinatesMappingLocal &, T_SHAPE_MATRICES &shapemat, FieldType< ShapeMatrixType::N >)
static void checkJacobianDeterminant(const double detJ, MeshLib::Element const &element)
ShapeMatrixType
Shape matrix type to be calculated.