src/fvm/fvm_to_med.h Source File

| programmer's documentation

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

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