preCICE v3.2.0
Loading...
Searching...
No Matches
preciceC.h File Reference

C language bindings to main Application Programming Interface of preCICE. More...

#include <precice/Version.h>
#include <precice/export.h>
Include dependency graph for preciceC.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

PRECICE_API const char * precicec_getVersionInformation ()
 Returns information on the version of preCICE.
Construction and Configuration
PRECICE_API void precicec_createParticipant_withCommunicator (const char *participantName, const char *configFileName, int solverProcessIndex, int solverProcessSize, void *communicator)
PRECICE_API void precicec_createParticipant (const char *participantName, const char *configFileName, int solverProcessIndex, int solverProcessSize)
 Creates the coupling interface and configures it.
Steering Methods
PRECICE_API void precicec_initialize ()
 Initiates the coupling to the coupling supervisor and initializes coupling data.
PRECICE_API void precicec_advance (double computedTimeStepSize)
 Exchanges data between solver and coupling supervisor.
PRECICE_API void precicec_finalize ()
 Finalizes the coupling to the coupling supervisor.
Implicit coupling
PRECICE_API int precicec_requiresWritingCheckpoint ()
PRECICE_API int precicec_requiresReadingCheckpoint ()
Status Queries
PRECICE_API int precicec_getMeshDimensions (const char *meshName)
 Returns the spatial dimensionality of the given mesh.
PRECICE_API int precicec_getDataDimensions (const char *meshName, const char *dataName)
 Returns the spatial dimensionality of the given data on the given mesh.
PRECICE_API int precicec_isCouplingOngoing ()
 Returns true (->1), if the coupled simulation is ongoing.
PRECICE_API int precicec_isTimeWindowComplete ()
 Returns true (->1), if the coupling time window is completed.
PRECICE_API double precicec_getMaxTimeStepSize ()
 Returns maximum allowed time step size.
Mesh Access
PRECICE_API int precicec_requiresMeshConnectivityFor (const char *meshName)
PRECICE_API void precicec_resetMesh (const char *meshName)
 Removes all vertices and connectivity information from the mesh.
PRECICE_API int precicec_setMeshVertex (const char *meshName, const double *coordinates)
 Creates a mesh vertex.
PRECICE_API int precicec_getMeshVertexSize (const char *meshName)
 Returns the number of vertices of a mesh.
PRECICE_API void precicec_setMeshVertices (const char *meshName, int size, const double *coordinates, int *ids)
 Creates multiple mesh vertices.
PRECICE_API void precicec_setMeshEdge (const char *meshName, int firstVertexID, int secondVertexID)
 Sets mesh edge from vertex IDs.
PRECICE_API void precicec_setMeshEdges (const char *meshName, int size, const int *ids)
 Sets multiple mesh edge from vertex IDs.
PRECICE_API void precicec_setMeshTriangle (const char *meshName, int firstVertexID, int secondVertexID, int thirdVertexID)
 Sets a triangle from vertex IDs. Creates missing edges.
PRECICE_API void precicec_setMeshTriangles (const char *meshName, int size, const int *ids)
 Sets multiple mesh triangles from vertex IDs.
PRECICE_API void precicec_setMeshQuad (const char *meshName, int firstVertexID, int secondVertexID, int thirdVertexID, int fourthVertexID)
 Sets surface mesh quadrangle from vertex IDs.
PRECICE_API void precicec_setMeshQuads (const char *meshName, int size, const int *ids)
 Sets multiple mesh quads from vertex IDs.
PRECICE_API void precicec_setMeshTetrahedron (const char *meshName, int firstVertexID, int secondVertexID, int thirdVertexID, int fourthVertexID)
 Sets mesh tetrahedron from vertex IDs.
PRECICE_API void precicec_setMeshTetrahedra (const char *meshName, int size, const int *ids)
 Sets multiple mesh tetrahedra from vertex IDs.
Data Access
PRECICE_API int precicec_requiresInitialData ()
PRECICE_API void precicec_writeData (const char *meshName, const char *dataName, int size, const int *valueIndices, const double *values)
 Writes vector data values given as block.
PRECICE_API void precicec_readData (const char *meshName, const char *dataName, int size, const int *valueIndices, double relativeReadTime, double *values)
 Reads vector data values given as block.
Just-in-time mapping
PRECICE_API void precicec_writeAndMapData (const char *meshName, const char *dataName, int size, const double *coordinates, const double *values)
 Writes data using just-in-time data mapping See.
