Moved free_grid() to grid.h and (new file) grid.c.

This commit is contained in:
Atgeirr Flø Rasmussen 2012-04-11 11:32:52 +02:00
parent 866cb0b6ab
commit b66ee75058
5 changed files with 51 additions and 25 deletions

View File

@ -50,6 +50,7 @@ opm/core/fluid/RockCompressibility.cpp \
opm/core/fluid/RockFromDeck.cpp \
opm/core/fluid/SaturationPropsBasic.cpp \
opm/core/fluid/SaturationPropsFromDeck.cpp \
opm/core/grid.c \
opm/core/grid/cart_grid.c \
opm/core/grid/cornerpoint_grid.c \
opm/core/grid/cpgpreprocess/geometry.c \

46
opm/core/grid.c Normal file
View File

@ -0,0 +1,46 @@
/*
Copyright 2012 SINTEF ICT, Applied Mathematics.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <opm/core/grid.h>
#include <stdlib.h>
void free_grid(struct UnstructuredGrid *g)
{
if (g!=NULL)
{
free(g->face_nodes);
free(g->face_nodepos);
free(g->face_cells);
free(g->cell_facepos);
free(g->cell_faces);
free(g->node_coordinates);
free(g->face_centroids);
free(g->face_areas);
free(g->face_normals);
free(g->cell_centroids);
free(g->cell_volumes);
free(g->global_cell);
free(g->cell_facetag);
}
free(g);
}

View File

@ -56,6 +56,10 @@ struct UnstructuredGrid {
int *cell_facetag;
};
void free_grid(struct UnstructuredGrid *g);
#ifdef __cplusplus
}
#endif

View File

@ -103,30 +103,6 @@ fill_cell_topology(struct processed_grid *pg,
return g->cell_facepos != NULL;
}
void free_grid(struct UnstructuredGrid *g)
{
if (g!=NULL)
{
free(g->face_nodes);
free(g->face_nodepos);
free(g->face_cells);
free(g->cell_facepos);
free(g->cell_faces);
free(g->node_coordinates);
free(g->face_centroids);
free(g->face_areas);
free(g->face_normals);
free(g->cell_centroids);
free(g->cell_volumes);
free(g->global_cell);
free(g->cell_facetag);
}
free(g);
}
static int
allocate_geometry(struct UnstructuredGrid *g)
{

View File

@ -46,7 +46,6 @@ extern "C" {
void compute_geometry (struct UnstructuredGrid *g);
void free_grid(struct UnstructuredGrid *g);
#ifdef __cplusplus
}
#endif