9.2
general documentation
fvm_nodal_extract.h
Go to the documentation of this file.
1#ifndef FVM_NODAL_EXTRACT_H
2#define FVM_NODAL_EXTRACT_H
3
4/*============================================================================
5 * Main structure for a nodal representation associated with a mesh
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2026 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#include "base/cs_defs.h"
31
32/*----------------------------------------------------------------------------
33 * Local headers
34 *----------------------------------------------------------------------------*/
35
36#include "fvm/fvm_defs.h"
37#include "fvm/fvm_nodal.h"
38
39/*=============================================================================
40 * Macro definitions
41 *============================================================================*/
42
43/*============================================================================
44 * Type definitions
45 *============================================================================*/
46
47/*----------------------------------------------------------------------------
48 * Structure defining a mesh in nodal definition
49 *----------------------------------------------------------------------------*/
50
51
52/*=============================================================================
53 * Static global variables
54 *============================================================================*/
55
56
57/*=============================================================================
58 * Public function prototypes
59 *============================================================================*/
60
61/*----------------------------------------------------------------------------
62 * Copy global vertex numbers to an array.
63 *
64 * parameters:
65 * this_nodal <-- pointer to nodal mesh structure
66 * g_vtx_num --> global vertex numbers (pre-allocated)
67 *----------------------------------------------------------------------------*/
68
69void
70fvm_nodal_get_global_vertex_num(const fvm_nodal_t *this_nodal,
71 cs_gnum_t *g_vtx_num);
72
73/*----------------------------------------------------------------------------
74 * Copy global element numbers of a given element type to an array.
75 *
76 * Note that if the mesh contains multiple sections of the same element type,
77 * the global element numbers are continued from one section to the next,
78 * so to the user, all is as if the sections were concatenated.
79 *
80 * parameters:
81 * this_nodal <-- pointer to nodal mesh structure
82 * element_type <-- type of elements to deal with
83 * g_elt_num <-> pointer to global_element_num array (pre-allocated)
84 *
85 * returns:
86 *----------------------------------------------------------------------------*/
87
88void
89fvm_nodal_get_global_element_num(const fvm_nodal_t *this_nodal,
90 fvm_element_t element_type,
91 cs_gnum_t *g_elt_num);
92
93/*----------------------------------------------------------------------------
94 * Copy vertex coordinates to an array.
95 *
96 * parameters:
97 * this_nodal <-- pointer to nodal mesh structure
98 * interlace <-- indicates if destination array is interlaced
99 * vertex_coords --> vertices coordinates (pre-allocated)
100 *----------------------------------------------------------------------------*/
101
102void
103fvm_nodal_get_vertex_coords(const fvm_nodal_t *this_nodal,
104 cs_interlace_t interlace,
105 cs_coord_t *vertex_coords);
106
107/*----------------------------------------------------------------------------
108 * Copy element centers to an array.
109 *
110 * Note that if the mesh contains multiple cell element sections of, the
111 * cell_centers array spans all sections, so to the user, all is as if the
112 * sections were concatenated.
113 *
114 * parameters:
115 * this_nodal <-- pointer to nodal mesh structure
116 * interlace <-- indicates if destination array is interlaced
117 * entity_dim <-- dimension of entities we want to count (0 to 3)
118 * cell_centers --> cell centers coordinates (pre-allocated)
119 *----------------------------------------------------------------------------*/
120
121void
122fvm_nodal_get_element_centers(const fvm_nodal_t *this_nodal,
123 cs_interlace_t interlace,
124 int entity_dim,
125 cs_coord_t *cell_centers);
126
127/*----------------------------------------------------------------------------
128 * Copy element -> vertex connectivity of a given element type to an array.
129 *
130 * Note that if the mesh contains multiple sections of the same element type,
131 * the connectivity spans all sections, so to the user, all is as if the
132 * sections were concatenated.
133 *
134 * Return local connectivity for sections of a given element_type.
135 *
136 * parameters:
137 * this_nodal <-- pointer to nodal mesh structure
138 * element_type <-- type of elements of the section to deal with
139 * connectivity <-> pointer to connectvity (pre-allocated)
140 *----------------------------------------------------------------------------*/
141
142void
143fvm_nodal_get_strided_connect(const fvm_nodal_t *this_nodal,
144 fvm_element_t element_type,
145 cs_lnum_t *connectivity);
146
147/*----------------------------------------------------------------------------
148 * Build inverse vertex -> element connectivity.
149 *
150 * The user is responsible for freeing the returned arrays.
151 * The size of element_index[] should be n_vertices + 1, where n_vertices
152 * is the value returned by fvm_nodal_get_n_entities(this_nodal, entity_dim).
153 * The size of element_id[] should be element_index[n_vertices].
154 *
155 * Note that if the mesh contains multiple cell element sections of, the
156 * cell_centers array spans all sections, so to the user, all is as if the
157 * sections were concatenated.
158 *
159 * Note also that both the vertex -> element index and connectivity arrays
160 * returned use 0 to n numbering.
161 *
162 * parameters:
163 * this_nodal <-- pointer to nodal mesh structure
164 * entity_dim <-- dimension of entities we want to count (1 to 3)
165 * element_index --> vertex -> element connectivity index (O to n-1)
166 * element_id --> vertex -> element connectivity (0 to n-1)
167 *----------------------------------------------------------------------------*/
168
169void
170fvm_nodal_get_vertex_elements(const fvm_nodal_t *this_nodal,
171 int entity_dim,
172 cs_lnum_t **element_index,
173 cs_lnum_t **element_id);
174
175/*----------------------------------------------------------------------------
176 * Compute extents of a nodal mesh representation
177 *
178 * parameters:
179 * this_nodal <-- pointer to mesh representation structure
180 * tolerance <-- addition to local extents of each element:
181 * extent = base_extent * (1 + tolerance)
182 * extents <-> extents associated with mesh:
183 * x_min, y_min, ..., x_max, y_max, ... (size: 2*dim)
184 *----------------------------------------------------------------------------*/
185
186void
187fvm_nodal_extents(const fvm_nodal_t *this_nodal,
188 double tolerance,
189 double extents[]);
190
191/*----------------------------------------------------------------------------*/
192
193#endif /* FVM_NODAL_EXTRACT_H */
double cs_coord_t
Definition: cs_defs.h:330
unsigned cs_gnum_t
global mesh entity number
Definition: cs_defs.h:317
cs_interlace_t
Definition: cs_defs.h:504
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
fvm_element_t
Definition: fvm_defs.h:44
void fvm_nodal_get_global_vertex_num(const fvm_nodal_t *this_nodal, cs_gnum_t *g_vtx_num)
Definition: fvm_nodal_extract.cpp:855
void fvm_nodal_get_global_element_num(const fvm_nodal_t *this_nodal, fvm_element_t element_type, cs_gnum_t *g_elt_num)
Definition: fvm_nodal_extract.cpp:897
void fvm_nodal_get_vertex_elements(const fvm_nodal_t *this_nodal, int entity_dim, cs_lnum_t **element_index, cs_lnum_t **element_id)
Definition: fvm_nodal_extract.cpp:1248
void fvm_nodal_get_strided_connect(const fvm_nodal_t *this_nodal, fvm_element_t element_type, cs_lnum_t *connectivity)
Definition: fvm_nodal_extract.cpp:1182
void fvm_nodal_extents(const fvm_nodal_t *this_nodal, double tolerance, double extents[])
Definition: fvm_nodal_extract.cpp:1421
void fvm_nodal_get_element_centers(const fvm_nodal_t *this_nodal, cs_interlace_t interlace, int entity_dim, cs_coord_t *cell_centers)
Definition: fvm_nodal_extract.cpp:1036
void fvm_nodal_get_vertex_coords(const fvm_nodal_t *this_nodal, cs_interlace_t interlace, cs_coord_t *vertex_coords)
Definition: fvm_nodal_extract.cpp:969