-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathSolverInterfaceC.h
253 lines (216 loc) · 6.67 KB
/
SolverInterfaceC.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
#ifndef PRECICE_ADAPTERS_C_SOLVERINTERFACEC_H_
#define PRECICE_ADAPTERS_C_SOLVERINTERFACEC_H_
/*#ifdef __cplusplus
extern "C" {
#endif
*/
/**
* @brief Creates the coupling interface and confiures it.
*
* Has to be called before any other method of this interface.
*
* @param participantName [IN] Name of the participant accessing the interface. Has to
* match one of the names specified in the
* configuration xml file.
* @param configFileName [IN] (Path and) name of the xml configuration file
* containing the precice configuration.
*/
void precicec_createSolverInterface (
const char* participantName,
const char* configFileName,
int solverProcessIndex,
int solverProcessSize );
/**
* @brief Initiates the coupling to the coupling supervisor.
*
* @return Maximal length of first timestep to be computed by solver.
*/
double precicec_initialize();
/**
* @brief Initializes coupling data.
*/
void precicec_initialize_data();
/**
* @brief Exchanges data between solver and coupling supervisor.
*
* @param computedTimestepLength [IN] Length of timestep computed by solver.
* @return Maximal length of next timestep to be computed by solver.
*/
double precicec_advance ( double computedTimestepLength );
/**
* @brief Finalizes the coupling to the coupling supervisor.
*/
void precicec_finalize();
/**
* @brief Returns the number of spatial configurations for the coupling.
*/
int precicec_getDimensions();
/**
* @brief Returns true (->1), if the coupled simulation is ongoing
*/
int precicec_isCouplingOngoing();
/**
* @brief Returns true (->1), if the coupling timestep is completed.
*/
int precicec_isCouplingTimestepComplete();
int precicec_isWriteDataRequired ( double computedTimestepLength );
/**
* @brief Returns true (->1), if new data to read is available.
*/
int precicec_isReadDataAvailable();
int precicec_isActionRequired ( const char* action );
void precicec_fulfilledAction ( const char* action );
/**
* @brief Returns id belonging to the given mesh name
*/
int precicec_getMeshID ( const char* meshName );
/**
* @brief Returns true (!=0), if data with given name is available.
*/
int precicec_hasData ( const char* dataName, int meshID );
/**
* @brief Returns the data id belonging to the given name.
*
* The given name (dataName) has to be one of the names specified in the
* configuration file. The data id obtained can be used to read and write
* data to and from the coupling mesh.
*/
int precicec_getDataID ( const char* dataName, int meshID );
int precicec_setMeshVertex (
int meshID,
const double* position );
void precicec_getMeshVertices (
int meshID,
int size,
int* ids,
double* positions );
void precicec_setMeshVertices (
int meshID,
int size,
double* positions,
int* ids );
int precicec_getMeshVertexSize ( int meshID );
int precicec_setMeshEdge (
int meshID,
int firstVertexID,
int secondVertexID );
void precicec_setMeshTriangle (
int meshID,
int firstEdgeID,
int secondEdgeID,
int thirdEdgeID );
/**
* @brief Sets a triangle from vertex IDs. Creates missing edges.
*/
void precicec_setMeshTriangleWithEdges (
int meshID,
int firstVertexID,
int secondVertexID,
int thirdVertexID );
/**
* @brief 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.
*
* @param dataID [IN] ID of the data to be written.
* @param size [IN] Number of indices, and number of values * dimensions.
* @param values [IN] Values of the data to be written.
*/
void precicec_writeBlockVectorData (
int dataID,
int size,
int* valueIndices,
double* values );
/**
* @brief Writes vectorial foating point data to the coupling mesh.
*
* @param dataID [IN] ID of the data to be written. Obtained by getDataID().
* @param dataPosition [IN] Spatial position of the data to be written.
* @param dataValue [IN] Vectorial data value to be written.
*/
void precicec_writeVectorData (
int dataID,
int valueIndex,
const double* dataValue );
/**
* @brief See precice::SolverInterface::writeBlockScalarData().
*/
void precicec_writeBlockScalarData (
int dataID,
int size,
int* valueIndices,
double* values );
/**
* @brief Writes scalar floating point data to the coupling mesh.
*
* @param dataID [IN] ID of the data to be written. Obtained by getDataID().
* @param dataPosition [IN] Spatial position of the data to be written.
* @param dataValue [IN] Scalar data value to be written.
*/
void precicec_writeScalarData (
int dataID,
int valueIndex,
double dataValue );
/**
* @brief 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.
*
* @param dataID [IN] ID of the data to be read.
* @param size [IN] Number of indices, and number of values * dimensions.
* @param valueIndices [IN] Indices (from setReadPosition()) of data values.
* @param values [IN] Values of the data to be read.
*/
void precicec_readBlockVectorData (
int dataID,
int size,
int* valueIndices,
double* values );
/**
* @brief Reads vectorial foating point data from the coupling mesh.
*
* @param dataID [IN] ID of the data to be read. Obtained by getDataID().
* @param dataPosition [IN] Position where the read data should be mapped to.
* @param dataValue [OUT] Vectorial data value read.
*/
void precicec_readVectorData (
int dataID,
int valueIndex,
double* dataValue );
/**
* @brief See precice::SolverInterface::readBlockScalarData().
*/
void precicec_readBlockScalarData (
int dataID,
int size,
int* valueIndices,
double* values );
/**
* @brief Reads scalar foating point data from the coupling mesh.
*
* @param dataID [IN] ID of the data to be read. Obtained by getDataID().
* @param dataPosition [IN] Position where the read data should be mapped to.
* @param dataValue [OUT] Scalar data value read.
*/
void precicec_readScalarData (
int dataID,
int valueIndex,
double* dataValue );
/**
* @brief Computes and maps all write data mapped from mesh with given ID.
*
*/
void precicec_mapWriteDataFrom ( int fromMeshID );
/**
* @brief Computes and maps all read data mapped to mesh with given ID.
*/
void precicec_mapReadDataTo ( int toMeshID );
/*#ifdef __cplusplus
}
#endif
*/
#endif /* PRECICE_ADAPTERS_C_SOLVERINTERFACEC_H_ */