grid.h
Go to the documentation of this file.
1 /*
2  Copyright 2010, 2011, 2012 SINTEF ICT, Applied Mathematics.
3 
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef OPM_GRID_HEADER_INCLUDED
21 #define OPM_GRID_HEADER_INCLUDED
22 
23 #include <stddef.h>
24 #include <stdbool.h>
25 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /*
38 ---- synopsis of grid.h ----
39 
40 struct UnstructuredGrid
41 {
42  int dimensions;
43  int number_of_cells;
44  int number_of_faces;
45  int number_of_nodes;
46  int *face_nodes;
47  int *face_nodepos;
48  int *face_cells;
49  int *cell_faces;
50  int *cell_facepos;
51  double *node_coordinates;
52  double *face_centroids;
53  double *face_areas;
54  double *face_normals;
55  double *cell_centroids;
56  double *cell_volumes;
57  int *global_cell;
58  int cartdims[3];
59  int *cell_facetag;
60 };
61 
62 void destroy_grid(struct UnstructuredGrid *g);
63 
64 struct UnstructuredGrid *
65 create_grid_empty(void);
66 
67 struct UnstructuredGrid *
68 allocate_grid(size_t ndims ,
69  size_t ncells ,
70  size_t nfaces ,
71  size_t nfacenodes,
72  size_t ncellfaces,
73  size_t nnodes );
74 
75 struct UnstructuredGrid *
76 read_grid(const char *fname);
77 
78  ---- end of synopsis of grid.h ----
79 */
80 
99 {
107 
114 
139 
153 
161 
168  double *face_centroids;
173  double *face_areas;
184  double *face_normals;
185 
192  double *cell_centroids;
197  double *cell_volumes;
198 
199 
215 
227  int cartdims[3];
245 };
246 
254 void destroy_grid(struct UnstructuredGrid *g);
255 
265 struct UnstructuredGrid *
266 create_grid_empty(void);
267 
284 struct UnstructuredGrid *
285 allocate_grid(size_t ndims ,
286  size_t ncells ,
287  size_t nfaces ,
288  size_t nfacenodes,
289  size_t ncellfaces,
290  size_t nnodes );
291 
292 
300 struct UnstructuredGrid *
301 read_grid(const char *fname);
302 
303 
304 
305 
306 bool
307 grid_equal(const struct UnstructuredGrid * grid1 , const struct UnstructuredGrid * grid2);
308 
309 #ifdef __cplusplus
310 }
311 #endif
312 
313 #endif /* OPM_GRID_HEADER_INCLUDED */
Definition: grid.h:98
double * face_normals
Definition: grid.h:184
int * face_cells
Definition: grid.h:138
int * cell_facetag
Definition: grid.h:244
int number_of_nodes
Definition: grid.h:113
int * face_nodes
Definition: grid.h:121
void destroy_grid(struct UnstructuredGrid *g)
struct UnstructuredGrid * create_grid_empty(void)
int number_of_faces
Definition: grid.h:111
double * cell_volumes
Definition: grid.h:197
int number_of_cells
Definition: grid.h:109
double * face_areas
Definition: grid.h:173
double * face_centroids
Definition: grid.h:168
int dimensions
Definition: grid.h:106
double * cell_centroids
Definition: grid.h:192
struct UnstructuredGrid * allocate_grid(size_t ndims, size_t ncells, size_t nfaces, size_t nfacenodes, size_t ncellfaces, size_t nnodes)
double * node_coordinates
Definition: grid.h:160
int cartdims[3]
Definition: grid.h:227
int * cell_faces
Definition: grid.h:146
struct UnstructuredGrid * read_grid(const char *fname)
int * global_cell
Definition: grid.h:214
bool grid_equal(const struct UnstructuredGrid *grid1, const struct UnstructuredGrid *grid2)
int * cell_facepos
Definition: grid.h:152
int * face_nodepos
Definition: grid.h:127