Code_Saturne
CFD tool
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-2012 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  cs_block_dist_info_t cell_bi; /* Block info for cell data */
91  cs_block_dist_info_t face_bi; /* Block info for face data */
92  cs_block_dist_info_t vertex_bi; /* Block info for vertex data */
93  cs_block_dist_info_t *per_face_bi; /* Block info for parallel face
94  couples */
95 
97 
98 /*============================================================================
99  * Static global variables
100  *============================================================================*/
101 
102 extern cs_mesh_builder_t *cs_glob_mesh_builder; /* Pointer to builder mesh
103  structure */
104 
105 /*============================================================================
106  * Public function prototypes
107  *============================================================================*/
108 
109 /*----------------------------------------------------------------------------
110  * Create an empty mesh builder structure.
111  *
112  * returns:
113  * A pointer to a mesh builder structure
114  *----------------------------------------------------------------------------*/
115 
118 
119 /*----------------------------------------------------------------------------*
120  * Destroy a cs_mesh_builder_t structure.
121  *
122  * parameters:
123  * mb <-> pointer to pointer of structure to destroy
124  *----------------------------------------------------------------------------*/
125 
126 void
128 
129 /*----------------------------------------------------------------------------
130  * Define block distribution sizes for mesh builder.
131  *
132  * parameters:
133  * mb <-> mesh builder
134  * rank_id <-- id of local rank
135  * n_ranks <-- number of associated ranks
136  * min_rank_step <-- minimum rank step between blocks
137  * min_block_size <-- minimum number of entities per block
138  * n_g_cells <-- global number of cells
139  * n_g_faces <-- global number of faces
140  * n_g_vertices <-- global number of vertices
141  *----------------------------------------------------------------------------*/
142 
143 void
145  int rank_id,
146  int n_ranks,
147  int min_rank_step,
148  int min_block_size,
149  cs_gnum_t n_g_cells,
150  cs_gnum_t n_g_faces,
151  cs_gnum_t n_g_vertices);
152 
153 /*----------------------------------------------------------------------------*/
154 
156 
157 #endif /* __CS_MESH_BUILDER_H__ */
bool have_cell_rank
Definition: cs_mesh_builder.h:65
cs_mesh_builder_t * cs_glob_mesh_builder
Definition: cs_mesh_builder.c:83
cs_block_dist_info_t * per_face_bi
Definition: cs_mesh_builder.h:93
Definition: cs_mesh_builder.h:56
Definition: cs_block_dist.h:50
#define BEGIN_C_DECLS
Definition: cs_defs.h:365
void cs_mesh_builder_destroy(cs_mesh_builder_t **mb)
Destroy a cs_mesh_builder_t structure.
Definition: cs_mesh_builder.c:151
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:92
cs_int_t * face_gc_id
Definition: cs_mesh_builder.h:73
int cs_int_t
Definition: cs_defs.h:263
cs_block_dist_info_t face_bi
Definition: cs_mesh_builder.h:91
cs_mesh_builder_t * cs_mesh_builder_create(void)
Create an empty mesh builder structure.
Definition: cs_mesh_builder.c:98
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 cs_lnum_t
Definition: cs_defs.h:260
int * cell_rank
Definition: cs_mesh_builder.h:86
unsigned cs_gnum_t
Definition: cs_defs.h:255
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:205
cs_block_dist_info_t cell_bi
Definition: cs_mesh_builder.h:90
#define END_C_DECLS
Definition: cs_defs.h:366
double cs_real_t
Definition: cs_defs.h:264
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