1 #ifndef __FVM_TO_CCM_H__
2 #define __FVM_TO_CCM_H__
3 
4 #if defined(HAVE_CCM)
5 
6 /*============================================================================
7  * Write a nodal representation associated with a mesh and associated
8  * variables to CCM-IO files
9  *============================================================================*/
10 
11 /*
12   This file is part of Code_Saturne, a general-purpose CFD tool.
13 
14   Copyright (C) 1998-2021 EDF S.A.
15 
16   This program is free software; you can redistribute it and/or modify it under
17   the terms of the GNU General Public License as published by the Free Software
18   Foundation; either version 2 of the License, or (at your option) any later
19   version.
20 
21   This program is distributed in the hope that it will be useful, but WITHOUT
22   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
23   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
24   details.
25 
26   You should have received a copy of the GNU General Public License along with
27   this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
28   Street, Fifth Floor, Boston, MA 02110-1301, USA.
29 */
30 
31 /*----------------------------------------------------------------------------*/
32 
33 #include "cs_defs.h"
34 
35 /*----------------------------------------------------------------------------
36  *  Local headers
37  *----------------------------------------------------------------------------*/
38 
39 #include "fvm_defs.h"
40 #include "fvm_nodal.h"
41 #include "fvm_writer.h"
42 
43 /*----------------------------------------------------------------------------*/
44 
45 BEGIN_C_DECLS
46 
47 /*=============================================================================
48  * Macro definitions
49  *============================================================================*/
50 
51 /*============================================================================
52  * Type definitions
53  *============================================================================*/
54 
55 /*=============================================================================
56  * Public function prototypes
57  *============================================================================*/
58 
59 /*----------------------------------------------------------------------------
60  * Returns number of library version strings associated with the CCM-IO format.
61  *
62  * returns:
63  *   number of library version strings associated with the CCM-IO format.
64  *----------------------------------------------------------------------------*/
65 
66 int
67 fvm_to_ccm_n_version_strings(void);
68 
69 /*----------------------------------------------------------------------------
70  * Returns a library version string associated with the CCM-IO format.
71  *
72  * In certain cases, when using dynamic libraries, fvm may be compiled
73  * with one library version, and linked with another. If both run-time
74  * and compile-time version information is available, this function
75  * will return the run-time version string by default.
76  *
77  * Setting the compile_time flag to 1, the compile-time version string
78  * will be returned if this is different from the run-time version.
79  * If the version is the same, or only one of the 2 version strings are
80  * available, a NULL character string will be returned with this flag set.
81  *
82  * parameters:
83  *   string_index <-- index in format's version string list (0 to n-1)
84  *   compile_time <-- 0 by default, 1 if we want the compile-time version
85  *                    string, if different from the run-time version.
86  *
87  * returns:
88  *   pointer to constant string containing the library's version.
89  *----------------------------------------------------------------------------*/
90 
91 const char *
92 fvm_to_ccm_version_string(int string_index,
93                           int compile_time_version);
94 
95 /*----------------------------------------------------------------------------
96  * Initialize FVM to CCM-IO file writer.
97  *
98  * parameters:
99  *   name           <-- base output case name.
100  *   options        <-- whitespace separated, lowercase options list
101  *   time_dependecy <-- indicates if and how meshes will change with time
102  *   comm           <-- associated MPI communicator.
103  *
104  * returns:
105  *   pointer to opaque CCM-IO writer structure.
106  *----------------------------------------------------------------------------*/
107 
108 #if defined(HAVE_MPI)
109 
110 void *
111 fvm_to_ccm_init_writer(const char             *name,
112                        const char             *path,
113                        const char             *options,
114                        fvm_writer_time_dep_t   time_dependency,
115                        MPI_Comm                comm);
116 
117 #else
118 
119 void *
120 fvm_to_ccm_init_writer(const char             *name,
121                        const char             *path,
122                        const char             *options,
123                        fvm_writer_time_dep_t   time_dependency);
124 
125 #endif
126 
127 /*----------------------------------------------------------------------------
128  * Finalize FVM to CCM-IO file writer.
129  *
130  * parameters:
131  *   this_writer_p <-- pointer to opaque CCM-IO writer structure.
132  *
133  * returns:
134  *   NULL pointer.
135  *----------------------------------------------------------------------------*/
136 
137 void *
138 fvm_to_ccm_finalize_writer(void  *this_writer_p);
139 
140 /*----------------------------------------------------------------------------
141  * Associate new time step with a CCM-IO geometry.
142  *
143  * parameters:
144  *   this_writer_p <-- pointer to associated writer
145  *   time_step     <-- time step number
146  *   time_value    <-- time_value number
147  *----------------------------------------------------------------------------*/
148 
149 void
150 fvm_to_ccm_set_mesh_time(void     *this_writer_p,
151                          int       time_step,
152                          double    time_value);
153 
154 /*----------------------------------------------------------------------------
155  * Write nodal mesh to a CCM-IO file
156  *
157  * parameters:
158  *   this_writer_p <-- pointer to associated writer.
159  *   mesh          <-- pointer to nodal mesh structure that should be written.
160  *----------------------------------------------------------------------------*/
161 
162 void
163 fvm_to_ccm_export_nodal(void               *this_writer_p,
164                         const fvm_nodal_t  *mesh);
165 
166 /*----------------------------------------------------------------------------
167  * Write field associated with a nodal mesh to a CCM-IO file.
168  *
169  * Assigning a negative value to the time step indicates a time-independent
170  * field (in which case the time_value argument is unused).
171  *
172  * parameters:
173  *   this_writer_p    <-- pointer to associated writer
174  *   mesh             <-- pointer to associated nodal mesh structure
175  *   name             <-- variable name
176  *   location         <-- variable definition location (nodes or elements)
177  *   dimension        <-- variable dimension (0: constant, 1: scalar,
178  *                        3: vector, 6: sym. tensor, 9: asym. tensor)
179  *   interlace        <-- indicates if variable in memory is interlaced
180  *   n_parent_lists   <-- indicates if variable values are to be obtained
181  *                        directly through the local entity index (when 0) or
182  *                        through the parent entity numbers (when 1 or more)
183  *   parent_num_shift <-- parent number to value array index shifts;
184  *                        size: n_parent_lists
185  *   datatype         <-- indicates the data type of (source) field values
186  *   time_step        <-- number of the current time step
187  *   time_value       <-- associated time value
188  *   field_values     <-- array of associated field value arrays
189  *----------------------------------------------------------------------------*/
190 
191 void
192 fvm_to_ccm_export_field(void                   *this_writer_p,
193                         const fvm_nodal_t      *mesh,
194                         const char             *name,
195                         fvm_writer_var_loc_t    location,
196                         int                     dimension,
197                         cs_interlace_t          interlace,
198                         int                     n_parent_lists,
199                         const cs_lnum_t         parent_num_shift[],
200                         cs_datatype_t           datatype,
201                         int                     time_step,
202                         double                  time_value,
203                         const void       *const field_values[]);
204 
205 /*----------------------------------------------------------------------------*/
206 
207 END_C_DECLS
208 
209 #endif /* HAVE_CCM */
210 
211 #endif /* __FVM_TO_CCM_H__ */
212