My Project
|
Main OPM-Core grid data structure along with helper functions for construction, destruction and reading a grid representation from disk. More...
#include <stddef.h>
#include <stdbool.h>
Go to the source code of this file.
Classes | |
struct | UnstructuredGrid |
Data structure for an unstructured grid, unstructured meaning that any cell may have an arbitrary number of adjacent cells. More... | |
Typedefs | |
typedef unsigned | grid_size_t |
Functions | |
void | destroy_grid (struct UnstructuredGrid *g) |
Destroy and deallocate an UnstructuredGrid and all its data. | |
struct UnstructuredGrid * | create_grid_empty (void) |
Allocate and initialise an empty UnstructuredGrid. | |
struct UnstructuredGrid * | allocate_grid (size_t ndims, size_t ncells, size_t nfaces, size_t nfacenodes, size_t ncellfaces, size_t nnodes) |
Allocate and initialise an UnstructuredGrid where pointers are set to location with correct size. | |
void | attach_zcorn_copy (struct UnstructuredGrid *G, const double *zcorn) |
Will allocate storage internally in the grid object to hold a copy of the zcorn data supplied in the second argument. | |
struct UnstructuredGrid * | read_grid (const char *fname) |
Import a grid from a character representation stored in file. | |
bool | grid_equal (const struct UnstructuredGrid *grid1, const struct UnstructuredGrid *grid2) |
Determine whether or not two grid structures represent the same underlying geometry and topology. | |
Main OPM-Core grid data structure along with helper functions for construction, destruction and reading a grid representation from disk.
struct UnstructuredGrid * allocate_grid | ( | size_t | ndims, |
size_t | ncells, | ||
size_t | nfaces, | ||
size_t | nfacenodes, | ||
size_t | ncellfaces, | ||
size_t | nnodes | ||
) |
Allocate and initialise an UnstructuredGrid where pointers are set to location with correct size.
[in] | ndims | Number of physical dimensions. |
[in] | ncells | Number of cells. |
[in] | nfaces | Number of faces. |
[in] | nfacenodes | Size of mapping from faces to nodes. |
[in] | ncellfaces | Size of mapping from cells to faces. (i.e., the number of ‘half-faces’) |
[in] | nnodes | Number of Nodes. |
global_cell
allocated, but not filled with meaningful values. NULL
in case of allocation failure. struct UnstructuredGrid * create_grid_empty | ( | void | ) |
Allocate and initialise an empty UnstructuredGrid.
This is the moral equivalent of a C++ default constructor.
NULL
as appropriate. NULL
in case of allocation failure. void destroy_grid | ( | struct UnstructuredGrid * | g | ) |
Destroy and deallocate an UnstructuredGrid and all its data.
This function assumes that all arrays of the UnstructuredGrid (if non-null) have been individually allocated by malloc(). They will be deallocated with free().
bool grid_equal | ( | const struct UnstructuredGrid * | grid1, |
const struct UnstructuredGrid * | grid2 | ||
) |
Determine whether or not two grid structures represent the same underlying geometry and topology.
The grids are declared equal if all of the following conditions hold:
[in] | grid1 | First grid. |
[in] | grid2 | Second grid. |
struct UnstructuredGrid * read_grid | ( | const char * | fname | ) |
Import a grid from a character representation stored in file.
[in] | fname | File name. |
NULL
in case of allocation failure.