Skip to content
Snippets Groups Projects
Commit 781168dd authored by Tom Fischer's avatar Tom Fischer
Browse files

[PL] Lower dim gauss pnt to bulk elem pnt mapping.

parent 37cee6ca
No related branches found
No related tags found
No related merge requests found
/**
* \copyright
* Copyright (c) 2012-2016, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#include <array>
#include "MapBulkElementPoint.h"
namespace ProcessLib
{
MathLib::Point3d getBulkElementPoint(MeshLib::Quad const& quad,
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.0, wp[0], 0.0}}};
case 2:
return MathLib::Point3d{std::array<double, 3>{{1.0 - wp[0], 1.0, 0.0}}};
case 3:
return MathLib::Point3d{std::array<double, 3>{{0.0, 1.0 - wp[0], 0.0}}};
default:
OGS_FATAL("Invalid face id '%u' for the quad.", face_id);
}
}
MathLib::Point3d getBulkElementPoint(MeshLib::Hex const& hex,
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], -1.0}}};
case 1:
return MathLib::Point3d{
std::array<double, 3>{{wp[0], -1.0, wp[1]}}};
case 2:
return MathLib::Point3d{std::array<double, 3>{{1.0, wp[0], wp[1]}}};
case 3:
return MathLib::Point3d{
std::array<double, 3>{{-wp[0], -1.0, wp[1]}}};
case 4:
return MathLib::Point3d{
std::array<double, 3>{{-1.0, -wp[0], -wp[1]}}};
case 5:
return MathLib::Point3d{std::array<double, 3>{{wp[0], wp[1], 1.0}}};
default:
OGS_FATAL("Invalid face id '%u' for the hexahedron.", face_id);
}
}
MathLib::Point3d getBulkElementPoint(MeshLib::Mesh const& mesh,
std::size_t const bulk_element_id,
std::size_t const bulk_face_id,
MathLib::WeightedPoint1D const& wp)
{
auto const* element = mesh.getElement(bulk_element_id);
if (element->getCellType() == MeshLib::CellType::QUAD4)
{
MeshLib::Quad const& quad(*dynamic_cast<MeshLib::Quad const*>(element));
return getBulkElementPoint(quad, bulk_face_id, wp);
}
OGS_FATAL("Wrong cell type '%s' or functionality not yet implemented.",
MeshLib::CellType2String(element->getCellType()).c_str());
}
MathLib::Point3d getBulkElementPoint(MeshLib::Mesh const& mesh,
std::size_t bulk_element_id,
std::size_t bulk_face_id,
MathLib::WeightedPoint2D const& wp)
{
auto const* element = mesh.getElement(bulk_element_id);
if (element->getCellType() == MeshLib::CellType::HEX8)
{
MeshLib::Hex const& hex(*dynamic_cast<MeshLib::Hex const*>(element));
return getBulkElementPoint(hex, bulk_face_id, wp);
}
OGS_FATAL("Wrong cell type '%s' or functionality not yet implemented.",
MeshLib::CellType2String(element->getCellType()).c_str());
}
// TODO disable the 3d elements in the local assembler creator
MathLib::Point3d getBulkElementPoint(MeshLib::Mesh const& mesh,
std::size_t bulk_element_id,
std::size_t bulk_face_id,
MathLib::WeightedPoint3D const& wp)
{
return MathLib::ORIGIN;
}
} // end namespace ProcessLib
/**
* \copyright
* Copyright (c) 2012-2016, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#ifndef PROCESSLIB_BALANCEPROCESS_MAPBULKELEMENT_H
#define PROCESSLIB_BALANCEPROCESS_MAPBULKELEMENT_H
#include <array>
#include "MathLib/TemplateWeightedPoint.h"
#include "MeshLib/Elements/FaceRule.h"
#include "MeshLib/Elements/Elements.h"
namespace ProcessLib
{
/// 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
/// \return the mapped point
MathLib::Point3d getBulkElementPoint(MeshLib::Quad const& quad,
std::size_t const face_id,
MathLib::WeightedPoint1D const& wp);
/// Maps the given 2d boundary point \c wp of a quad face, given in local
/// coordinates of the quad, to 3d point existing on a hexahedron face also in
/// local coordinates.
MathLib::Point3d getBulkElementPoint(MeshLib::Hex const& hex,
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.
MathLib::Point3d getBulkElementPoint(MeshLib::Mesh const& mesh,
std::size_t const bulk_element_id,
std::size_t const bulk_face_id,
MathLib::WeightedPoint1D const& wp);
/// Maps the given 2d 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.
MathLib::Point3d getBulkElementPoint(MeshLib::Mesh const& mesh,
std::size_t bulk_element_id,
std::size_t bulk_face_id,
MathLib::WeightedPoint2D const& wp);
// TODO disable the 3d elements in the local assembler creator
MathLib::Point3d getBulkElementPoint(MeshLib::Mesh const& mesh,
std::size_t bulk_element_id,
std::size_t bulk_face_id,
MathLib::WeightedPoint3D const& wp);
} // end namespace ProcessLib
#endif
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