preCICE v3.1.1
Loading...
Searching...
No Matches
MeshConfiguration.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4#include <map>
5#include <memory>
6#include <string>
7#include <utility>
8#include <vector>
9#include "logging/Logger.hpp"
10#include "mesh/Data.hpp"
13#include "xml/XMLTag.hpp"
14
15namespace precice {
16namespace mesh {
17class DataConfiguration;
18}
19} // namespace precice
20
21// ----------------------------------------------------------- CLASS DEFINITION
22
23namespace precice {
24namespace mesh {
25
27public:
30 xml::XMLTag & parent,
32
34 const std::vector<PtrMesh> &meshes() const;
35
38
40 bool hasMeshName(const std::string &meshName) const;
41
43 mesh::PtrMesh getMesh(const std::string &meshName) const;
44
45 virtual void xmlTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag);
46
47 virtual void xmlEndTagCallback(
48 const xml::ConfigurationContext &context,
49 xml::XMLTag & callingTag);
50
52
53 void addMesh(const mesh::PtrMesh &mesh);
54
59
60 void addNeededMesh(
61 const std::string &participant,
62 const std::string &mesh);
63
68
71 int dimensions);
72
73private:
74 logging::Logger _log{"mesh::MeshConfiguration"};
75
81
83
86
88 int getDataDimensions(const std::string &meshName, const Data::typeName typeName) const;
89
92
95
97
99};
100
101} // namespace mesh
102} // namespace precice
This class provides a lightweight logger.
Definition Logger.hpp:16
std::map< std::string, std::vector< std::string > > _neededMeshes
to check later if all meshes that any coupling scheme needs are actually used by the participants
std::vector< PtrMesh > _meshes
Configured meshes.
void addNeededMesh(const std::string &participant, const std::string &mesh)
void addMesh(const mesh::PtrMesh &mesh)
mesh::PtrMesh getMesh(const std::string &meshName) const
Returns the configured mesh with given name, or NULL.
std::unique_ptr< utils::ManageUniqueIDs > _meshIdManager
std::unique_ptr< utils::ManageUniqueIDs > extractMeshIdManager()
MeshConfiguration(xml::XMLTag &parent, PtrDataConfiguration config)
Constructor, takes a valid data configuration as argument.
const PtrDataConfiguration & getDataConfiguration() const
virtual void xmlTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag)
Callback at begin of XML tag.
utils::ManageUniqueIDs _dataIDManager
bool hasMeshName(const std::string &meshName) const
Returns whether Mesh has Data with the dataName.
virtual void xmlEndTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag)
Callback at end of XML tag and at end of subtag.
std::map< std::string, int > _meshDimensionsMap
int getDataDimensions(const std::string &meshName, const Data::typeName typeName) const
Get the number of dimensions that data values of this type (scalar/vector) have on this mesh.
PtrDataConfiguration _dataConfig
Data configuration.
void insertMeshToMeshDimensionsMap(const std::string &mesh, int dimensions)
Initialize the map between meshes and dimensions, for unit tests that directly create mesh objects wi...
std::map< std::string, std::vector< std::string > > & getNeededMeshes()
const std::vector< PtrMesh > & meshes() const
Returns all configured meshes.
Manages a set of unique IDs.
Represents an XML tag to be configured automatically.
Definition XMLTag.hpp:31
Main namespace of the precice library.
Tightly coupled to the parameters of Participant()
Definition XMLTag.hpp:24
Callback interface for configuration classes using XMLTag.
Definition XMLTag.hpp:43