Revision 5901701c1511c4aaf2dedb9abe1e446b966e6043 authored by Shuang Chen on 08 September 2023, 08:48:44 UTC, committed by Shuang Chen on 08 September 2023, 08:48:44 UTC
Draft: [RT/Docu] add a reactive transport benchmark of co2 injection See merge request ogs/ogs!4729
MeshInformation.h
/**
* \file
* \author Karsten Rink
* \date 2013-10-28
* \brief Definition of the MeshInformation class
*
* \copyright
* Copyright (c) 2012-2023, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#pragma once
#include <array>
#include <limits>
#include <map>
#include <optional>
#include <string>
#include "GeoLib/AABB.h"
#include "MeshLib/Mesh.h"
#include "MeshLib/Node.h"
#include "MeshLib/Properties.h"
namespace MeshToolsLib
{
/**
* \brief A set of tools for extracting information from a mesh
*/
class MeshInformation
{
public:
/// Returns the smallest and largest value of a scalar array with the given
/// name.
template <typename T>
static std::optional<std::pair<T, T>> const getValueBounds(
MeshLib::PropertyVector<T> const& property)
{
if (property.empty())
{
INFO("Mesh property vector '{:s}' is empty.",
property.getPropertyName());
return std::nullopt;
}
auto const [min, max] =
std::minmax_element(begin(property), end(property));
return {{*min, *max}};
}
/// Returns the bounding box of the mesh.
static GeoLib::AABB getBoundingBox(const MeshLib::Mesh& mesh);
/**
* Returns an array with the number of elements of each type in the given
* mesh. On completion, n_element_types array contains the number of
* elements of each of the seven supported types. The index to element type
* conversion is this: 0: \#lines 1: \#triangles 2: \#quads 3: \#tetrahedra
* 4: \#hexahedra
* 5: \#pyramids
* 6: \#prisms
*/
static std::map<MeshLib::MeshElemType, unsigned> getNumberOfElementTypes(
const MeshLib::Mesh& mesh);
/// writes all numbers of element types
static void writeAllNumbersOfElementTypes(const MeshLib::Mesh& mesh);
/// writes out property vector information
static void writePropertyVectorInformation(const MeshLib::Mesh& mesh);
/// writes out mesh validation results
/// Remark: MeshValidation can modify the original mesh
static void writeMeshValidationResults(MeshLib::Mesh& mesh);
/// writes out a list of all material IDs that occur in the mesh.
static std::vector<int> getMaterialIDs(const MeshLib::Mesh& mesh);
};
} // namespace MeshToolsLib
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...