PRECICE_API void precicec_mapAndReadData (const char *meshName, const char *dataName, int size, const double *coordinates, double relativeReadTime, double *values)
 Reads data using just-in-time data mapping. See.
Direct mesh access
PRECICE_API void precicec_setMeshAccessRegion (const char *meshName, const double *boundingBox)
 See precice::Participant::setMeshAccessRegion().
PRECICE_API void precicec_getMeshVertexIDsAndCoordinates (const char *meshName, const int size, int *ids, double *coordinates)
 See precice::Participant::getMeshVertexIDsAndCoordinates().
Experimental Gradient Data

These API functions are experimental and may change in future versions.

PRECICE_API int precicec_requiresGradientDataFor (const char *meshName, const char *dataName)
 Checks if the given data set requires gradient data. We check if the data object has been initialized with the gradient flag.
PRECICE_API void precicec_writeGradientData (const char *meshName, const char *dataName, int size, const int *valueIndices, const double *gradients)
 Writes vector gradient data to a mesh.
User-defined profiling
PRECICE_API void precicec_startProfilingSection (const char *sectionName)
PRECICE_API void precicec_stopLastProfilingSection ()

Detailed Description

C language bindings to main Application Programming Interface of preCICE.

The C bindings are thin wrappers around the C++ API.

Refer to precice::Participant for detailed documentation.

Definition in file preciceC.h.

Function Documentation

◆ precicec_advance()

PRECICE_API void precicec_advance ( double computedTimeStepSize)

Exchanges data between solver and coupling supervisor.

Parameters
[in]computedTimeStepSizeSize of time step computed by solver.

Definition at line 68 of file preciceC.cpp.

◆ precicec_createParticipant()

PRECICE_API void precicec_createParticipant ( const char * participantName,
const char * configFileName,
int solverProcessIndex,
int solverProcessSize )

Creates the coupling interface and configures it.

Has to be called before any other method of this interface.

Parameters
[in]participantNameName of the participant accessing the interface. Has to match one of the names specified in the configuration xml file.
[in]configFileName(Path and) name of the xml configuration file containing the precice configuration.
[in]solverProcessIndexIf 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]solverProcessSizeThe number of solver processes using preCICE.

Definition at line 45 of file preciceC.cpp.

Here is the call graph for this function:

◆ precicec_createParticipant_withCommunicator()

PRECICE_API void precicec_createParticipant_withCommunicator ( const char * participantName,
const char * configFileName,
int solverProcessIndex,
int solverProcessSize,
void * communicator )
Parameters
[in]participantNameName of the participant using the interface. Has to match the name given for a participant in the xml configuration file.
[in]configurationFileNameName (with path) of the xml configuration file.
[in]solverProcessIndexIf 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]solverProcessSizeThe number of solver processes using preCICE.
[in]communicatorA pointer to an MPI_Comm to use as communicator.

Definition at line 28 of file preciceC.cpp.

Here is the call graph for this function:

◆ precicec_finalize()

PRECICE_API void precicec_finalize ( )

Finalizes the coupling to the coupling supervisor.

Definition at line 76 of file preciceC.cpp.

◆ precicec_getDataDimensions()

PRECICE_API int precicec_getDataDimensions ( const char * meshName,
const char * dataName )

Returns the spatial dimensionality of the given data on the given mesh.

Note that vectorial data dimensionality directly depends on the spatial dimensionality of the mesh.

Parameters
[in]meshNamethe name of the associated mesh
[in]dataNamethe name of the data to get the dimensions for
Returns
the dimensions of the given Data
See also
getMeshDimensions

Definition at line 94 of file preciceC.cpp.

◆ precicec_getMaxTimeStepSize()

PRECICE_API double precicec_getMaxTimeStepSize ( )

Returns maximum allowed time step size.

Definition at line 127 of file preciceC.cpp.

◆ precicec_getMeshDimensions()

PRECICE_API int precicec_getMeshDimensions ( const char * meshName)

Returns the spatial dimensionality of the given mesh.

Parameters
[in]meshNamethe name of the associated mesh
Returns
the dimensions of the given mesh

Definition at line 85 of file preciceC.cpp.

◆ precicec_getMeshVertexIDsAndCoordinates()

PRECICE_API void precicec_getMeshVertexIDsAndCoordinates ( const char * meshName,
const int size,
int * ids,
double * coordinates )

◆ precicec_getMeshVertexSize()

PRECICE_API int precicec_getMeshVertexSize ( const char * meshName)

