7.0
general documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
cs_mesh_adjacencies.h
Go to the documentation of this file.
1 #ifndef __CS_MESH_ADJACENCIES_H__
2 #define __CS_MESH_ADJACENCIES_H__
3 
4 /*============================================================================
5  * Additional mesh adjacencies.
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2021 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_halo.h"
36 #include "cs_mesh.h"
37 
38 /*----------------------------------------------------------------------------*/
39 
41 
42 /*=============================================================================
43  * Macro definitions
44  *============================================================================*/
45 
53 #define CS_ADJACENCY_SHARED (1 << 0)
54 
55 #define CS_ADJACENCY_STRIDE (1 << 1)
56 
57 #define CS_ADJACENCY_SIGNED (1 << 2)
58 
61 /*============================================================================
62  * Type definitions
63  *============================================================================*/
64 
67 typedef struct {
68 
70  int stride;
75  short int *sgn;
78 
81 typedef struct {
82 
83  /* metadata */
84 
88  /* cells -> cells connectivity (standard) */
89 
93  /* cells -> cells connectivity (extended) */
94 
98  /* cells -> boundary faces connectivity */
99 
103  /* cells -> vertices connectivity */
104 
111 
112 /*============================================================================
113  * Global variables
114  *============================================================================*/
115 
116 /* Read-only pointer to global mesh additional adjacencies structure */
117 
119 
120 /*=============================================================================
121  * Public function prototypes
122  *============================================================================*/
123 
124 /*----------------------------------------------------------------------------*/
128 /*----------------------------------------------------------------------------*/
129 
130 void
132 
133 /*----------------------------------------------------------------------------*/
137 /*----------------------------------------------------------------------------*/
138 
139 void
141 
142 /*----------------------------------------------------------------------------*/
146 /*----------------------------------------------------------------------------*/
147 
148 void
150 
151 /*----------------------------------------------------------------------------*/
156 /*----------------------------------------------------------------------------*/
157 
158 void
160 
161 /*----------------------------------------------------------------------------*/
169 /*----------------------------------------------------------------------------*/
170 
171 const cs_adjacency_t *
173 
174 /*----------------------------------------------------------------------------*/
184 /*----------------------------------------------------------------------------*/
185 
188  int stride,
189  cs_lnum_t n_elts);
190 
191 /*----------------------------------------------------------------------------*/
203 /*----------------------------------------------------------------------------*/
204 
207  int stride,
208  cs_lnum_t *ids,
209  short int *sgn);
210 
211 /*----------------------------------------------------------------------------*/
223 /*----------------------------------------------------------------------------*/
224 
227  cs_lnum_t *idx,
228  cs_lnum_t *ids,
229  short int *sgn);
230 
231 /*----------------------------------------------------------------------------*/
237 /*----------------------------------------------------------------------------*/
238 
239 void
241 
242 /*----------------------------------------------------------------------------*/
255 /*----------------------------------------------------------------------------*/
256 
258 cs_adjacency_compose(int n_c_elts,
259  const cs_adjacency_t *a2b,
260  const cs_adjacency_t *b2c);
261 
262 /*----------------------------------------------------------------------------*/
272 /*----------------------------------------------------------------------------*/
273 
275 cs_adjacency_transpose(int n_b_elts,
276  const cs_adjacency_t *a2b);
277 
278 /*----------------------------------------------------------------------------*/
285 /*----------------------------------------------------------------------------*/
286 
287 void
289 
290 /*----------------------------------------------------------------------------*/
298 /*----------------------------------------------------------------------------*/
299 
300 void
302 
303 /*----------------------------------------------------------------------------*/
312 /*----------------------------------------------------------------------------*/
313 
314 void
315 cs_adjacency_dump(const char *name,
316  FILE *_f,
317  cs_adjacency_t *adj);
318 
319 /*----------------------------------------------------------------------------*/
333 /*----------------------------------------------------------------------------*/
334 
337  int boundary_order);
338 
339 /*----------------------------------------------------------------------------*/
352 /*----------------------------------------------------------------------------*/
353 
356 
357 /*----------------------------------------------------------------------------*/
358 
360 
361 #endif /* __CS_MESH_ADJACENCIES__ */
const cs_adjacency_t * cs_mesh_adjacencies_cell_vertices(void)
Return cell -> vertex connectivites in mesh adjacencies helper API relative to mesh.
Definition: cs_mesh_adjacencies.c:578
cs_lnum_t n_elts
Definition: cs_mesh_adjacencies.h:72
cs_adjacency_t * cs_mesh_adjacency_c2f(const cs_mesh_t *m, int boundary_order)
Build a cells to faces adjacency structure.
Definition: cs_mesh_adjacencies.c:1303
bool single_faces_to_cells
Definition: cs_mesh_adjacencies.h:85
short int * sgn
Definition: cs_mesh_adjacencies.h:75
cs_adjacency_t * cs_adjacency_create_from_s_arrays(cs_lnum_t n_elts, int stride, cs_lnum_t *ids, short int *sgn)
Create a cs_adjacency_t structure sharing arrays scanned with a stride.
Definition: cs_mesh_adjacencies.c:663
cs_adjacency_t * _c2v
Definition: cs_mesh_adjacencies.h:107
cs_adjacency_t * cs_adjacency_create_from_i_arrays(cs_lnum_t n_elts, cs_lnum_t *idx, cs_lnum_t *ids, short int *sgn)
Create a cs_adjacency_t structure sharing arrays scanned with an index.
Definition: cs_mesh_adjacencies.c:709
Definition: cs_mesh_adjacencies.h:67
Definition: cs_mesh_adjacencies.h:81
#define BEGIN_C_DECLS
Definition: cs_defs.h:495
cs_lnum_t * cell_b_faces_idx
Definition: cs_mesh_adjacencies.h:100
void cs_mesh_adjacencies_initialize(void)
Initialize mesh adjacencies helper API.
Definition: cs_mesh_adjacencies.c:479
void cs_adjacency_sort(cs_adjacency_t *adj)
Sort each sub-list related to an entry in a cs_adjacency_t structure.
Definition: cs_mesh_adjacencies.c:1121
const cs_lnum_t * cell_cells_e_idx
Definition: cs_mesh_adjacencies.h:95
cs_adjacency_t * cs_mesh_adjacency_v2v(const cs_mesh_t *m)
Definition: cs_mesh_adjacencies.c:1408
Definition: cs_mesh.h:84
int stride
Definition: cs_mesh_adjacencies.h:70
void cs_adjacency_destroy(cs_adjacency_t **p_adj)
Destroy a cs_adjacency_t structure.
Definition: cs_mesh_adjacencies.c:741
cs_lnum_t * ids
Definition: cs_mesh_adjacencies.h:74
cs_adjacency_t * cs_adjacency_compose(int n_c_elts, const cs_adjacency_t *a2b, const cs_adjacency_t *b2c)
Create a new cs_adjacency_t structure from the composition of two cs_adjacency_t structures: (1) A ->...
Definition: cs_mesh_adjacencies.c:779
void cs_adjacency_remove_self_entries(cs_adjacency_t *adj)
In an indexed list, remove id(s) corresponding to the current index. Useful for instance in order to ...
Definition: cs_mesh_adjacencies.c:1172
void cs_adjacency_dump(const char *name, FILE *_f, cs_adjacency_t *adj)
Dump a cs_adjacency_t structure to a file or into the standard output.
Definition: cs_mesh_adjacencies.c:1210
const cs_mesh_adjacencies_t * cs_glob_mesh_adjacencies
cs_adjacency_t * cs_adjacency_transpose(int n_b_elts, const cs_adjacency_t *a2b)
Create a new cs_adjacency_t structure from a one corresponding to A -> B. The resulting structure dea...
Definition: cs_mesh_adjacencies.c:993
void cs_mesh_adjacencies_update_mesh(void)
Update mesh adjacencies helper API relative to mesh.
Definition: cs_mesh_adjacencies.c:527
const cs_adjacency_t * c2v
Definition: cs_mesh_adjacencies.h:105
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:301
cs_lnum_t * cell_cells
Definition: cs_mesh_adjacencies.h:91
void cs_mesh_adjacencies_finalize(void)
Finalize mesh adjacencies helper API.
Definition: cs_mesh_adjacencies.c:505
#define END_C_DECLS
Definition: cs_defs.h:496
cs_flag_t flag
Definition: cs_mesh_adjacencies.h:69
unsigned short int cs_flag_t
Definition: cs_defs.h:309
void cs_mesh_adjacencies_update_cell_cells_e(void)
Update extended cell -> cell connectivites in mesh adjacencies helper API relative to mesh...
Definition: cs_mesh_adjacencies.c:557
cs_lnum_t * cell_b_faces
Definition: cs_mesh_adjacencies.h:101
cs_lnum_t * cell_cells_idx
Definition: cs_mesh_adjacencies.h:90
cs_adjacency_t * cs_adjacency_create(cs_flag_t flag, int stride, cs_lnum_t n_elts)
Create a cs_adjacency_t structure of size n_elts.
Definition: cs_mesh_adjacencies.c:603
const cs_lnum_t * cell_cells_e
Definition: cs_mesh_adjacencies.h:96
cs_lnum_t * idx
Definition: cs_mesh_adjacencies.h:73