My Project
programmer's documentation
Loading...
Searching...
No Matches
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-2019 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
70 cs_gnum_t *face_cells;
72 cs_gnum_t *face_vertices;
76
77 /* Periodic features */
78
79 int *periodicity_num; /* Periodicity numbers */
80 cs_lnum_t *n_per_face_couples; /* Nb. face couples per periodicity */
81 cs_gnum_t *n_g_per_face_couples; /* Global nb. couples per periodicity */
82
83 cs_gnum_t **per_face_couples; /* Periodic face couples list. */
84
85 /* Optional partitioning info */
86
87 int *cell_rank; /* Partition id for each cell */
88
89 /* Block ranges for parallel distribution */
90
91 int min_rank_step; /* Minimum block rank step */
92 cs_block_dist_info_t cell_bi; /* Block info for cell data */
93 cs_block_dist_info_t face_bi; /* Block info for face data */
94 cs_block_dist_info_t vertex_bi; /* Block info for vertex data */
95 cs_block_dist_info_t *per_face_bi; /* Block info for parallel face
96 couples */
97
99
100/*============================================================================
101 * Static global variables
102 *============================================================================*/
103
104extern cs_mesh_builder_t *cs_glob_mesh_builder; /* Pointer to builder mesh
105 structure */
106
107/*============================================================================
108 * Public function prototypes
109 *============================================================================*/
110
111/*----------------------------------------------------------------------------
112 * Create an empty mesh builder structure.
113 *
114 * returns:
115 * A pointer to a mesh builder structure
116 *----------------------------------------------------------------------------*/
117
120
121/*----------------------------------------------------------------------------*
122 * Destroy a cs_mesh_builder_t structure.
123 *
124 * parameters:
125 * mb <-> pointer to pointer of structure to destroy
126 *----------------------------------------------------------------------------*/
127
128void
130
131/*----------------------------------------------------------------------------
132 * Define block distribution sizes for mesh builder.
133 *
134 * parameters:
135 * mb <-> mesh builder
136 * rank_id <-- id of local rank
137 * n_ranks <-- number of associated ranks
138 * min_rank_step <-- minimum rank step between blocks
139 * min_block_size <-- minimum number of entities per block
140 * n_g_cells <-- global number of cells
141 * n_g_faces <-- global number of faces
142 * n_g_vertices <-- global number of vertices
143 *----------------------------------------------------------------------------*/
144
145void
147 int rank_id,
148 int n_ranks,
149 int min_rank_step,
150 int min_block_size,
151 cs_gnum_t n_g_cells,
152 cs_gnum_t n_g_faces,
153 cs_gnum_t n_g_vertices);
154
155#if defined(HAVE_MPI)
156
157/*----------------------------------------------------------------------------
158 * Extract periodic face connectivity information from faces interface
159 * for mesh builder whn running in parallel mode.
160 *
161 * parameters:
162 * n_init_perio <-- number of initial periodicities
163 * mesh <-- pointer to mesh structure
164 * mb <-> pointer to mesh builder structure
165 * periodicity <-- periodicity information
166 * face_gnum <-- global face numbers, or NULL
167 * face_ifs <-- parallel and periodic faces interfaces set
168 *----------------------------------------------------------------------------*/
169
170void
171cs_mesh_builder_extract_periodic_faces_g(int n_init_perio,
173 fvm_periodicity_t *periodicity,
174 const cs_gnum_t *face_gnum,
175 const cs_interface_set_t *face_ifs);
176
177#endif /* defined(HAVE_MPI) */
178
179/*----------------------------------------------------------------------------*/
180
182
183#endif /* __CS_MESH_BUILDER_H__ */
#define BEGIN_C_DECLS
Definition cs_defs.h:467
double cs_real_t
Floating-point value.
Definition cs_defs.h:302
int cs_int_t
Fortran-compatible integer.
Definition cs_defs.h:301
#define END_C_DECLS
Definition cs_defs.h:468
int cs_lnum_t
local mesh entity id
Definition cs_defs.h:298
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.c:249
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.c:195
cs_mesh_builder_t * cs_mesh_builder_create(void)
Create an empty mesh builder structure.
Definition cs_mesh_builder.c: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:83
cs_int_t * face_gc_id
Definition cs_mesh_builder.h:74
cs_lnum_t * face_vertices_idx
Definition cs_mesh_builder.h:71
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:95
cs_block_dist_info_t face_bi
Definition cs_mesh_builder.h:93
cs_lnum_t * n_per_face_couples
Definition cs_mesh_builder.h:80
cs_gnum_t * n_g_per_face_couples
Definition cs_mesh_builder.h:81
int * cell_rank
Definition cs_mesh_builder.h:87
cs_gnum_t n_g_faces
Definition cs_mesh_builder.h:61
cs_int_t * cell_gc_id
Definition cs_mesh_builder.h:73
int min_rank_step
Definition cs_mesh_builder.h:91
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:94
int n_perio
Definition cs_mesh_builder.h:64
int * periodicity_num
Definition cs_mesh_builder.h:79
cs_block_dist_info_t cell_bi
Definition cs_mesh_builder.h:92