7.1
general documentation
cs_paramedmem_coupling.h
Go to the documentation of this file.
1 #ifndef __CS_PARAMEDMEM_HXX__
2 #define __CS_PARAMEDMEM_HXX__
3 
4 /*============================================================================
5  * Coupling using ParaMEDMEM
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2021 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------
29  * Local headers
30  *----------------------------------------------------------------------------*/
31 
32 #include "cs_defs.h"
33 
34 /*============================================================================
35  * Structure definitions
36  *============================================================================*/
37 
38 typedef struct _cs_paramedmem_coupling_t cs_paramedmem_coupling_t;
39 
40 /*----------------------------------------------------------------------------*/
41 
43 
44 /*============================================================================
45  * Global variable definitions
46  *============================================================================*/
47 
48 typedef enum {
52 
53 typedef enum {
58 
59 typedef enum {
66 
67 /*============================================================================
68  * Public C++ function prototypes
69  *============================================================================*/
70 
71 /*----------------------------------------------------------------------------*/
80 /*----------------------------------------------------------------------------*/
81 
82 cs_paramedmem_coupling_t *
84 
85 /*----------------------------------------------------------------------------*/
94 /*----------------------------------------------------------------------------*/
95 
96 cs_paramedmem_coupling_t *
97 cs_paramedmem_coupling_by_name(const char *name);
98 
99 /*----------------------------------------------------------------------------*/
110 /*----------------------------------------------------------------------------*/
111 
112 cs_paramedmem_coupling_t *
113 cs_paramedmem_coupling_create(const char *app1_name,
114  const char *app2_name,
115  const char *cpl_name);
116 
117 /*----------------------------------------------------------------------------*/
123 /*----------------------------------------------------------------------------*/
124 
125 void
126 cs_paramedmem_coupling_destroy(cs_paramedmem_coupling_t *c);
127 
128 /*----------------------------------------------------------------------------*/
132 /*----------------------------------------------------------------------------*/
133 
134 void
136 
137 /*----------------------------------------------------------------------------*/
145 /*----------------------------------------------------------------------------*/
146 
147 void
148 cs_paramedmem_add_mesh_from_criteria(cs_paramedmem_coupling_t *c,
149  const char *sel_crit,
150  int elt_dim);
151 
152 /*----------------------------------------------------------------------------*/
159 /*----------------------------------------------------------------------------*/
160 
161 void
162 cs_paramedmem_add_mesh_from_zone(cs_paramedmem_coupling_t *c,
163  const cs_zone_t *zone);
164 
165 /*----------------------------------------------------------------------------*/
171 /*----------------------------------------------------------------------------*/
172 int
174 
175 /*----------------------------------------------------------------------------*/
183 /*----------------------------------------------------------------------------*/
184 
185 cs_lnum_t
186 cs_paramedmem_mesh_get_n_elts(const cs_paramedmem_coupling_t *coupling);
187 
188 /*----------------------------------------------------------------------------*/
196 /*----------------------------------------------------------------------------*/
197 
198 const cs_lnum_t *
199 cs_paramedmem_mesh_get_elt_list(const cs_paramedmem_coupling_t *coupling);
200 
201 /*----------------------------------------------------------------------------*/
215 /*----------------------------------------------------------------------------*/
216 
217 int
218 cs_paramedmem_def_coupled_field(cs_paramedmem_coupling_t *c,
219  const char *name,
220  int dim,
221  cs_medcpl_field_nature_t field_nature,
222  cs_medcpl_space_discr_t space_discr,
223  cs_medcpl_time_discr_t time_discr);
224 
225 /*----------------------------------------------------------------------------*/
236 /*----------------------------------------------------------------------------*/
237 
238 int
239 cs_paramedmem_def_coupled_field_from_cs_field(cs_paramedmem_coupling_t *c,
240  cs_field_t *f,
243 
244 /*----------------------------------------------------------------------------*/
252 /*----------------------------------------------------------------------------*/
253 
254 void
255 cs_paramedmem_field_export(cs_paramedmem_coupling_t *c,
256  const char *name,
257  const double values[]);
258 
259 /*----------------------------------------------------------------------------*/
267 /*----------------------------------------------------------------------------*/
268 
269 void
270 cs_paramedmem_field_import(cs_paramedmem_coupling_t *c,
271  const char *name,
272  double values[]);
273 
274 /*----------------------------------------------------------------------------*/
281 /*----------------------------------------------------------------------------*/
282 
283 void
284 cs_paramedmem_sync_dec(cs_paramedmem_coupling_t *c);
285 
286 /*----------------------------------------------------------------------------*/
293 /*----------------------------------------------------------------------------*/
294 
295 void
296 cs_paramedmem_send_data(cs_paramedmem_coupling_t *c);
297 
298 /*----------------------------------------------------------------------------*/
305 /*----------------------------------------------------------------------------*/
306 
307 void
308 cs_paramedmem_recv_data(cs_paramedmem_coupling_t *c);
309 
310 /*----------------------------------------------------------------------------*/
318 /*----------------------------------------------------------------------------*/
319 
320 void
321 cs_paramedmem_attach_field_by_id(cs_paramedmem_coupling_t *c,
322  int field_id);
323 
324 /*----------------------------------------------------------------------------*/
331 /*----------------------------------------------------------------------------*/
332 
333 void
334 cs_paramedmem_attach_field_by_name(cs_paramedmem_coupling_t *c,
335  const char *name);
336 
337 /*----------------------------------------------------------------------------*/
347 /*----------------------------------------------------------------------------*/
348 
349 void
350 cs_paramedmem_send_field_vals(cs_paramedmem_coupling_t *c,
351  const char *name,
352  const double *vals);
353 
354 /*----------------------------------------------------------------------------*/
363 /*----------------------------------------------------------------------------*/
364 
365 void
366 cs_paramedmem_recv_field_vals(cs_paramedmem_coupling_t *c,
367  const char *name,
368  double *vals);
369 
370 /*----------------------------------------------------------------------------*/
375 /*----------------------------------------------------------------------------*/
376 
377 void
379 
380 /*----------------------------------------------------------------------------*/
385 /*----------------------------------------------------------------------------*/
386 
387 void
389 
390 /*----------------------------------------------------------------------------*/
395 /*----------------------------------------------------------------------------*/
396 
397 void
399 
400 /*----------------------------------------------------------------------------*/
401 
403 
404 #endif /* __CS_PARAMEDMEM_HXX__ */
Definition: cs_paramedmem_coupling.h:64
void cs_paramedmem_send_data(cs_paramedmem_coupling_t *c)
Send values of field attached to DEC.
Definition: cs_paramedmem_coupling.cxx:959
cs_medcpl_field_nature_t
Definition: cs_paramedmem_coupling.h:59
Field descriptor.
Definition: cs_field.h:125
void cs_paramedmem_field_import(cs_paramedmem_coupling_t *c, const char *name, double values[])
Read values before sending operation.
Definition: cs_paramedmem_coupling.cxx:870
Definition: cs_paramedmem_coupling.h:62
cs_paramedmem_coupling_t * cs_paramedmem_coupling_by_id(int cpl_id)
Retrieve coupling struct pointer by id.
Definition: cs_paramedmem_coupling.cxx:248
#define BEGIN_C_DECLS
Definition: cs_defs.h:510
void cs_paramedmem_field_export(cs_paramedmem_coupling_t *c, const char *name, const double values[])
Write values before sending operation.
Definition: cs_paramedmem_coupling.cxx:809
void cs_paramedmem_recv_field_vals(cs_paramedmem_coupling_t *c, const char *name, double *vals)
Recieve values of a field.
Definition: cs_paramedmem_coupling.cxx:1121
cs_medcpl_time_discr_t
Definition: cs_paramedmem_coupling.h:53
Definition: cs_paramedmem_coupling.h:56
Definition: cs_paramedmem_coupling.h:55
int cs_paramedmem_def_coupled_field_from_cs_field(cs_paramedmem_coupling_t *c, cs_field_t *f, cs_medcpl_field_nature_t fn, cs_medcpl_time_discr_t td)
Define a coupled field based on a cs_field_t pointer.
Definition: cs_paramedmem_coupling.cxx:756
int cs_paramedmem_def_coupled_field(cs_paramedmem_coupling_t *c, const char *name, int dim, cs_medcpl_field_nature_t field_nature, cs_medcpl_space_discr_t space_discr, cs_medcpl_time_discr_t time_discr)
Define a coupled field.
Definition: cs_paramedmem_coupling.cxx:644
void cs_paramedmem_add_mesh_from_criteria(cs_paramedmem_coupling_t *c, const char *sel_crit, int elt_dim)
Define coupled mesh based on a selection criteria.
Definition: cs_paramedmem_coupling.cxx:471
Definition: cs_paramedmem_coupling.h:60
cs_medcpl_space_discr_t
Definition: cs_paramedmem_coupling.h:48
void cs_paramedmem_coupling_destroy(cs_paramedmem_coupling_t *c)
Destroy a given ParaMEDMEM coupling structure.
Definition: cs_paramedmem_coupling.cxx:414
double precision, dimension(ncharm), save fn
Definition: cs_coal_incl.f90:42
void cs_paramedmem_recv_data(cs_paramedmem_coupling_t *c)
Recieve values of field attached to DEC.
Definition: cs_paramedmem_coupling.cxx:985
void cs_paramedmem_coupling_define_mesh_fields(void)
initialize coupled mesh and fields based on user functions
Definition: cs_paramedmem_coupling.cxx:1213
Definition: cs_paramedmem_coupling.h:50
void cs_paramedmem_coupling_all_finalize(void)
Destroy all coupling structures.
Definition: cs_paramedmem_coupling.cxx:450
Definition: cs_paramedmem_coupling.h:61
void cs_paramedmem_add_mesh_from_zone(cs_paramedmem_coupling_t *c, const cs_zone_t *zone)
Define coupled mesh based on a cs_zone_t pointer.
Definition: cs_paramedmem_coupling.cxx:502
void cs_paramedmem_send_field_vals(cs_paramedmem_coupling_t *c, const char *name, const double *vals)
Send values of a field. If vals pointer is non-null, values are updated before send.
Definition: cs_paramedmem_coupling.cxx:1084
cs_paramedmem_coupling_t * cs_paramedmem_coupling_create(const char *app1_name, const char *app2_name, const char *cpl_name)
Create a new ParaMEDMEM coupling.
Definition: cs_paramedmem_coupling.cxx:323
void cs_paramedmem_coupling_all_init(void)
initialize couplings based on user functions
Definition: cs_paramedmem_coupling.cxx:1200
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:316
Definition: cs_paramedmem_coupling.h:49
Definition: cs_paramedmem_coupling.h:63
#define END_C_DECLS
Definition: cs_defs.h:511
Definition: cs_paramedmem_coupling.h:54
int cs_paramedmem_get_number_of_couplings(void)
Get number of defined couplings.
Definition: cs_paramedmem_coupling.cxx:546
void cs_paramedmem_coupling_log_setup(void)
Log ParaMEDMEM coupling setup information.
Definition: cs_paramedmem_coupling.cxx:1153
void cs_paramedmem_attach_field_by_name(cs_paramedmem_coupling_t *c, const char *name)
Attach a field to InterpKernelDEC for send operation using its name.
Definition: cs_paramedmem_coupling.cxx:1040
void cs_paramedmem_sync_dec(cs_paramedmem_coupling_t *c)
Sync the coupling's InterpKernelDEC.
Definition: cs_paramedmem_coupling.cxx:930
const cs_lnum_t * cs_paramedmem_mesh_get_elt_list(const cs_paramedmem_coupling_t *coupling)
Get indirection list for elements in coupled mesh.
Definition: cs_paramedmem_coupling.cxx:607
cs_paramedmem_coupling_t * cs_paramedmem_coupling_by_name(const char *name)
Retrieve coupling struct pointer by name.
Definition: cs_paramedmem_coupling.cxx:283
cs_lnum_t cs_paramedmem_mesh_get_n_elts(const cs_paramedmem_coupling_t *coupling)
Get number of elements of coupled mesh.
Definition: cs_paramedmem_coupling.cxx:576
void cs_paramedmem_attach_field_by_id(cs_paramedmem_coupling_t *c, int field_id)
Attach a field to InterpKernelDEC for send operation using its index.
Definition: cs_paramedmem_coupling.cxx:1012
Definition: cs_zone.h:55