preCICE
|
Main Application Programming Interface of preCICE. More...
#include <SolverInterface.hpp>
Public Member Functions | |
SolverInterface (const SolverInterface ©)=delete | |
Disable copy construction. More... | |
SolverInterface & | operator= (const SolverInterface &assign)=delete |
Disable assignment construction. More... | |
Construction and Configuration | |
SolverInterface (const std::string &participantName, const std::string &configurationFileName, int solverProcessIndex, int solverProcessSize) | |
Constructs a SolverInterface for the given participant. More... | |
SolverInterface (const std::string &participantName, const std::string &configurationFileName, int solverProcessIndex, int solverProcessSize, void *communicator) | |
Constructs a SolverInterface for the given participant and a custom MPI communicator. More... | |
~SolverInterface () | |
Steering Methods | |
double | initialize () |
Fully initializes preCICE. More... | |
void | initializeData () |
Initializes coupling data. More... | |
double | advance (double computedTimestepLength) |
Advances preCICE after the solver has computed one timestep. More... | |
void | finalize () |
Finalizes preCICE. More... | |
Status Queries | |
int | getDimensions () const |
Returns the number of spatial dimensions configured. More... | |
bool | isCouplingOngoing () const |
Checks if the coupled simulation is still ongoing. More... | |
bool | isReadDataAvailable () const |
Checks if new data to be read is available. More... | |
bool | isWriteDataRequired (double computedTimestepLength) const |
Checks if new data has to be written before calling advance(). More... | |
bool | isTimeWindowComplete () const |
Checks if the current coupling window is completed. More... | |
bool | hasToEvaluateSurrogateModel () const |
Returns whether the solver has to evaluate the surrogate model representation. More... | |
bool | hasToEvaluateFineModel () const |
Checks if the solver has to evaluate the fine model representation. More... | |
Action Methods | |
bool | isActionRequired (const std::string &action) const |
Checks if the provided action is required. More... | |
void | markActionFulfilled (const std::string &action) |
Indicates preCICE that a required action has been fulfilled by a solver. More... | |
Mesh Access | |
bool | hasMesh (const std::string &meshName) const |
Checks if the mesh with given name is used by a solver. More... | |
int | getMeshID (const std::string &meshName) const |
Returns the ID belonging to the mesh with given name. More... | |
std::set< int > | getMeshIDs () const |
Returns a id-set of all used meshes by this participant. More... | |
bool | isMeshConnectivityRequired (int meshID) const |
Checks if the given mesh requires connectivity. More... | |
int | setMeshVertex (int meshID, const double *position) |
Creates a mesh vertex. More... | |
int | getMeshVertexSize (int meshID) const |
Returns the number of vertices of a mesh. More... | |
void | setMeshVertices (int meshID, int size, const double *positions, int *ids) |
Creates multiple mesh vertices. More... | |
void | getMeshVertices (int meshID, int size, const int *ids, double *positions) const |
Get vertex positions for multiple vertex ids from a given mesh. More... | |
void | getMeshVertexIDsFromPositions (int meshID, int size, const double *positions, int *ids) const |
Gets mesh vertex IDs from positions. More... | |
int | setMeshEdge (int meshID, int firstVertexID, int secondVertexID) |
Sets mesh edge from vertex IDs, returns edge ID. More... | |
void | setMeshTriangle (int meshID, int firstEdgeID, int secondEdgeID, int thirdEdgeID) |
Sets mesh triangle from edge IDs. More... | |
void | setMeshTriangleWithEdges (int meshID, int firstVertexID, int secondVertexID, int thirdVertexID) |
Sets mesh triangle from vertex IDs. More... | |
void | setMeshQuad (int meshID, int firstEdgeID, int secondEdgeID, int thirdEdgeID, int fourthEdgeID) |
Sets mesh Quad from edge IDs. More... | |
void | setMeshQuadWithEdges (int meshID, int firstVertexID, int secondVertexID, int thirdVertexID, int fourthVertexID) |
Sets surface mesh quadrangle from vertex IDs. More... | |
void | setMeshTetrahedron (int meshID, int firstVertexID, int secondVertexID, int thirdVertexID, int fourthVertexID) |
Set tetrahedron in 3D mesh from vertex ID. More... | |
Data Access | |
bool | hasData (const std::string &dataName, int meshID) const |
Checks if the data with given name is used by a solver and mesh. More... | |
int | getDataID (const std::string &dataName, int meshID) const |
Returns the ID of the data associated with the given name and mesh. More... | |
void | mapReadDataTo (int toMeshID) |
Computes and maps all read data mapped to the mesh with given ID. More... | |
void | mapWriteDataFrom (int fromMeshID) |
Computes and maps all write data mapped from the mesh with given ID. More... | |
void | writeBlockVectorData (int dataID, int size, const int *valueIndices, const double *values) |
Writes vector data given as block. More... | |
void | writeVectorData (int dataID, int valueIndex, const double *value) |
Writes vector data to a vertex. More... | |
void | writeBlockScalarData (int dataID, int size, const int *valueIndices, const double *values) |
Writes scalar data given as block. More... | |
void | writeScalarData (int dataID, int valueIndex, double value) |
Writes scalar data to a vertex. More... | |
void | readBlockVectorData (int dataID, int size, const int *valueIndices, double *values) const |
Reads vector data values given as block from a mesh. Values correspond to the end of the current time window. More... | |
void | readVectorData (int dataID, int valueIndex, double *value) const |
Reads vector data at a vertex on a mesh. Values correspond to the end of the current time window. More... | |
void | readBlockScalarData (int dataID, int size, const int *valueIndices, double *values) const |
Reads scalar data values given as block from a mesh. Values correspond to the end of the current time window. More... | |
void | readScalarData (int dataID, int valueIndex, double &value) const |
Reads scalar data at a vertex on a mesh. Values correspond to the end of the current time window. More... | |
Experimental: Direct Access | |
These API functions are experimental and may change in future versions. | |
void | setMeshAccessRegion (const int meshID, const double *boundingBox) const |
setMeshAccessRegion Define a region of interest on a received mesh (<use-mesh ... from="otherParticipant />") in order to receive only a certain mesh region. Have a look at the website under https://precice.org/couple-your-code-direct-access.html or navigate manually to the page Docs->Couple your code -> Advanced topics -> Accessing received meshes directly for a comprehensive documentation More... | |
void | getMeshVerticesAndIDs (const int meshID, const int size, int *ids, double *coordinates) const |
getMeshVerticesAndIDs Iterates over the region of interest defined by bounding boxes and reads the corresponding coordinates omitting the mapping. More... | |
Experimental: Time Interpolation | |
These API functions are experimental and may change in future versions. | |
void | readBlockVectorData (int dataID, int size, const int *valueIndices, double relativeReadTime, double *values) const |
Reads vector data values given as block from a mesh. Values correspond to a given point in time relative to the beginning of the current timestep. More... | |
void | readVectorData (int dataID, int valueIndex, double relativeReadTime, double *value) const |
Reads vector data at a vertex on a mesh. Values correspond to a given point in time relative to the beginning of the current timestep. More... | |
void | readBlockScalarData (int dataID, int size, const int *valueIndices, double relativeReadTime, double *values) const |
Reads scalar data values given as block from a mesh. Values correspond to a given point in time relative to the beginning of the current timestep. More... | |
void | readScalarData (int dataID, int valueIndex, double relativeReadTime, double &value) const |
Reads scalar data at a vertex on a mesh. Values correspond to a given point in time relative to the beginning of the current timestep. More... | |
Experimental: Gradient Data | |
These API functions are experimental and may change in future versions. | |
bool | isGradientDataRequired (int dataID) const |
Checks if the given data set requires gradient data. We check if the data object has been initialized with the gradient flag. More... | |
void | writeBlockVectorGradientData (int dataID, int size, const int *valueIndices, const double *gradientValues) |
Writes vector gradient data given as block. More... | |
void | writeScalarGradientData (int dataID, int valueIndex, const double *gradientValues) |
Writes scalar gradient data to a vertex. More... | |
void | writeVectorGradientData (int dataID, int valueIndex, const double *gradientValues) |
Writes vector gradient data to a vertex. More... | |
void | writeBlockScalarGradientData (int dataID, int size, const int *valueIndices, const double *gradientValues) |
Writes scalar gradient data given as block. More... | |
Private Attributes | |
std::unique_ptr< impl::SolverInterfaceImpl > | _impl |
Pointer to implementation of SolverInterface. More... | |
Friends | |
struct | testing::WhiteboxAccessor |
Main Application Programming Interface of preCICE.
To adapt a solver to preCICE, follow the following main structure:
Finalize preCICE with SolverInterface::finalize()
Definition at line 39 of file SolverInterface.hpp.
precice::SolverInterface::SolverInterface | ( | const std::string & | participantName, |
const std::string & | configurationFileName, | ||
int | solverProcessIndex, | ||
int | solverProcessSize | ||
) |
Constructs a SolverInterface for the given participant.
[in] | participantName | Name of the participant using the interface. Has to match the name given for a participant in the xml configuration file. |
[in] | configurationFileName | Name (with path) of the xml configuration file. |
[in] | solverProcessIndex | If the solver code runs with several processes, each process using preCICE has to specify its index, which has to start from 0 and end with solverProcessSize - 1. |
[in] | solverProcessSize | The number of solver processes using preCICE. |
Definition at line 8 of file SolverInterface.cpp.
precice::SolverInterface::SolverInterface | ( | const std::string & | participantName, |
const std::string & | configurationFileName, | ||
int | solverProcessIndex, | ||
int | solverProcessSize, | ||
void * | communicator | ||
) |
Constructs a SolverInterface for the given participant and a custom MPI communicator.
[in] | participantName | Name of the participant using the interface. Has to match the name given for a participant in the xml configuration file. |
[in] | configurationFileName | Name (with path) of the xml configuration file. |
[in] | solverProcessIndex | If the solver code runs with several processes, each process using preCICE has to specify its index, which has to start from 0 and end with solverProcessSize - 1. |
[in] | solverProcessSize | The number of solver processes using preCICE. |
[in] | communicator | A pointer to an MPI_Comm to use as communicator. |
Definition at line 17 of file SolverInterface.cpp.
|
default |
|
delete |
Disable copy construction.
double precice::SolverInterface::advance | ( | double | computedTimestepLength | ) |
Advances preCICE after the solver has computed one timestep.
[in] | computedTimestepLength | Length of timestep used by the solver. |
Definition at line 39 of file SolverInterface.cpp.
void precice::SolverInterface::finalize | ( | ) |
Finalizes preCICE.
If initialize() has been called:
Always:
Definition at line 45 of file SolverInterface.cpp.
int precice::SolverInterface::getDataID | ( | const std::string & | dataName, |
int | meshID | ||
) | const |
Returns the ID of the data associated with the given name and mesh.
[in] | dataName | the name of the data |
[in] | meshID | the id of the associated mesh |
Definition at line 121 of file SolverInterface.cpp.
int precice::SolverInterface::getDimensions | ( | ) | const |
Returns the number of spatial dimensions configured.
Currently, two and three dimensional problems can be solved using preCICE. The dimension is specified in the XML configuration.
Definition at line 50 of file SolverInterface.cpp.
int precice::SolverInterface::getMeshID | ( | const std::string & | meshName | ) | const |
Returns the ID belonging to the mesh with given name.
The existing names are determined from the configuration.
[in] | meshName | the name of the mesh |
Definition at line 94 of file SolverInterface.cpp.
std::set< int > precice::SolverInterface::getMeshIDs | ( | ) | const |
Returns a id-set of all used meshes by this participant.
Definition at line 100 of file SolverInterface.cpp.
void precice::SolverInterface::getMeshVertexIDsFromPositions | ( | int | meshID, |
int | size, | ||
const double * | positions, | ||
int * | ids | ||
) | const |
Gets mesh vertex IDs from positions.
[in] | meshID | ID of the mesh to retrieve positions from |
[in] | size | Number of vertices to lookup. |
[in] | positions | Positions to find ids for. The 2D-format is (d0x, d0y, d1x, d1y, ..., dnx, dny) The 3D-format is (d0x, d0y, d0z, d1x, d1y, d1z, ..., dnx, dny, dnz) |
[out] | ids | IDs corresponding to positions. |
Definition at line 175 of file SolverInterface.cpp.
int precice::SolverInterface::getMeshVertexSize | ( | int | meshID | ) | const |
Returns the number of vertices of a mesh.
[in] | meshID | the id of the mesh |
initialize()
, if the meshID
corresponds to a received mesh, since the relevant mesh data is exchanged during the initialize()
call. Definition at line 151 of file SolverInterface.cpp.
void precice::SolverInterface::getMeshVertices | ( | int | meshID, |
int | size, | ||
const int * | ids, | ||
double * | positions | ||
) | const |
Get vertex positions for multiple vertex ids from a given mesh.
[in] | meshID | the id of the mesh to read the vertices from. |
[in] | size | Number of vertices to lookup |
[in] | ids | The ids of the vertices to lookup |
[out] | positions | a pointer to memory to write the coordinates to The 2D-format is (d0x, d0y, d1x, d1y, ..., dnx, dny) The 3D-format is (d0x, d0y, d0z, d1x, d1y, d1z, ..., dnx, dny, dnz) |
Definition at line 166 of file SolverInterface.cpp.
void precice::SolverInterface::getMeshVerticesAndIDs | ( | const int | meshID, |
const int | size, | ||
int * | ids, | ||
double * | coordinates | ||
) | const |
getMeshVerticesAndIDs Iterates over the region of interest defined by bounding boxes and reads the corresponding coordinates omitting the mapping.
[in] | meshID | corresponding mesh ID |
[in] | size | return value of getMeshVertexSize() |
[out] | ids | ids corresponding to the coordinates |
[out] | coordinates | the coordinates associated to the ids and corresponding data values (dim * size ) |
getMeshVertexSize()
initialize()
, if the meshID
corresponds to a received mesh, since the relevant mesh data is exchanged during the initialize()
call. Definition at line 401 of file SolverInterface.cpp.
bool precice::SolverInterface::hasData | ( | const std::string & | dataName, |
int | meshID | ||
) | const |
Checks if the data with given name is used by a solver and mesh.
[in] | dataName | the name of the data |
[in] | meshID | the id of the associated mesh |
Definition at line 115 of file SolverInterface.cpp.
bool precice::SolverInterface::hasMesh | ( | const std::string & | meshName | ) | const |
Checks if the mesh with given name is used by a solver.
[in] | meshName | the name of the mesh |
Definition at line 88 of file SolverInterface.cpp.
bool precice::SolverInterface::hasToEvaluateFineModel | ( | ) | const |
Checks if the solver has to evaluate the fine model representation.
Definition at line 132 of file SolverInterface.cpp.
bool precice::SolverInterface::hasToEvaluateSurrogateModel | ( | ) | const |
Returns whether the solver has to evaluate the surrogate model representation.
Definition at line 127 of file SolverInterface.cpp.
double precice::SolverInterface::initialize | ( | ) |
Fully initializes preCICE.
Definition at line 29 of file SolverInterface.cpp.
void precice::SolverInterface::initializeData | ( | ) |
Initializes coupling data.
The starting values for coupling data are zero by default.
To provide custom values, first set the data using the Data Access methods and call this method to finally exchange the data.
Definition at line 34 of file SolverInterface.cpp.
bool precice::SolverInterface::isActionRequired | ( | const std::string & | action | ) | const |
Checks if the provided action is required.
[in] | action | the name of the action |
Some features of preCICE require a solver to perform specific actions, in order to be in valid state for a coupled simulation. A solver is made eligible to use those features, by querying for the required actions, performing them on demand, and calling markActionFulfilled() to signalize preCICE the correct behavior of the solver.
Definition at line 76 of file SolverInterface.cpp.
bool precice::SolverInterface::isCouplingOngoing | ( | ) | const |
Checks if the coupled simulation is still ongoing.
A coupling is ongoing as long as
Definition at line 55 of file SolverInterface.cpp.
bool precice::SolverInterface::isGradientDataRequired | ( | int | dataID | ) | const |
Checks if the given data set requires gradient data. We check if the data object has been initialized with the gradient flag.
preCICE may require gradient data information from the solver and ignores any API calls regarding gradient data if it is not required. (When applying a nearest-neighbor-gradient mapping)
[in] | dataID | the id of the data |
Definition at line 110 of file SolverInterface.cpp.
bool precice::SolverInterface::isMeshConnectivityRequired | ( | int | meshID | ) | const |
Checks if the given mesh requires connectivity.
preCICE may require connectivity information from the solver and ignores any API calls regarding connectivity if it is not required. Use this function to conditionally generate this connectivity.
[in] | meshID | the id of the mesh |
Definition at line 105 of file SolverInterface.cpp.
bool precice::SolverInterface::isReadDataAvailable | ( | ) | const |
Checks if new data to be read is available.
Data is classified to be new, if it has been received while calling initialize() and before calling advance(), or in the last call of advance(). This is always true, if a participant does not make use of subcycling, i.e. choosing smaller timesteps than the limits returned in initialize() and advance().
Definition at line 60 of file SolverInterface.cpp.
bool precice::SolverInterface::isTimeWindowComplete | ( | ) | const |
Checks if the current coupling window is completed.
The following reasons require several solver time steps per time window step:
Definition at line 71 of file SolverInterface.cpp.
bool precice::SolverInterface::isWriteDataRequired | ( | double | computedTimestepLength | ) | const |
Checks if new data has to be written before calling advance().
[in] | computedTimestepLength | Length of timestep used by the solver. |
This is always true, if a participant does not make use of subcycling, i.e. choosing smaller timesteps than the limits returned in initialize() and advance().
Definition at line 65 of file SolverInterface.cpp.
void precice::SolverInterface::mapReadDataTo | ( | int | toMeshID | ) |
Computes and maps all read data mapped to the mesh with given ID.
This is an explicit request to map read data to the Mesh associated with toMeshID. It also computes the mapping if necessary.
Definition at line 242 of file SolverInterface.cpp.
void precice::SolverInterface::mapWriteDataFrom | ( | int | fromMeshID | ) |
Computes and maps all write data mapped from the mesh with given ID.
This is an explicit request to map write data from the Mesh associated with fromMeshID. It also computes the mapping if necessary.
Definition at line 248 of file SolverInterface.cpp.
void precice::SolverInterface::markActionFulfilled | ( | const std::string & | action | ) |
Indicates preCICE that a required action has been fulfilled by a solver.
[in] | action | the name of the action |
Definition at line 82 of file SolverInterface.cpp.
|
delete |
Disable assignment construction.
void precice::SolverInterface::readBlockScalarData | ( | int | dataID, |
int | size, | ||
const int * | valueIndices, | ||
double * | values | ||
) | const |
Reads scalar data values given as block from a mesh. Values correspond to the end of the current time window.
This function reads values of specified vertices from a dataID. Values are provided as a block of continuous memory. valueIndices contains the indices of the vertices.
[in] | dataID | ID to read from. |
[in] | size | Number n of vertices. |
[in] | valueIndices | Indices of the vertices. |
[out] | values | Pointer to the read destination. |
Definition at line 359 of file SolverInterface.cpp.
void precice::SolverInterface::readBlockScalarData | ( | int | dataID, |
int | size, | ||
const int * | valueIndices, | ||
double | relativeReadTime, | ||
double * | values | ||
) | const |
Reads scalar data values given as block from a mesh. Values correspond to a given point in time relative to the beginning of the current timestep.
This function reads values of specified vertices from a dataID. Values are provided as a block of continuous memory. valueIndices contains the indices of the vertices.
The data is read at relativeReadTime, which indicates the point in time measured from the beginning of the current time step. relativeReadTime = 0 corresponds to data at the beginning of the time step. Assuming that the user will call advance(dt) at the end of the time step, dt indicates the length of the current time step. Then relativeReadTime = dt corresponds to the data at the end of the time step.
[in] | dataID | ID to read from. |
[in] | size | Number n of vertices. |
[in] | valueIndices | Indices of the vertices. |
[in] | relativeReadTime | Point in time where data is read relative to the beginning of the current time step. |
[out] | values | Pointer to the read destination. |
Definition at line 368 of file SolverInterface.cpp.
void precice::SolverInterface::readBlockVectorData | ( | int | dataID, |
int | size, | ||
const int * | valueIndices, | ||
double * | values | ||
) | const |
Reads vector data values given as block from a mesh. Values correspond to the end of the current time window.
This function reads values of specified vertices from a dataID. Values are read into a block of continuous memory. valueIndices contains the indices of the vertices.
The 2D-format of values is (d0x, d0y, d1x, d1y, ..., dnx, dny) The 3D-format of values is (d0x, d0y, d0z, d1x, d1y, d1z, ..., dnx, dny, dnz)
[in] | dataID | ID to read from. |
[in] | size | Number n of vertices. |
[in] | valueIndices | Indices of the vertices. |
[out] | values | Pointer to read destination. |
Definition at line 322 of file SolverInterface.cpp.
void precice::SolverInterface::readBlockVectorData | ( | int | dataID, |
int | size, | ||
const int * | valueIndices, | ||
double | relativeReadTime, | ||
double * | values | ||
) | const |
Reads vector data values given as block from a mesh. Values correspond to a given point in time relative to the beginning of the current timestep.
This function reads values of specified vertices from a dataID. Values are read into a block of continuous memory. valueIndices contains the indices of the vertices.
The 2D-format of values is (d0x, d0y, d1x, d1y, ..., dnx, dny) The 3D-format of values is (d0x, d0y, d0z, d1x, d1y, d1z, ..., dnx, dny, dnz)
The data is read at relativeReadTime, which indicates the point in time measured from the beginning of the current time step. relativeReadTime = 0 corresponds to data at the beginning of the time step. Assuming that the user will call advance(dt) at the end of the time step, dt indicates the length of the current time step. Then relativeReadTime = dt corresponds to the data at the end of the time step.
[in] | dataID | ID to read from. |
[in] | size | Number n of vertices. |
[in] | valueIndices | Indices of the vertices. |
[in] | relativeReadTime | Point in time where data is read relative to the beginning of the current time step. |
[out] | values | Pointer to read destination. |
Definition at line 331 of file SolverInterface.cpp.
void precice::SolverInterface::readScalarData | ( | int | dataID, |
int | valueIndex, | ||
double & | value | ||
) | const |
Reads scalar data at a vertex on a mesh. Values correspond to the end of the current time window.
This function reads a value of a specified vertex from a dataID.
[in] | dataID | ID to read from. |
[in] | valueIndex | Index of the vertex. |
[out] | value | Read destination of the value. |
Definition at line 378 of file SolverInterface.cpp.
void precice::SolverInterface::readScalarData | ( | int | dataID, |
int | valueIndex, | ||
double | relativeReadTime, | ||
double & | value | ||
) | const |
Reads scalar data at a vertex on a mesh. Values correspond to a given point in time relative to the beginning of the current timestep.
This function reads a value of a specified vertex from a dataID.
The data is read at relativeReadTime, which indicates the point in time measured from the beginning of the current time step. relativeReadTime = 0 corresponds to data at the beginning of the time step. Assuming that the user will call advance(dt) at the end of the time step, dt indicates the length of the current time step. Then relativeReadTime = dt corresponds to the data at the end of the time step.
[in] | dataID | ID to read from. |
[in] | valueIndex | Index of the vertex. |
[in] | relativeReadTime | Point in time where data is read relative to the beginning of the current time step |
[out] | value | Read destination of the value. |
Definition at line 386 of file SolverInterface.cpp.
void precice::SolverInterface::readVectorData | ( | int | dataID, |
int | valueIndex, | ||
double * | value | ||
) | const |
Reads vector data at a vertex on a mesh. Values correspond to the end of the current time window.
This function reads a value of a specified vertex from a dataID. Values are provided as a block of continuous memory.
The 2D-format of value is (x, y) The 3D-format of value is (x, y, z)
[in] | dataID | ID to read from. |
[in] | valueIndex | Index of the vertex. |
[out] | value | Pointer to the vector value. |
Definition at line 341 of file SolverInterface.cpp.
void precice::SolverInterface::readVectorData | ( | int | dataID, |
int | valueIndex, | ||
double | relativeReadTime, | ||
double * | value | ||
) | const |
Reads vector data at a vertex on a mesh. Values correspond to a given point in time relative to the beginning of the current timestep.
This function reads a value of a specified vertex from a dataID. Values are provided as a block of continuous memory.
The 2D-format of value is (x, y) The 3D-format of value is (x, y, z)
The data is read at relativeReadTime, which indicates the point in time measured from the beginning of the current time step. relativeReadTime = 0 corresponds to data at the beginning of the time step. Assuming that the user will call advance(dt) at the end of the time step, dt indicates the length of the current time step. Then relativeReadTime = dt corresponds to the data at the end of the time step.
[in] | dataID | ID to read from. |
[in] | valueIndex | Index of the vertex. |
[in] | relativeReadTime | Point in time where data is read relative to the beginning of the current time step. |
[out] | value | Pointer to the vector value. |
Definition at line 349 of file SolverInterface.cpp.
void precice::SolverInterface::setMeshAccessRegion | ( | const int | meshID, |
const double * | boundingBox | ||
) | const |
setMeshAccessRegion Define a region of interest on a received mesh (<use-mesh ... from="otherParticipant />") in order to receive only a certain mesh region. Have a look at the website under https://precice.org/couple-your-code-direct-access.html or navigate manually to the page Docs->Couple your code -> Advanced topics -> Accessing received meshes directly for a comprehensive documentation
This function is required if you don't want to use the mapping schemes in preCICE, but rather want to use your own solver for data mapping. As opposed to the usual preCICE mapping, only a single mesh (from the other participant) is now involved in this situation since an 'own' mesh defined by the participant itself is not required any more. In order to re-partition the received mesh, the participant needs to define the mesh region it wants read data from and write data to. The mesh region is specified through an axis-aligned bounding box given by the lower and upper [min and max] bounding-box limits in each space dimension [x, y, z].
[in] | meshID | ID of the mesh you want to access through the bounding box |
[in] | boundingBox | Axis aligned bounding boxes which has in 3D the format [x_min, x_max, y_min, y_max, z_min, z_max] |
initialize()
has not yet been called. Definition at line 395 of file SolverInterface.cpp.
int precice::SolverInterface::setMeshEdge | ( | int | meshID, |
int | firstVertexID, | ||
int | secondVertexID | ||
) |
Sets mesh edge from vertex IDs, returns edge ID.
[in] | meshID | ID of the mesh to add the edge to |
[in] | firstVertexID | ID of the first vertex of the edge |
[in] | secondVertexID | ID of the second vertex of the edge |
Definition at line 184 of file SolverInterface.cpp.
void precice::SolverInterface::setMeshQuad | ( | int | meshID, |
int | firstEdgeID, | ||
int | secondEdgeID, | ||
int | thirdEdgeID, | ||
int | fourthEdgeID | ||
) |
Sets mesh Quad from edge IDs.
[in] | meshID | ID of the mesh to add the Quad to |
[in] | firstEdgeID | ID of the first edge of the Quad |
[in] | secondEdgeID | ID of the second edge of the Quad |
[in] | thirdEdgeID | ID of the third edge of the Quad |
[in] | fourthEdgeID | ID of the forth edge of the Quad |
Definition at line 210 of file SolverInterface.cpp.
void precice::SolverInterface::setMeshQuadWithEdges | ( | int | meshID, |
int | firstVertexID, | ||
int | secondVertexID, | ||
int | thirdVertexID, | ||
int | fourthVertexID | ||
) |
Sets surface mesh quadrangle from vertex IDs.
[in] | meshID | ID of the mesh to add the Quad to |
[in] | firstVertexID | ID of the first vertex of the Quad |
[in] | secondVertexID | ID of the second vertex of the Quad |
[in] | thirdVertexID | ID of the third vertex of the Quad |
[in] | fourthVertexID | ID of the fourth vertex of the Quad |
Definition at line 220 of file SolverInterface.cpp.
void precice::SolverInterface::setMeshTetrahedron | ( | int | meshID, |
int | firstVertexID, | ||
int | secondVertexID, | ||
int | thirdVertexID, | ||
int | fourthVertexID | ||
) |
Set tetrahedron in 3D mesh from vertex ID.
[in] | meshID | ID of the mesh to add the Tetrahedron to |
[in] | firstVertexID | ID of the first vertex of the Tetrahedron |
[in] | secondVertexID | ID of the second vertex of the Tetrahedron |
[in] | thirdVertexID | ID of the third vertex of the Tetrahedron |
[in] | fourthVertexID | ID of the fourth vertex of the Tetrahedron |
Definition at line 231 of file SolverInterface.cpp.
void precice::SolverInterface::setMeshTriangle | ( | int | meshID, |
int | firstEdgeID, | ||
int | secondEdgeID, | ||
int | thirdEdgeID | ||
) |
Sets mesh triangle from edge IDs.
[in] | meshID | ID of the mesh to add the triangle to |
[in] | firstEdgeID | ID of the first edge of the triangle |
[in] | secondEdgeID | ID of the second edge of the triangle |
[in] | thirdEdgeID | ID of the third edge of the triangle |
Definition at line 192 of file SolverInterface.cpp.
void precice::SolverInterface::setMeshTriangleWithEdges | ( | int | meshID, |
int | firstVertexID, | ||
int | secondVertexID, | ||
int | thirdVertexID | ||
) |
Sets mesh triangle from vertex IDs.
[in] | meshID | ID of the mesh to add the triangle to |
[in] | firstVertexID | ID of the first vertex of the triangle |
[in] | secondVertexID | ID of the second vertex of the triangle |
[in] | thirdVertexID | ID of the third vertex of the triangle |
Definition at line 201 of file SolverInterface.cpp.
int precice::SolverInterface::setMeshVertex | ( | int | meshID, |
const double * | position | ||
) |
Creates a mesh vertex.
[in] | meshID | the id of the mesh to add the vertex to. |
[in] | position | a pointer to the coordinates of the vertex. |
Definition at line 144 of file SolverInterface.cpp.
void precice::SolverInterface::setMeshVertices | ( | int | meshID, |
int | size, | ||
const double * | positions, | ||
int * | ids | ||
) |
Creates multiple mesh vertices.
[in] | meshID | the id of the mesh to add the vertices to. |
[in] | size | Number of vertices to create |
[in] | positions | a pointer to the coordinates of the vertices The 2D-format is (d0x, d0y, d1x, d1y, ..., dnx, dny) The 3D-format is (d0x, d0y, d0z, d1x, d1y, d1z, ..., dnx, dny, dnz) |
[out] | ids | The ids of the created vertices |
Definition at line 157 of file SolverInterface.cpp.
void precice::SolverInterface::writeBlockScalarData | ( | int | dataID, |
int | size, | ||
const int * | valueIndices, | ||
const double * | values | ||
) |
Writes scalar data given as block.
This function writes values of specified vertices to a dataID. Values are provided as a block of continuous memory. valueIndices contains the indices of the vertices
[in] | dataID | ID to write to. |
[in] | size | Number n of vertices. |
[in] | valueIndices | Indices of the vertices. |
[in] | values | Pointer to the values. |
Definition at line 288 of file SolverInterface.cpp.
void precice::SolverInterface::writeBlockScalarGradientData | ( | int | dataID, |
int | size, | ||
const int * | valueIndices, | ||
const double * | gradientValues | ||
) |
Writes scalar gradient data given as block.
This function writes values of specified vertices to a dataID. Values are provided as a block of continuous memory. valueIndices contains the indices of the vertices
The gradients need to be provided in the following format:
The 2D-format of gradientValues
is (v0_dx, v0_dy, v1_dx, v1_dy, ... , vn_dx, vn_dy, vn_dz) corresponding to the scalar data v0, v1, ... , vn differentiated in spatial directions x and y.
The 3D-format of gradientValues
is (v0_dx, v0_dy, v0_dz, v1_dx, v1_dy, v1_dz, ... , vn_dx, vn_dy, vn_dz) corresponding to the scalar data v0, v1, ... , vn differentiated in spatial directions x, y and z.
[in] | dataID | ID to write to. |
[in] | size | Number n of vertices. |
[in] | valueIndices | Indices of the vertices. |
[in] | gradientValues | Pointer to the gradient values. |
Definition at line 297 of file SolverInterface.cpp.
void precice::SolverInterface::writeBlockVectorData | ( | int | dataID, |
int | size, | ||
const int * | valueIndices, | ||
const double * | values | ||
) |
Writes vector data given as block.
This function writes values of specified vertices to a dataID. Values are provided as a block of continuous memory. valueIndices contains the indices of the vertices
The 2D-format of values is (d0x, d0y, d1x, d1y, ..., dnx, dny) The 3D-format of values is (d0x, d0y, d0z, d1x, d1y, d1z, ..., dnx, dny, dnz)
[in] | dataID | ID to write to. |
[in] | size | Number n of vertices. |
[in] | valueIndices | Indices of the vertices. |
[in] | values | Pointer to the vector values. |
Definition at line 254 of file SolverInterface.cpp.
void precice::SolverInterface::writeBlockVectorGradientData | ( | int | dataID, |
int | size, | ||
const int * | valueIndices, | ||
const double * | gradientValues | ||
) |
Writes vector gradient data given as block.
This function writes values of specified vertices to a dataID. Values are provided as a block of continuous memory. valueIndices
contains the indices of the vertices
The values are passed in the same format applied in writeVectorGradientData() for each data vertex:
The 2D-format of gradientValues
is ( v0x_dx, v0y_dx, v0x_dy, v0y_dy, v1x_dx, v1y_dx, v1x_dy, v1y_dy, ... , vnx_dx, vny_dx, vnx_dy, vny_dy)
corresponding to the vector data v0 = (v0x, v0y) , v1 = (v1x, v1y), ... , vn = (vnx, vny) differentiated in spatial directions x and y.
The 3D-format of gradientValues
is ( v0x_dx, v0y_dx, v0z_dx, v0x_dy, v0y_dy, v0z_dy, v0x_dz, v0y_dz, v0z_dz, v1x_dx, v1y_dx, v1z_dx, v1x_dy, v1y_dy, v1z_dy, v1x_dz, v1y_dz, v1z_dz, ... , vnx_dx, vny_dx, vnz_dx, vnx_dy, vny_dy, vnz_dy, vnx_dz, vny_dz, vnz_dz)
corresponding to the vector data v0 = (v0x, v0y, v0z) , v1 = (v1x, v1y, v1z), ... , vn = (vnx, vny, vnz) differentiated in spatial directions x,y and z.
[in] | dataID | ID to write to. |
[in] | size | Number n of vertices. |
[in] | valueIndices | Indices of the vertices. |
[in] | gradientValues | Pointer to the gradient values. |
Definition at line 263 of file SolverInterface.cpp.
void precice::SolverInterface::writeScalarData | ( | int | dataID, |
int | valueIndex, | ||
double | value | ||
) |
Writes scalar data to a vertex.
This function writes a value of a specified vertex to a dataID.
[in] | dataID | ID to write to. |
[in] | valueIndex | Index of the vertex. |
[in] | value | The value to write. |
Definition at line 306 of file SolverInterface.cpp.
void precice::SolverInterface::writeScalarGradientData | ( | int | dataID, |
int | valueIndex, | ||
const double * | gradientValues | ||
) |
Writes scalar gradient data to a vertex.
This function writes a the corresponding gradient value of a specified vertex to a dataID. Values are provided as a block of continuous memory.
[in] | dataID | ID to write to. |
[in] | valueIndex | Index of the vertex. |
[in] | gradientValues | Gradient values differentiated in the spacial direction (dx, dy) for 2D space, (dx, dy, dz) for 3D space |
Definition at line 314 of file SolverInterface.cpp.
void precice::SolverInterface::writeVectorData | ( | int | dataID, |
int | valueIndex, | ||
const double * | value | ||
) |
Writes vector data to a vertex.
This function writes a value of a specified vertex to a dataID. Values are provided as a block of continuous memory.
The 2D-format of value is (x, y) The 3D-format of value is (x, y, z)
[in] | dataID | ID to write to. |
[in] | valueIndex | Index of the vertex. |
[in] | value | Pointer to the vector value. |
Definition at line 272 of file SolverInterface.cpp.
void precice::SolverInterface::writeVectorGradientData | ( | int | dataID, |
int | valueIndex, | ||
const double * | gradientValues | ||
) |
Writes vector gradient data to a vertex.
This function writes the corresponding gradient matrix value of a specified vertex to a dataID. Values are provided as a block of continuous memory.
The gradients need to be provided in the following format:
The 2D-format of gradientValues
is (vx_dx, vy_dx, vx_dy, vy_dy) matrix corresponding to the data block v = (vx, vy) differentiated respectively in x-direction dx and y-direction dy
The 3D-format of gradientValues
is (vx_dx, vy_dx, vz_dx, vx_dy, vy_dy, vz_dy, vx_dz, vy_dz, vz_dz) matrix corresponding to the data block v = (vx, vy, vz) differentiated respectively in spatial directions x-direction dx and y-direction dy and z-direction dz
[in] | dataID | ID to write to. |
[in] | valueIndex | Index of the vertex. |
[in] | gradientValue | pointer to the gradient value. |
Definition at line 280 of file SolverInterface.cpp.
|
friend |
Definition at line 1262 of file SolverInterface.hpp.
|
private |
Pointer to implementation of SolverInterface.
Definition at line 1259 of file SolverInterface.hpp.