Skip to content
Snippets Groups Projects
Commit 948516ef authored by Christoph Lehmann's avatar Christoph Lehmann
Browse files

[NL] pass global_dim explicitly

parent b3792140
No related branches found
No related tags found
No related merge requests found
......@@ -129,6 +129,7 @@ computeMappingMatrices(
shapemat.detJ = shapemat.J.determinant();
#ifndef NDEBUG
// TODO make fatal?
if (shapemat.detJ<=.0)
ERR("det|J|=%e is not positive.\n", shapemat.detJ);
#endif
......@@ -180,7 +181,7 @@ computeMappingMatrices(
auto const nnodes(shapemat.dNdr.cols());
auto const ele_dim(shapemat.dNdr.rows());
assert(shapemat.dNdr.rows()==ele.getDimension());
const unsigned global_dim(ele_local_coord.getGlobalCoordinateSystem().getDimension());
const unsigned global_dim = ele_local_coord.getGlobalDimension();
if (global_dim==ele_dim) {
shapemat.dNdx.topLeftCorner(ele_dim, nnodes).noalias() = shapemat.invJ * shapemat.dNdr;
} else {
......@@ -226,10 +227,10 @@ template <class T_MESH_ELEMENT,
ShapeMatrixType T_SHAPE_MATRIX_TYPE>
void naturalCoordinatesMappingComputeShapeMatrices(const T_MESH_ELEMENT& ele,
const double* natural_pt,
T_SHAPE_MATRICES& shapemat)
T_SHAPE_MATRICES& shapemat,
const unsigned global_dim)
{
const MeshLib::CoordinateSystem coords(ele);
const MeshLib::ElementCoordinatesMappingLocal ele_local_coord(ele, coords);
const MeshLib::ElementCoordinatesMappingLocal ele_local_coord(ele, global_dim);
detail::computeMappingMatrices<
T_MESH_ELEMENT,
......@@ -251,7 +252,8 @@ void naturalCoordinatesMappingComputeShapeMatrices(const T_MESH_ELEMENT& ele,
ShapeMatrixType::WHICHPART>( \
MeshLib::TemplateElement<MeshLib::RULE> const&, \
double const*, \
SHAPEMATRIXPOLICY<NumLib::SHAPE, DIM>::ShapeMatrices&)
SHAPEMATRIXPOLICY<NumLib::SHAPE, DIM>::ShapeMatrices&, \
const unsigned global_dim)
#define OGS_INSTANTIATE_NATURAL_COORDINATES_MAPPING_DYN(RULE, SHAPE) \
OGS_INSTANTIATE_NATURAL_COORDINATES_MAPPING_PART( \
......
......@@ -28,7 +28,8 @@ template <class T_MESH_ELEMENT,
ShapeMatrixType T_SHAPE_MATRIX_TYPE>
void naturalCoordinatesMappingComputeShapeMatrices(const T_MESH_ELEMENT& ele,
const double* natural_pt,
T_SHAPE_MATRICES& shapemat);
T_SHAPE_MATRICES& shapemat,
const unsigned global_dim);
} // namespace detail
/**
......@@ -54,9 +55,10 @@ struct NaturalCoordinatesMapping
*/
static void computeShapeMatrices(const T_MESH_ELEMENT& ele,
const double* natural_pt,
T_SHAPE_MATRICES& shapemat)
T_SHAPE_MATRICES& shapemat,
const unsigned global_dim)
{
computeShapeMatrices<ShapeMatrixType::ALL>(ele, natural_pt, shapemat);
computeShapeMatrices<ShapeMatrixType::ALL>(ele, natural_pt, shapemat, global_dim);
}
/**
......@@ -72,13 +74,14 @@ struct NaturalCoordinatesMapping
template <ShapeMatrixType T_SHAPE_MATRIX_TYPE>
static void computeShapeMatrices(const T_MESH_ELEMENT& ele,
const double* natural_pt,
T_SHAPE_MATRICES& shapemat)
T_SHAPE_MATRICES& shapemat,
const unsigned global_dim)
{
detail::naturalCoordinatesMappingComputeShapeMatrices<
T_MESH_ELEMENT,
T_SHAPE_FUNC,
T_SHAPE_MATRICES,
T_SHAPE_MATRIX_TYPE>(ele, natural_pt, shapemat);
T_SHAPE_MATRIX_TYPE>(ele, natural_pt, shapemat, global_dim);
}
};
......
......@@ -77,16 +77,17 @@ public:
{
this->_ele = &e;
}
/**
* compute shape functions
*
* @param natural_pt position in natural coordinates
* @param shape evaluated shape function matrices
*/
void computeShapeFunctions(const double *natural_pt, ShapeMatrices &shape) const
void computeShapeFunctions(const double* natural_pt, ShapeMatrices& shape,
const unsigned global_dim) const
{
NaturalCoordsMappingType::computeShapeMatrices(*_ele, natural_pt, shape);
NaturalCoordsMappingType::computeShapeMatrices(*_ele, natural_pt, shape,
global_dim);
}
/**
......@@ -97,12 +98,13 @@ public:
* @param shape evaluated shape function matrices
*/
template <ShapeMatrixType T_SHAPE_MATRIX_TYPE>
void computeShapeFunctions(const double *natural_pt, ShapeMatrices &shape) const
void computeShapeFunctions(const double* natural_pt, ShapeMatrices& shape,
const unsigned global_dim) const
{
NaturalCoordsMappingType::template computeShapeMatrices<T_SHAPE_MATRIX_TYPE>(*_ele, natural_pt, shape);
NaturalCoordsMappingType::template computeShapeMatrices<
T_SHAPE_MATRIX_TYPE>(*_ele, natural_pt, shape, global_dim);
}
private:
const MeshElementType* _ele;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment