Code_Saturne
CFD tool
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-2012 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 /*----------------------------------------------------------------------------
32  * Local headers
33  *----------------------------------------------------------------------------*/
34 
35 #include "fvm_defs.h"
36 #include "fvm_nodal.h"
37 #include "fvm_writer.h"
38 
39 /*----------------------------------------------------------------------------*/
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #if 0
44 } /* Fake brace to force back Emacs auto-indentation back to column 0 */
45 #endif
46 #endif /* __cplusplus */
47 
48 /*=============================================================================
49  * Macro definitions
50  *============================================================================*/
51 
52 /*============================================================================
53  * Type definitions
54  *============================================================================*/
55 
56 /*=============================================================================
57  * Public function prototypes
58  *============================================================================*/
59 
60 /*----------------------------------------------------------------------------
61  * Initialize FVM to EnSight Gold file writer.
62  *
63  * Options are:
64  * text output text files
65  * binary output binary files (default)
66  * big_endian force binary files to big-endian
67  * discard_polygons do not output polygons or related values
68  * discard_polyhedra do not output polyhedra or related values
69  * divide_polygons tesselate polygons with triangles
70  * divide_polyhedra tesselate polyhedra with tetrahedra and pyramids
71  * (adding a vertex near each polyhedron's center)
72  *
73  * parameters:
74  * name <-- base output case name.
75  * options <-- whitespace separated, lowercase options list
76  * time_dependecy <-- indicates if and how meshes will change with time
77  * comm <-- associated MPI communicator.
78  *
79  * returns:
80  * pointer to opaque EnSight Gold writer structure.
81  *----------------------------------------------------------------------------*/
82 
83 #if defined(HAVE_MPI)
84 
85 void *
86 fvm_to_ensight_init_writer(const char *name,
87  const char *path,
88  const char *options,
89  fvm_writer_time_dep_t time_dependency,
90  MPI_Comm comm);
91 
92 #else
93 
94 void *
95 fvm_to_ensight_init_writer(const char *name,
96  const char *path,
97  const char *options,
98  fvm_writer_time_dep_t time_dependency);
99 
100 #endif
101 
102 /*----------------------------------------------------------------------------
103  * Finalize FVM to EnSight Gold file writer.
104  *
105  * parameters:
106  * this_writer_p <-- pointer to opaque Ensight Gold writer structure.
107  *
108  * returns:
109  * NULL pointer.
110  *----------------------------------------------------------------------------*/
111 
112 void *
113 fvm_to_ensight_finalize_writer(void *this_writer_p);
114 
115 /*----------------------------------------------------------------------------
116  * Associate new time step with an EnSight geometry.
117  *
118  * parameters:
119  * this_writer_p <-- pointer to associated writer
120  * time_step <-- time step number
121  * time_value <-- time_value number
122  *----------------------------------------------------------------------------*/
123 
124 void
125 fvm_to_ensight_set_mesh_time(void *this_writer_p,
126  const int time_step,
127  const double time_value);
128 
129 /*----------------------------------------------------------------------------
130  * Indicate if a elements of a given type in a mesh associated to a given
131  * EnSight Gold file writer need to be tesselated.
132  *
133  * parameters:
134  * this_writer_p <-- pointer to associated writer
135  * mesh <-- pointer to nodal mesh structure that should be written
136  * element_type <-- element type we are interested in
137  *
138  * returns:
139  * 1 if tesselation of the given element type is needed, 0 otherwise
140  *----------------------------------------------------------------------------*/
141 
142 int
144  const fvm_nodal_t *mesh,
145  fvm_element_t element_type);
146 
147 /*----------------------------------------------------------------------------
148  * Write nodal mesh to a an EnSight Gold file
149  *
150  * parameters:
151  * this_writer_p <-- pointer to associated writer.
152  * mesh <-- pointer to nodal mesh structure that should be written.
153  *----------------------------------------------------------------------------*/
154 
155 void
156 fvm_to_ensight_export_nodal(void *this_writer_p,
157  const fvm_nodal_t *mesh);
158 
159 /*----------------------------------------------------------------------------
160  * Write field associated with a nodal mesh to an EnSight Gold file.
161  *
162  * Assigning a negative value to the time step indicates a time-independent
163  * field (in which case the time_value argument is unused).
164  *
165  * parameters:
166  * this_writer_p <-- pointer to associated writer
167  * mesh <-- pointer to associated nodal mesh structure
168  * name <-- variable name
169  * location <-- variable definition location (nodes or elements)
170  * dimension <-- variable dimension (0: constant, 1: scalar,
171  * 3: vector, 6: sym. tensor, 9: asym. tensor)
172  * interlace <-- indicates if variable in memory is interlaced
173  * n_parent_lists <-- indicates if variable values are to be obtained
174  * directly through the local entity index (when 0) or
175  * through the parent entity numbers (when 1 or more)
176  * parent_num_shift <-- parent number to value array index shifts;
177  * size: n_parent_lists
178  * datatype <-- indicates the data type of (source) field values
179  * time_step <-- number of the current time step
180  * time_value <-- associated time value
181  * field_values <-- array of associated field value arrays
182  *----------------------------------------------------------------------------*/
183 
184 void
185 fvm_to_ensight_export_field(void *this_writer_p,
186  const fvm_nodal_t *mesh,
187  const char *name,
188  fvm_writer_var_loc_t location,
189  int dimension,
190  cs_interlace_t interlace,
191  int n_parent_lists,
192  const cs_lnum_t parent_num_shift[],
193  cs_datatype_t datatype,
194  int time_step,
195  double time_value,
196  const void *const field_values[]);
197 
198 /*----------------------------------------------------------------------------*/
199 
200 #ifdef __cplusplus
201 }
202 #endif /* __cplusplus */
203 
204 #endif /* __FVM_TO_ENSIGHT_H__ */
cs_datatype_t
Definition: cs_defs.h:223
fvm_writer_var_loc_t
Definition: fvm_writer.h:70
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:3680
cs_interlace_t
Definition: cs_defs.h:347
Definition: fvm_nodal_priv.h:152
Definition: fvm_writer_priv.h:171
void fvm_to_ensight_set_mesh_time(void *this_writer_p, const int time_step, const double time_value)
Definition: fvm_to_ensight.c:3355
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
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:3221
void fvm_to_ensight_export_nodal(void *this_writer_p, const fvm_nodal_t *mesh)
Definition: fvm_to_ensight.c:3428
void * fvm_to_ensight_finalize_writer(void *this_writer_p)
Definition: fvm_to_ensight.c:3331
int fvm_to_ensight_needs_tesselation(fvm_writer_t *this_writer_p, const fvm_nodal_t *mesh, fvm_element_t element_type)
Definition: fvm_to_ensight.c:3381
Definition: mesh.f90:25