programmer's documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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-2013 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 /*============================================================================
60  * Type definitions
61  *============================================================================*/
62 
63 /*----------------------------------------------------------------------------
64  * Function pointer types
65  *----------------------------------------------------------------------------*/
66 
67 typedef int
69 
70 typedef const char *
71 (fvm_writer_version_string_t)(int string_index,
72  int compile_time_version);
73 
74 #if defined(HAVE_MPI)
75 
76 typedef void *
77 (fvm_writer_init_t) (const char *name,
78  const char *path,
79  const char *options,
80  fvm_writer_time_dep_t time_dependency,
81  MPI_Comm comm);
82 
83 #else
84 
85 typedef void *
86 (fvm_writer_init_t) (const char *name,
87  const char *path,
88  const char *options,
89  fvm_writer_time_dep_t time_dependency);
90 
91 #endif /* defined(HAVE_MPI) */
92 
93 typedef void *
94 (fvm_writer_finalize_t) (void *this_writer);
95 
96 typedef void
97 (fvm_writer_set_mesh_time_t) (void *this_writer,
98  int time_step,
99  double time_value);
100 
101 typedef int
102 (fvm_writer_needs_tesselation_t) (fvm_writer_t *this_writer,
103  const fvm_nodal_t *mesh,
104  fvm_element_t element_type);
105 
106 typedef void
107 (fvm_writer_export_nodal_t) (void *this_writer,
108  const fvm_nodal_t *mesh);
109 
110 typedef void
111 (fvm_writer_export_field_t) (void *this_writer,
112  const fvm_nodal_t *mesh,
113  const char *name,
114  fvm_writer_var_loc_t location,
115  int dimension,
116  cs_interlace_t interlace,
117  int n_parent_lists,
118  const cs_lnum_t parent_num_shift[],
119  cs_datatype_t datatype,
120  int time_step,
121  double time_value,
122  const void *const field_values[]);
123 
124 typedef void
125 (fvm_writer_flush_t) (fvm_writer_t *this_writer);
126 
127 /*----------------------------------------------------------------------------
128  * Format information structure
129  *----------------------------------------------------------------------------*/
130 
131 typedef struct {
132 
133  char name[32]; /* Format name */
134  char version[16]; /* Format version (if defined) */
135  int info_mask; /* Additional format info */
136  fvm_writer_time_dep_t max_time_dep; /* Maximum time dependency level
137  possible with this format */
138 
139  int dl_count; /* Number of writers using the
140  dynamically loadable library
141  for this format, if relevant */
142  void *dl_lib; /* Pointer to dynamically loadable
143  library, if used */
144  const char *dl_name; /* Prefix for name of dynamically
145  loadable library, or NULL */
146  const char *dl_prefix; /* Prefix for exported symbols of
147  dynamically loadable library,
148  or NULL */
149 
159 
161 
162 /*----------------------------------------------------------------------------
163  * Structure defining a writer definition
164  *----------------------------------------------------------------------------*/
165 
167 
168  char *name; /* Writer name */
169  fvm_writer_format_t *format; /* Output format */
170  char *options; /* Output options */
171  char *path; /* Output path */
172  fvm_writer_time_dep_t time_dep; /* Geometry time dependency */
173  void *format_writer; /* Format-specific writer */
174 
175  cs_timer_counter_t mesh_time; /* Meshes output timer */
176  cs_timer_counter_t field_time; /* Fields output timer */
177  cs_timer_counter_t flush_time; /* output "completion" timer */
178 
179 };
180 
181 /*=============================================================================
182  * Semi-private function prototypes
183  *============================================================================*/
184 
185 /*----------------------------------------------------------------------------
186  * Compute recommended buffer sizes to input or output a nodal mesh
187  * definition by slices. This is especially useful when gathering the mesh for
188  * output by slices using standard I/O in parallel mode.
189  *
190  * The global number of vertices and elements of each slice may also
191  * be returned, if the pointers n_g_vertices and n_g_elements_section
192  * are non-NULL respectively.
193  *
194  * The number of slices indicated is a minimum, and only a target;
195  * computation is based primarily on cell and face connectivity, and the
196  * target should be met for strided connectivities on those types of elements
197  * only. Using an "optimistic" (i.e. small) mean number of vertices per
198  * polyhedra or polygon will typically lead to requiring more slices, as
199  * the connectivity slice size returned will be smaller than that truly
200  * required for the corresponding slice size.
201  * Slice sizes required for edges connectivity will meet the target only
202  * when the global numbers of cells and faces given are zero, so as to
203  * avoid generating too large connectivity slice sizes for cells should a mesh
204  * contain both (as for example a hexahedral connectivity slice is 8 times
205  * larger than the corresponding slice size, while an edges connectivity is
206  * only 2 times as large).
207  *
208  * parameters:
209  * this_nodal <-- pointer to nodal mesh structure
210  * n_slices <-- target number of slices required
211  * n_polyhedron_vertices_mean <-- estimate of the mean number of vertices
212  * per polyhedron
213  * n_polygon_vertices_mean <-- estimate of the mean number of vertices
214  * per polygon
215  * n_g_vertices --> global number of vertices (or NULL)
216  * n_g_elements_section --> array for global number of elements per
217  * section (or NULL)
218  * global_s_size --> maximum number of entities defined per slice
219  * global_connect_s_size --> maximum number of connectivity values
220  * per slice
221  *----------------------------------------------------------------------------*/
222 
223 void
224 fvm_writer_def_nodal_buf_size(const fvm_nodal_t *this_nodal,
225  int n_slices,
226  int n_polyhedron_vertices_mean,
227  int n_polygon_vertices_mean,
228  cs_gnum_t *n_g_vertices,
229  cs_gnum_t n_g_elements_section[],
230  cs_gnum_t *global_s_size,
231  cs_gnum_t *global_connect_s_size);
232 
233 /*----------------------------------------------------------------------------*/
234 
236 
237 #endif /* __FVM_WRITER_PRIV_H__ */