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

[MeL/MG] LayeredMeshGenerator: Use PV instead of getValue()/setValue().

parent 8c503f54
No related branches found
No related tags found
No related merge requests found
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include <vector> #include <vector>
#include <fstream> #include <fstream>
#include <logog/include/logog.hpp>
#include "FileIO/AsciiRasterInterface.h" #include "FileIO/AsciiRasterInterface.h"
#include "GeoLib/Raster.h" #include "GeoLib/Raster.h"
...@@ -24,6 +26,8 @@ ...@@ -24,6 +26,8 @@
#include "MeshLib/Mesh.h" #include "MeshLib/Mesh.h"
#include "MeshLib/Node.h" #include "MeshLib/Node.h"
#include "MeshLib/Elements/Element.h" #include "MeshLib/Elements/Element.h"
#include "MeshLib/PropertyVector.h"
#include "MeshLib/Properties.h"
#include "MeshLib/MeshQuality/MeshValidation.h" #include "MeshLib/MeshQuality/MeshValidation.h"
#include "MeshLib/MeshSearch/NodeSearch.h" #include "MeshLib/MeshSearch/NodeSearch.h"
#include "MeshLib/MeshEditing/RemoveMeshComponents.h" #include "MeshLib/MeshEditing/RemoveMeshComponents.h"
...@@ -53,17 +57,28 @@ bool LayeredMeshGenerator::createLayers(MeshLib::Mesh const& mesh, ...@@ -53,17 +57,28 @@ bool LayeredMeshGenerator::createLayers(MeshLib::Mesh const& mesh,
MeshLib::Mesh* LayeredMeshGenerator::getMesh(std::string const& mesh_name) const MeshLib::Mesh* LayeredMeshGenerator::getMesh(std::string const& mesh_name) const
{ {
if (_nodes.empty() || _elements.empty()) if (_nodes.empty() || _elements.empty())
return nullptr; return nullptr;
MeshLib::Mesh* result (new MeshLib::Mesh(mesh_name, _nodes, _elements)); MeshLib::Properties properties;
MeshLib::NodeSearch ns(*result); if (_materials.size() == _elements.size())
if (ns.searchUnused() > 0) { {
auto new_mesh = MeshLib::removeNodes(*result, ns.getSearchedNodeIDs(), mesh_name); boost::optional<MeshLib::PropertyVector<int> &> materials =
delete result; properties.createNewPropertyVector<int>("MaterialIDs", MeshLib::MeshItemType::Cell);
return new_mesh; materials->resize(_materials.size());
} std::copy(_materials.cbegin(), _materials.cend(), materials->begin());
return result; }
else
WARN ("Skipping MaterialID information, number of entries does not match element number");
MeshLib::Mesh* result (new MeshLib::Mesh(mesh_name, _nodes, _elements, properties));
MeshLib::NodeSearch ns(*result);
if (ns.searchUnused() > 0) {
auto new_mesh = MeshLib::removeNodes(*result, ns.getSearchedNodeIDs(), mesh_name);
delete result;
return new_mesh;
}
return result;
} }
double LayeredMeshGenerator::calcEpsilon(GeoLib::Raster const& low, GeoLib::Raster const& high) double LayeredMeshGenerator::calcEpsilon(GeoLib::Raster const& low, GeoLib::Raster const& high)
......
...@@ -97,6 +97,7 @@ protected: ...@@ -97,6 +97,7 @@ protected:
double _elevation_epsilon; double _elevation_epsilon;
double _minimum_thickness; double _minimum_thickness;
std::vector<int> _materials;
std::vector<MeshLib::Node*> _nodes; std::vector<MeshLib::Node*> _nodes;
std::vector<MeshLib::Element*> _elements; std::vector<MeshLib::Element*> _elements;
}; };
......
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