My Project
programmer's documentation
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-2019 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 #include "cs_defs.h"
31 
32 /*----------------------------------------------------------------------------
33  * Local headers
34  *----------------------------------------------------------------------------*/
35 
36 #include "fvm_defs.h"
37 #include "fvm_nodal.h"
38 #include "fvm_writer.h"
39 
40 /*----------------------------------------------------------------------------*/
41 
43 
44 /*=============================================================================
45  * Macro definitions
46  *============================================================================*/
47 
48 /*============================================================================
49  * Type definitions
50  *============================================================================*/
51 
52 /* Opaque structure to manage case file */
53 
54 typedef struct _fvm_to_ensight_case_t fvm_to_ensight_case_t;
55 
56 /* Geometry or variable file info */
57 
58 typedef struct {
59 
60  const char * name; /* Pointer to file name */
61  bool queried; /* Indicates if this file name has already been
62  returned by "fvm_to_ensight_case_get_..._file()"
63  (so we can decide to create or append to it) */
64 
66 
67 /*=============================================================================
68  * Public function prototypes
69  *============================================================================*/
70 
71 /*----------------------------------------------------------------------------
72  * Create a new case file structure.
73  *
74  * parameters:
75  * name <-- case name
76  * dir_prefix <-- associated local or absolute directory name
77  * time_dependency <-- indicates if and how meshes will change with time
78  *
79  * returns:
80  * pointer to new case file structure
81  *----------------------------------------------------------------------------*/
82 
84 fvm_to_ensight_case_create(const char *const name,
85  const char *const dir_prefix,
86  const fvm_writer_time_dep_t time_dependency);
87 
88 /*----------------------------------------------------------------------------
89  * Destroy a case file structure.
90  *
91  * parameters:
92  * this_case <-- case structure
93  *
94  * returns:
95  * NULL pointer
96  *----------------------------------------------------------------------------*/
97 
100 
101 /*----------------------------------------------------------------------------
102  * Return time dependency status of an EnSight geometry.
103  *
104  * parameters:
105  * this_case <-- case structure
106  *
107  * returns:
108  * time dependency status
109  *----------------------------------------------------------------------------*/
110 
113 
114 /*----------------------------------------------------------------------------
115  * Associate new time step with an EnSight geometry.
116  *
117  * parameters:
118  * this_case <-- case structure
119  * time_step <-- time step number
120  * time_value <-- time_value number
121  *
122  * returns:
123  * 0 if no time was added, 1 if a new time was added
124  *----------------------------------------------------------------------------*/
125 
126 int
128  const int time_step,
129  const double time_value);
130 
131 /*----------------------------------------------------------------------------
132  * Return current file name and "queried" indicator associated with an
133  * EnSight geometry.
134  *
135  * The "queried" flag in the info structure is set to "false" the first
136  * time this function returns a given file name, and to "true" all other
137  * times.
138  *
139  * parameters:
140  * this_case <-- case structure
141  *
142  * returns:
143  * Info structure for geometry file
144  *----------------------------------------------------------------------------*/
145 
148 
149 /*----------------------------------------------------------------------------
150  * Associate a part name with a case and return its number.
151  * If the part was already associated, zero is returned.
152  *
153  * parameters:
154  * this_case <-- case structure
155  * part_name <-- part name
156  *
157  * returns:
158  * part number in case, or 0 if part already associated
159  *----------------------------------------------------------------------------*/
160 
161 int
163  const char *const part_name);
164 
165 /*----------------------------------------------------------------------------
166  * Return the part number associated with a given part name, or 0
167  *
168  * parameters:
169  * this_case <-- case structure
170  * part_name <-- part name
171  *
172  * returns:
173  * part number in case, or 0 if part name is not associated with this case
174  *----------------------------------------------------------------------------*/
175 
176 int
178  const char *const part_name);
179 
180 /*----------------------------------------------------------------------------
181  * Return current file name and "queried" indicator associated with an
182  * EnSight variable.
183  *
184  * The "queried" flag in the info structure is set to "false" the first
185  * time this function returns a given file name, and to "true" all other
186  * times.
187  *
188  * if the corresponding variable or physical time are not present in the
189  * structure, the necessary elements are added.
190  *
191  * parameters:
192  * this_case <-> pointer to structure that should be updated
193  * name <-- variable name
194  * dimension <-- variable dimension (0: constant, 1: scalar, 3: vector,
195  * 6: symmetrical tensor, 9: asymmetrical tensor)
196  * location <-- variable definition location (nodes, elements, or particles)
197  * time_step <-- number of time step to add
198  * time_value <-- associated time value
199  *
200  * returns:
201  * Info structure for file associated with the variable
202  *----------------------------------------------------------------------------*/
203 
206  const char *const name,
207  const int dimension,
208  const fvm_writer_var_loc_t location,
209  const int time_step,
210  const double time_value);
211 
212 /*----------------------------------------------------------------------------
213  * Write an EnSight Gold case file.
214  *
215  * parameters:
216  * this_case <-- case structure
217  * rank <-- calling rank in case of parallelism
218  *----------------------------------------------------------------------------*/
219 
220 void
222  int rank);
223 
224 /*----------------------------------------------------------------------------*/
225 
227 
228 #endif /* __FVM_TO_ENSIGHT_CASE_H__ */
fvm_to_ensight_case_file_info_t::queried
bool queried
Definition: fvm_to_ensight_case.h:61
fvm_to_ensight_case_create
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:563
fvm_writer_var_loc_t
fvm_writer_var_loc_t
Definition: fvm_writer.h:69
cs_defs.h
fvm_to_ensight_case_file_info_t::name
const char * name
Definition: fvm_to_ensight_case.h:60
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
fvm_to_ensight_case_set_geom_time
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:720
fvm_writer_time_dep_t
fvm_writer_time_dep_t
Definition: fvm_writer.h:57
fvm_to_ensight_case_destroy
fvm_to_ensight_case_t * fvm_to_ensight_case_destroy(fvm_to_ensight_case_t *this_case)
Definition: fvm_to_ensight_case.c:656
fvm_to_ensight_case_get_time_dep
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:702
fvm_to_ensight_case_get_geom_file
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:765
fvm_to_ensight_case_get_var_file
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:880
fvm_nodal.h
fvm_defs.h
fvm_to_ensight_case_t
struct _fvm_to_ensight_case_t fvm_to_ensight_case_t
Definition: fvm_to_ensight_case.h:54
fvm_to_ensight_case_file_info_t
Definition: fvm_to_ensight_case.h:58
fvm_to_ensight_case_write_case
void fvm_to_ensight_case_write_case(fvm_to_ensight_case_t *this_case, int rank)
Definition: fvm_to_ensight_case.c:1016
fvm_to_ensight_case_get_part_num
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:835
fvm_to_ensight_case_add_part
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:791