Code_Saturne
CFD tool
fvm_to_medcoupling.h
Go to the documentation of this file.
1 #ifndef __FVM_TO_MEDCOUPLING_H__
2 #define __FVM_TO_MEDCOUPLING_H__
3 
4 #if defined(HAVE_MEDCOUPLING)
5 
6 /*============================================================================
7  * Write a nodal representation associated with a mesh and associated
8  * variables to MEDCoupling objects
9  *============================================================================*/
10 
11 /*
12  This file is part of Code_Saturne, a general-purpose CFD tool.
13 
14  Copyright (C) 1998-2011 EDF S.A.
15 
16  This program is free software; you can redistribute it and/or modify it under
17  the terms of the GNU General Public License as published by the Free Software
18  Foundation; either version 2 of the License, or (at your option) any later
19  version.
20 
21  This program is distributed in the hope that it will be useful, but WITHOUT
22  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
23  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
24  details.
25 
26  You should have received a copy of the GNU General Public License along with
27  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
28  Street, Fifth Floor, Boston, MA 02110-1301, USA.
29 */
30 
31 /*----------------------------------------------------------------------------*/
32 
33 /*----------------------------------------------------------------------------
34  * Local headers
35  *----------------------------------------------------------------------------*/
36 
37 #include "fvm_defs.h"
38 #include "fvm_nodal.h"
39 #include "fvm_writer.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #if 0
46 } /* Fake brace to force back Emacs auto-indentation back to column 0 */
47 #endif
48 #endif /* __cplusplus */
49 
50 /*=============================================================================
51  * Macro definitions
52  *============================================================================*/
53 
54 /*============================================================================
55  * Type definitions
56  *============================================================================*/
57 
58 /*=============================================================================
59  * Public function prototypes
60  *============================================================================*/
61 
62 /*----------------------------------------------------------------------------
63  * Initialize FVM to MEDCoupling object writer.
64  *
65  * No options are available for this format.
66  *
67  * parameters:
68  * name <-- base output case name.
69  * options <-- whitespace separated, lowercase options list
70  * time_dependecy <-- indicates if and how meshes will change with time
71  * comm <-- associated MPI communicator.
72  *
73  * returns:
74  * pointer to opaque MEDCoupling writer structure.
75  *----------------------------------------------------------------------------*/
76 
77 #if defined(HAVE_MPI)
78 
79 void *
80 fvm_to_medcoupling_init_writer(const char *name,
81  const char *path,
82  const char *options,
83  fvm_writer_time_dep_t time_dependency,
84  MPI_Comm comm);
85 
86 #else
87 
88 void *
89 fvm_to_medcoupling_init_writer(const char *name,
90  const char *path,
91  const char *options,
92  fvm_writer_time_dep_t time_dependency);
93 
94 #endif
95 
96 /*----------------------------------------------------------------------------
97  * Finalize FVM to MEDCoupling object writer.
98  *
99  * parameters:
100  * this_writer_p <-- pointer to opaque MEDCoupling writer structure.
101  *
102  * returns:
103  * NULL pointer.
104  *----------------------------------------------------------------------------*/
105 
106 void *
107 fvm_to_medcoupling_finalize_writer(void *this_writer_p);
108 
109 /*----------------------------------------------------------------------------
110  * Associate new time step with a MEDCoupling geometry.
111  *
112  * parameters:
113  * this_writer_p <-- pointer to associated writer
114  * time_step <-- time step number
115  * time_value <-- time_value number
116  *----------------------------------------------------------------------------*/
117 
118 void
119 fvm_to_medcoupling_set_mesh_time(void *this_writer_p,
120  const int time_step,
121  const double time_value);
122 
123 /*----------------------------------------------------------------------------
124  * Write nodal mesh to a a MEDCoupling object
125  *
126  * parameters:
127  * this_writer_p <-- pointer to associated writer.
128  * mesh <-- pointer to nodal mesh structure that should be written.
129  *----------------------------------------------------------------------------*/
130 
131 void
132 fvm_to_medcoupling_export_nodal(void *this_writer_p,
133  const fvm_nodal_t *mesh);
134 
135 /*----------------------------------------------------------------------------
136  * Write field associated with a nodal mesh to a MEDCoupling object.
137  *
138  * Assigning a negative value to the time step indicates a time-independent
139  * field (in which case the time_value argument is unused).
140  *
141  * parameters:
142  * this_writer_p <-- pointer to associated writer
143  * mesh <-- pointer to associated nodal mesh structure
144  * name <-- variable name
145  * location <-- variable definition location (nodes or elements)
146  * dimension <-- variable dimension (0: constant, 1: scalar,
147  * 3: vector, 6: sym. tensor, 9: asym. tensor)
148  * interlace <-- indicates if variable in memory is interlaced
149  * n_parent_lists <-- indicates if variable values are to be obtained
150  * directly through the local entity index (when 0) or
151  * through the parent entity numbers (when 1 or more)
152  * parent_num_shift <-- parent number to value array index shifts;
153  * size: n_parent_lists
154  * datatype <-- indicates the data type of (source) field values
155  * time_step <-- number of the current time step
156  * time_value <-- associated time value
157  * field_values <-- array of associated field value arrays
158  *----------------------------------------------------------------------------*/
159 
160 void
161 fvm_to_medcoupling_export_field(void *this_writer_p,
162  const fvm_nodal_t *mesh,
163  const char *name,
164  fvm_writer_var_loc_t location,
165  int dimension,
166  cs_interlace_t interlace,
167  int n_parent_lists,
168  const cs_lnum_t parent_num_shift[],
169  cs_datatype_t datatype,
170  int time_step,
171  double time_value,
172  const void *const field_values[]);
173 
174 /*----------------------------------------------------------------------------*/
175 
176 #ifdef __cplusplus
177 }
178 #endif /* __cplusplus */
179 
180 #endif /* defined(HAVE_MEDCOUPLING) */
181 
182 #endif /* __FVM_TO_MEDCOUPLING_H__ */
cs_datatype_t
Definition: cs_defs.h:223
fvm_writer_var_loc_t
Definition: fvm_writer.h:70
cs_interlace_t
Definition: cs_defs.h:347
Definition: fvm_nodal_priv.h:152
fvm_writer_time_dep_t
Definition: fvm_writer.h:58
int cs_lnum_t
Definition: cs_defs.h:260
Definition: mesh.f90:25