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