programmer's 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-2015 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 
41 /*----------------------------------------------------------------------------*/
42 
44 
45 /*=============================================================================
46  * Macro definitions
47  *============================================================================*/
48 
49 /*============================================================================
50  * Type definitions
51  *============================================================================*/
52 
53 /* Auxiliary and temporary structure used to build or distribute mesh */
54 /* ------------------------------------------------------------------ */
55 
56 typedef struct {
57 
58  /* Global dimensions */
59 
60  cs_gnum_t n_g_faces; /* Number of faces */
61  cs_gnum_t n_g_face_connect_size; /* Size of face connectivity */
62 
63  int n_perio; /* Number of periodicities */
64 
65  bool have_cell_rank; /* True if cell_rank array is defined */
66 
67  /* Temporary mesh data */
68 
75 
76  /* Periodic features */
77 
78  int *periodicity_num; /* Periodicity numbers */
79  cs_lnum_t *n_per_face_couples; /* Nb. face couples per periodicity */
80  cs_gnum_t *n_g_per_face_couples; /* Global nb. couples per periodicity */
81 
82  cs_gnum_t **per_face_couples; /* Periodic face couples list. */
83 
84  /* Optional partitioning info */
85 
86  int *cell_rank; /* Partition id for each cell */
87 
88  /* Block ranges for parallel distribution */
89 
90  int min_rank_step; /* Minimum block rank step */
91  cs_block_dist_info_t cell_bi; /* Block info for cell data */
92  cs_block_dist_info_t face_bi; /* Block info for face data */
93  cs_block_dist_info_t vertex_bi; /* Block info for vertex data */
94  cs_block_dist_info_t *per_face_bi; /* Block info for parallel face
95  couples */
96 
98 
99 /*============================================================================
100  * Static global variables
101  *============================================================================*/
102 
103 extern cs_mesh_builder_t *cs_glob_mesh_builder; /* Pointer to builder mesh
104  structure */
105 
106 /*============================================================================
107  * Public function prototypes
108  *============================================================================*/
109 
110 /*----------------------------------------------------------------------------
111  * Create an empty mesh builder structure.
112  *
113  * returns:
114  * A pointer to a mesh builder structure
115  *----------------------------------------------------------------------------*/
116 
119 
120 /*----------------------------------------------------------------------------*
121  * Destroy a cs_mesh_builder_t structure.
122  *
123  * parameters:
124  * mb <-> pointer to pointer of structure to destroy
125  *----------------------------------------------------------------------------*/
126 
127 void
129 
130 /*----------------------------------------------------------------------------
131  * Define block distribution sizes for mesh builder.
132  *
133  * parameters:
134  * mb <-> mesh builder
135  * rank_id <-- id of local rank
136  * n_ranks <-- number of associated ranks
137  * min_rank_step <-- minimum rank step between blocks
138  * min_block_size <-- minimum number of entities per block
139  * n_g_cells <-- global number of cells
140  * n_g_faces <-- global number of faces
141  * n_g_vertices <-- global number of vertices
142  *----------------------------------------------------------------------------*/
143 
144 void
146  int rank_id,
147  int n_ranks,
148  int min_rank_step,
149  int min_block_size,
150  cs_gnum_t n_g_cells,
151  cs_gnum_t n_g_faces,
152  cs_gnum_t n_g_vertices);
153 
154 /*----------------------------------------------------------------------------*/
155 
157 
158 #endif /* __CS_MESH_BUILDER_H__ */
bool have_cell_rank
Definition: cs_mesh_builder.h:65
cs_mesh_builder_t * cs_glob_mesh_builder
unsigned long cs_gnum_t
global mesh entity number
Definition: cs_defs.h:280
cs_block_dist_info_t * per_face_bi
Definition: cs_mesh_builder.h:94
Definition: cs_mesh_builder.h:56
Definition: cs_block_dist.h:50
#define BEGIN_C_DECLS
Definition: cs_defs.h:429
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:295
void cs_mesh_builder_destroy(cs_mesh_builder_t **mb)
Destroy a cs_mesh_builder_t structure.
Definition: cs_mesh_builder.c:156
int min_rank_step
Definition: cs_mesh_builder.h:90
cs_gnum_t n_g_face_connect_size
Definition: cs_mesh_builder.h:61
cs_gnum_t ** per_face_couples
Definition: cs_mesh_builder.h:82
cs_gnum_t * face_vertices
Definition: cs_mesh_builder.h:71
cs_int_t * cell_gc_id
Definition: cs_mesh_builder.h:72
cs_gnum_t n_g_faces
Definition: cs_mesh_builder.h:60
cs_block_dist_info_t vertex_bi
Definition: cs_mesh_builder.h:93
cs_int_t * face_gc_id
Definition: cs_mesh_builder.h:73
cs_block_dist_info_t face_bi
Definition: cs_mesh_builder.h:92
cs_mesh_builder_t * cs_mesh_builder_create(void)
Create an empty mesh builder structure.
Definition: cs_mesh_builder.c:102
cs_gnum_t * n_g_per_face_couples
Definition: cs_mesh_builder.h:80
int n_perio
Definition: cs_mesh_builder.h:63
cs_lnum_t * n_per_face_couples
Definition: cs_mesh_builder.h:79
int * cell_rank
Definition: cs_mesh_builder.h:86
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:210
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:292
cs_block_dist_info_t cell_bi
Definition: cs_mesh_builder.h:91
#define END_C_DECLS
Definition: cs_defs.h:430
double cs_real_t
Definition: cs_defs.h:296
int * periodicity_num
Definition: cs_mesh_builder.h:78
cs_lnum_t * face_vertices_idx
Definition: cs_mesh_builder.h:70
cs_real_t * vertex_coords
Definition: cs_mesh_builder.h:74
cs_gnum_t * face_cells
Definition: cs_mesh_builder.h:69