Add default grid constructor. Creates an empty grid.
This is mostly for use in *other* grid constructors, as it enables putting a grid into a defined state before allocating and/or filling the specific fields of the UnstructuredGrid. While here, add a Doxygen \file command lest function documentation not be output to the documentation set.
This commit is contained in:
parent
c65dff9f2d
commit
394c463f1e
@ -44,3 +44,17 @@ void destroy_grid(struct UnstructuredGrid *g)
|
||||
free(g);
|
||||
}
|
||||
|
||||
|
||||
struct UnstructuredGrid *
|
||||
create_grid_empty(void)
|
||||
{
|
||||
struct UnstructuredGrid *G, g = { 0 };
|
||||
|
||||
G = malloc(1 * sizeof *G);
|
||||
|
||||
if (G != NULL) {
|
||||
*G = g;
|
||||
}
|
||||
|
||||
return G;
|
||||
}
|
||||
|
@ -20,6 +20,12 @@
|
||||
#ifndef OPM_GRID_HEADER_INCLUDED
|
||||
#define OPM_GRID_HEADER_INCLUDED
|
||||
|
||||
/**
|
||||
* \file
|
||||
*
|
||||
* Main OPM-Core grid data structure along with destructor and default
|
||||
* constructor.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -221,6 +227,17 @@ struct UnstructuredGrid
|
||||
*/
|
||||
void destroy_grid(struct UnstructuredGrid *g);
|
||||
|
||||
/**
|
||||
Allocate and initialise an empty UnstructuredGrid.
|
||||
|
||||
This is the moral equivalent of a C++ default constructor.
|
||||
|
||||
\return Fully formed UnstructuredGrid with all fields zero or
|
||||
<code>NULL</code> as appropriate. <code>NULL</code> in case of
|
||||
allocation failure.
|
||||
*/
|
||||
struct UnstructuredGrid *
|
||||
create_grid_empty(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user