My Project
programmer's documentation
Loading...
Searching...
No Matches
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-2019 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)
55#define CS_ADJACENCY_STRIDE (1 << 1)
57#define CS_ADJACENCY_SIGNED (1 << 2)
58
61/*============================================================================
62 * Type definition
63 *============================================================================*/
64
65typedef struct {
66
67 /* metadata */
68
69 bool single_faces_to_cells; /* true if a single face is adjacent
70 to 2 given cells */
71
72 /* cells -> cells connectivity (standard) */
73
74 cs_lnum_t *cell_cells_idx; /* indexes (shared) */
75 cs_lnum_t *cell_cells; /* adjacency (shared) */
76
77 /* cells -> cells connectivity (extended) */
78
79 const cs_lnum_t *cell_cells_e_idx; /* indexes (shared) */
80 const cs_lnum_t *cell_cells_e; /* adjacency (shared) */
81
82 /* cells -> boundary faces connectivity */
83
86
88
89
90typedef struct {
91
92 cs_flag_t flag; /* Compact way to store metadata */
93 int stride;
94
96 cs_lnum_t *idx; /* size = n_elts + 1 */
97 cs_lnum_t *ids; /* ids from 0 to n-1 (there is no multifold entry) */
98 short int *sgn; /* +/- 1 according to the orientation of the element */
99
101
102/*============================================================================
103 * Global variables
104 *============================================================================*/
105
106/* Read-only pointer to global mesh additional adjacencies structure */
107
109
110/*=============================================================================
111 * Public function prototypes
112 *============================================================================*/
113
114/*----------------------------------------------------------------------------*/
118/*----------------------------------------------------------------------------*/
119
120void
122
123/*----------------------------------------------------------------------------*/
127/*----------------------------------------------------------------------------*/
128
129void
131
132/*----------------------------------------------------------------------------*/
136/*----------------------------------------------------------------------------*/
137
138void
140
141/*----------------------------------------------------------------------------*/
146/*----------------------------------------------------------------------------*/
147
148void
150
151/*----------------------------------------------------------------------------*/
161/*----------------------------------------------------------------------------*/
162
165 int stride,
166 cs_lnum_t n_elts);
167
168/*----------------------------------------------------------------------------*/
180/*----------------------------------------------------------------------------*/
181
184 int stride,
185 cs_lnum_t *ids,
186 short int *sgn);
187
188/*----------------------------------------------------------------------------*/
200/*----------------------------------------------------------------------------*/
201
204 cs_lnum_t *idx,
205 cs_lnum_t *ids,
206 short int *sgn);
207
208/*----------------------------------------------------------------------------*/
214/*----------------------------------------------------------------------------*/
215
216void
218
219/*----------------------------------------------------------------------------*/
232/*----------------------------------------------------------------------------*/
233
235cs_adjacency_compose(int n_c_elts,
236 const cs_adjacency_t *a2b,
237 const cs_adjacency_t *b2c);
238
239/*----------------------------------------------------------------------------*/
249/*----------------------------------------------------------------------------*/
250
252cs_adjacency_transpose(int n_b_elts,
253 const cs_adjacency_t *a2b);
254
255/*----------------------------------------------------------------------------*/
262/*----------------------------------------------------------------------------*/
263
264void
266
267/*----------------------------------------------------------------------------*/
275/*----------------------------------------------------------------------------*/
276
277void
279
280/*----------------------------------------------------------------------------*/
289/*----------------------------------------------------------------------------*/
290
291void
292cs_adjacency_dump(const char *name,
293 FILE *_f,
294 cs_adjacency_t *adj);
295
296/*----------------------------------------------------------------------------*/
310/*----------------------------------------------------------------------------*/
311
314 int boundary_order);
315
316/*----------------------------------------------------------------------------*/
329/*----------------------------------------------------------------------------*/
330
333
334/*----------------------------------------------------------------------------*/
335
337
338#endif /* __CS_MESH_ADJACENCIES__ */
#define BEGIN_C_DECLS
Definition cs_defs.h:467
#define END_C_DECLS
Definition cs_defs.h:468
int cs_lnum_t
local mesh entity id
Definition cs_defs.h:298
unsigned short int cs_flag_t
Definition cs_defs.h:304
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:415
void cs_adjacency_destroy(cs_adjacency_t **p_adj)
Destroy a cs_adjacency_t structure.
Definition cs_mesh_adjacencies.c:576
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:1045
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:614
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:438
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:498
void cs_mesh_adjacencies_initialize(void)
Initialize mesh adjacencies helper API.
Definition cs_mesh_adjacencies.c:347
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:828
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:956
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:1138
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:544
cs_adjacency_t * cs_mesh_adjacency_v2v(const cs_mesh_t *m)
Definition cs_mesh_adjacencies.c:1243
void cs_mesh_adjacencies_update_mesh(void)
Update mesh adjacencies helper API relative to mesh.
Definition cs_mesh_adjacencies.c:390
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:1007
void cs_mesh_adjacencies_finalize(void)
Finalize mesh adjacencies helper API.
Definition cs_mesh_adjacencies.c:370
const cs_mesh_adjacencies_t * cs_glob_mesh_adjacencies
Definition cs_mesh_adjacencies.h:90
int stride
Definition cs_mesh_adjacencies.h:93
cs_lnum_t * idx
Definition cs_mesh_adjacencies.h:96
cs_lnum_t n_elts
Definition cs_mesh_adjacencies.h:95
cs_flag_t flag
Definition cs_mesh_adjacencies.h:92
cs_lnum_t * ids
Definition cs_mesh_adjacencies.h:97
short int * sgn
Definition cs_mesh_adjacencies.h:98
Definition cs_mesh_adjacencies.h:65
cs_lnum_t * cell_cells_idx
Definition cs_mesh_adjacencies.h:74
cs_lnum_t * cell_cells
Definition cs_mesh_adjacencies.h:75
const cs_lnum_t * cell_cells_e_idx
Definition cs_mesh_adjacencies.h:79
cs_lnum_t * cell_b_faces
Definition cs_mesh_adjacencies.h:85
bool single_faces_to_cells
Definition cs_mesh_adjacencies.h:69
const cs_lnum_t * cell_cells_e
Definition cs_mesh_adjacencies.h:80
cs_lnum_t * cell_b_faces_idx
Definition cs_mesh_adjacencies.h:84
Definition cs_mesh.h:63