My Project
programmer's documentation
fvm_to_ensight.h
Go to the documentation of this file.
1 #ifndef __FVM_TO_ENSIGHT_H__
2 #define __FVM_TO_ENSIGHT_H__
3 
4 /*============================================================================
5  * Write a nodal representation associated with a mesh and associated
6  * variables to EnSight Gold files
7  *============================================================================*/
8 
9 /*
10  This file is part of Code_Saturne, a general-purpose CFD tool.
11 
12  Copyright (C) 1998-2019 EDF S.A.
13 
14  This program is free software; you can redistribute it and/or modify it under
15  the terms of the GNU General Public License as published by the Free Software
16  Foundation; either version 2 of the License, or (at your option) any later
17  version.
18 
19  This program is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
22  details.
23 
24  You should have received a copy of the GNU General Public License along with
25  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
26  Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 */
28 
29 /*----------------------------------------------------------------------------*/
30 
31 #include "cs_defs.h"
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 
44 
45 /*=============================================================================
46  * Macro definitions
47  *============================================================================*/
48 
49 /*============================================================================
50  * Type definitions
51  *============================================================================*/
52 
53 /*=============================================================================
54  * Public function prototypes
55  *============================================================================*/
56 
57 /*----------------------------------------------------------------------------
58  * Initialize FVM to EnSight Gold file writer.
59  *
60  * Options are:
61  * text output text files
62  * binary output binary files (default)
63  * big_endian force binary files to big-endian
64  * discard_polygons do not output polygons or related values
65  * discard_polyhedra do not output polyhedra or related values
66  * divide_polygons tesselate polygons with triangles
67  * divide_polyhedra tesselate polyhedra with tetrahedra and pyramids
68  * (adding a vertex near each polyhedron's center)
69  *
70  * parameters:
71  * name <-- base output case name.
72  * options <-- whitespace separated, lowercase options list
73  * time_dependecy <-- indicates if and how meshes will change with time
74  * comm <-- associated MPI communicator.
75  *
76  * returns:
77  * pointer to opaque EnSight Gold writer structure.
78  *----------------------------------------------------------------------------*/
79 
80 #if defined(HAVE_MPI)
81 
82 void *
83 fvm_to_ensight_init_writer(const char *name,
84  const char *path,
85  const char *options,
86  fvm_writer_time_dep_t time_dependency,
87  MPI_Comm comm);
88 
89 #else
90 
91 void *
92 fvm_to_ensight_init_writer(const char *name,
93  const char *path,
94  const char *options,
95  fvm_writer_time_dep_t time_dependency);
96 
97 #endif
98 
99 /*----------------------------------------------------------------------------
100  * Finalize FVM to EnSight Gold file writer.
101  *
102  * parameters:
103  * this_writer_p <-- pointer to opaque Ensight Gold writer structure.
104  *
105  * returns:
106  * NULL pointer.
107  *----------------------------------------------------------------------------*/
108 
109 void *
110 fvm_to_ensight_finalize_writer(void *this_writer_p);
111 
112 /*----------------------------------------------------------------------------
113  * Associate new time step with an EnSight geometry.
114  *
115  * parameters:
116  * this_writer_p <-- pointer to associated writer
117  * time_step <-- time step number
118  * time_value <-- time_value number
119  *----------------------------------------------------------------------------*/
120 
121 void
122 fvm_to_ensight_set_mesh_time(void *this_writer_p,
123  const int time_step,
124  const double time_value);
125 
126 /*----------------------------------------------------------------------------
127  * Indicate if a elements of a given type in a mesh associated to a given
128  * EnSight Gold file writer need to be tesselated.
129  *
130  * parameters:
131  * this_writer_p <-- pointer to associated writer
132  * mesh <-- pointer to nodal mesh structure that should be written
133  * element_type <-- element type we are interested in
134  *
135  * returns:
136  * 1 if tesselation of the given element type is needed, 0 otherwise
137  *----------------------------------------------------------------------------*/
138 
139 int
140 fvm_to_ensight_needs_tesselation(void *this_writer_p,
141  const fvm_nodal_t *mesh,
142  fvm_element_t element_type);
143 
144 /*----------------------------------------------------------------------------
145  * Write nodal mesh to a an EnSight Gold file
146  *
147  * parameters:
148  * this_writer_p <-- pointer to associated writer.
149  * mesh <-- pointer to nodal mesh structure that should be written.
150  *----------------------------------------------------------------------------*/
151 
152 void
153 fvm_to_ensight_export_nodal(void *this_writer_p,
154  const fvm_nodal_t *mesh);
155 
156 /*----------------------------------------------------------------------------
157  * Write field associated with a nodal mesh to an EnSight Gold file.
158  *
159  * Assigning a negative value to the time step indicates a time-independent
160  * field (in which case the time_value argument is unused).
161  *
162  * parameters:
163  * this_writer_p <-- pointer to associated writer
164  * mesh <-- pointer to associated nodal mesh structure
165  * name <-- variable name
166  * location <-- variable definition location (nodes or elements)
167  * dimension <-- variable dimension (0: constant, 1: scalar,
168  * 3: vector, 6: sym. tensor, 9: asym. tensor)
169  * interlace <-- indicates if variable in memory is interlaced
170  * n_parent_lists <-- indicates if variable values are to be obtained
171  * directly through the local entity index (when 0) or
172  * through the parent entity numbers (when 1 or more)
173  * parent_num_shift <-- parent number to value array index shifts;
174  * size: n_parent_lists
175  * datatype <-- indicates the data type of (source) field values
176  * time_step <-- number of the current time step
177  * time_value <-- associated time value
178  * field_values <-- array of associated field value arrays
179  *----------------------------------------------------------------------------*/
180 
181 void
182 fvm_to_ensight_export_field(void *this_writer_p,
183  const fvm_nodal_t *mesh,
184  const char *name,
185  fvm_writer_var_loc_t location,
186  int dimension,
187  cs_interlace_t interlace,
188  int n_parent_lists,
189  const cs_lnum_t parent_num_shift[],
190  cs_datatype_t datatype,
191  int time_step,
192  double time_value,
193  const void *const field_values[]);
194 
195 /*----------------------------------------------------------------------------*/
196 
198 
199 #endif /* __FVM_TO_ENSIGHT_H__ */
fvm_writer_var_loc_t
fvm_writer_var_loc_t
Definition: fvm_writer.h:69
cs_defs.h
fvm_to_ensight_export_field
void fvm_to_ensight_export_field(void *this_writer_p, const fvm_nodal_t *mesh, const char *name, fvm_writer_var_loc_t location, int dimension, cs_interlace_t interlace, int n_parent_lists, const cs_lnum_t parent_num_shift[], cs_datatype_t datatype, int time_step, double time_value, const void *const field_values[])
Definition: fvm_to_ensight.c:3023
fvm_to_ensight_export_nodal
void fvm_to_ensight_export_nodal(void *this_writer_p, const fvm_nodal_t *mesh)
Definition: fvm_to_ensight.c:2770
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
fvm_writer.h
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
mesh
Definition: mesh.f90:26
cs_datatype_t
cs_datatype_t
Definition: cs_defs.h:260
fvm_element_t
fvm_element_t
Definition: fvm_defs.h:48
fvm_to_ensight_needs_tesselation
int fvm_to_ensight_needs_tesselation(void *this_writer_p, const fvm_nodal_t *mesh, fvm_element_t element_type)
Definition: fvm_to_ensight.c:2723
fvm_writer_time_dep_t
fvm_writer_time_dep_t
Definition: fvm_writer.h:57
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
cs_interlace_t
cs_interlace_t
Definition: cs_defs.h:439
fvm_nodal.h
fvm_defs.h
fvm_to_ensight_finalize_writer
void * fvm_to_ensight_finalize_writer(void *this_writer_p)
Definition: fvm_to_ensight.c:2673
fvm_to_ensight_set_mesh_time
void fvm_to_ensight_set_mesh_time(void *this_writer_p, const int time_step, const double time_value)
Definition: fvm_to_ensight.c:2697
fvm_to_ensight_init_writer
void * fvm_to_ensight_init_writer(const char *name, const char *path, const char *options, fvm_writer_time_dep_t time_dependency)
Definition: fvm_to_ensight.c:2553