preCICE v3.1.2
|
#include "precice/preciceFortran.hpp"
#include <cstddef>
#include <iostream>
#include <memory>
#include <stdexcept>
#include <string>
#include <string_view>
#include "logging/LogMacros.hpp"
#include "logging/Logger.hpp"
#include "precice/impl/versions.hpp"
#include "precice/precice.hpp"
#include "utils/assertion.hpp"
Go to the source code of this file.
Namespaces | |
namespace | precice |
Main namespace of the precice library. | |
namespace | precice::impl |
Functions | |
int | precice::impl::strippedLength (const char *string, int length) |
Returns length of string without trailing whitespace. | |
std::string_view | precice::impl::strippedStringView (const char *string, int length) |
void | precicef_create_ (const char *participantName, const char *configFileName, const int *solverProcessIndex, const int *solverProcessSize, int participantNameLength, int configFileNameLength) |
void | precicef_initialize_ () |
void | precicef_advance_ (const double *timeStepSize) |
void | precicef_finalize_ () |
void | precicef_get_mesh_dimensions_ (const char *meshName, int *dimensions, int meshNameLength) |
void | precicef_get_data_dimensions_ (const char *meshName, const char *dataName, int *dimensions, int meshNameLength, int dataNameLength) |
void | precicef_is_coupling_ongoing_ (int *isOngoing) |
void | precicef_is_time_window_complete_ (int *isComplete) |
void | precicef_get_max_time_step_size_ (double *maxTimeStepSize) |
void | precicef_requires_initial_data_ (int *isRequired) |
void | precicef_requires_writing_checkpoint_ (int *isRequired) |
void | precicef_requires_reading_checkpoint_ (int *isRequired) |
void | precicef_requires_mesh_connectivity_for_ (const char *meshName, int *required, int meshNameLength) |
void | precicef_set_vertex_ (const char *meshName, const double *position, int *vertexID, int meshNameLength) |
void | precicef_get_mesh_vertex_size_ (const char *meshName, int *meshSize, int meshNameLength) |
void | precicef_set_vertices_ (const char *meshName, const int *size, double *coordinates, int *ids, int meshNameLength) |
void | precicef_set_edge_ (const char *meshName, const int *firstVertexID, const int *secondVertexID, int meshNameLength) |
void | precicef_set_mesh_edges_ (const char *meshName, const int *size, const int *ids, int meshNameLength) |
void | precicef_set_triangle_ (const char *meshName, const int *firstVertexID, const int *secondVertexID, const int *thirdVertexID, int meshNameLength) |
void | precicef_set_mesh_triangles_ (const char *meshName, const int *size, const int *ids, int meshNameLength) |
void | precicef_set_quad_ (const char *meshName, const int *firstVertexID, const int *secondVertexID, const int *thirdVertexID, const int *fourthVertexID, int meshNameLength) |
void | precicef_set_mesh_quads_ (const char *meshName, const int *size, const int *ids, int meshNameLength) |
void | precicef_set_tetrahedron (const char *meshName, const int *firstVertexID, const int *secondVertexID, const int *thirdVertexID, const int *fourthVertexID, int meshNameLength) |
void | precicef_set_mesh_tetrahedra_ (const char *meshName, const int *size, const int *ids, int meshNameLength) |
void | precicef_write_data_ (const char *meshName, const char *dataName, const int *size, int *ids, double *values, int meshNameLength, int dataNameLength) |
void | precicef_read_data_ (const char *meshName, const char *dataName, const int *size, int *ids, const double *relativeReadTime, double *values, int meshNameLength, int dataNameLength) |
void | precicef_get_version_information_ (char *versionInfo, int lengthVersionInfo) |
void | precicef_requires_gradient_data_for_ (const char *meshName, const char *dataName, int *required, int meshNameLength, int dataNameLength) |
void | precicef_write_gradient_data_ (const char *meshName, const char *dataName, const int *size, const int *ids, const double *gradients, int meshNameLength, int dataNameLength) |
void | precicef_set_mesh_access_region_ (const char *meshName, const double *boundingBox, int meshNameLength) |
void | precicef_get_mesh_vertex_ids_and_coordinates_ (const char *meshName, const int size, int *ids, double *coordinates, int meshNameLength) |
Variables | |
static std::unique_ptr< precice::Participant > | impl = nullptr |
static precice::logging::Logger | _log ("preciceFortran") |
static std::string | errormsg = "preCICE has not been created properly. Be sure to call \"precicef_create\" before any other call to preCICE." |
void precicef_advance_ | ( | const double * | timeStepSize | ) |
Fortran syntax: precicef_advance( DOUBLE PRECISION timeStepSize )
IN: timeStepSize OUT: -
Advances preCICE after the solver has computed one time step.
There are two cases to distinguish at this point. If computedTimeStepSize
== getMaxTimeStepSize(), then the solver has reached the end of a time window and proceeds the coupling. This call is a computationally expensive process as it involves among other tasks:
If computedTimeStepSize
< getMaxTimeStepSize(), then the solver hasn't reached the end of a time window and it is subcycling. Depending on the configuration, written data can be used by preCICE to generate additional samples allowing for time interpolation using readData(). This call is computationally inexpensive.
[in] | computedTimeStepSize | Size of time step used by the solver. |
computedTimeStep
to advance().computedTimeStepSize
.Definition at line 62 of file preciceFortran.cpp.
void precicef_create_ | ( | const char * | participantName, |
const char * | configFileName, | ||
const int * | solverProcessIndex, | ||
const int * | solverProcessSize, | ||
int | participantNameLength, | ||
int | configFileNameLength ) |
Fortran syntax: precicef_create( CHARACTER participantName(*), CHARACTER configFileName(*), INTEGER solverProcessIndex, INTEGER solverProcessSize )
IN: participantName, configFileName, solverProcessIndex, solverProcessSize OUT: -
Constructs a Participant 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 41 of file preciceFortran.cpp.
void precicef_finalize_ | ( | ) |
Fortran syntax: precicef_finalize();
Finalizes preCICE.
If initialize() has been called:
Always:
Definition at line 69 of file preciceFortran.cpp.
void precicef_get_data_dimensions_ | ( | const char * | meshName, |
const char * | dataName, | ||
int * | dimensions, | ||
int | meshNameLength, | ||
int | dataNameLength ) |
Fortran syntax: precicef_get_data_dimensions_( CHARACTER meshName(*), CHARACTER dataName(*), INTEGER dimensions)
IN: mesh, data, meshNameLength, dataNameLength OUT: dimensions
Returns the spatial dimensionality of the given data on the given mesh.
Note that vectorial data dimensionality directly depends on the spacial dimensionality of the mesh.
[in] | meshName | the name of the associated mesh |
[in] | dataName | the name of the data to get the dimensions for |
Definition at line 85 of file preciceFortran.cpp.
void precicef_get_max_time_step_size_ | ( | double * | maxTimeStepSize | ) |
Fortran syntax: precicef_get_max_time_step_size( DOUBLE PRECISION maxTimeStepSize )
IN: - OUT: maxTimeStepSize
Get the maximum allowed time step size of the current window.
Allows the user to query the maximum allowed time step size in the current window. This should be used to compute the actual time step that the solver uses.
Definition at line 118 of file preciceFortran.cpp.
void precicef_get_mesh_dimensions_ | ( | const char * | meshName, |
int * | dimensions, | ||
int | meshNameLength ) |
Fortran syntax: precicef_get_mesh_dimensions_( CHARACTER meshName(*), INTEGER dimensions)
IN: mesh, meshNameLength OUT: dimensions
Returns the spatial dimensionality of the given mesh.
[in] | meshName | the name of the associated mesh |
Definition at line 76 of file preciceFortran.cpp.
void precicef_get_mesh_vertex_ids_and_coordinates_ | ( | const char * | meshName, |
const int | size, | ||
int * | ids, | ||
double * | coordinates, | ||
int | meshNameLength ) |
Fortran syntax: precicef_get_mesh_vertex_ids_and_coordinates_( CHARACTER meshName(*), INTEGER size, INTEGER ids(size), DOUBLE PRECISION coordinates(dim*size))
IN: mesh, size, meshNameLength OUT: ids, coordinates
getMeshVertexIDsAndCoordinates Iterates over the region of interest defined by bounding boxes and reads the corresponding coordinates omitting the mapping.
[in] | meshName | corresponding mesh name |
[out] | ids | ids corresponding to the coordinates |
[out] | coordinates | the coordinates associated to the ids and corresponding data values |
initialize()
, if the meshName
corresponds to a received mesh, since the relevant mesh data is exchanged during the initialize()
call.Definition at line 396 of file preciceFortran.cpp.
void precicef_get_mesh_vertex_size_ | ( | const char * | meshName, |
int * | meshSize, | ||
int | meshNameLength ) |
Fortran syntax: precicef_get_mesh_vertex_size( CHARACTER meshName(*), INTEGER meshSize )
IN: mesh, meshNameLength OUT: meshSize
Returns the number of vertices of a mesh.
[in] | meshName | the name of the mesh |
initialize()
, if the meshName
corresponds to a received mesh, since the relevant mesh data is exchanged during the initialize()
call. Definition at line 171 of file preciceFortran.cpp.
void precicef_get_version_information_ | ( | char * | versionInfo, |
int | lengthVersionInfo ) |
void precicef_initialize_ | ( | ) |
Fortran syntax: precicef_initialize()
IN: - OUT: -
Fully initializes preCICE and coupling data.
- Sets up a connection to the other participants of the coupled simulation.
Definition at line 56 of file preciceFortran.cpp.
void precicef_is_coupling_ongoing_ | ( | int * | isOngoing | ) |
Fortran syntax: precicef_is_coupling_ongoing( INTEGER isOngoing )
IN: - OUT: isOngoing(1:true, 0:false)
Checks if the coupled simulation is still ongoing.
A coupling is ongoing as long as
Definition at line 96 of file preciceFortran.cpp.
void precicef_is_time_window_complete_ | ( | int * | isComplete | ) |
Fortran syntax: precicef_is_time_window_complete( INTEGER isComplete );
IN: - OUT: isComplete(1:true, 0:false)
Checks if the current coupling window is completed.
The following reasons require several solver time steps per time window:
Hence, a time window is complete if we reach the end of the time window and the implicit coupling has converged.
For implicit coupling this condition is equivalent with the requirement to write an iteration checkpoint. This is, however, not the case for explicit coupling.
Definition at line 107 of file preciceFortran.cpp.
void precicef_read_data_ | ( | const char * | meshName, |
const char * | dataName, | ||
const int * | size, | ||
int * | ids, | ||
const double * | relativeReadTime, | ||
double * | values, | ||
int | meshNameLength, | ||
int | dataNameLength ) |
Fortran syntax: precicef_read_data( CHARACTER meshName(*), CHARACTER dataName(*), INTEGER size, INTEGER ids, DOUBLE PRECISION relativeReadTime, DOUBLE PRECISION values(dim*size) )
IN: mesh, data, size, ids, meshNameLength, dataNameLength OUT: values
Reads data values 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 data of a mesh. 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.
[in] | meshName | the name of mesh that hold the data. |
[in] | dataName | the name of the data to read from. |
[in] | ids | the vertex ids of the vertices to read data from. |
[in] | relativeReadTime | Point in time where data is read relative to the beginning of the current time step. |
[out] | values | the destination memory to read the data from. |
Definition at line 301 of file preciceFortran.cpp.
void precicef_requires_gradient_data_for_ | ( | const char * | meshName, |
const char * | dataName, | ||
int * | required, | ||
int | meshNameLength, | ||
int | dataNameLength ) |
Fortran syntax: precicef_requires_gradient_data_for_( CHARACTER meshName(*), CHARACTER dataName(*), INTEGER required )
IN: dataID OUT: required(1:true, 0:false)
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] | meshName | the name of mesh that hold the data. |
[in] | dataName | the name of the data. |
Definition at line 350 of file preciceFortran.cpp.
void precicef_requires_initial_data_ | ( | int * | isRequired | ) |
Fortran syntax: precicef_requires_initial_data_( INTEGER isRequired )
IN: - OUT: isRequired(1:true, 0:false)
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().
Definition at line 125 of file preciceFortran.cpp.
void precicef_requires_mesh_connectivity_for_ | ( | const char * | meshName, |
int * | required, | ||
int | meshNameLength ) |
Fortran syntax: precicef_precicef_requires_mesh_connectivity_for_( CHARACTER meshName(*), INTEGER required)
IN: mesh, meshNameLength OUT: required(1:true, 0:false)
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] | meshName | the name of the mesh |
Definition at line 146 of file preciceFortran.cpp.
void precicef_requires_reading_checkpoint_ | ( | int * | isRequired | ) |
Fortran syntax: precicef_requires_reading_checkpoint_( INTEGER isRequired )
IN: - OUT: isRequired(1:true, 0:false)
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().
Definition at line 139 of file preciceFortran.cpp.
void precicef_requires_writing_checkpoint_ | ( | int * | isRequired | ) |
Fortran syntax: precicef_requires_writing_checkpoint_( INTEGER isRequired )
IN: - OUT: isRequired(1:true, 0:false)
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().
Definition at line 132 of file preciceFortran.cpp.
void precicef_set_edge_ | ( | const char * | meshName, |
const int * | firstVertexID, | ||
const int * | secondVertexID, | ||
int | meshNameLength ) |
Fortran syntax: precicef_set_edge( CHARACTER meshName(*), INTEGER firstVertexID, INTEGER secondVertexID )
IN: mesh, firstVertexID, secondVertexID, meshNameLength OUT: -
Sets a mesh edge from vertex IDs.
Ignored if preCICE doesn't require connectivity for the mesh.
[in] | meshName | name of the mesh to add the edge to |
[in] | first | ID of the first vertex of the edge |
[in] | second | ID of the second vertex of the edge |
Definition at line 193 of file preciceFortran.cpp.
void precicef_set_mesh_access_region_ | ( | const char * | meshName, |
const double * | boundingBox, | ||
int | meshNameLength ) |
Fortran syntax: precicef_set_mesh_access_region_( CHARACTER meshName(*), DOUBLE PRECISION bounding_box(dim*2))
IN: mesh, bounding_box, meshNameLength OUT: -
setMeshAccessRegion Define a region of interest on a received mesh (<receive-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] | meshName | name 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 385 of file preciceFortran.cpp.
void precicef_set_mesh_edges_ | ( | const char * | meshName, |
const int * | size, | ||
const int * | ids, | ||
int | meshNameLength ) |
Fortran syntax: precicef_set_mesh_edges_( CHARACTER meshName(*), INTEGER size, INTEGER ids(size*2) )
IN: mesh, size, ids, meshNameLength OUT: -
Sets multiple mesh edges from vertex IDs.
vertices contain pairs of vertex indices for each edge to define. The format follows: e1a, e1b, e2a, e2b, ... Ignored if preCICE doesn't require connectivity for the mesh.
[in] | meshName | the name of the mesh to add the n edges to |
[in] | ids | an array containing 2n vertex IDs for n edges |
ids
were added to the mesh with the name meshName ids.size()
is multiple of 2Fortran syntax: precicef_set_mesh_triangles_( CHARACTER meshName(*), INTEGER size, INTEGER ids(size*3) )
IN: mesh, size, ids, meshNameLength OUT: -
Sets multiple mesh triangles from vertex IDs.
vertices contain triples of vertex indices for each triangle to define. The format follows: t1a, t1b, t1c, t2a, t2b, t2c, ... Ignored if preCICE doesn't require connectivity for the mesh.
[in] | meshName | name of the mesh to add the n triangles to |
[in] | ids | an array containing 3n vertex IDs for n triangles |
ids
were added to the mesh with the name meshName ids.size()
is multiple of 3Definition at line 203 of file preciceFortran.cpp.
void precicef_set_mesh_quads_ | ( | const char * | meshName, |
const int * | size, | ||
const int * | ids, | ||
int | meshNameLength ) |
Fortran syntax: precicef_set_mesh_quads( CHARACTER meshName(*), INTEGER size, INTEGER ids(size*4) )
IN: mesh, size, ids, meshNameLength OUT: -
Sets multiple mesh quads from vertex IDs.
vertices contain quadruples of vertex indices for each quad to define. The format follows: q1a, q1b, q1c, q1d, q2a, q2b, q2c, q2d, ...
Each planar quad will be triangulated, maximizing area-to-circumference. Ignored if preCICE doesn't require connectivity for the mesh.
[in] | meshName | name of the mesh to add the n quads to |
[in] | ids | an array containing 4n vertex IDs for n quads |
ids
were added to the mesh with the name meshName ids.size()
is multiple of 4Definition at line 248 of file preciceFortran.cpp.
void precicef_set_mesh_tetrahedra_ | ( | const char * | meshName, |
const int * | size, | ||
const int * | ids, | ||
int | meshNameLength ) |
Fortran syntax: precicef_set_mesh_tetrahedra_( CHARACTER meshName(*), INTEGER size, INTEGER ids(size*4) )
IN: mesh, size, ids, meshNameLength OUT: -
Sets multiple mesh tetrahedra from vertex IDs.
vertices contain quadruples of vertex indices for each tetrahedron to define. The format follows: t1a, t1b, t1c, t1d, t2a, t2b, t2c, t2d, ... Ignored if preCICE doesn't require connectivity for the mesh.
[in] | meshName | name of the mesh to add the n tetrahedra to |
[in] | ids | an array containing 4n vertex IDs for n tetrahedra |
ids
were added to the mesh with the name meshName Definition at line 271 of file preciceFortran.cpp.
void precicef_set_mesh_triangles_ | ( | const char * | meshName, |
const int * | size, | ||
const int * | ids, | ||
int | meshNameLength ) |
void precicef_set_quad_ | ( | const char * | meshName, |
const int * | firstVertexID, | ||
const int * | secondVertexID, | ||
const int * | thirdVertexID, | ||
const int * | fourthVertexID, | ||
int | meshNameLength ) |
Fortran syntax: precicef_set_quad_( CHARACTER meshName(*), INTEGER firstVertexID, INTEGER secondVertexID, INTEGER thirdVertexID, INTEGER fourthVertexID )
IN: mesh, firstVertexID, secondVertexID, thirdVertexID, fourthVertexID, meshNameLength OUT: -
Sets a planar surface mesh quadrangle from vertex IDs.
The planar quad will be triangulated, maximizing area-to-circumference. Ignored if preCICE doesn't require connectivity for the mesh.
[in] | meshName | name of the mesh to add the Quad to |
[in] | first | ID of the first vertex of the Quad |
[in] | second | ID of the second vertex of the Quad |
[in] | third | ID of the third vertex of the Quad |
[in] | fourth | ID of the fourth vertex of the Quad |
Definition at line 236 of file preciceFortran.cpp.
void precicef_set_tetrahedron | ( | const char * | meshName, |
const int * | firstVertexID, | ||
const int * | secondVertexID, | ||
const int * | thirdVertexID, | ||
const int * | fourthVertexID, | ||
int | meshNameLength ) |
Fortran syntax: precicef_set_tetrahedron( CHARACTER meshName(*), INTEGER firstVertexID, INTEGER secondVertexID, INTEGER thirdVertexID, INTEGER fourthVertexID )
IN: mesh, firstVertexID, secondVertexID, thirdVertexID, fourthVertexID, meshNameLength OUT: -
Set tetrahedron in 3D mesh from vertex ID.
[in] | meshName | name of the mesh to add the Tetrahedron to |
[in] | first | ID of the first vertex of the Tetrahedron |
[in] | second | ID of the second vertex of the Tetrahedron |
[in] | third | ID of the third vertex of the Tetrahedron |
[in] | fourth | ID of the fourth vertex of the Tetrahedron |
Definition at line 259 of file preciceFortran.cpp.
void precicef_set_triangle_ | ( | const char * | meshName, |
const int * | firstVertexID, | ||
const int * | secondVertexID, | ||
const int * | thirdVertexID, | ||
int | meshNameLength ) |
Fortran syntax: precicef_set_triangle_( CHARACTER meshName(*), INTEGER firstVertexID, INTEGER secondVertexID, INTEGER thirdVertexID )
IN: mesh, firstVertexID, secondVertexID, thirdVertexID, meshNameLength OUT: -
Sets mesh triangle from vertex IDs.
[in] | meshName | name of the mesh to add the triangle to |
[in] | first | ID of the first vertex of the triangle |
[in] | second | ID of the second vertex of the triangle |
[in] | third | ID of the third vertex of the triangle |
Definition at line 214 of file preciceFortran.cpp.
void precicef_set_vertex_ | ( | const char * | meshName, |
const double * | coordinates, | ||
int * | id, | ||
int | meshNameLength ) |
Fortran syntax: precicef_set_vertex( CHARACTER meshName(*), DOUBLE PRECISION coordinates(dim), INTEGER id )
IN: mesh, coordinates, meshNameLength OUT: id
Creates a mesh vertex.
[in] | meshName | the name of the mesh to add the vertex to. |
[in] | position | the coordinates of the vertex. |
Definition at line 159 of file preciceFortran.cpp.
void precicef_set_vertices_ | ( | const char * | meshName, |
const int * | size, | ||
double * | coordinates, | ||
int * | ids, | ||
int | meshNameLength ) |
Fortran syntax: precicef_set_vertices( CHARACTER meshName(*), INTEGER size, DOUBLE PRECISION coordinates(dim*size), INTEGER ids(size) )
IN: mesh, size, coordinates, meshNameLength OUT: ids
Creates multiple mesh vertices.
[in] | meshName | the name of the mesh to add the vertices to. |
[in] | coordinates | a 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) |
[out] | ids | The ids of the created vertices |
coordinates.size()
== getMeshDimensions(meshName) * ids.size()Definition at line 180 of file preciceFortran.cpp.
void precicef_write_data_ | ( | const char * | meshName, |
const char * | dataName, | ||
const int * | size, | ||
int * | ids, | ||
double * | values, | ||
int | meshNameLength, | ||
int | dataNameLength ) |
Fortran syntax: precicef_write_data( CHARACTER meshName(*), CHARACTER dataName(*), INTEGER size, INTEGER ids, DOUBLE PRECISION values(dim*size) )
IN: mesh, data, size, ids, values, meshNameLength, dataNameLength OUT: -
Writes data to a mesh.
This function writes values of specified vertices to data of a mesh. Values are provided as a block of continuous memory defined by values. The order of the provided data follows 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)
[in] | meshName | the name of mesh that hold the data. |
[in] | dataName | the name of the data to write to. |
[in] | ids | the vertex ids of the vertices to write data to. |
[in] | values | the values to write to preCICE. |
ids
is a return value of setMeshVertex or setMeshVertices Definition at line 282 of file preciceFortran.cpp.
void precicef_write_gradient_data_ | ( | const char * | meshName, |
const char * | dataName, | ||
const int * | size, | ||
const int * | ids, | ||
const double * | gradients, | ||
int | meshNameLength, | ||
int | dataNameLength ) |
Fortran syntax: precicef_write_gradient_data_( CHARACTER meshName(*), CHARACTER dataName(*), INTEGER size, INTEGER ids, DOUBLE PRECISION gradients )
IN: mesh, data, size, ids, gradients, meshNameLength, dataNameLength OUT: -
Writes vector gradient data to a mesh.
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 |
[in] | meshName | the name of mesh that hold the data. |
[in] | dataName | the name of the data to write to. |
[in] | ids | the vertex ids of the vertices to write gradient data to. |
[in] | gradients | the linearised gradient data to write to preCICE. |
Definition at line 364 of file preciceFortran.cpp.
|
static |
|
static |
Definition at line 29 of file preciceFortran.cpp.
|
static |
Definition at line 25 of file preciceFortran.cpp.