8.3
general documentation
cs_mesh_builder.h
Go to the documentation of this file.
1#ifndef __CS_MESH_BUILDER_H__
2#define __CS_MESH_BUILDER_H__
3
4/*============================================================================
5 * Auxiliary structure used to read, write, and partition mesh data.
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2024 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/*----------------------------------------------------------------------------
31 * Local headers
32 *----------------------------------------------------------------------------*/
33
34#include "cs_defs.h"
35
36#include "fvm_periodicity.h"
37
38#include "cs_base.h"
39#include "cs_block_dist.h"
40#include "cs_interface.h"
41
42/*----------------------------------------------------------------------------*/
43
45
46/*=============================================================================
47 * Macro definitions
48 *============================================================================*/
49
50/*============================================================================
51 * Type definitions
52 *============================================================================*/
53
54/* Auxiliary and temporary structure used to build or distribute mesh */
55/* ------------------------------------------------------------------ */
56
57typedef struct {
58
59 /* Global dimensions */
60
61 cs_gnum_t n_g_faces; /* Number of faces */
62 cs_gnum_t n_g_face_connect_size; /* Size of face connectivity */
63
64 int n_perio; /* Number of periodicities */
65
66 bool have_cell_rank; /* True if cell_rank array is defined */
67
68 /* Temporary mesh data */
69
76
77 /* Refinement features */
78
80 char *vtx_r_gen;
81
82 /* Periodic features */
83
84 int *periodicity_num; /* Periodicity numbers */
85 cs_lnum_t *n_per_face_couples; /* Nb. face couples per periodicity */
86 cs_gnum_t *n_g_per_face_couples; /* Global nb. couples per periodicity */
87
88 cs_gnum_t **per_face_couples; /* Periodic face couples list. */
89
90 /* Optional partitioning info */
91
92 int *cell_rank; /* Partition id for each cell */
93
94 /* Block ranges for parallel distribution */
95
96 int min_rank_step; /* Minimum block rank step */
97 cs_block_dist_info_t cell_bi; /* Block info for cell data */
98 cs_block_dist_info_t face_bi; /* Block info for face data */
99 cs_block_dist_info_t vertex_bi; /* Block info for vertex data */
100 cs_block_dist_info_t *per_face_bi; /* Block info for parallel face
101 couples */
102
104
105/*============================================================================
106 * Static global variables
107 *============================================================================*/
108
109extern cs_mesh_builder_t *cs_glob_mesh_builder; /* Pointer to builder mesh
110 structure */
111
112/*============================================================================
113 * Public function prototypes
114 *============================================================================*/
115
116/*----------------------------------------------------------------------------
117 * Create an empty mesh builder structure.
118 *
119 * returns:
120 * A pointer to a mesh builder structure
121 *----------------------------------------------------------------------------*/
122
125
126/*----------------------------------------------------------------------------*
127 * Destroy a cs_mesh_builder_t structure.
128 *
129 * parameters:
130 * mb <-> pointer to pointer of structure to destroy
131 *----------------------------------------------------------------------------*/
132
133void
135
136/*----------------------------------------------------------------------------
137 * Define block distribution sizes for mesh builder.
138 *
139 * parameters:
140 * mb <-> mesh builder
141 * rank_id <-- id of local rank
142 * n_ranks <-- number of associated ranks
143 * min_rank_step <-- minimum rank step between blocks
144 * min_block_size <-- minimum number of entities per block
145 * n_g_cells <-- global number of cells
146 * n_g_faces <-- global number of faces
147 * n_g_vertices <-- global number of vertices
148 *----------------------------------------------------------------------------*/
149
150void
152 int rank_id,
153 int n_ranks,
154 int min_rank_step,
155 int min_block_size,
156 cs_gnum_t n_g_cells,
157 cs_gnum_t n_g_faces,
158 cs_gnum_t n_g_vertices);
159
160#if defined(HAVE_MPI)
161
162/*----------------------------------------------------------------------------
163 * Extract periodic face connectivity information from faces interface
164 * for mesh builder whn running in parallel mode.
165 *
166 * parameters:
167 * n_init_perio <-- number of initial periodicities
168 * mesh <-- pointer to mesh structure
169 * mb <-> pointer to mesh builder structure
170 * periodicity <-- periodicity information
171 * face_gnum <-- global face numbers, or NULL
172 * face_ifs <-- parallel and periodic faces interfaces set
173 *----------------------------------------------------------------------------*/
174
175void
176cs_mesh_builder_extract_periodic_faces_g(int n_init_perio,
178 fvm_periodicity_t *periodicity,
179 const cs_gnum_t *face_gnum,
180 const cs_interface_set_t *face_ifs);
181
182#endif /* defined(HAVE_MPI) */
183
184/*----------------------------------------------------------------------------*/
185
187
188#endif /* __CS_MESH_BUILDER_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
double cs_real_t
Floating-point value.
Definition: cs_defs.h:342
uint64_t cs_gnum_t
global mesh entity number
Definition: cs_defs.h:325
#define END_C_DECLS
Definition: cs_defs.h:543
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
struct _cs_interface_set_t cs_interface_set_t
Definition: cs_interface.h:61
void cs_mesh_builder_define_block_dist(cs_mesh_builder_t *mb, int rank_id, int n_ranks, int min_rank_step, int min_block_size, cs_gnum_t n_g_cells, cs_gnum_t n_g_faces, cs_gnum_t n_g_vertices)
Define block distribution sizes for mesh builder.
Definition: cs_mesh_builder.cpp:262
cs_mesh_builder_t * cs_glob_mesh_builder
void cs_mesh_builder_destroy(cs_mesh_builder_t **mb)
Destroy a cs_mesh_builder_t structure.
Definition: cs_mesh_builder.cpp:200
cs_mesh_builder_t * cs_mesh_builder_create(void)
Create an empty mesh builder structure.
Definition: cs_mesh_builder.cpp:141
struct _fvm_periodicity_t fvm_periodicity_t
Definition: fvm_periodicity.h:67
Definition: cs_block_dist.h:50
Definition: cs_mesh_builder.h:57
cs_gnum_t * face_cells
Definition: cs_mesh_builder.h:70
cs_gnum_t ** per_face_couples
Definition: cs_mesh_builder.h:88
cs_lnum_t * face_vertices_idx
Definition: cs_mesh_builder.h:71
int * cell_gc_id
Definition: cs_mesh_builder.h:73
cs_real_t * vertex_coords
Definition: cs_mesh_builder.h:75
cs_gnum_t * face_vertices
Definition: cs_mesh_builder.h:72
cs_block_dist_info_t * per_face_bi
Definition: cs_mesh_builder.h:100
cs_block_dist_info_t face_bi
Definition: cs_mesh_builder.h:98
char * vtx_r_gen
Definition: cs_mesh_builder.h:80
cs_lnum_t * n_per_face_couples
Definition: cs_mesh_builder.h:85
cs_gnum_t * n_g_per_face_couples
Definition: cs_mesh_builder.h:86
int * cell_rank
Definition: cs_mesh_builder.h:92
char * face_r_gen
Definition: cs_mesh_builder.h:79
cs_gnum_t n_g_faces
Definition: cs_mesh_builder.h:61
int min_rank_step
Definition: cs_mesh_builder.h:96
bool have_cell_rank
Definition: cs_mesh_builder.h:66
cs_gnum_t n_g_face_connect_size
Definition: cs_mesh_builder.h:62
cs_block_dist_info_t vertex_bi
Definition: cs_mesh_builder.h:99
int * face_gc_id
Definition: cs_mesh_builder.h:74
int n_perio
Definition: cs_mesh_builder.h:64
int * periodicity_num
Definition: cs_mesh_builder.h:84
cs_block_dist_info_t cell_bi
Definition: cs_mesh_builder.h:97