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