OGS
MeshInformation.h
Go to the documentation of this file.
1
15#pragma once
16
17#include <array>
18#include <limits>
19#include <map>
20#include <optional>
21#include <string>
22
23#include "GeoLib/AABB.h"
24#include "MeshLib/Mesh.h"
25#include "MeshLib/Node.h"
26#include "MeshLib/Properties.h"
27
28namespace MeshToolsLib
29{
34{
35public:
38 template <typename T>
39 static std::optional<std::pair<T, T>> const getValueBounds(
40 MeshLib::PropertyVector<T> const& property)
41 {
42 if (property.empty())
43 {
44 INFO("Mesh property vector '{:s}' is empty.",
45 property.getPropertyName());
46 return std::nullopt;
47 }
48
49 auto const [min, max] =
50 std::minmax_element(begin(property), end(property));
51 return {{*min, *max}};
52 }
53
55 static GeoLib::AABB getBoundingBox(const MeshLib::Mesh& mesh);
56
66 static std::map<MeshLib::MeshElemType, unsigned> getNumberOfElementTypes(
67 const MeshLib::Mesh& mesh);
68
70 static void writeAllNumbersOfElementTypes(const MeshLib::Mesh& mesh);
71
73 static void writePropertyVectorInformation(const MeshLib::Mesh& mesh);
74
78
80 static std::vector<int> getMaterialIDs(const MeshLib::Mesh& mesh);
81};
82
83} // namespace MeshToolsLib
Definition of the AABB class.
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:35
Definition of the class Properties that implements a container of properties.
Definition of the Mesh class.
Definition of the Node class.
Class AABB is an axis aligned bounding box around a given set of geometric points of (template) type ...
Definition AABB.h:56
std::string const & getPropertyName() const
A set of tools for extracting information from a mesh.
static GeoLib::AABB getBoundingBox(const MeshLib::Mesh &mesh)
Returns the bounding box of the mesh.
static void writeMeshValidationResults(MeshLib::Mesh &mesh)
static std::optional< std::pair< T, T > > const getValueBounds(MeshLib::PropertyVector< T > const &property)
static std::vector< int > getMaterialIDs(const MeshLib::Mesh &mesh)
writes out a list of all material IDs that occur in the mesh.
static void writeAllNumbersOfElementTypes(const MeshLib::Mesh &mesh)
writes all numbers of element types
static std::map< MeshLib::MeshElemType, unsigned > getNumberOfElementTypes(const MeshLib::Mesh &mesh)
static void writePropertyVectorInformation(const MeshLib::Mesh &mesh)
writes out property vector information