My Project
programmer's 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-2019 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  *
64  * parameters:
65  * name <-- base output case name.
66  * options <-- whitespace separated, lowercase options list
67  * time_dependecy <-- indicates if and how meshes will change with time
68  * comm <-- associated MPI communicator.
69  *
70  * returns:
71  * pointer to opaque plot writer structure.
72  *----------------------------------------------------------------------------*/
73 
74 #if defined(HAVE_MPI)
75 
76 void *
77 fvm_to_plot_init_writer(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 void *
86 fvm_to_plot_init_writer(const char *name,
87  const char *path,
88  const char *options,
89  fvm_writer_time_dep_t time_dependency);
90 
91 #endif
92 
93 /*----------------------------------------------------------------------------
94  * Finalize FVM to plot file writer.
95  *
96  * parameters:
97  * writer <-- pointer to opaque plot writer structure.
98  *
99  * returns:
100  * NULL pointer.
101  *----------------------------------------------------------------------------*/
102 
103 void *
104 fvm_to_plot_finalize_writer(void *writer);
105 
106 /*----------------------------------------------------------------------------
107  * Associate new time step with an Plot geometry.
108  *
109  * parameters:
110  * writer <-- pointer to associated writer
111  * time_step <-- time step number
112  * time_value <-- time_value number
113  *----------------------------------------------------------------------------*/
114 
115 void
116 fvm_to_plot_set_mesh_time(void *writer,
117  const int time_step,
118  const double time_value);
119 
120 /*----------------------------------------------------------------------------
121  * Write nodal mesh to a plot file
122  *
123  * parameters:
124  * writer <-- pointer to associated writer.
125  * mesh <-- pointer to nodal mesh structure that should be written.
126  *----------------------------------------------------------------------------*/
127 
128 void
129 fvm_to_plot_export_nodal(void *writer,
130  const fvm_nodal_t *mesh);
131 
132 /*----------------------------------------------------------------------------
133  * Write field associated with a nodal mesh to a plot file.
134  *
135  * Assigning a negative value to the time step indicates a time-independent
136  * field (in which case the time_value argument is unused).
137  *
138  * parameters:
139  * writer <-- pointer to associated writer
140  * mesh <-- pointer to associated nodal mesh structure
141  * name <-- variable name
142  * location <-- variable definition location (nodes or elements)
143  * dimension <-- variable dimension (0: constant, 1: scalar,
144  * 3: vector, 6: sym. tensor, 9: asym. tensor)
145  * interlace <-- indicates if variable in memory is interlaced
146  * n_parent_lists <-- indicates if variable values are to be obtained
147  * directly through the local entity index (when 0) or
148  * through the parent entity numbers (when 1 or more)
149  * parent_num_shift <-- parent number to value array index shifts;
150  * size: n_parent_lists
151  * datatype <-- indicates the data type of (source) field values
152  * time_step <-- number of the current time step
153  * time_value <-- associated time value
154  * field_values <-- array of associated field value arrays
155  *----------------------------------------------------------------------------*/
156 
157 void
158 fvm_to_plot_export_field(void *writer,
159  const fvm_nodal_t *mesh,
160  const char *name,
161  fvm_writer_var_loc_t location,
162  int dimension,
163  cs_interlace_t interlace,
164  int n_parent_lists,
165  const cs_lnum_t parent_num_shift[],
166  cs_datatype_t datatype,
167  int time_step,
168  double time_value,
169  const void *const field_values[]);
170 
171 /*----------------------------------------------------------------------------
172  * Flush files associated with a given writer.
173  *
174  * In this case, the effective writing to file is done.
175  *
176  * parameters:
177  * writer <-- pointer to associated writer
178  *----------------------------------------------------------------------------*/
179 
180 void
181 fvm_to_plot_flush(void *writer);
182 
183 /*----------------------------------------------------------------------------*/
184 
186 
187 #endif /* __FVM_TO_PLOT_H__ */
fvm_writer_var_loc_t
fvm_writer_var_loc_t
Definition: fvm_writer.h:69
cs_defs.h
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
fvm_writer.h
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
fvm_to_plot_export_nodal
void fvm_to_plot_export_nodal(void *writer, const fvm_nodal_t *mesh)
Definition: fvm_to_plot.c:455
mesh
Definition: mesh.f90:26
cs_datatype_t
cs_datatype_t
Definition: cs_defs.h:260
fvm_to_plot_export_field
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:532
fvm_to_plot_init_writer
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:312
fvm_to_plot_finalize_writer
void * fvm_to_plot_finalize_writer(void *writer)
Definition: fvm_to_plot.c:406
fvm_writer_time_dep_t
fvm_writer_time_dep_t
Definition: fvm_writer.h:57
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
cs_interlace_t
cs_interlace_t
Definition: cs_defs.h:439
fvm_nodal.h
fvm_to_plot_flush
void fvm_to_plot_flush(void *writer)
Definition: fvm_to_plot.c:614
fvm_defs.h
fvm_to_plot_set_mesh_time
void fvm_to_plot_set_mesh_time(void *writer, const int time_step, const double time_value)
Definition: fvm_to_plot.c:433