My Project
programmer's documentation
fvm_writer_priv.h
Go to the documentation of this file.
1 #ifndef __FVM_WRITER_PRIV_H__
2 #define __FVM_WRITER_PRIV_H__
3 
4 /*============================================================================
5  * Private types for mesh and field writers
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 "cs_timer.h"
37 
38 #include "fvm_defs.h"
39 #include "fvm_nodal.h"
40 #include "fvm_writer.h"
41 
42 /*----------------------------------------------------------------------------*/
43 
45 
46 /*=============================================================================
47  * Macro definitions
48  *============================================================================*/
49 
50 /*
51  * Writer format implementation and functionality info
52  */
53 
54 #define FVM_WRITER_FORMAT_USE_EXTERNAL (1 << 0)
55 
56 #define FVM_WRITER_FORMAT_HAS_POLYGON (1 << 1)
57 #define FVM_WRITER_FORMAT_HAS_POLYHEDRON (1 << 2)
58 
59 #define FVM_WRITER_FORMAT_SEPARATE_MESHES (1 << 3)
60 
61 #define FVM_WRITER_FORMAT_NAME_IS_OPTIONAL (1 << 4)
62 
63 /*============================================================================
64  * Type definitions
65  *============================================================================*/
66 
67 /*----------------------------------------------------------------------------
68  * Function pointer types
69  *----------------------------------------------------------------------------*/
70 
71 typedef int
73 
74 typedef const char *
75 (fvm_writer_version_string_t)(int string_index,
76  int compile_time_version);
77 
78 #if defined(HAVE_MPI)
79 
80 typedef void *
81 (fvm_writer_init_t) (const char *name,
82  const char *path,
83  const char *options,
84  fvm_writer_time_dep_t time_dependency,
85  MPI_Comm comm);
86 
87 #else
88 
89 typedef void *
90 (fvm_writer_init_t) (const char *name,
91  const char *path,
92  const char *options,
93  fvm_writer_time_dep_t time_dependency);
94 
95 #endif /* defined(HAVE_MPI) */
96 
97 typedef void *
98 (fvm_writer_finalize_t) (void *this_writer);
99 
100 typedef void
101 (fvm_writer_set_mesh_time_t) (void *this_writer,
102  int time_step,
103  double time_value);
104 
105 typedef int
106 (fvm_writer_needs_tesselation_t) (void *this_writer,
107  const fvm_nodal_t *mesh,
108  fvm_element_t element_type);
109 
110 typedef void
111 (fvm_writer_export_nodal_t) (void *this_writer,
112  const fvm_nodal_t *mesh);
113 
114 typedef void
115 (fvm_writer_export_field_t) (void *this_writer,
116  const fvm_nodal_t *mesh,
117  const char *name,
118  fvm_writer_var_loc_t location,
119  int dimension,
120  cs_interlace_t interlace,
121  int n_parent_lists,
122  const cs_lnum_t parent_num_shift[],
123  cs_datatype_t datatype,
124  int time_step,
125  double time_value,
126  const void *const field_values[]);
127 
128 typedef void
129 (fvm_writer_flush_t) (void *this_writer);
130 
131 /*----------------------------------------------------------------------------
132  * Format information structure
133  *----------------------------------------------------------------------------*/
134 
135 typedef struct {
136 
137  char name[32]; /* Format name */
138  char version[16]; /* Format version (if defined) */
139  int info_mask; /* Additional format info */
140  fvm_writer_time_dep_t max_time_dep; /* Maximum time dependency level
141  possible with this format */
142 
143  int dl_count; /* Number of writers using the
144  dynamically loadable library
145  for this format, if relevant */
146  void *dl_lib; /* Pointer to dynamically loadable
147  library, if used */
148  const char *dl_name; /* Prefix for name of dynamically
149  loadable library, or NULL */
150  const char *dl_prefix; /* Prefix for exported symbols of
151  dynamically loadable library,
152  or NULL */
153 
163 
165 
166 /*----------------------------------------------------------------------------
167  * Structure defining a writer definition
168  *----------------------------------------------------------------------------*/
169 
171 
172  char *name; /* Writer name */
173  fvm_writer_format_t *format; /* Output format */
174  char *options; /* Output options */
175  char *path; /* Output path */
176  fvm_writer_time_dep_t time_dep; /* Geometry time dependency */
177  int n_format_writers; /* number of actual writers */
178  void **format_writer; /* Format-specific writers */
179  char **mesh_names; /* List of mesh names if one
180  writer per mesh is required */
181 
182  cs_timer_counter_t mesh_time; /* Meshes output timer */
183  cs_timer_counter_t field_time; /* Fields output timer */
184  cs_timer_counter_t flush_time; /* output "completion" timer */
185 
186 };
187 
188 /*----------------------------------------------------------------------------*/
189 
191 
192 #endif /* __FVM_WRITER_PRIV_H__ */
fvm_writer_var_loc_t
fvm_writer_var_loc_t
Definition: fvm_writer.h:69
cs_defs.h
_fvm_writer_t::field_time
cs_timer_counter_t field_time
Definition: fvm_writer_priv.h:183
fvm_writer_format_t::needs_tesselation_func
fvm_writer_needs_tesselation_t * needs_tesselation_func
Definition: fvm_writer_priv.h:159
fvm_writer_format_t::dl_count
int dl_count
Definition: fvm_writer_priv.h:143
fvm_writer_format_t::set_mesh_time_func
fvm_writer_set_mesh_time_t * set_mesh_time_func
Definition: fvm_writer_priv.h:158
fvm_writer_finalize_t
void *() fvm_writer_finalize_t(void *this_writer)
Definition: fvm_writer_priv.h:98
fvm_writer_format_t::finalize_func
fvm_writer_finalize_t * finalize_func
Definition: fvm_writer_priv.h:157
_fvm_writer_t::flush_time
cs_timer_counter_t flush_time
Definition: fvm_writer_priv.h:184
cs_timer_counter_t
Definition: cs_timer.h:57
fvm_writer_version_string_t
const typedef char *() fvm_writer_version_string_t(int string_index, int compile_time_version)
fvm_writer_needs_tesselation_t
int() fvm_writer_needs_tesselation_t(void *this_writer, const fvm_nodal_t *mesh, fvm_element_t element_type)
Definition: fvm_writer_priv.h:106
_fvm_writer_t::options
char * options
Definition: fvm_writer_priv.h:174
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
fvm_writer_format_t::dl_name
const char * dl_name
Definition: fvm_writer_priv.h:148
fvm_writer_format_t::version_string_func
fvm_writer_version_string_t * version_string_func
Definition: fvm_writer_priv.h:155
_fvm_writer_t::n_format_writers
int n_format_writers
Definition: fvm_writer_priv.h:177
fvm_writer_export_field_t
void() fvm_writer_export_field_t(void *this_writer, 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_writer_priv.h:115
fvm_writer.h
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
fvm_writer_format_t::max_time_dep
fvm_writer_time_dep_t max_time_dep
Definition: fvm_writer_priv.h:140
fvm_writer_format_t::export_field_func
fvm_writer_export_field_t * export_field_func
Definition: fvm_writer_priv.h:161
_fvm_writer_t::time_dep
fvm_writer_time_dep_t time_dep
Definition: fvm_writer_priv.h:176
_fvm_writer_t
Definition: fvm_writer_priv.h:170
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_writer_init_t
void *() fvm_writer_init_t(const char *name, const char *path, const char *options, fvm_writer_time_dep_t time_dependency)
Definition: fvm_writer_priv.h:90
fvm_writer_format_t::info_mask
int info_mask
Definition: fvm_writer_priv.h:139
_fvm_writer_t::format_writer
void ** format_writer
Definition: fvm_writer_priv.h:178
fvm_writer_time_dep_t
fvm_writer_time_dep_t
Definition: fvm_writer.h:57
fvm_writer_format_t::export_nodal_func
fvm_writer_export_nodal_t * export_nodal_func
Definition: fvm_writer_priv.h:160
fvm_writer_format_t::dl_prefix
const char * dl_prefix
Definition: fvm_writer_priv.h:150
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
fvm_writer_export_nodal_t
void() fvm_writer_export_nodal_t(void *this_writer, const fvm_nodal_t *mesh)
Definition: fvm_writer_priv.h:111
cs_interlace_t
cs_interlace_t
Definition: cs_defs.h:439
fvm_writer_format_t::flush_func
fvm_writer_flush_t * flush_func
Definition: fvm_writer_priv.h:162
fvm_writer_n_version_strings_t
int() fvm_writer_n_version_strings_t(void)
Definition: fvm_writer_priv.h:72
fvm_writer_flush_t
void() fvm_writer_flush_t(void *this_writer)
Definition: fvm_writer_priv.h:129
fvm_writer_format_t::init_func
fvm_writer_init_t * init_func
Definition: fvm_writer_priv.h:156
fvm_nodal.h
_fvm_writer_t::path
char * path
Definition: fvm_writer_priv.h:175
fvm_writer_format_t::n_version_strings_func
fvm_writer_n_version_strings_t * n_version_strings_func
Definition: fvm_writer_priv.h:154
fvm_writer_format_t::dl_lib
void * dl_lib
Definition: fvm_writer_priv.h:146
fvm_defs.h
_fvm_writer_t::format
fvm_writer_format_t * format
Definition: fvm_writer_priv.h:173
_fvm_writer_t::mesh_time
cs_timer_counter_t mesh_time
Definition: fvm_writer_priv.h:182
fvm_writer_set_mesh_time_t
void() fvm_writer_set_mesh_time_t(void *this_writer, int time_step, double time_value)
Definition: fvm_writer_priv.h:101
_fvm_writer_t::mesh_names
char ** mesh_names
Definition: fvm_writer_priv.h:179
fvm_writer_format_t
Definition: fvm_writer_priv.h:135
cs_timer.h
_fvm_writer_t::name
char * name
Definition: fvm_writer_priv.h:172