Returns the number of vertices of a mesh.

Parameters
[in]meshNamethe name of the mesh.
Returns
the amount of the vertices of the mesh

Definition at line 208 of file preciceC.cpp.

◆ precicec_getVersionInformation()

PRECICE_API const char * precicec_getVersionInformation ( )

Returns information on the version of preCICE.

Returns a semicolon-separated C-string containing:

1) the version of preCICE 2) the revision information of preCICE 3) the configuration of preCICE including MPI, PETSC, PYTHON

Definition at line 403 of file preciceC.cpp.

◆ precicec_initialize()

PRECICE_API void precicec_initialize ( )

Initiates the coupling to the coupling supervisor and initializes coupling data.

Definition at line 60 of file preciceC.cpp.

◆ precicec_isCouplingOngoing()

PRECICE_API int precicec_isCouplingOngoing ( )

Returns true (->1), if the coupled simulation is ongoing.

Definition at line 103 of file preciceC.cpp.

◆ precicec_isTimeWindowComplete()

PRECICE_API int precicec_isTimeWindowComplete ( )

Returns true (->1), if the coupling time window is completed.

Definition at line 115 of file preciceC.cpp.

◆ precicec_mapAndReadData()

PRECICE_API void precicec_mapAndReadData ( const char * meshName,
const char * dataName,
int size,
const double * coordinates,
double relativeReadTime,
double * values )

Reads data using just-in-time data mapping. See.

See also
precice::Participant::mapAndReadData() and the just-in-time mapping doxygen section for more information.
Parameters
[in]meshNameName of the mesh to write and map the data to. Typically a received mesh
[in]dataNameName of the data to field on this mesh.
[in]sizeNumber of vertices to write
[in]coordinatesPointer to the coordinates where we read the data. Needs to have size x precicec_getMeshDimensions( meshName ) entries
[in]relativeReadTimeSame as in
See also
precice::Participant::readData()
Parameters
[in/out]values Pointer to the values to be filled by preCICE. Needs to have size x precicec_getDataDimensions( meshName , dataName ) entries

Reads data values from a mesh using a just-in-time data mapping. Values correspond to a given point in time relative to the beginning of the current timestep (experimental).

Attention
This API function is experimental and may change in the future!

This function reads values at temporary locations from data of a mesh. As opposed to the readData function using VertexIDs, this function allows reading data via coordinates, which don't have to be specified during the initialization. This is particularly useful for meshes, which vary over time. Note that using this function comes at a performance cost, since the specified mapping needs to be computed locally for the given locations, whereas the other variant (readData) can typically exploit the static interface mesh and pre-compute data structures more efficient.

Values are read into a block of continuous memory defined by values in the order specified by vertices.

The 1D/Scalar-format of values is (d0, d1, ..., dn) 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 size of the current time step. Then relativeReadTime = dt corresponds to the data at the end of the time step.

Parameters
[in]meshNameThe name of the mesh that holds the data, needs to be a mesh received from another participant.
[in]dataNameThe name of the data to read from.
[in]coordinatesa span 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)
[in]relativeReadTimePoint in time where data is read relative to the beginning of the current time step.
[out]valuesThe destination memory to read the data from.
Precondition
The coordinates are within the bounding box previously defined via setMeshAccessRegion(). Using coordinates outside the defined bounding box will throw an error.
Postcondition
values contain the read data as specified in the above format.
Note
Only supported for consistent mapping constraints and mapping:rbf-pum-direct or mapping:nearest-neighbor.
The function makes use of a caching mechanism that reuses the result from the previous call with the same relativeReadTime on each individual rank. As a result, calling the function for different coordinates while keeping the relativeReadTime constant is more efficient than calling it for varying relativeReadTime values at each coordinate. In practice, this means that iterating over time (i.e., varying relativeReadTime) in the outer loop and over space (i.e., iterating over coordinates) in the inner loop gives a significantly better performance than vice versa.
See also
Participant::setMeshAccessRegion()

Definition at line 359 of file preciceC.cpp.

◆ precicec_readData()

PRECICE_API void precicec_readData ( const char * meshName,
const char * dataName,
int size,
const int * valueIndices,
double relativeReadTime,
double * values )

Reads vector data values given as block.

The block contains the vector values in the following form: values = (d0x, d0y, d0z, d1x, d1y, d1z, ...., dnx, dny, dnz), where n is the number of vector values. In 2D, the z-components are removed.

