7.1
general documentation
fvm_to_plot.h
Go to the documentation of this file.
1 #ifndef __FVM_TO_PLOT_H__
2 #define __FVM_TO_PLOT_H__
3 
4 /*============================================================================
5  * Write a nodal representation associated with a mesh and associated
6  * variables to plot (whitepace-separated or csv) files
7  *============================================================================*/
8 
9 /*
10  This file is part of Code_Saturne, a general-purpose CFD tool.
11 
12  Copyright (C) 1998-2021 EDF S.A.
13 
14  This program is free software; you can redistribute it and/or modify it under
15  the terms of the GNU General Public License as published by the Free Software
16  Foundation; either version 2 of the License, or (at your option) any later
17  version.
18 
19  This program is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
22  details.
23 
24  You should have received a copy of the GNU General Public License along with
25  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
26  Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 */
28 
29 /*----------------------------------------------------------------------------*/
30 
31 #include "cs_defs.h"
32 
33 /*----------------------------------------------------------------------------
34  * Local headers
35  *----------------------------------------------------------------------------*/
36 
37 #include "fvm_defs.h"
38 #include "fvm_nodal.h"
39 #include "fvm_writer.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
44 
45 /*=============================================================================
46  * Macro definitions
47  *============================================================================*/
48 
49 /*============================================================================
50  * Type definitions
51  *============================================================================*/
52 
53 /*=============================================================================
54  * Public function prototypes
55  *============================================================================*/
56 
57 /*----------------------------------------------------------------------------
58  * Initialize FVM to plot file writer.
59  *
60  * Options are:
61  * dat output .dat files
62  * csv output .csv files (default)
63  * no_time_step do not add time step id to file name
64  *
65  * parameters:
66  * name <-- base output case name.
67  * options <-- whitespace separated, lowercase options list
68  * time_dependecy <-- indicates if and how meshes will change with time
69  * comm <-- associated MPI communicator.
70  *
71  * returns:
72  * pointer to opaque plot writer structure.
73  *----------------------------------------------------------------------------*/
74 
75 #if defined(HAVE_MPI)
76 
77 void *
78 fvm_to_plot_init_writer(const char *name,
79  const char *path,
80  const char *options,
81  fvm_writer_time_dep_t time_dependency,
82  MPI_Comm comm);
83 
84 #else
85 
86 void *
87 fvm_to_plot_init_writer(const char *name,
88  const char *path,
89  const char *options,
90  fvm_writer_time_dep_t time_dependency);
91 
92 #endif
93 
94 /*----------------------------------------------------------------------------
95  * Finalize FVM to plot file writer.
96  *
97  * parameters:
98  * writer <-- pointer to opaque plot writer structure.
99  *
100  * returns:
101  * NULL pointer.
102  *----------------------------------------------------------------------------*/
103 
104 void *
105 fvm_to_plot_finalize_writer(void *writer);
106 
107 /*----------------------------------------------------------------------------
108  * Associate new time step with an Plot geometry.
109  *
110  * parameters:
111  * writer <-- pointer to associated writer
112  * time_step <-- time step number
113  * time_value <-- time_value number
114  *----------------------------------------------------------------------------*/
115 
116 void
117 fvm_to_plot_set_mesh_time(void *writer,
118  const int time_step,
119  const double time_value);
120 
121 /*----------------------------------------------------------------------------
122  * Write nodal mesh to a plot file
123  *
124  * parameters:
125  * writer <-- pointer to associated writer.
126  * mesh <-- pointer to nodal mesh structure that should be written.
127  *----------------------------------------------------------------------------*/
128 
129 void
130 fvm_to_plot_export_nodal(void *writer,
131  const fvm_nodal_t *mesh);
132 
133 /*----------------------------------------------------------------------------
134  * Write field associated with a nodal mesh to a plot file.
135  *
136  * Assigning a negative value to the time step indicates a time-independent
137  * field (in which case the time_value argument is unused).
138  *
139  * parameters:
140  * writer <-- pointer to associated writer
141  * mesh <-- pointer to associated nodal mesh structure
142  * name <-- variable name
143  * location <-- variable definition location (nodes or elements)
144  * dimension <-- variable dimension (0: constant, 1: scalar,
145  * 3: vector, 6: sym. tensor, 9: asym. tensor)
146  * interlace <-- indicates if variable in memory is interlaced
147  * n_parent_lists <-- indicates if variable values are to be obtained
148  * directly through the local entity index (when 0) or
149  * through the parent entity numbers (when 1 or more)
150  * parent_num_shift <-- parent number to value array index shifts;
151  * size: n_parent_lists
152  * datatype <-- indicates the data type of (source) field values
153  * time_step <-- number of the current time step
154  * time_value <-- associated time value
155  * field_values <-- array of associated field value arrays
156  *----------------------------------------------------------------------------*/
157 
158 void
159 fvm_to_plot_export_field(void *writer,
160  const fvm_nodal_t *mesh,
161  const char *name,
162  fvm_writer_var_loc_t location,
163  int dimension,
164  cs_interlace_t interlace,
165  int n_parent_lists,
166  const cs_lnum_t parent_num_shift[],
167  cs_datatype_t datatype,
168  int time_step,
169  double time_value,
170  const void *const field_values[]);
171 
172 /*----------------------------------------------------------------------------
173  * Flush files associated with a given writer.
174  *
175  * In this case, the effective writing to file is done.
176  *
177  * parameters:
178  * writer <-- pointer to associated writer
179  *----------------------------------------------------------------------------*/
180 
181 void
182 fvm_to_plot_flush(void *writer);
183 
184 /*----------------------------------------------------------------------------*/
185 
187 
188 #endif /* __FVM_TO_PLOT_H__ */
void fvm_to_plot_flush(void *writer)
Definition: fvm_to_plot.c:652
cs_datatype_t
Definition: cs_defs.h:275
fvm_writer_var_loc_t
Definition: fvm_writer.h:69
cs_interlace_t
Definition: cs_defs.h:482
#define BEGIN_C_DECLS
Definition: cs_defs.h:510
fvm_writer_time_dep_t
Definition: fvm_writer.h:57
void fvm_to_plot_export_nodal(void *writer, const fvm_nodal_t *mesh)
Definition: fvm_to_plot.c:490
void fvm_to_plot_export_field(void *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_to_plot.c:570
void * fvm_to_plot_init_writer(const char *name, const char *path, const char *options, fvm_writer_time_dep_t time_dependency)
Definition: fvm_to_plot.c:337
void * fvm_to_plot_finalize_writer(void *writer)
Definition: fvm_to_plot.c:434
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:316
#define END_C_DECLS
Definition: cs_defs.h:511
void fvm_to_plot_set_mesh_time(void *writer, const int time_step, const double time_value)
Definition: fvm_to_plot.c:464
Definition: mesh.f90:26