src/mesh/cs_mesh_builder.h Source File

| programmer's documentation

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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-2013 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
43 BEGIN_C_DECLS
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
69 cs_gnum_t *face_cells;
70 cs_lnum_t *face_vertices_idx;
71 cs_gnum_t *face_vertices;
72 cs_int_t *cell_gc_id;
73 cs_int_t *face_gc_id;
74 cs_real_t *vertex_coords;
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
97 } cs_mesh_builder_t;
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
117 cs_mesh_builder_t *
118 cs_mesh_builder_create(void);
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
128 cs_mesh_builder_destroy(cs_mesh_builder_t **mb);
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
145 cs_mesh_builder_define_block_dist(cs_mesh_builder_t *mb,
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
156 END_C_DECLS
157
158 #endif /* __CS_MESH_BUILDER_H__ */