Parameters
[in]meshNamethe name of the mesh
[in]dataNamethe name of the data to be read.
[in]sizeNumber of indices, and number of values * dimensions.
[in]valueIndicesIndices (from setReadPosition()) of data values.
[in]relativeReadTimePoint in time where data is read relative to the beginning of the current time step.
[in]valuesValues of the data to be read.
See also
Participant::readData

Definition at line 329 of file preciceC.cpp.

◆ precicec_requiresGradientDataFor()

PRECICE_API int precicec_requiresGradientDataFor ( const char * meshName,
const char * dataName )

Checks if the given data set requires gradient data. We check if the data object has been initialized with the gradient flag.

Attention
This API function is experimental and may change in the future!

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)

Parameters
[in]meshNamethe name of mesh that hold the data.
[in]dataNamethe name of the data.
Returns
whether gradient is required

Definition at line 375 of file preciceC.cpp.

◆ precicec_requiresInitialData()

PRECICE_API int precicec_requiresInitialData ( )

Checks if the participant is required to provide initial data.

If true, then the participant needs to write initial data to defined vertices prior to calling initialize().

Note
If initial data is configured, then this function needs to be called.
Precondition
initialize() has not yet been called

Definition at line 135 of file preciceC.cpp.

◆ precicec_requiresMeshConnectivityFor()

PRECICE_API int precicec_requiresMeshConnectivityFor ( const char * meshName)

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.

Parameters
[in]meshNamethe name of the mesh
Returns
whether connectivity is required

Definition at line 162 of file preciceC.cpp.

◆ precicec_requiresReadingCheckpoint()

PRECICE_API int precicec_requiresReadingCheckpoint ( )

Checks if the participant is required to read an iteration checkpoint.

If true, the participant is required to read an iteration checkpoint before calling advance().

Note
If implicit coupling is configured for this Participant, then this function needs to be called.
This function returns false before the first call to advance().
Precondition
initialize() has been called
See also
requiresWritingCheckpoint()

Definition at line 153 of file preciceC.cpp.

◆ precicec_requiresWritingCheckpoint()

PRECICE_API int precicec_requiresWritingCheckpoint ( )

Checks if the participant is required to write an iteration checkpoint.

If true, the participant is required to write an iteration checkpoint before calling advance().

Note
If implicit coupling is configured for this Participant, then this function needs to be called.
Precondition
initialize() has been called
See also
requiresReadingCheckpoint()

Definition at line 144 of file preciceC.cpp.

◆ precicec_resetMesh()

PRECICE_API void precicec_resetMesh ( const char * meshName)

Removes all vertices and connectivity information from the mesh.

Attention
This API function is experimental and may change in the future!

Allows redefining a mesh during runtime. After the call to resetMesh(), the mesh vertices need to be set with setMeshVertex() and setMeshVertices() again. Connectivity information may be set as well.

Reading data from this mesh using readData() is not possible until the next call to advance().

Parameters
[in]meshNamethe name of the mesh to reset
Precondition
initialize() has been called
isCouplingOngoing() is true
Postcondition
previously returned vertex ids from setMeshVertex() and setMeshVertices() of the given mesh are invalid.

Definition at line 174 of file preciceC.cpp.

◆ precicec_setMeshAccessRegion()

PRECICE_API void precicec_setMeshAccessRegion ( const char * meshName,
const double * boundingBox )

◆ precicec_setMeshEdge()

PRECICE_API void precicec_setMeshEdge ( const char * meshName,
int firstVertexID,
int secondVertexID )

Sets mesh edge from vertex IDs.

Parameters
[in]meshNamethe name of the mesh to add the edge to
[in]firstVertexIDID of the first vertex of the edge
[in]secondVertexIDID of the second vertex of the edge
Precondition
ids were added to the mesh with the name meshName

Definition at line 218 of file preciceC.cpp.

◆ precicec_setMeshEdges()

PRECICE_API void precicec_setMeshEdges ( const char * meshName,
int size,
const int * ids )

Sets multiple mesh edge from vertex IDs.

Parameters
[in]meshNamethe name of the mesh to add the edges to
[in]sizethe amount of edges to set
[in]idsan array containing 2*size vertex IDs
Precondition
ids were added to the mesh with the name meshName

Definition at line 229 of file preciceC.cpp.

◆ precicec_setMeshQuad()

PRECICE_API void precicec_setMeshQuad ( const char * meshName,
int firstVertexID,
int secondVertexID,
int thirdVertexID,
int fourthVertexID )

