8.1
general documentation
cs_mesh_cartesian.h
Go to the documentation of this file.
1 #ifndef __CS_MESH_CARTESIAN_H__
2 #define __CS_MESH_CARTESIAN_H__
3 
4 /*============================================================================
5  * Cartesian mesh generation
6  *============================================================================*/
7 
8 /*
9  This file is part of code_saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2023 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  * Local headers
30  *----------------------------------------------------------------------------*/
31 
32 #include "cs_defs.h"
33 
34 /*============================================================================
35  * Type definitions
36  *============================================================================*/
37 
38 typedef enum {
39 
40  CS_MESH_CARTESIAN_CONSTANT_LAW, /* Constant step law */
41  CS_MESH_CARTESIAN_GEOMETRIC_LAW, /* Geometric step law */
42  CS_MESH_CARTESIAN_PARABOLIC_LAW, /* Parabolic step law */
43  CS_MESH_CARTESIAN_USER_LAW, /* User defined discretization */
44  CS_MESH_CARTESIAN_N_LAW_TYPES /* Number of step discretization laws */
45 
47 
48 typedef struct _cs_mesh_cartesian_params_t cs_mesh_cartesian_params_t;
49 
50 /*============================================================================
51  * Public C function prototypes
52  *============================================================================*/
53 
54 /*----------------------------------------------------------------------------*/
60 /*----------------------------------------------------------------------------*/
61 
62 int
64 
65 /*----------------------------------------------------------------------------*/
73 /*----------------------------------------------------------------------------*/
74 
75 cs_mesh_cartesian_params_t *
76 cs_mesh_cartesian_by_id(const int id);
77 
78 /*----------------------------------------------------------------------------*/
87 /*----------------------------------------------------------------------------*/
88 
89 cs_mesh_cartesian_params_t *
90 cs_mesh_cartesian_by_name_try(const char *name);
91 
92 /*----------------------------------------------------------------------------*/
101 /*----------------------------------------------------------------------------*/
102 
103 cs_mesh_cartesian_params_t *
104 cs_mesh_cartesian_by_name(const char *name);
105 
106 /*----------------------------------------------------------------------------*/
113 /*----------------------------------------------------------------------------*/
114 
115 cs_mesh_cartesian_params_t *
116 cs_mesh_cartesian_create(const char *name);
117 
118 /*----------------------------------------------------------------------------*/
128 /*----------------------------------------------------------------------------*/
129 
130 int
131 cs_mesh_cartesian_define_simple(const char *name,
132  int ncells[3],
133  cs_real_t xyz[6]);
134 
135 /*----------------------------------------------------------------------------*/
144 /*----------------------------------------------------------------------------*/
145 
146 void
147 cs_mesh_cartesian_define_dir_user(cs_mesh_cartesian_params_t *mp,
148  int idir,
149  int ncells,
150  cs_real_t vtx_coord[]);
151 
152 /*----------------------------------------------------------------------------*/
172 /*----------------------------------------------------------------------------*/
173 
174 void
175 cs_mesh_cartesian_define_dir_geom_by_part(cs_mesh_cartesian_params_t *mp,
176  int idir,
177  int n_parts,
178  const cs_real_t part_coords[],
179  const cs_lnum_t n_part_cells[],
180  const cs_real_t amp_factors[]);
181 
182 /*----------------------------------------------------------------------------*/
199 /*----------------------------------------------------------------------------*/
200 
201 void
202 cs_mesh_cartesian_define_from_csv(const char *name,
203  const char *csv_file_name);
204 
205 /*----------------------------------------------------------------------------*/
218 /*----------------------------------------------------------------------------*/
219 
220 void
221 cs_mesh_cartesian_define_dir_params(cs_mesh_cartesian_params_t *mp,
222  int idim,
224  int ncells,
225  cs_real_t smin,
226  cs_real_t smax,
227  cs_real_t progression);
228 
229 /*----------------------------------------------------------------------------*/
234 /*----------------------------------------------------------------------------*/
235 
236 int
238 
239 /*----------------------------------------------------------------------------*/
247 /*----------------------------------------------------------------------------*/
248 
249 const char *
251 
252 /*----------------------------------------------------------------------------*/
260 /*----------------------------------------------------------------------------*/
261 
262 int
264 
265 /*----------------------------------------------------------------------------*/
273 /*----------------------------------------------------------------------------*/
274 
275 void
277  int shift);
278 
279 /*----------------------------------------------------------------------------*/
287 /*----------------------------------------------------------------------------*/
288 
289 cs_gnum_t
291 
292 /*----------------------------------------------------------------------------*/
300 /*----------------------------------------------------------------------------*/
301 
302 cs_gnum_t
304 
305 /*----------------------------------------------------------------------------*/
313 /*----------------------------------------------------------------------------*/
314 
315 cs_gnum_t
317 
318 /*----------------------------------------------------------------------------*/
326 /*----------------------------------------------------------------------------*/
327 
328 int
330  int idim);
331 
332 /*----------------------------------------------------------------------------*/
340 /*----------------------------------------------------------------------------*/
341 
342 void
344  cs_mesh_t *m,
345  cs_mesh_builder_t *mb,
346  long echo);
347 
348 /*----------------------------------------------------------------------------*/
352 /*----------------------------------------------------------------------------*/
353 
354 void
356 
357 /*----------------------------------------------------------------------------*/
360 /*----------------------------------------------------------------------------*/
361 
362 void
364 
365 /*----------------------------------------------------------------------------*/
371 /*----------------------------------------------------------------------------*/
372 
373 void
375 
376 /*----------------------------------------------------------------------------*/
377 
378 #endif /* __CS_MESH_CARTESIAN_H__ */
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
unsigned long cs_gnum_t
global mesh entity number
Definition: cs_defs.h:298
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:313
void cs_mesh_cartesian_set_gc_id_shift(int id, int shift)
Set group class id shift of cartesian mesh.
Definition: cs_mesh_cartesian.c:1120
cs_mesh_cartesian_params_t * cs_mesh_cartesian_create(const char *name)
Create cartesian mesh structure.
Definition: cs_mesh_cartesian.c:704
cs_gnum_t cs_mesh_cartesian_get_n_g_vtx(int id)
Get global number of vertices of a cartesian mesh.
Definition: cs_mesh_cartesian.c:1175
int cs_mesh_cartesian_get_number_of_meshes(void)
Return number of structured meshes to build.
Definition: cs_mesh_cartesian.c:623
cs_mesh_cartesian_params_t * cs_mesh_cartesian_by_name(const char *name)
Get function for structured mesh based on its name.
Definition: cs_mesh_cartesian.c:677
void cs_mesh_cartesian_set_max_number_of_blocks(int n_blocks)
Set maximum number of cartesian blocks (by default is set to None)
Definition: cs_mesh_cartesian.c:1469
void cs_mesh_cartesian_finalize_definition(void)
Compute all global values for meshes.
Definition: cs_mesh_cartesian.c:1412
void cs_mesh_cartesian_block_connectivity(int id, cs_mesh_t *m, cs_mesh_builder_t *mb, long echo)
Build unstructured connectivity needed for partitionning.
Definition: cs_mesh_cartesian.c:1212
cs_gnum_t cs_mesh_cartesian_get_n_g_faces(int id)
Get global number of faces of a cartesian mesh.
Definition: cs_mesh_cartesian.c:1157
const char * cs_mesh_cartesian_get_name(int id)
Get name of structured mesh.
Definition: cs_mesh_cartesian.c:1084
cs_mesh_cartesian_params_t * cs_mesh_cartesian_by_id(const int id)
Return pointer to cartesian mesh parameters structure.
Definition: cs_mesh_cartesian.c:639
int cs_mesh_cartesian_define_simple(const char *name, int ncells[3], cs_real_t xyz[6])
Define a simple cartesian mesh with a constant step in all directions.
Definition: cs_mesh_cartesian.c:726
int cs_mesh_cartesian_need_build(void)
Indicate if a cartesian mesh is to be built.
Definition: cs_mesh_cartesian.c:1066
void cs_mesh_cartesian_define_dir_params(cs_mesh_cartesian_params_t *mp, int idim, cs_mesh_cartesian_law_t law, int ncells, cs_real_t smin, cs_real_t smax, cs_real_t progression)
Define parameters for a given direction.
Definition: cs_mesh_cartesian.c:1001
void cs_mesh_cartesian_define_dir_user(cs_mesh_cartesian_params_t *mp, int idir, int ncells, cs_real_t vtx_coord[])
Define directions parameters based on a user input.
Definition: cs_mesh_cartesian.c:755
int cs_mesh_cartesian_get_gc_id_shift(int id)
Get group class id shift of cartesian mesh.
Definition: cs_mesh_cartesian.c:1102
int cs_mesh_cartesian_get_ncells(int id, int idim)
Get number of cells in a given direction.
Definition: cs_mesh_cartesian.c:1193
cs_mesh_cartesian_params_t * cs_mesh_cartesian_by_name_try(const char *name)
Get function for structured mesh based on its name.
Definition: cs_mesh_cartesian.c:658
void cs_mesh_cartesian_define_from_csv(const char *name, const char *csv_file_name)
Define a simple cartesian mesh based on a CSV file. CSV file needs to contain : (1) First line which ...
Definition: cs_mesh_cartesian.c:904
void cs_mesh_cartesian_define_dir_geom_by_part(cs_mesh_cartesian_params_t *mp, int idir, int n_parts, const cs_real_t part_coords[], const cs_lnum_t n_part_cells[], const cs_real_t amp_factors[])
Define direction parameters based on a piecewise definition. Each part follows a geometric (or unifor...
Definition: cs_mesh_cartesian.c:809
void cs_mesh_cartesian_params_destroy(void)
Destroy cartesian mesh parameters.
Definition: cs_mesh_cartesian.c:1442
cs_mesh_cartesian_law_t
Definition: cs_mesh_cartesian.h:38
@ CS_MESH_CARTESIAN_USER_LAW
Definition: cs_mesh_cartesian.h:43
@ CS_MESH_CARTESIAN_CONSTANT_LAW
Definition: cs_mesh_cartesian.h:40
@ CS_MESH_CARTESIAN_N_LAW_TYPES
Definition: cs_mesh_cartesian.h:44
@ CS_MESH_CARTESIAN_PARABOLIC_LAW
Definition: cs_mesh_cartesian.h:42
@ CS_MESH_CARTESIAN_GEOMETRIC_LAW
Definition: cs_mesh_cartesian.h:41
cs_gnum_t cs_mesh_cartesian_get_n_g_cells(int id)
Get global number of cells of a cartesian mesh.
Definition: cs_mesh_cartesian.c:1139
integer(c_int), pointer, save smin
starting min
Definition: atincl.f90:196
Definition: cs_mesh_builder.h:57
Definition: cs_mesh.h:85