Skip to content
Snippets Groups Projects
Commit 10a52b5f authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

Merge pull request #1195 from TomFischer/GeoMapperRefactorizationMeshLibPart

[MeL] Changes in MeshLib used for GeoMapper refactorization.
parents d6a8f15a 93c3021f
No related branches found
No related tags found
No related merge requests found
......@@ -100,6 +100,16 @@ MeshElementGrid::MeshElementGrid(MeshLib::Mesh const& sfc_mesh) :
sortElementsInGridCells(sfc_mesh);
}
MathLib::Point3d const& MeshElementGrid::getMinPoint() const
{
return _aabb.getMinPoint();
}
MathLib::Point3d const& MeshElementGrid::getMaxPoint() const
{
return _aabb.getMaxPoint();
}
void MeshElementGrid::sortElementsInGridCells(MeshLib::Mesh const& sfc_mesh)
{
for (auto const element : sfc_mesh.getElements()) {
......@@ -142,6 +152,13 @@ bool MeshElementGrid::sortElementInGridCells(MeshLib::Element const& element)
const std::size_t n_plane(_n_steps[0]*_n_steps[1]);
// If a node of an element is almost equal to the upper right point of the
// AABB the grid cell coordinates computed by getGridCellCoordintes() could
// be to large (due to numerical errors). The following lines ensure that
// the grid cell coordinates are in the valid range.
for (std::size_t k(0); k<3; ++k)
max[k] = std::min(_n_steps[k]-1, max[k]);
// insert the element into the grid cells
for (std::size_t i(min[0]); i<=max[0]; i++) {
for (std::size_t j(min[1]); j<=max[1]; j++) {
......
......@@ -56,24 +56,6 @@ public:
auto const min_coords(getGridCellCoordinates(min));
auto const max_coords(getGridCellCoordinates(max));
if (!min_coords.first) {
WARN(
"MeshElementGrid::getElementsInVolume: Min point (%f,%f,%f) "
"outside of MeshElementGrid [%f,%f) x [%f,%f) x [%f,%f).",
min[0], min[1], min[2], _aabb.getMinPoint()[0],
_aabb.getMaxPoint()[0], _aabb.getMinPoint()[1],
_aabb.getMaxPoint()[1], _aabb.getMinPoint()[2],
_aabb.getMaxPoint()[2]);
}
if (!max_coords.first) {
WARN(
"MeshElementGrid::getElementsInVolume: Max point (%f,%f,%f) "
"outside of MeshElementGrid [%f,%f) x [%f,%f) x [%f,%f).",
max[0], max[1], max[2], _aabb.getMinPoint()[0],
_aabb.getMaxPoint()[0], _aabb.getMinPoint()[1],
_aabb.getMaxPoint()[1], _aabb.getMinPoint()[2],
_aabb.getMaxPoint()[2]);
}
std::vector<MeshLib::Element const*> elements_vec;
const std::size_t n_plane(_n_steps[0]*_n_steps[1]);
......@@ -90,6 +72,13 @@ public:
return elements_vec;
}
/// Returns the min point of the internal AABB. The method is a wrapper for
/// GeoLib::AABB::getMinPoint().
MathLib::Point3d const& getMinPoint() const;
/// Returns the max point of the internal AABB. The method is a wrapper for
/// AABB::getMaxPoint().
MathLib::Point3d const& getMaxPoint() const;
private:
void sortElementsInGridCells(MeshLib::Mesh const& sfc_mesh);
bool sortElementInGridCells(MeshLib::Element const& element);
......
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