Code_Saturne
CFD tool
fvm_to_med.h
Go to the documentation of this file.
1 #ifndef __FVM_TO_MED_H__
2 #define __FVM_TO_MED_H__
3 
4 #if defined(HAVE_MED)
5 
6 /*============================================================================
7  * Write a nodal representation associated with a mesh and associated
8  * variables to MED files
9  *============================================================================*/
10 
11 /*
12  This file is part of Code_Saturne, a general-purpose CFD tool.
13 
14  Copyright (C) 1998-2012 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  * Returns number of library version strings associated with the MED format.
64  *
65  * The first associated version string should corresponds to the MED library,
66  * The second to the HDF5 library.
67  *
68  * returns:
69  * number of library version strings associated with the MED format.
70  *----------------------------------------------------------------------------*/
71 
72 int
73 fvm_to_med_n_version_strings(void);
74 
75 /*----------------------------------------------------------------------------
76  * Returns a library version string associated with the MED format.
77  *
78  * The first associated version string should corresponds to the MED library,
79  * The second to the HDF5 library.
80  *
81  * In certain cases, when using dynamic libraries, fvm may be compiled
82  * with one library version, and linked with another. If both run-time
83  * and compile-time version information is available, this function
84  * will return the run-time version string by default.
85  *
86  * Setting the compile_time flag to 1, the compile-time version string
87  * will be returned if this is different from the run-time version.
88  * If the version is the same, or only one of the 2 version strings are
89  * available, a NULL character string will be returned with this flag set.
90  *
91  * parameters:
92  * string_index <-- index in format's version string list (0 to n-1)
93  * compile_time <-- 0 by default, 1 if we want the compile-time version
94  * string, if different from the run-time version.
95  *
96  * returns:
97  * pointer to constant string containing the library's version.
98  *----------------------------------------------------------------------------*/
99 
100 const char *
101 fvm_to_med_version_string(int string_index,
102  int compile_time_version);
103 
104 /*----------------------------------------------------------------------------
105  * Initialize FVM to MED file writer.
106  *
107  * Options are:
108  * discard_polygons do not output polygons or related values
109  * discard_polyhedra do not output polyhedra or related values
110  * divide_polygons tesselate polygons with triangles
111  * divide_polyhedra tesselate polyhedra with tetrahedra and pyramids
112  * (adding a vertex near each polyhedron's center)
113  *
114  * parameters:
115  * name <-- base output case name.
116  * options <-- whitespace separated, lowercase options list
117  * time_dependecy <-- indicates if and how meshes will change with time
118  * comm <-- associated MPI communicator.
119  *
120  * returns:
121  * pointer to opaque MED writer structure.
122  *----------------------------------------------------------------------------*/
123 
124 #if defined(HAVE_MPI)
125 
126 void *
127 fvm_to_med_init_writer(const char *const name,
128  const char *const path,
129  const char *const options,
130  const fvm_writer_time_dep_t time_dependency,
131  const MPI_Comm comm);
132 
133 #else
134 
135 void *
136 fvm_to_med_init_writer(const char *const name,
137  const char *const path,
138  const char *const options,
139  const fvm_writer_time_dep_t time_dependency);
140 
141 #endif
142 
143 /*----------------------------------------------------------------------------
144  * Finalize FVM to MED file writer.
145  *
146  * parameters:
147  * this_writer_p <-- pointer to opaque MED writer structure.
148  *
149  * returns:
150  * NULL pointer.
151  *----------------------------------------------------------------------------*/
152 
153 void *
154 fvm_to_med_finalize_writer(void *this_writer_p);
155 
156 /*----------------------------------------------------------------------------
157  * Indicate if a elements of a given type in a mesh associated to a given
158  * MED file writer need to be tesselated.
159  *
160  * parameters:
161  * this_writer <-- pointer to associated writer
162  * mesh <-- pointer to nodal mesh structure that should be written
163  * element_type <-- element type we are interested in
164  *
165  * returns:
166  * 1 if tesselation of the given element type is needed, 0 otherwise
167  *----------------------------------------------------------------------------*/
168 
169 int
170 fvm_to_med_needs_tesselation(fvm_writer_t *this_writer,
171  const fvm_nodal_t *mesh,
172  fvm_element_t element_type);
173 
174 /*----------------------------------------------------------------------------
175  * Associate new time step with a MED mesh.
176  *
177  * parameters:
178  * this_writer <-- pointer to associated writer
179  * time_step <-- time step number
180  * time_value <-- time_value number
181  *----------------------------------------------------------------------------*/
182 
183 void
184 fvm_to_med_set_mesh_time(void *const this_writer,
185  const int time_step,
186  const double time_value);
187 
188 /*----------------------------------------------------------------------------
189  * Write nodal mesh to a MED file
190  *
191  * parameters:
192  * this_writer_p <-- pointer to associated writer.
193  * mesh <-- pointer to nodal mesh structure that should be written.
194  *----------------------------------------------------------------------------*/
195 
196 void
197 fvm_to_med_export_nodal(void *const this_writer_p,
198  const fvm_nodal_t *const mesh);
199 
200 /*----------------------------------------------------------------------------
201  * Write field associated with a nodal mesh to a MED file.
202  *
203  * Assigning a negative value to the time step indicates a time-independent
204  * field (in which case the time_value argument is unused).
205  *
206  * parameters:
207  * this_writer_p <-- pointer to associated writer
208  * mesh <-- pointer to associated nodal mesh structure
209  * name <-- variable name
210  * location <-- variable definition location (nodes or elements)
211  * dimension <-- variable dimension (0: constant, 1: scalar,
212  * 3: vector, 6: sym. tensor, 9: asym. tensor)
213  * interlace <-- indicates if variable in memory is interlaced
214  * n_parent_lists <-- indicates if variable values are to be obtained
215  * directly through the local entity index (when 0) or
216  * through the parent entity numbers (when 1 or more)
217  * parent_num_shift <-- parent number to value array index shifts;
218  * size: n_parent_lists
219  * datatype <-- indicates the data type of (source) field values
220  * time_step <-- number of the current time step
221  * time_value <-- associated time value
222  * field_values <-- array of associated field value arrays
223  *----------------------------------------------------------------------------*/
224 
225 void
226 fvm_to_med_export_field(void *const this_writer,
227  const fvm_nodal_t *const mesh,
228  const char *const name,
229  const fvm_writer_var_loc_t location,
230  const int dimension,
231  const cs_interlace_t interlace,
232  const int n_parent_lists,
233  const cs_lnum_t parent_num_shift[],
234  const cs_datatype_t datatype,
235  const int time_step,
236  const double time_value,
237  const void *const field_values[]);
238 
239 /*----------------------------------------------------------------------------*/
240 
241 #ifdef __cplusplus
242 }
243 #endif /* __cplusplus */
244 
245 #endif /* __FVM_TO_MED_H__ */
246 
247 #endif /* HAVE_MED */
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
Definition: fvm_writer_priv.h:171
fvm_writer_time_dep_t
Definition: fvm_writer.h:58
fvm_element_t
Definition: fvm_defs.h:49
int cs_lnum_t
Definition: cs_defs.h:260
Definition: mesh.f90:25