8.3
general documentation
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-2024 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
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
66int
67fvm_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
91const char *
92fvm_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_bcs do not output boundary conditions
100 * discard_steady discard steady solution data
101 * (to avoid issues with some tools when both steady
102 * and unsteady data is present)
103 * discard_polygons do not output polygons or related values
104 * discard_polyhedra do not output polyhedra or related values
105 * divide_polygons tesselate polygons with triangles
106 * preserve_precision do not convert double precision to single
107 * precision types (leads to larger files)
108 * adf use ADF file type
109 * hdf5 use HDF5 file type (default if available)
110 * links split output to separate files using links
111 *
112 * As CGNS does not handle polyhedral elements in a simple manner,
113 * polyhedra are automatically tesselated with tetrahedra and pyramids
114 * (adding a vertex near each polyhedron's center) unless discarded.
115 *
116 * parameters:
117 * name <-- base output case name.
118 * options <-- whitespace separated, lowercase options list
119 * time_dependecy <-- indicates if and how meshes will change with time
120 * comm <-- associated MPI communicator.
121 *
122 * returns:
123 * pointer to opaque CGNS writer structure.
124 *----------------------------------------------------------------------------*/
125
126#if defined(HAVE_MPI)
127
128void *
129fvm_to_cgns_init_writer(const char *name,
130 const char *path,
131 const char *options,
132 fvm_writer_time_dep_t time_dependency,
133 MPI_Comm comm);
134
135#else
136
137void *
138fvm_to_cgns_init_writer(const char *name,
139 const char *path,
140 const char *options,
141 fvm_writer_time_dep_t time_dependency);
142
143#endif
144
145/*----------------------------------------------------------------------------
146 * Finalize FVM to CGNS file writer.
147 *
148 * parameters:
149 * this_writer_p <-- pointer to opaque CGNS writer structure.
150 *
151 * returns:
152 * null pointer.
153 *----------------------------------------------------------------------------*/
154
155void *
156fvm_to_cgns_finalize_writer(void *this_writer_p);
157
158/*----------------------------------------------------------------------------
159 * Associate new time step with a CGNS geometry.
160 *
161 * parameters:
162 * this_writer_p <-- pointer to associated writer
163 * time_step <-- time step number
164 * time_value <-- time_value number
165 *----------------------------------------------------------------------------*/
166
167void
168fvm_to_cgns_set_mesh_time(void *this_writer_p,
169 int time_step,
170 double time_value);
171
172/*----------------------------------------------------------------------------
173 * Indicate if elements of a given type in a mesh associated with a given
174 * CGNS file writer need to be tesselated.
175 *
176 * parameters:
177 * this_writer_p <-- pointer to associated writer
178 * mesh <-- pointer to nodal mesh structure that should be written
179 * element_type <-- element type we are interested in
180 *
181 * returns:
182 * 1 if tesselation of the given element type is needed, 0 otherwise
183 *----------------------------------------------------------------------------*/
184
185int
186fvm_to_cgns_needs_tesselation(void *this_writer_p,
187 const fvm_nodal_t *mesh,
188 fvm_element_t element_type);
189
190/*----------------------------------------------------------------------------
191 * Write nodal mesh to a CGNS file
192 *
193 * parameters:
194 * this_writer_p <-- pointer to associated writer.
195 * mesh <-- pointer to nodal mesh structure that should be written.
196 *----------------------------------------------------------------------------*/
197
198void
199fvm_to_cgns_export_nodal(void *this_writer_p,
200 const fvm_nodal_t *mesh);
201
202/*----------------------------------------------------------------------------
203 * Write field associated with a nodal mesh to a CGNS file.
204 *
205 * Assigning a negative value to the time step indicates a time-independent
206 * field (in which case the time_value argument is unused).
207 *
208 * parameters:
209 * this_writer_p <-- pointer to associated writer
210 * mesh <-- pointer to associated nodal mesh structure
211 * name <-- variable name
212 * location <-- variable definition location (nodes or elements)
213 * dimension <-- variable dimension (0: constant, 1: scalar,
214 * 3: vector, 6: sym. tensor, 9: asym. tensor)
215 * interlace <-- indicates if variable in memory is interlaced
216 * n_parent_lists <-- indicates if variable values are to be obtained
217 * directly through the local entity index (when 0) or
218 * through the parent entity numbers (when 1 or more)
219 * parent_num_shift <-- parent number to value array index shifts;
220 * size: n_parent_lists
221 * datatype <-- indicates the data type of (source) field values
222 * time_step <-- number of the current time step
223 * time_value <-- associated time value
224 * field_values <-- array of associated field value arrays
225 *----------------------------------------------------------------------------*/
226
227void
228fvm_to_cgns_export_field(void *this_writer_p,
229 const fvm_nodal_t *mesh,
230 const char *name,
231 fvm_writer_var_loc_t location,
232 int dimension,
233 cs_interlace_t interlace,
234 int n_parent_lists,
235 const cs_lnum_t parent_num_shift[],
236 cs_datatype_t datatype,
237 int time_step,
238 double time_value,
239 const void *const field_values[]);
240
241/*----------------------------------------------------------------------------
242 * Flush files associated with a given writer.
243 *
244 * parameters:
245 * this_writer_p <-- pointer to associated writer
246 *----------------------------------------------------------------------------*/
247
248void
249fvm_to_cgns_flush(void *this_writer_p);
250
251/*----------------------------------------------------------------------------*/
252
254
255#endif /* HAVE_CGNS */
256
257#endif /* __FVM_TO_CGNS_H__ */
cs_datatype_t
Definition: cs_defs.h:300
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
cs_interlace_t
Definition: cs_defs.h:514
#define END_C_DECLS
Definition: cs_defs.h:543
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
fvm_element_t
Definition: fvm_defs.h:48
fvm_writer_time_dep_t
Definition: fvm_writer.h:57
fvm_writer_var_loc_t
Definition: fvm_writer.h:69
Definition: mesh.f90:26