programmer's documentation
cs_cdo_connect.h
Go to the documentation of this file.
1 #ifndef __CS_CDO_CONNECT_H__
2 #define __CS_CDO_CONNECT_H__
3 
4 /*============================================================================
5  * Manage connectivity (Topological features of the mesh)
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_base.h"
35 #include "cs_mesh.h"
36 #include "cs_mesh_quantities.h"
37 
38 #include "cs_cdo.h"
39 #include "cs_sla.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
44 
45 /*============================================================================
46  * Macro definitions
47  *============================================================================*/
48 
49 /* First level of information */
50 #define CS_CDO_CONNECT_IN (1 << 0) /* Interior entity */
51 #define CS_CDO_CONNECT_BD (1 << 1) /* Border entity */
52 
53 /* Second level of information */
54 #define CS_CDO_CONNECT_II (1 << 2) /* Interior ent. connected to interior */
55 #define CS_CDO_CONNECT_IB (1 << 3) /* Interior ent. connected to border */
56 #define CS_CDO_CONNECT_BI (1 << 4) /* Border ent. connected to interior */
57 #define CS_CDO_CONNECT_BB (1 << 5) /* Border ent. connected to border */
58 
59 /*============================================================================
60  * Type definitions
61  *============================================================================*/
62 
63 typedef struct {
64 
65  bool owner;
66  int n;
67  int *idx; /* from 0, size = n+1 */
68  int *ids; /* ids from 0 to n-1 (there is no multifold entry) */
69 
71 
72 typedef struct {
73 
74  short int *flag; /* CS_CONNECT_(IN/BD/II/IB/BB/BI) */
75 
76  cs_lnum_t n; /* full number of entities */
77  cs_lnum_t n_in; /* Interior entity */
78  cs_lnum_t n_bd; /* Border entity */
79  cs_lnum_t n_ii; /* Interior entity connected only to interior entity */
80  cs_lnum_t n_ib; /* Interior entity connected to at least one border entity */
81  cs_lnum_t n_bb; /* Border entity connected only to border entity */
82  cs_lnum_t n_bi; /* Border entity connected to at least one interior entity */
83 
85 
86 typedef struct { /* Connectivity structure */
87 
88  /* Upward oriented connectivity */
89  cs_sla_matrix_t *v2e; // vertex --> edges connectivity
90  cs_sla_matrix_t *e2f; // edge --> faces connectivity
91  cs_sla_matrix_t *f2c; // face --> cells connectivity
92 
93  /* Downward oriented connectivity */
94  cs_sla_matrix_t *e2v; // edge --> vertices connectivity
95  cs_sla_matrix_t *f2e; // face --> edges connectivity
96  cs_sla_matrix_t *c2f; // cell --> faces connectivity
97 
98  /* Specific CDO connect : not oriented (same spirit as Code_Saturne
99  historical connectivity. Use this connectivity to scan dual quantities
100  */
101  cs_connect_index_t *c2e; /* cell -> edges connectivity */
102  cs_connect_index_t *c2v; /* cell -> vertices connectivity */
103 
104  /* Max. connectitivy size for cells */
105  cs_lnum_t n_max_vbyc; // max. number of vertices in a cell
106  cs_lnum_t n_max_ebyc; // max. number of edges in a cell
107  cs_lnum_t n_max_fbyc; // max. number of faces in a cell
108 
109  cs_lnum_t max_set_size; /* max between n_vertices, n_edges, n_faces
110  and n_cells */
111 
112  /* Status internal or border entity */
113  cs_connect_info_t *v_info; // count of interior/border vertices
114  cs_connect_info_t *e_info; // count of interior/border edges
115  cs_connect_info_t *f_info; // count of interior/border faces
116  cs_connect_info_t *c_info; /* count of interior/border cells
117  a border cell has at least one border face */
118 
120 
121 /*============================================================================
122  * Global variables
123  *============================================================================*/
124 
125 /*============================================================================
126  * Public function prototypes
127  *============================================================================*/
128 
129 /*----------------------------------------------------------------------------*/
135 /*----------------------------------------------------------------------------*/
136 
137 const char *
138 cs_cdo_connect_flagname(short int flag);
139 
140 /*----------------------------------------------------------------------------*/
148 /*----------------------------------------------------------------------------*/
149 
152 
153 /*----------------------------------------------------------------------------*/
161 /*----------------------------------------------------------------------------*/
162 
165 
166 /*----------------------------------------------------------------------------*/
172 /*----------------------------------------------------------------------------*/
173 
174 void
176 
177 /*----------------------------------------------------------------------------*/
184 /*----------------------------------------------------------------------------*/
185 
186 void
187 cs_cdo_connect_dump(const cs_cdo_connect_t *connect);
188 
189 /*----------------------------------------------------------------------------*/
197 /*----------------------------------------------------------------------------*/
198 
200 cs_index_create(int n);
201 
202 /*----------------------------------------------------------------------------*/
212 /*----------------------------------------------------------------------------*/
213 
215 cs_index_map(int n,
216  int *idx,
217  int *ids);
218 
219 /*----------------------------------------------------------------------------*/
225 /*----------------------------------------------------------------------------*/
226 
227 void
229 
230 /*----------------------------------------------------------------------------*/
240 /*----------------------------------------------------------------------------*/
241 
243 cs_index_compose(int nc,
244  const cs_connect_index_t *a2b,
245  const cs_connect_index_t *b2c);
246 
247 /*----------------------------------------------------------------------------*/
256 /*----------------------------------------------------------------------------*/
257 
259 cs_index_transpose(int nb,
260  const cs_connect_index_t *a2b);
261 
262 /*----------------------------------------------------------------------------*/
268 /*----------------------------------------------------------------------------*/
269 
270 void
272 
273 /*----------------------------------------------------------------------------*/
282 /*----------------------------------------------------------------------------*/
283 
284 void
285 cs_index_dump(const char *name,
286  FILE *f,
287  cs_connect_index_t *x);
288 
289 /*----------------------------------------------------------------------------*/
290 
292 
293 #endif /* __CS_CDO_CONNECT_H__ */
cs_lnum_t n_max_ebyc
Definition: cs_cdo_connect.h:106
cs_lnum_t n_max_fbyc
Definition: cs_cdo_connect.h:107
double precision, dimension(:,:,:), allocatable nc
Definition: atimbr.f90:105
cs_sla_matrix_t * c2f
Definition: cs_cdo_connect.h:96
Definition: cs_cdo_connect.h:63
int n
Definition: cs_cdo_connect.h:66
cs_lnum_t n_ib
Definition: cs_cdo_connect.h:80
cs_sla_matrix_t * e2v
Definition: cs_cdo_connect.h:94
#define BEGIN_C_DECLS
Definition: cs_defs.h:419
cs_lnum_t n_in
Definition: cs_cdo_connect.h:77
cs_lnum_t n_max_vbyc
Definition: cs_cdo_connect.h:105
cs_lnum_t n_bd
Definition: cs_cdo_connect.h:78
void cs_index_dump(const char *name, FILE *f, cs_connect_index_t *x)
Dump a cs_connect_index_t structure to a file or into the standard output.
Definition: cs_cdo_connect.c:1386
void cs_index_sort(cs_connect_index_t *x)
Sort each list related to an entry in a cs_connect_index_t structure.
Definition: cs_cdo_connect.c:1365
void cs_cdo_connect_dump(const cs_cdo_connect_t *connect)
Dump a cs_cdo_connect_t structure.
Definition: cs_cdo_connect.c:1111
void cs_cdo_connect_resume(const cs_cdo_connect_t *connect)
Resume connectivity information.
Definition: cs_cdo_connect.c:1059
Definition: cs_cdo_connect.h:86
cs_connect_index_t * cs_index_transpose(int nb, const cs_connect_index_t *a2b)
From a cs_connect_index_t struct. A -> B create a new index B -> A.
Definition: cs_cdo_connect.c:1314
int * idx
Definition: cs_cdo_connect.h:67
cs_connect_index_t * c2v
Definition: cs_cdo_connect.h:102
Definition: cs_sla.h:87
Definition: cs_cdo_connect.h:72
cs_connect_index_t * cs_index_create(int n)
Create an index structure of size n.
Definition: cs_cdo_connect.c:1151
Definition: cs_mesh.h:62
cs_lnum_t max_set_size
Definition: cs_cdo_connect.h:109
cs_connect_info_t * v_info
Definition: cs_cdo_connect.h:113
cs_cdo_connect_t * cs_cdo_connect_free(cs_cdo_connect_t *connect)
Destroy a cs_cdo_connect_t structure.
Definition: cs_cdo_connect.c:1024
cs_sla_matrix_t * f2e
Definition: cs_cdo_connect.h:95
cs_sla_matrix_t * f2c
Definition: cs_cdo_connect.h:91
cs_connect_index_t * cs_index_compose(int nc, const cs_connect_index_t *a2b, const cs_connect_index_t *b2c)
From 2 indexes : A -> B and B -> C create a new index A -> C.
Definition: cs_cdo_connect.c:1236
cs_lnum_t n
Definition: cs_cdo_connect.h:76
const char * cs_cdo_connect_flagname(short int flag)
String related to flag in cs_connect_info_t.
Definition: cs_cdo_connect.c:922
bool owner
Definition: cs_cdo_connect.h:65
void cs_index_free(cs_connect_index_t **pidx)
Destroy a cs_connect_index_t structure.
Definition: cs_cdo_connect.c:1207
cs_lnum_t n_bb
Definition: cs_cdo_connect.h:81
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:292
cs_sla_matrix_t * e2f
Definition: cs_cdo_connect.h:90
cs_connect_index_t * c2e
Definition: cs_cdo_connect.h:101
cs_lnum_t n_bi
Definition: cs_cdo_connect.h:82
#define END_C_DECLS
Definition: cs_defs.h:420
cs_connect_index_t * cs_index_map(int n, int *idx, int *ids)
Map arrays into an index structure of size n (owner = false)
Definition: cs_cdo_connect.c:1182
cs_connect_info_t * e_info
Definition: cs_cdo_connect.h:114
cs_connect_info_t * c_info
Definition: cs_cdo_connect.h:116
int * ids
Definition: cs_cdo_connect.h:68
cs_cdo_connect_t * cs_cdo_connect_build(const cs_mesh_t *m)
Define a cs_cdo_connect_t structure.
Definition: cs_cdo_connect.c:975
cs_connect_info_t * f_info
Definition: cs_cdo_connect.h:115
short int * flag
Definition: cs_cdo_connect.h:74
cs_lnum_t n_ii
Definition: cs_cdo_connect.h:79
cs_sla_matrix_t * v2e
Definition: cs_cdo_connect.h:89