preCICE v3.1.2
|
Container and creator for meshes. More...
#include <Mesh.hpp>
Public Types | |
using | VertexContainer = std::deque<Vertex> |
using | EdgeContainer = std::deque<Edge> |
using | TriangleContainer = std::deque<Triangle> |
using | TetraContainer = std::deque<Tetrahedron> |
using | DataContainer = std::vector<PtrData> |
using | BoundingBoxMap = std::map<int, BoundingBox> |
using | VertexDistribution = std::map<Rank, std::vector<VertexID>> |
A mapping from rank to used (not necessarily owned) vertex IDs. | |
using | CommunicationMap = std::map<Rank, std::vector<VertexID>> |
A mapping from remote local ranks to the IDs that must be communicated. | |
using | ConnectionMap = CommunicationMap |
using | VertexOffsets = std::vector<int> |
Public Member Functions | |
Mesh (std::string name, int dimensions, MeshID id) | |
Constructor. | |
Vertex & | vertex (VertexID id) |
Mutable access to a vertex by VertexID. | |
const Vertex & | vertex (VertexID id) const |
Const access to a vertex by VertexID. | |
VertexContainer & | vertices () |
Returns modifieable container holding all vertices. | |
const VertexContainer & | vertices () const |
Returns const container holding all vertices. | |
std::size_t | nVertices () const |
Returns the number of vertices. | |
bool | empty () const |
Does the mesh contain any vertices? | |
EdgeContainer & | edges () |
Returns modifiable container holding all edges. | |
const EdgeContainer & | edges () const |
Returns const container holding all edges. | |
bool | hasEdges () const |
TriangleContainer & | triangles () |
Returns modifiable container holding all triangles. | |
const TriangleContainer & | triangles () const |
Returns const container holding all triangles. | |
bool | hasTriangles () const |
TetraContainer & | tetrahedra () |
Returns modifiable container holding all tetrahedra. | |
const TetraContainer & | tetrahedra () const |
Returns const container holding all tetrahedra. | |
bool | hasTetrahedra () const |
bool | hasConnectivity () const |
int | getDimensions () const |
Vertex & | createVertex (const Eigen::VectorXd &coords) |
Creates and initializes a Vertex object. | |
Edge & | createEdge (Vertex &vertexOne, Vertex &vertexTwo) |
Creates and initializes an Edge object. | |
Triangle & | createTriangle (Edge &edgeOne, Edge &edgeTwo, Edge &edgeThree) |
Creates and initializes a Triangle object. | |
Triangle & | createTriangle (Vertex &vertexOne, Vertex &vertexTwo, Vertex &vertexThree) |
Creates and initializes a Triangle object. | |
Tetrahedron & | createTetrahedron (Vertex &vertexOne, Vertex &vertexTwo, Vertex &vertexThree, Vertex &vertexFour) |
Creates and initializes a Tetrahedron object. | |
PtrData & | createData (const std::string &name, int dimension, DataID id, int waveformDegree=time::Time::DEFAULT_WAVEFORM_DEGREE) |
Create only data for vertex. | |
const DataContainer & | data () const |
Allows access to all data. | |
bool | hasDataID (DataID dataID) const |
Returns whether Mesh has Data with the matchingID. | |
const PtrData & | data (DataID dataID) const |
Returns the data with the matching ID. | |
bool | hasDataName (std::string_view dataName) const |
Returns whether Mesh has Data with the dataName. | |
std::vector< std::string > | availableData () const |
Returns the names of all available data. | |
const PtrData & | data (std::string_view dataName) const |
Returns the data with the matching name. | |
const std::string & | getName () const |
Returns the name of the mesh, as set in the config file. | |
MeshID | getID () const |
Returns the base ID of the mesh. | |
bool | isValidVertexID (VertexID vertexID) const |
Returns true if the given vertexID is valid. | |
void | allocateDataValues () |
Allocates memory for the vertex data values and corresponding gradient values. | |
void | computeBoundingBox () |
Computes the boundingBox for the vertices. | |
void | clear () |
Removes all mesh elements and data values (does not remove data or the bounding boxes). | |
void | clearPartitioning () |
Clears the partitioning information. | |
void | setVertexDistribution (VertexDistribution vd) |
const VertexDistribution & | getVertexDistribution () const |
Returns a mapping from rank to used (not necessarily owned) vertex IDs. | |
const VertexOffsets & | getVertexOffsets () const |
void | setVertexOffsets (VertexOffsets vertexOffsets) |
Only used for tests. | |
int | getGlobalNumberOfVertices () const |
void | setGlobalNumberOfVertices (int num) |
Eigen::VectorXd | getOwnedVertexData (const Eigen::VectorXd &values) |
void | tagAll () |
const std::vector< Rank > & | getConnectedRanks () const |
Returns a vector of connected ranks. | |
void | setConnectedRanks (std::vector< Rank > ranks) |
Returns a vector of connected ranks. | |
CommunicationMap & | getCommunicationMap () |
Returns a mapping from remote local connected ranks to the corresponding vertex IDs. | |
void | addMesh (Mesh &deltaMesh) |
const BoundingBox & | getBoundingBox () const |
Returns the bounding box of the mesh. | |
void | expandBoundingBox (const BoundingBox &bounding_box) |
bool | operator== (const Mesh &other) const |
bool | operator!= (const Mesh &other) const |
const query::Index & | index () const |
Call preprocess() before index() to ensure correct projection handling. | |
query::Index & | index () |
Call preprocess() before index() to ensure correct projection handling. | |
void | preprocess () |
Static Public Attributes | |
static constexpr MeshID | MESH_ID_UNDEFINED {-1} |
Use if the id of the mesh is not necessary. | |
Private Member Functions | |
void | removeDuplicates () |
Removes all duplicate connectivity. | |
void | generateImplictPrimitives () |
Private Attributes | |
logging::Logger | _log {"mesh::Mesh"} |
std::string | _name |
Name of the mesh. | |
int | _dimensions |
Dimension of mesh. | |
MeshID | _id |
The ID of this mesh. | |
VertexContainer | _vertices |
Holds vertices, edges, triangles and tetrahedra. | |
EdgeContainer | _edges |
TriangleContainer | _triangles |
TetraContainer | _tetrahedra |
DataContainer | _data |
Data hold by the vertices of the mesh. | |
VertexDistribution | _vertexDistribution |
Vertex distribution for the primary rank, holding for each secondary rank all vertex IDs it owns. | |
VertexOffsets | _vertexOffsets |
Holds the index of the last vertex for each rank. | |
int | _globalNumberOfVertices = -1 |
Number of unique vertices for complete distributed mesh. | |
std::vector< Rank > | _connectedRanks |
each rank stores list of connected remote ranks. In the m2n package, this is used to create the initial communication channels. | |
CommunicationMap | _communicationMap |
each rank stores list of connected ranks and corresponding vertex IDs here. In the m2n package, this is used to create the final communication channels. | |
BoundingBox | _boundingBox |
query::Index | _index |
Container and creator for meshes.
A Mesh can consist of Vertices, Edges, Triangles, and nested Meshes. It provides functionality to conveniently create those objects.
In addition to creating the topological information of a mesh, the Mesh class can also be used to add data to the vertices of a mesh, such as function values or also gradient values.
Usage example: precice::mesh::tests::MeshTest::testDemonstration()
using precice::mesh::Mesh::BoundingBoxMap = std::map<int, BoundingBox> |
using precice::mesh::Mesh::VertexOffsets = std::vector<int> |
precice::mesh::Mesh::Mesh | ( | std::string | name, |
int | dimensions, | ||
MeshID | id ) |
void precice::mesh::Mesh::addMesh | ( | Mesh & | deltaMesh | ) |
void precice::mesh::Mesh::allocateDataValues | ( | ) |
std::vector< std::string > precice::mesh::Mesh::availableData | ( | ) | const |
void precice::mesh::Mesh::clear | ( | ) |
void precice::mesh::Mesh::clearPartitioning | ( | ) |
void precice::mesh::Mesh::computeBoundingBox | ( | ) |
PtrData & precice::mesh::Mesh::createData | ( | const std::string & | name, |
int | dimension, | ||
DataID | id, | ||
int | waveformDegree = time::Time::DEFAULT_WAVEFORM_DEGREE ) |
Tetrahedron & precice::mesh::Mesh::createTetrahedron | ( | Vertex & | vertexOne, |
Vertex & | vertexTwo, | ||
Vertex & | vertexThree, | ||
Vertex & | vertexFour ) |
Creates and initializes a Tetrahedron object.
[in] | vertexOne | Reference to first vertex defining the Tetrahedron. |
[in] | vertexTwo | Reference to second vertex defining the Tetrahedron. |
[in] | vertexThree | Reference to third vertex defining the Tetrahedron. |
[in] | vertexFour | Reference to fourth vertex defining the Tetrahedron. |
Definition at line 141 of file Mesh.cpp.
Creates and initializes a Triangle object.
[in] | edgeOne | Reference to first edge defining the Triangle. |
[in] | edgeTwo | Reference to second edge defining the Triangle. |
[in] | edgeThree | Reference to third edge defining the Triangle. |
Definition at line 119 of file Mesh.cpp.
Triangle & precice::mesh::Mesh::createTriangle | ( | Vertex & | vertexOne, |
Vertex & | vertexTwo, | ||
Vertex & | vertexThree ) |
Creates and initializes a Triangle object.
[in] | vertexOne | Reference to first edge defining the Triangle. |
[in] | vertexTwo | Reference to second edge defining the Triangle. |
[in] | vertexThree | Reference to third edge defining the Triangle. |
Definition at line 132 of file Mesh.cpp.
Vertex & precice::mesh::Mesh::createVertex | ( | const Eigen::VectorXd & | coords | ) |
const Mesh::DataContainer & precice::mesh::Mesh::data | ( | ) | const |
const PtrData & precice::mesh::Mesh::data | ( | std::string_view | dataName | ) | const |
Mesh::EdgeContainer & precice::mesh::Mesh::edges | ( | ) |
const Mesh::EdgeContainer & precice::mesh::Mesh::edges | ( | ) | const |
|
inline |
void precice::mesh::Mesh::expandBoundingBox | ( | const BoundingBox & | bounding_box | ) |
|
private |
Generates implicit primitives for correct projection handling
removeDuplicates() should be called first to avoid unnecessary filtering.
Definition at line 432 of file Mesh.cpp.
const BoundingBox & precice::mesh::Mesh::getBoundingBox | ( | ) | const |
Returns the bounding box of the mesh.
BoundingBox is a vector of pairs (min, max), one pair for each dimension. Note that the bounding box does not necessarily need to match the bounding box of the contained vertices of the mesh. Examples are the direct mesh access or a computation of the bounding box before applying additional filtering during the repartitioning. Note that mesh::clear doesn't clear the underlying bounding box (which is potentially a user input when using and defining direct mesh access)
|
inline |
|
inline |
|
inline |
MeshID precice::mesh::Mesh::getID | ( | ) | const |
const std::string & precice::mesh::Mesh::getName | ( | ) | const |
Eigen::VectorXd precice::mesh::Mesh::getOwnedVertexData | ( | const Eigen::VectorXd & | values | ) |
|
inline |
|
inline |
|
inline |
bool precice::mesh::Mesh::hasDataID | ( | DataID | dataID | ) | const |
bool precice::mesh::Mesh::hasDataName | ( | std::string_view | dataName | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
Call preprocess() before index() to ensure correct projection handling.
|
inline |
Call preprocess() before index() to ensure correct projection handling.
bool precice::mesh::Mesh::isValidVertexID | ( | VertexID | vertexID | ) | const |
std::size_t precice::mesh::Mesh::nVertices | ( | ) | const |
bool precice::mesh::Mesh::operator!= | ( | const Mesh & | other | ) | const |
bool precice::mesh::Mesh::operator== | ( | const Mesh & | other | ) | const |
void precice::mesh::Mesh::preprocess | ( | ) |
|
private |
|
inline |
|
inline |
|
inline |
|
inline |
void precice::mesh::Mesh::tagAll | ( | ) |
Mesh::TetraContainer & precice::mesh::Mesh::tetrahedra | ( | ) |
const Mesh::TetraContainer & precice::mesh::Mesh::tetrahedra | ( | ) | const |
Mesh::TriangleContainer & precice::mesh::Mesh::triangles | ( | ) |
const Mesh::TriangleContainer & precice::mesh::Mesh::triangles | ( | ) | const |
Mesh::VertexContainer & precice::mesh::Mesh::vertices | ( | ) |
const Mesh::VertexContainer & precice::mesh::Mesh::vertices | ( | ) | const |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
mutableprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticconstexpr |