OGS
MeshSurfaceExtraction.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <Eigen/Core>
7#include <cstddef>
8#include <vector>
9
10#include "MeshLib/Mesh.h"
11#include "MeshLib/Properties.h"
12
13namespace MeshLib
14{
15// forward declarations
16class Mesh;
17class Element;
18class Node;
19} // namespace MeshLib
20
21namespace MeshToolsLib
22{
28{
29public:
31 static std::vector<double> getSurfaceAreaForNodes(
32 const MeshLib::Mesh& mesh);
33
35 static std::vector<MeshLib::Node*> getSurfaceNodes(
36 const MeshLib::Mesh& mesh, Eigen::Vector3d const& dir, double angle);
37
58 const MeshLib::Mesh& subsfc_mesh,
59 Eigen::Vector3d const& dir,
60 double angle,
61 std::string_view subsfc_node_id_prop_name = "",
62 std::string_view subsfc_element_id_prop_name = "",
63 std::string_view face_id_prop_name = "");
64
65private:
67 static void get2DSurfaceElements(
68 const std::vector<MeshLib::Element*>& all_elements,
69 std::vector<MeshLib::Element*>& sfc_elements,
70 std::vector<std::size_t>& element_to_bulk_element_id_map,
71 std::vector<std::size_t>& element_to_bulk_face_id_map,
72 Eigen::Vector3d const& dir,
73 double angle,
74 unsigned mesh_dimension);
75};
76
77namespace BoundaryExtraction
78{
79std::unique_ptr<MeshLib::Mesh> getBoundaryElementsAsMesh(
80 MeshLib::Mesh const& bulk_mesh,
81 std::string_view subsfc_node_id_prop_name,
82 std::string_view subsfc_element_id_prop_name,
83 std::string_view face_id_prop_name);
84}
85
87 MeshLib::Mesh& surface_mesh,
88 std::string_view node_to_bulk_node_id_map_name,
89 std::vector<std::size_t> const& node_to_bulk_node_id_map,
90 std::string_view element_to_bulk_element_id_map_name,
91 std::vector<std::size_t> const& element_to_bulk_element_id_map,
92 std::string_view element_to_bulk_face_id_map_name,
93 std::vector<std::size_t> const& element_to_bulk_face_id_map);
94
95} // namespace MeshToolsLib
A set of tools concerned with extracting nodes and elements from a mesh surface.
static std::vector< double > getSurfaceAreaForNodes(const MeshLib::Mesh &mesh)
Returns a vector of the areas assigned to each node on a surface mesh.
static void get2DSurfaceElements(const std::vector< MeshLib::Element * > &all_elements, std::vector< MeshLib::Element * > &sfc_elements, std::vector< std::size_t > &element_to_bulk_element_id_map, std::vector< std::size_t > &element_to_bulk_face_id_map, Eigen::Vector3d const &dir, double angle, unsigned mesh_dimension)
Functionality needed for getSurfaceNodes() and getMeshSurface()
static MeshLib::Mesh * getMeshSurface(const MeshLib::Mesh &subsfc_mesh, Eigen::Vector3d const &dir, double angle, std::string_view subsfc_node_id_prop_name="", std::string_view subsfc_element_id_prop_name="", std::string_view face_id_prop_name="")
static std::vector< MeshLib::Node * > getSurfaceNodes(const MeshLib::Mesh &mesh, Eigen::Vector3d const &dir, double angle)
Returns the surface nodes of a mesh.
std::unique_ptr< MeshLib::Mesh > getBoundaryElementsAsMesh(MeshLib::Mesh const &bulk_mesh, std::string_view subsfc_node_id_prop_name, std::string_view subsfc_element_id_prop_name, std::string_view face_id_prop_name)
void addBulkIDPropertiesToMesh(MeshLib::Mesh &surface_mesh, std::string_view node_to_bulk_node_id_map_name, std::vector< std::size_t > const &node_to_bulk_node_id_map, std::string_view element_to_bulk_element_id_map_name, std::vector< std::size_t > const &element_to_bulk_element_id_map, std::string_view element_to_bulk_face_id_map_name, std::vector< std::size_t > const &element_to_bulk_face_id_map)