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