Sets surface mesh quadrangle from vertex IDs.

Parameters
[in]meshNamethe name of the mesh to add the Quad to
[in]firstVertexIDID of the first vertex of the Quad
[in]secondVertexIDID of the second vertex of the Quad
[in]thirdVertexIDID of the third vertex of the Quad
[in]fourthVertexIDID of the fourth vertex of the Quad

Definition at line 265 of file preciceC.cpp.

◆ precicec_setMeshQuads()

PRECICE_API void precicec_setMeshQuads ( const char * meshName,
int size,
const int * ids )

Sets multiple mesh quads from vertex IDs.

Parameters
[in]meshNamethe name of the mesh to add the quad to
[in]sizethe amount of quads to set
[in]idsan array containing 4*size vertex IDs
Precondition
vertices in \ids were added to the mesh with the name meshName

Definition at line 278 of file preciceC.cpp.

◆ precicec_setMeshTetrahedra()

PRECICE_API void precicec_setMeshTetrahedra ( const char * meshName,
int size,
const int * ids )

Sets multiple mesh tetrahedra from vertex IDs.

Parameters
[in]meshNamethe name of the mesh to add the tetrahedra to
[in]sizethe amount of tetrahedra to set
[in]idsan array containing 4*size vertex IDs
Precondition
vertices in ids were added to the mesh with the name meshName

Definition at line 303 of file preciceC.cpp.

◆ precicec_setMeshTetrahedron()

PRECICE_API void precicec_setMeshTetrahedron ( const char * meshName,
int firstVertexID,
int secondVertexID,
int thirdVertexID,
int fourthVertexID )

Sets mesh tetrahedron from vertex IDs.

Parameters
[in]meshNamethe name of the mesh to add the Tetra to
[in]firstVertexIDID of the first vertex of the Tetra
[in]secondVertexIDID of the second vertex of the Tetra
[in]thirdVertexIDID of the third vertex of the Tetra
[in]fourthVertexIDID of the fourth vertex of the Tetra

Definition at line 290 of file preciceC.cpp.

◆ precicec_setMeshTriangle()

PRECICE_API void precicec_setMeshTriangle ( const char * meshName,
int firstVertexID,
int secondVertexID,
int thirdVertexID )

Sets a triangle from vertex IDs. Creates missing edges.

Definition at line 241 of file preciceC.cpp.

◆ precicec_setMeshTriangles()

PRECICE_API void precicec_setMeshTriangles ( const char * meshName,
int size,
const int * ids )

Sets multiple mesh triangles from vertex IDs.

Parameters
[in]meshNamethe name of the mesh to add the triangles to
[in]sizethe amount of triangles to set
[in]idsan array containing 3*size vertex IDs
Precondition
vertices in ids were added to the mesh with the name meshName

Definition at line 253 of file preciceC.cpp.

◆ precicec_setMeshVertex()

PRECICE_API int precicec_setMeshVertex ( const char * meshName,
const double * coordinates )

Creates a mesh vertex.

Parameters
[in]meshNamethe name of the mesh to add the vertex to.
[in]coordinatesa pointer to the coordinates of the vertex.
Returns
the id of the created vertex

Definition at line 182 of file preciceC.cpp.

◆ precicec_setMeshVertices()

PRECICE_API void precicec_setMeshVertices ( const char * meshName,
int size,
const double * coordinates,
int * ids )

Creates multiple mesh vertices.

Parameters
[in]meshNamethe name of the mesh to add the vertices to.
[in]sizeNumber of vertices to create
[in]coordinatesa 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]idsThe ids of the created vertices

Definition at line 194 of file preciceC.cpp.

◆ precicec_startProfilingSection()

PRECICE_API void precicec_startProfilingSection ( const char * sectionName)

Start a named user-defined profiling section

Starts a profiling section to record with the given name. This action is active until it is stopped by stopLastProfilingSection().

All active sections must be stopped before calling initialize() or advance().

Parameters
[in]sectionNamethe name of the profiling section to start. The name may not contain forward slashes /.

Definition at line 430 of file preciceC.cpp.

◆ precicec_stopLastProfilingSection()

PRECICE_API void precicec_stopLastProfilingSection ( )

Stop the last profiling section

Precondition
a profiling section has been started using startProfilingSection()

Definition at line 437 of file preciceC.cpp.

◆ precicec_writeAndMapData()

PRECICE_API void precicec_writeAndMapData ( const char * meshName,
const char * dataName,
int size,
const double * coordinates,
const double * values )

