7#include "precice/impl/versions.hpp"
17 auto trim_pos = s.find(
'\0');
18 if (trim_pos != s.npos) {
19 s.remove_suffix(s.size() - trim_pos);
28 int solverProcessIndex,
29 int solverProcessSize)
30 : _impl(new impl::ParticipantImpl(toSV(participantName), toSV(configurationFileName), solverProcessIndex, solverProcessSize,
std::nullopt))
37 int solverProcessIndex,
38 int solverProcessSize,
40 : _impl(new impl::ParticipantImpl(toSV(participantName), toSV(configurationFileName), solverProcessIndex, solverProcessSize, {communicator}))
52 double computedTimeStepSize)
54 _impl->advance(computedTimeStepSize);
59 return _impl->finalize();
64 return _impl->getMeshDimensions(toSV(meshName));
69 return _impl->getDataDimensions(toSV(meshName), toSV(dataName));
74 return _impl->isCouplingOngoing();
79 return _impl->isTimeWindowComplete();
84 return _impl->getMaxTimeStepSize();
89 return _impl->requiresInitialData();
94 return _impl->requiresReadingCheckpoint();
99 return _impl->requiresWritingCheckpoint();
104 return _impl->requiresMeshConnectivityFor(toSV(meshName));
110 return _impl->requiresGradientDataFor(toSV(meshName), toSV(dataName));
117 return _impl->setMeshVertex(toSV(meshName), coordinates);
123 return _impl->getMeshVertexSize(toSV(meshName));
131 _impl->setMeshVertices(toSV(meshName), coordinates, ids);
139 _impl->setMeshEdge(toSV(meshName), first, second);
146 _impl->setMeshEdges(toSV(meshName), ids);
155 _impl->setMeshTriangle(toSV(meshName), first, second, third);
162 _impl->setMeshTriangles(toSV(meshName), ids);
172 _impl->setMeshQuad(toSV(meshName), first, second, third, fourth);
179 _impl->setMeshQuads(toSV(meshName), ids);
189 _impl->setMeshTetrahedron(toSV(meshName), first, second, third, fourth);
196 _impl->setMeshTetrahedra(toSV(meshName), ids);
205 _impl->writeData(toSV(meshName), toSV(dataName), ids, values);
212 double relativeReadTime,
215 _impl->readData(toSV(meshName), toSV(dataName), ids, relativeReadTime, values);
221 _impl->setMeshAccessRegion(toSV(meshName), boundingBox);
228 _impl->getMeshVertexIDsAndCoordinates(toSV(meshName), ids, coordinates);
237 _impl->writeGradientData(toSV(meshName), toSV(dataName), ids, gradients);
int getMeshVertexSize(::precice::string_view meshName) const
Returns the number of vertices of a mesh.
void setMeshAccessRegion(::precice::string_view meshName, ::precice::span< const double > boundingBox) const
setMeshAccessRegion Define a region of interest on a received mesh (<receive-mesh ....
void setMeshQuads(::precice::string_view meshName, ::precice::span< const VertexID > ids)
Sets multiple mesh quads from vertex IDs.
int getDataDimensions(::precice::string_view meshName, ::precice::string_view dataName) const
Returns the spatial dimensionality of the given data on the given mesh.
Participant(::precice::string_view participantName, ::precice::string_view configurationFileName, int solverProcessIndex, int solverProcessSize)
Constructs a Participant for the given participant.
bool isCouplingOngoing() const
Checks if the coupled simulation is still ongoing.
bool requiresInitialData()
void getMeshVertexIDsAndCoordinates(::precice::string_view meshName, ::precice::span< VertexID > ids, ::precice::span< double > coordinates) const
getMeshVertexIDsAndCoordinates Iterates over the region of interest defined by bounding boxes and rea...
VertexID setMeshVertex(::precice::string_view meshName, ::precice::span< const double > position)
Creates a mesh vertex.
void finalize()
Finalizes preCICE.
void setMeshTetrahedra(::precice::string_view meshName, ::precice::span< const VertexID > ids)
Sets multiple mesh tetrahedra from vertex IDs.
bool requiresWritingCheckpoint()
void initialize()
Fully initializes preCICE and coupling data.
void writeData(::precice::string_view meshName, ::precice::string_view dataName, ::precice::span< const VertexID > ids, ::precice::span< const double > values)
Writes data to a mesh.
bool requiresReadingCheckpoint()
void setMeshTriangle(::precice::string_view meshName, VertexID first, VertexID second, VertexID third)
Sets mesh triangle from vertex IDs.
std::unique_ptr< impl::ParticipantImpl > _impl
Pointer to implementation of Participant.
void setMeshVertices(::precice::string_view meshName, ::precice::span< const double > coordinates, ::precice::span< VertexID > ids)
Creates multiple mesh vertices.
void writeGradientData(::precice::string_view meshName, ::precice::string_view dataName, ::precice::span< const VertexID > ids, ::precice::span< const double > gradients)
Writes vector gradient data to a mesh.
double getMaxTimeStepSize() const
Get the maximum allowed time step size of the current window.
bool requiresGradientDataFor(::precice::string_view meshName, ::precice::string_view dataName) const
Checks if the given data set requires gradient data. We check if the data object has been initialized...
bool requiresMeshConnectivityFor(::precice::string_view meshName) const
Checks if the given mesh requires connectivity.
void advance(double computedTimeStepSize)
Advances preCICE after the solver has computed one time step.
int getMeshDimensions(::precice::string_view meshName) const
Returns the spatial dimensionality of the given mesh.
void setMeshTriangles(::precice::string_view meshName, ::precice::span< const VertexID > ids)
Sets multiple mesh triangles from vertex IDs.
void setMeshEdges(::precice::string_view meshName, ::precice::span< const VertexID > ids)
Sets multiple mesh edges from vertex IDs.
void readData(::precice::string_view meshName, ::precice::string_view dataName, ::precice::span< const VertexID > ids, double relativeReadTime, ::precice::span< double > values) const
Reads data values from a mesh. Values correspond to a given point in time relative to the beginning o...
void setMeshEdge(::precice::string_view meshName, VertexID first, VertexID second)
Sets a mesh edge from vertex IDs.
bool isTimeWindowComplete() const
Checks if the current coupling window is completed.
void setMeshTetrahedron(::precice::string_view meshName, VertexID first, VertexID second, VertexID third, VertexID fourth)
Set tetrahedron in 3D mesh from vertex ID.
void setMeshQuad(::precice::string_view meshName, VertexID first, VertexID second, VertexID third, VertexID fourth)
Sets a planar surface mesh quadrangle from vertex IDs.
A C++ 11 implementation of the non-owning C++20 std::span type.
constexpr pointer data() const noexcept
constexpr size_type size() const noexcept
Main namespace of the precice library.