8.3
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 * MEDCoupling ParaMESH/ParaFIELD wrapper functions.
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2024 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#include "cs_field.h"
35#include "cs_zone.h"
36
37/*============================================================================
38 * Structure definitions
39 *============================================================================*/
40
41typedef struct _cs_paramedmem_coupling_t cs_paramedmem_coupling_t;
42
43/*----------------------------------------------------------------------------*/
44
46
47/*============================================================================
48 * Global variable definitions
49 *============================================================================*/
50
51typedef enum {
55
56typedef enum {
61
62typedef enum {
69
70/*============================================================================
71 * Public C++ function prototypes
72 *============================================================================*/
73
74/*----------------------------------------------------------------------------*/
83/*----------------------------------------------------------------------------*/
84
85cs_paramedmem_coupling_t *
87
88/*----------------------------------------------------------------------------*/
96/*----------------------------------------------------------------------------*/
97
98cs_paramedmem_coupling_t *
99cs_paramedmem_coupling_by_name(const char *name);
100
101/*----------------------------------------------------------------------------*/
112/*----------------------------------------------------------------------------*/
113
114cs_paramedmem_coupling_t *
115cs_paramedmem_coupling_create(const char *app1_name,
116 const char *app2_name,
117 const char *cpl_name);
118
119/*----------------------------------------------------------------------------*/
135/*----------------------------------------------------------------------------*/
136
137cs_paramedmem_coupling_t *
138cs_paramedmem_coupling_create_uncoupled(const char *cpl_name);
139
140/*----------------------------------------------------------------------------*/
146/*----------------------------------------------------------------------------*/
147
148void
149cs_paramedmem_coupling_destroy(cs_paramedmem_coupling_t *c);
150
151/*----------------------------------------------------------------------------*/
155/*----------------------------------------------------------------------------*/
156
157void
159
160/*----------------------------------------------------------------------------*/
168/*----------------------------------------------------------------------------*/
169
170void
171cs_paramedmem_add_mesh_from_criteria(cs_paramedmem_coupling_t *c,
172 const char *sel_crit,
173 int elt_dim);
174
175/*----------------------------------------------------------------------------*/
182/*----------------------------------------------------------------------------*/
183
184void
185cs_paramedmem_add_mesh_from_zone(cs_paramedmem_coupling_t *c,
186 const cs_zone_t *zone);
187
188/*----------------------------------------------------------------------------*/
197/*----------------------------------------------------------------------------*/
198
199void
200cs_paramedmem_add_mesh_from_ids(cs_paramedmem_coupling_t *c,
201 cs_lnum_t n_elts,
202 const cs_lnum_t elt_ids[],
203 int elt_dim);
204
205/*----------------------------------------------------------------------------*/
211/*----------------------------------------------------------------------------*/
212
213int
215
216/*----------------------------------------------------------------------------*/
224/*----------------------------------------------------------------------------*/
225
227cs_paramedmem_mesh_get_n_elts(const cs_paramedmem_coupling_t *coupling);
228
229/*----------------------------------------------------------------------------*/
237/*----------------------------------------------------------------------------*/
238
239const cs_lnum_t *
240cs_paramedmem_mesh_get_elt_list(const cs_paramedmem_coupling_t *coupling);
241
242/*----------------------------------------------------------------------------*/
250/*----------------------------------------------------------------------------*/
251
253cs_paramedmem_mesh_get_n_vertices(const cs_paramedmem_coupling_t *coupling);
254
255/*----------------------------------------------------------------------------*/
263/*----------------------------------------------------------------------------*/
264
265const cs_lnum_t *
266cs_paramedmem_mesh_get_vertex_list(const cs_paramedmem_coupling_t *coupling);
267
268/*----------------------------------------------------------------------------*/
281/*----------------------------------------------------------------------------*/
282
283int
284cs_paramedmem_def_coupled_field(cs_paramedmem_coupling_t *c,
285 const char *name,
286 int dim,
287 cs_medcpl_field_nature_t field_nature,
288 cs_medcpl_space_discr_t space_discr,
289 cs_medcpl_time_discr_t time_discr);
290
291/*----------------------------------------------------------------------------*/
302/*----------------------------------------------------------------------------*/
303
304int
305cs_paramedmem_def_coupled_field_from_cs_field(cs_paramedmem_coupling_t *c,
306 cs_field_t *f,
309
310/*----------------------------------------------------------------------------*/
320/*----------------------------------------------------------------------------*/
321
322void
323cs_paramedmem_field_export(cs_paramedmem_coupling_t *c,
324 const char *name,
325 const double values[]);
326
327/*----------------------------------------------------------------------------*/
340/*----------------------------------------------------------------------------*/
341
342void
343cs_paramedmem_field_export_l(cs_paramedmem_coupling_t *c,
344 const char *name,
345 const double values[]);
346
347/*----------------------------------------------------------------------------*/
356/*----------------------------------------------------------------------------*/
357
358void
359cs_paramedmem_field_import(cs_paramedmem_coupling_t *c,
360 const char *name,
361 double values[]);
362
363/*----------------------------------------------------------------------------*/
376/*----------------------------------------------------------------------------*/
377
378void
379cs_paramedmem_field_import_l(cs_paramedmem_coupling_t *c,
380 const char *name,
381 double values[]);
382
383/*----------------------------------------------------------------------------*/
389/*----------------------------------------------------------------------------*/
390
391void
392cs_paramedmem_sync_dec(cs_paramedmem_coupling_t *c);
393
394/*----------------------------------------------------------------------------*/
400/*----------------------------------------------------------------------------*/
401
402void
403cs_paramedmem_send_data(cs_paramedmem_coupling_t *c);
404
405/*----------------------------------------------------------------------------*/
411/*----------------------------------------------------------------------------*/
412
413void
414cs_paramedmem_recv_data(cs_paramedmem_coupling_t *c);
415
416/*----------------------------------------------------------------------------*/
423/*----------------------------------------------------------------------------*/
424
425void
426cs_paramedmem_attach_field_by_id(cs_paramedmem_coupling_t *c,
427 int field_id);
428
429/*----------------------------------------------------------------------------*/
436/*----------------------------------------------------------------------------*/
437
438void
439cs_paramedmem_attach_field_by_name(cs_paramedmem_coupling_t *c,
440 const char *name);
441
442/*----------------------------------------------------------------------------*/
451/*----------------------------------------------------------------------------*/
452
453void
454cs_paramedmem_send_field_vals(cs_paramedmem_coupling_t *c,
455 const char *name,
456 const double *vals);
457
458/*----------------------------------------------------------------------------*/
467/*----------------------------------------------------------------------------*/
468
469void
470cs_paramedmem_send_field_vals_l(cs_paramedmem_coupling_t *c,
471 const char *name,
472 const double *vals);
473
474/*----------------------------------------------------------------------------*/
482/*----------------------------------------------------------------------------*/
483
484void
485cs_paramedmem_recv_field_vals(cs_paramedmem_coupling_t *c,
486 const char *name,
487 double *vals);
488
489/*----------------------------------------------------------------------------*/
497/*----------------------------------------------------------------------------*/
498
499void
500cs_paramedmem_recv_field_vals_l(cs_paramedmem_coupling_t *c,
501 const char *name,
502 double *vals);
503
504/*----------------------------------------------------------------------------*/
508/*----------------------------------------------------------------------------*/
509
510void
512
513/*----------------------------------------------------------------------------*/
517/*----------------------------------------------------------------------------*/
518
519void
521
522/*----------------------------------------------------------------------------*/
526/*----------------------------------------------------------------------------*/
527
528void
530
531/*----------------------------------------------------------------------------*/
532
534
535#endif /* __CS_PARAMEDMEM_HXX__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
#define END_C_DECLS
Definition: cs_defs.h:543
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
void cs_paramedmem_coupling_destroy(cs_paramedmem_coupling_t *c)
Destroy a given ParaMEDMEM coupling structure.
Definition: cs_paramedmem_coupling.cxx:578
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:637
void cs_paramedmem_send_field_vals_l(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:1532
void cs_paramedmem_coupling_define_mesh_fields(void)
initialize coupled mesh and fields based on user functions
Definition: cs_paramedmem_coupling.cxx:1698
void cs_paramedmem_field_export_l(cs_paramedmem_coupling_t *c, const char *name, const double values[])
Assign values based on mesh location corresponding to coupled elements (and associated ParaMESH) to a...
Definition: cs_paramedmem_coupling.cxx:1180
cs_paramedmem_coupling_t * cs_paramedmem_coupling_by_name(const char *name)
Retrieve coupling struct pointer by name.
Definition: cs_paramedmem_coupling.cxx:401
cs_medcpl_field_nature_t
Definition: cs_paramedmem_coupling.h:62
@ CS_MEDCPL_FIELD_EXT_CONSERVATION
Definition: cs_paramedmem_coupling.h:65
@ CS_MEDCPL_FIELD_EXT_MAXIMUM
Definition: cs_paramedmem_coupling.h:66
@ CS_MEDCPL_FIELD_INT_CONSERVATION
Definition: cs_paramedmem_coupling.h:63
@ CS_MEDCPL_FIELD_INT_MAXIMUM
Definition: cs_paramedmem_coupling.h:64
@ CS_MEDCPL_FIELD_N_NATURE
Definition: cs_paramedmem_coupling.h:67
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:441
void cs_paramedmem_send_data(cs_paramedmem_coupling_t *c)
Send values of field attached to DEC.
Definition: cs_paramedmem_coupling.cxx:1345
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:1427
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:908
cs_lnum_t cs_paramedmem_mesh_get_n_vertices(const cs_paramedmem_coupling_t *coupling)
Get number of vertices of coupled mesh.
Definition: cs_paramedmem_coupling.cxx:840
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:668
const cs_lnum_t * cs_paramedmem_mesh_get_vertex_list(const cs_paramedmem_coupling_t *coupling)
Get indirection list for vertices in coupled mesh.
Definition: cs_paramedmem_coupling.cxx:872
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:809
int cs_paramedmem_get_number_of_couplings(void)
Get number of defined couplings.
Definition: cs_paramedmem_coupling.cxx:748
cs_paramedmem_coupling_t * cs_paramedmem_coupling_by_id(int cpl_id)
Retrieve coupling struct pointer by id.
Definition: cs_paramedmem_coupling.cxx:366
cs_paramedmem_coupling_t * cs_paramedmem_coupling_create_uncoupled(const char *cpl_name)
Create a new ParaMEDMEM handler structure with no actual coupling.
Definition: cs_paramedmem_coupling.cxx:543
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:1398
void cs_paramedmem_recv_field_vals_l(cs_paramedmem_coupling_t *c, const char *name, double *vals)
Recieve values of a field.
Definition: cs_paramedmem_coupling.cxx:1607
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:778
void cs_paramedmem_field_import(cs_paramedmem_coupling_t *c, const char *name, double values[])
Copy values from associated ParaFIELD object to array defined parent mesh location.
Definition: cs_paramedmem_coupling.cxx:1219
void cs_paramedmem_coupling_all_finalize(void)
Destroy all coupling structures.
Definition: cs_paramedmem_coupling.cxx:616
void cs_paramedmem_coupling_all_init(void)
initialize couplings based on user functions
Definition: cs_paramedmem_coupling.cxx:1686
cs_medcpl_time_discr_t
Definition: cs_paramedmem_coupling.h:56
@ CS_MEDCPL_NO_TIME
Definition: cs_paramedmem_coupling.h:57
@ CS_MEDCPL_ONE_TIME
Definition: cs_paramedmem_coupling.h:58
@ CS_MEDCPL_LINEAR_TIME
Definition: cs_paramedmem_coupling.h:59
cs_medcpl_space_discr_t
Definition: cs_paramedmem_coupling.h:51
@ CS_MEDCPL_ON_NODES
Definition: cs_paramedmem_coupling.h:53
@ CS_MEDCPL_ON_CELLS
Definition: cs_paramedmem_coupling.h:52
void cs_paramedmem_sync_dec(cs_paramedmem_coupling_t *c)
Sync the coupling's InterpKernelDEC.
Definition: cs_paramedmem_coupling.cxx:1316
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:1493
void cs_paramedmem_recv_data(cs_paramedmem_coupling_t *c)
Recieve values of field attached to DEC.
Definition: cs_paramedmem_coupling.cxx:1371
void cs_paramedmem_add_mesh_from_ids(cs_paramedmem_coupling_t *c, cs_lnum_t n_elts, const cs_lnum_t elt_ids[], int elt_dim)
Define coupled mesh based on a cs_zone_t pointer.
Definition: cs_paramedmem_coupling.cxx:716
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:1059
void cs_paramedmem_field_import_l(cs_paramedmem_coupling_t *c, const char *name, double values[])
Copy values from associated ParaFIELD structure to array defined on mesh location corresponding to co...
Definition: cs_paramedmem_coupling.cxx:1279
void cs_paramedmem_field_export(cs_paramedmem_coupling_t *c, const char *name, const double values[])
Assign values based on parent mesh location to associated ParaFIELD objects.
Definition: cs_paramedmem_coupling.cxx:1115
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:1570
void cs_paramedmem_coupling_log_setup(void)
Log ParaMEDMEM coupling setup information.
Definition: cs_paramedmem_coupling.cxx:1640
real(c_double), dimension(:), pointer, save fn
Definition: cs_coal_incl.f90:42
Field descriptor.
Definition: cs_field.h:131
Definition: cs_zone.h:55