29 const std::vector<GeoLib::Raster const*>& rasters,
30 double minimum_thickness,
31 double noDataReplacementValue)
51 top = std::make_unique<MeshLib::Mesh>(mesh);
55 *top, *rasters.back(), noDataReplacementValue))
60 std::unique_ptr<MeshLib::Mesh> bottom(
new MeshLib::Mesh(*top));
71 ERR(
"The materials vector is not empty.");
77 const std::size_t nRasters(rasters.size());
78 for (std::size_t i = 1; i < nRasters; ++i)
95 const std::vector<MeshLib::Node*>& nodes(dem_mesh.
getNodes());
96 const std::size_t node_id_offset(
_nodes.size());
97 const std::size_t last_layer_node_offset(node_id_offset - nNodes);
99 for (std::size_t i = 0; i < nNodes; ++i)
102 *
_nodes[last_layer_node_offset + i],
107 const std::vector<MeshLib::Element*>& layer_elements(
113 std::array<MeshLib::Node*, 3> tri_nodes = {
114 {
_nodes[node_id_offset + getNodeIndex(*elem, 0)],
115 _nodes[node_id_offset + getNodeIndex(*elem, 1)],
116 _nodes[node_id_offset + getNodeIndex(*elem, 2)]}};
122 std::array<MeshLib::Node*, 4> quad_nodes = {
123 {
_nodes[node_id_offset + getNodeIndex(*elem, 0)],
124 _nodes[node_id_offset + getNodeIndex(*elem, 1)],
125 _nodes[node_id_offset + getNodeIndex(*elem, 2)],
126 _nodes[node_id_offset + getNodeIndex(*elem, 3)]}};
136 const unsigned nLayerBoundaries(nLayers - 1);
138 const std::vector<MeshLib::Element*>& layer_elements(layer.
getElements());
141 const std::size_t nElemNodes(elem->getNumberOfBaseNodes());
142 for (
unsigned i = 0; i < nElemNodes; ++i)
144 if (elem->getNeighbor(i) ==
nullptr)
146 for (
unsigned j = 0; j < nLayerBoundaries; ++j)
148 const std::size_t offset(j * nNodes);
152 getNodeIndex(*elem, (i + 1) % nElemNodes)];
155 getNodeIndex(*elem, (i + 1) % nElemNodes)];
157 _nodes[offset + nNodes + getNodeIndex(*elem, i)];
163 double const eps = std::numeric_limits<double>::epsilon();
165 if ((v2 - v1).norm() > eps)
167 const std::array tri_nodes = {n0, n2, n1};
171 if ((v3 - v0).norm() > eps)
173 const std::array tri_nodes = {n0, n3, n2};
184 std::size_t nElementsPerLayer)
186 for (std::size_t i = nLayers - 1; i > 0; --i)
188 const std::size_t lower_offset((i - 1) * nElementsPerLayer);
189 const std::size_t upper_offset(i * nElementsPerLayer);
190 for (std::size_t j = 0; j < nElementsPerLayer; ++j)
197 for (std::size_t k = 0; k < nElemNodes; ++k)
199 if (getNodeIndex(*high, k) == getNodeIndex(*low, k))
206 if (count == nElemNodes)
Definition of Duplicate functions.
Definition of the LayeredVolume class.
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition of the MeshLayerMapper class.
Definition of the class Properties that implements a container of properties.
Definition of the Quad class.
Definition of the GeoLib::Raster class.
Definition of the Tri class.
Class Raster is used for managing raster data.
double _minimum_thickness
std::vector< int > _materials
double _elevation_epsilon
static double calcEpsilon(GeoLib::Raster const &low, GeoLib::Raster const &high)
Calculates a data-dependent epsilon value.
MeshLib::Node * getNewLayerNode(MeshLib::Node const &dem_node, MeshLib::Node const &last_layer_node, GeoLib::Raster const &raster, std::size_t new_node_id) const
std::vector< MeshLib::Node * > _nodes
std::vector< MeshLib::Element * > _elements
void removeCongruentElements(std::size_t nLayers, std::size_t nElementsPerLayer)
Removes duplicate 2D elements (possible due to outcroppings)
std::vector< MeshLib::Node > _attribute_points
void addLayerToMesh(const MeshLib::Mesh &dem_mesh, unsigned layer_id, GeoLib::Raster const &raster) override
Adds another layer to the subsurface mesh.
bool createRasterLayers(const MeshLib::Mesh &mesh, const std::vector< GeoLib::Raster const * > &rasters, double minimum_thickness, double noDataReplacementValue=0.0) override
void addLayerBoundaries(const MeshLib::Mesh &layer, std::size_t nLayers)
Eigen::Vector3d const & asEigenVector3d() const
const std::vector< std::size_t > & getSearchedElementIDs() const
return marked elements
std::size_t searchByElementType(MeshElemType eleType)
Marks all elements of the given element type.
virtual unsigned getNumberOfBaseNodes() const =0
virtual void setNode(unsigned idx, Node *node)=0
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
std::size_t getNumberOfNodes() const
Get the number of nodes.
std::vector< Node * > copyNodeVector(const std::vector< Node * > &nodes)
Creates a deep copy of a Node vector.
MathLib::Point3d getCenterOfGravity(Element const &element)
Calculates the center of gravity for the mesh element.
std::vector< Element * > copyElementVector(std::vector< Element * > const &elements, std::vector< Node * > const &new_nodes, std::vector< std::size_t > const *const node_id_map)