Writes data using just-in-time data mapping See.

See also
precice::Participant::writeAndMapData() and the just-in-time mapping doxygen section for more information.
Parameters
[in]meshNameName of the mesh to write and map the data to. Typically a received mesh
[in]dataNameName of the data to field on this mesh.
[in]sizeNumber of vertices to write
[in]coordinatesPointer to the coordinates where we write the data. Needs to have size x precicec_getMeshDimensions( meshName ) entries
[in]valuesPointer to the data values we want to pass to preCICE. Needs to have size x precicec_getDataDimensions( meshName , dataName ) entries

Writes data values to a mesh using a just-in-time mapping (experimental).

Attention
This API function is experimental and may change in the future!

This function writes values at temporary locations to data of a mesh. As opposed to the writeData function using VertexIDs, this function allows to write data via coordinates, which don't have to be specified during the initialization. This is particularly useful for meshes, which vary over time. Note that using this function comes at a performance cost, since the specified mapping needs to be computed locally for the given locations, whereas the other variant (writeData) can typically exploit the static interface mesh and pre-compute data structures more efficiently.

Values are passed via a block of continuous memory defined by values in the order specified by vertices.

The 1D/Scalar-format of values is (d0, d1, ..., dn) 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)

Parameters
[in]meshNameThe name of the mesh that holds the data, needs to be a mesh received from another participant.
[in]dataNameThe name of the data to write.
[in]coordinatesA span 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)
[in]valuesThe values containing the write data.
Precondition
The coordinates are within the bounding box previously defined via setMeshAccessRegion(). Using coordinates outside the defined bounding box will throw an error.
Note
Only supported for conservative mapping constraints and mapping:rbf-pum-direct or mapping:nearest-neighbor.
Caution when calling this function multiple times on the same data coordinates: There is no internal check and preCICE accumulates data values for conservative mappings.
See also
Participant::setMeshAccessRegion()

Definition at line 344 of file preciceC.cpp.

◆ precicec_writeData()

PRECICE_API void precicec_writeData ( const char * meshName,
const char * dataName,
int size,
const int * valueIndices,
const double * values )

Writes vector data values given as block.

The block must contain the vector values in the following form: values = (d0x, d0y, d0z, d1x, d1y, d1z, ...., dnx, dny, dnz), where n is the number of vector values. In 2D, the z-components are removed.

Parameters
[in]meshNamethe name of the mesh
[in]dataNamethe name of the data to be written.
[in]sizeNumber of indices, and number of values * dimensions.
[in]valuesValues of the data to be written.
See also
Participant::writeData

Definition at line 315 of file preciceC.cpp.

◆ precicec_writeGradientData()

PRECICE_API void precicec_writeGradientData ( const char * meshName,
const char * dataName,
int size,
const int * valueIndices,
const double * gradients )

Writes vector gradient data to a mesh.

Attention
This API function is experimental and may change in the future!

This function writes gradient values of specified vertices to data of a mesh. Values are provided as a block of continuous memory defined by gradients. The order of the provided gradient data follows the order specified by vertices.

Each gradient or Jacobian depends on the dimensionality of the mesh and data. Each gradient has a total of getMeshDimensions(meshName) * getDataDimensions(meshName, dataName) components and is stored in a linearised format as follows:

Spatial Dimensions Scalar Data Vectorial Data
2D s dx, s dy x dx, y dx, x dy, y dy
3D s dy, s dy, s dz x dx, y dx, z dx, x dy, y dy, z dy, x dz, y dz, z dz

The gradients/Jacobian for all vertices are then contiguously saved in memory.

Example for 2D Vectorial:

Index 0 1 2 3 ... 4n 4n+1 4n+2 4n+3
Component x0 dx y0 dx x0 dy y0 dy ... xn dx yn dx xn dy yn dy
Parameters
[in]meshNamethe name of mesh that hold the data.
[in]dataNamethe name of the data to write to.
[in]idsthe vertex ids of the vertices to write gradient data to.
[in]gradientsthe linearised gradient data to write to preCICE.
Precondition
Data has attribute hasGradient = true
every VertexID in vertices is a return value of setMeshVertex or setMeshVertices
gradients.size() == ids.size() * getMeshDimensions(meshName) * getDataDimensions(meshName, dataName)
See also
Participant::setMeshVertex()
Participant::setMeshVertices()
Participant::getMeshDimensions()
Participant::getDataDimensions()

Definition at line 388 of file preciceC.cpp.