Code_Saturne
CFD tool
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
fvm_to_ensight_case.h
Go to the documentation of this file.
1 #ifndef __FVM_TO_ENSIGHT_CASE_H__
2 #define __FVM_TO_ENSIGHT_CASE_H__
3 
4 /*============================================================================
5  * Manage case files associated with the EnSight Gold writer
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2012 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------*/
29 
30 /*----------------------------------------------------------------------------
31  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "fvm_defs.h"
35 #include "fvm_nodal.h"
36 #include "fvm_writer.h"
37 
38 /*----------------------------------------------------------------------------*/
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #if 0
43 } /* Fake brace to force back Emacs auto-indentation back to column 0 */
44 #endif
45 #endif /* __cplusplus */
46 
47 /*=============================================================================
48  * Macro definitions
49  *============================================================================*/
50 
51 /*============================================================================
52  * Type definitions
53  *============================================================================*/
54 
55 /* Opaque structure to manage case file */
56 
58 
59 /* Geometry or variable file info */
60 
61 typedef struct {
62 
63  const char * name; /* Pointer to file name */
64  _Bool queried; /* Indicates if this file name has already been
65  returned by "fvm_to_ensight_case_get_..._file()"
66  (so we can decide to create or append to it) */
67 
69 
70 /*=============================================================================
71  * Public function prototypes
72  *============================================================================*/
73 
74 /*----------------------------------------------------------------------------
75  * Create a new case file structure.
76  *
77  * parameters:
78  * name <-- case name
79  * dir_prefix <-- associated local or absolute directory name
80  * time_dependency <-- indicates if and how meshes will change with time
81  *
82  * returns:
83  * pointer to new case file structure
84  *----------------------------------------------------------------------------*/
85 
87 fvm_to_ensight_case_create(const char *const name,
88  const char *const dir_prefix,
89  const fvm_writer_time_dep_t time_dependency);
90 
91 /*----------------------------------------------------------------------------
92  * Destroy a case file structure.
93  *
94  * parameters:
95  * this_case <-- case structure
96  *
97  * returns:
98  * NULL pointer
99  *----------------------------------------------------------------------------*/
100 
103 
104 /*----------------------------------------------------------------------------
105  * Return time dependency status of an EnSight geometry.
106  *
107  * parameters:
108  * this_case <-- case structure
109  *
110  * returns:
111  * time dependency status
112  *----------------------------------------------------------------------------*/
113 
116 
117 /*----------------------------------------------------------------------------
118  * Associate new time step with an EnSight geometry.
119  *
120  * parameters:
121  * this_case <-- case structure
122  * time_step <-- time step number
123  * time_value <-- time_value number
124  *
125  * returns:
126  * 0 if no time was added, 1 if a new time was added
127  *----------------------------------------------------------------------------*/
128 
129 int
131  const int time_step,
132  const double time_value);
133 
134 /*----------------------------------------------------------------------------
135  * Return current file name and "queried" indicator associated with an
136  * EnSight geometry.
137  *
138  * The "queried" flag in the info structure is set to "false" the first
139  * time this function returns a given file name, and to "true" all other
140  * times.
141  *
142  * parameters:
143  * this_case <-- case structure
144  *
145  * returns:
146  * Info structure for geometry file
147  *----------------------------------------------------------------------------*/
148 
151 
152 /*----------------------------------------------------------------------------
153  * Associate a part name with a case and return its number.
154  * If the part was already associated, zero is returned.
155  *
156  * parameters:
157  * this_case <-- case structure
158  * part_name <-- part name
159  *
160  * returns:
161  * part number in case, or 0 if part already associated
162  *----------------------------------------------------------------------------*/
163 
164 int
166  const char *const part_name);
167 
168 /*----------------------------------------------------------------------------
169  * Return the part number associated with a given part name, or 0
170  *
171  * parameters:
172  * this_case <-- case structure
173  * part_name <-- part name
174  *
175  * returns:
176  * part number in case, or 0 if part name is not associated with this case
177  *----------------------------------------------------------------------------*/
178 
179 int
181  const char *const part_name);
182 
183 /*----------------------------------------------------------------------------
184  * Return current file name and "queried" indicator associated with an
185  * EnSight variable.
186  *
187  * The "queried" flag in the info structure is set to "false" the first
188  * time this function returns a given file name, and to "true" all other
189  * times.
190  *
191  * if the corresponding variable or physical time are not present in the
192  * structure, the necessary elements are added.
193  *
194  * parameters:
195  * this_case <-> pointer to structure that should be updated
196  * name <-- variable name
197  * dimension <-- variable dimension (0: constant, 1: scalar, 3: vector,
198  * 6: symmetrical tensor, 9: asymmetrical tensor)
199  * location <-- variable definition location (nodes, elements, or particles)
200  * time_step <-- number of time step to add
201  * time_value <-- associated time value
202  *
203  * returns:
204  * Info structure for file associated with the variable
205  *----------------------------------------------------------------------------*/
206 
209  const char *const name,
210  const int dimension,
211  const fvm_writer_var_loc_t location,
212  const int time_step,
213  const double time_value);
214 
215 /*----------------------------------------------------------------------------
216  * Write an EnSight Gold case file.
217  *
218  * parameters:
219  * this_case <-- case structure
220  * rank <-- calling rank in case of parallelism
221  *----------------------------------------------------------------------------*/
222 
223 void
225  int rank);
226 
227 /*----------------------------------------------------------------------------*/
228 
229 #ifdef __cplusplus
230 }
231 #endif /* __cplusplus */
232 
233 #endif /* __FVM_TO_ENSIGHT_CASE_H__ */
fvm_to_ensight_case_t * fvm_to_ensight_case_create(const char *const name, const char *const dir_prefix, const fvm_writer_time_dep_t time_dependency)
Definition: fvm_to_ensight_case.c:568
fvm_to_ensight_case_file_info_t fvm_to_ensight_case_get_var_file(fvm_to_ensight_case_t *const this_case, const char *const name, const int dimension, const fvm_writer_var_loc_t location, const int time_step, const double time_value)
Definition: fvm_to_ensight_case.c:879
fvm_writer_var_loc_t
Definition: fvm_writer.h:70
fvm_to_ensight_case_t * fvm_to_ensight_case_destroy(fvm_to_ensight_case_t *this_case)
Definition: fvm_to_ensight_case.c:661
Definition: fvm_to_ensight_case.c:109
fvm_writer_time_dep_t
Definition: fvm_writer.h:58
Definition: fvm_to_ensight_case.h:61
fvm_writer_time_dep_t fvm_to_ensight_case_get_time_dep(fvm_to_ensight_case_t *this_case)
Definition: fvm_to_ensight_case.c:707
_Bool queried
Definition: fvm_to_ensight_case.h:64
void fvm_to_ensight_case_write_case(fvm_to_ensight_case_t *this_case, int rank)
Definition: fvm_to_ensight_case.c:989
const char * name
Definition: fvm_to_ensight_case.h:63
fvm_to_ensight_case_file_info_t fvm_to_ensight_case_get_geom_file(fvm_to_ensight_case_t *const this_case)
Definition: fvm_to_ensight_case.c:770
int fvm_to_ensight_case_add_part(fvm_to_ensight_case_t *const this_case, const char *const part_name)
Definition: fvm_to_ensight_case.c:796
int fvm_to_ensight_case_get_part_num(fvm_to_ensight_case_t *const this_case, const char *const part_name)
Definition: fvm_to_ensight_case.c:834
#define _Bool
Definition: cs_defs.h:154
int fvm_to_ensight_case_set_geom_time(fvm_to_ensight_case_t *const this_case, const int time_step, const double time_value)
Definition: fvm_to_ensight_case.c:725