2009-11-20 09:36:32 -06:00
|
|
|
/*===========================================================================
|
2009-06-19 02:54:00 -05:00
|
|
|
//
|
|
|
|
// File: preprocess.h
|
|
|
|
//
|
|
|
|
// Created: Fri Jun 19 08:43:04 2009
|
|
|
|
//
|
|
|
|
// Author: Jostein R. Natvig <Jostein.R.Natvig@sintef.no>
|
|
|
|
//
|
|
|
|
// $Date$
|
|
|
|
//
|
|
|
|
// $Revision$
|
|
|
|
//
|
2009-11-20 09:36:32 -06:00
|
|
|
//==========================================================================*/
|
2009-06-19 02:54:00 -05:00
|
|
|
|
|
|
|
/*
|
2010-03-18 10:57:02 -05:00
|
|
|
Copyright 2009, 2010 SINTEF ICT, Applied Mathematics.
|
|
|
|
Copyright 2009, 2010 Statoil ASA.
|
2009-06-19 02:54:00 -05:00
|
|
|
|
2013-01-29 06:42:24 -06:00
|
|
|
This file is part of the Open Porous Media project (OPM).
|
2009-06-19 02:54:00 -05:00
|
|
|
|
2013-01-29 06:42:24 -06:00
|
|
|
OPM is free software: you can redistribute it and/or modify
|
2009-07-03 13:18:59 -05:00
|
|
|
it under the terms of the GNU General Public License as published by
|
2012-06-20 13:22:20 -05:00
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
2009-07-03 13:18:59 -05:00
|
|
|
(at your option) any later version.
|
2009-06-19 02:54:00 -05:00
|
|
|
|
2013-01-29 06:42:24 -06:00
|
|
|
OPM is distributed in the hope that it will be useful,
|
2009-07-03 13:18:59 -05:00
|
|
|
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.
|
2009-06-19 02:54:00 -05:00
|
|
|
|
2009-07-03 13:18:59 -05:00
|
|
|
You should have received a copy of the GNU General Public License
|
2013-01-29 06:42:24 -06:00
|
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
2009-06-19 02:54:00 -05:00
|
|
|
*/
|
|
|
|
|
2013-01-29 06:42:24 -06:00
|
|
|
#ifndef OPM_PREPROCESS_HEADER
|
|
|
|
#define OPM_PREPROCESS_HEADER
|
2009-06-15 02:30:16 -05:00
|
|
|
|
2012-07-18 04:22:43 -05:00
|
|
|
/**
|
|
|
|
* \file
|
|
|
|
* Low-level corner-point processing routines and supporting data structures.
|
|
|
|
*
|
|
|
|
* User code should typically employ higher-level routines such as
|
|
|
|
* create_grid_cornerpoint() in order to construct fully formed UnstructuredGrid
|
|
|
|
* data structures from a corner-point specification. Incidentally, the routines
|
|
|
|
* provided by this module are used to implement function
|
|
|
|
* create_grid_cornerpoint().
|
|
|
|
*/
|
2009-06-15 02:30:16 -05:00
|
|
|
|
2009-06-20 15:36:56 -05:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2012-07-18 04:22:43 -05:00
|
|
|
/**
|
|
|
|
* Raw corner-point specification of a particular geological model.
|
|
|
|
*/
|
|
|
|
struct grdecl {
|
|
|
|
int dims[3]; /**< Cartesian box dimensions. */
|
|
|
|
const double *coord; /**< Pillar end-points. */
|
2012-10-02 09:24:13 -05:00
|
|
|
const double *zcorn; /**< Corner-point depths. */
|
|
|
|
const int *actnum; /**< Explicit "active" map. May be NULL.*/
|
2012-09-05 06:36:19 -05:00
|
|
|
const double *mapaxes; /**< 6 Element rotation vector - can be NULL. */
|
2009-07-03 13:18:59 -05:00
|
|
|
};
|
2009-06-15 02:30:16 -05:00
|
|
|
|
2012-07-18 04:22:43 -05:00
|
|
|
/**
|
|
|
|
* Connection taxonomy.
|
|
|
|
*/
|
|
|
|
enum face_tag {
|
|
|
|
LEFT, /**< Connection topologically parallel to J-K plane. */
|
|
|
|
BACK, /**< Connection topologically parallel to I-K plane. */
|
|
|
|
TOP /**< Connection topologically parallel to I-J plane. */
|
2009-07-03 13:18:59 -05:00
|
|
|
};
|
2009-06-15 02:30:16 -05:00
|
|
|
|
|
|
|
|
2012-07-18 04:22:43 -05:00
|
|
|
/**
|
|
|
|
* Result structure representing minimal derived topology and geometry of
|
|
|
|
* a geological model in corner-point format.
|
|
|
|
*/
|
|
|
|
struct processed_grid {
|
|
|
|
int m; /**< Upper bound on "number_of_faces". For internal use in
|
|
|
|
function process_grid()'s memory management. */
|
|
|
|
int n; /**< Upper bound on "number_of_nodes". For internal use in
|
|
|
|
function process_grid()'s memory management. */
|
|
|
|
|
|
|
|
int dimensions[3]; /**< Cartesian box dimensions. */
|
|
|
|
|
|
|
|
int number_of_faces; /**< Total number of unique grid faces
|
|
|
|
(i.e., connections). */
|
|
|
|
int *face_nodes; /**< Node (vertex) numbers of each face,
|
|
|
|
stored sequentially. */
|
|
|
|
int *face_ptr; /**< Start position for each face's
|
|
|
|
`face_nodes'. */
|
|
|
|
int *face_neighbors; /**< Global cell numbers. Two elements per
|
|
|
|
face, stored sequentially. */
|
|
|
|
enum face_tag *face_tag; /**< Classification of grid's individual
|
|
|
|
connections (faces). */
|
|
|
|
|
|
|
|
int number_of_nodes; /**< Number of unique grid vertices. */
|
|
|
|
int number_of_nodes_on_pillars; /**< Total number of unique cell
|
|
|
|
vertices that lie on pillars. */
|
|
|
|
double *node_coordinates; /**< Vertex coordinates. Three doubles
|
|
|
|
(\f$x\f$, \f$y\f$, \f$z\f$) per vertex,
|
|
|
|
stored sequentially. */
|
|
|
|
|
|
|
|
int number_of_cells; /**< Number of active grid cells. */
|
|
|
|
int *local_cell_index; /**< Deceptively named local-to-global cell
|
|
|
|
index mapping. */
|
|
|
|
};
|
2009-06-15 02:30:16 -05:00
|
|
|
|
2012-07-18 04:22:43 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a prototypical grid representation from a corner-point
|
|
|
|
* specification.
|
|
|
|
*
|
|
|
|
* Pinched cells will be removed irrespective of any explicit "active" map
|
|
|
|
* in the geological model input specification. On input, the result
|
|
|
|
* structure "out" must point to a valid management structure. In other
|
|
|
|
* words, the result structure must point to a region of memory that is
|
|
|
|
* typically backed by automatic or allocated (dynamic) storage duration.
|
|
|
|
*
|
|
|
|
* @param[in] g Corner-point specification. If "actnum" is NULL, then
|
|
|
|
* the specification is interpreted as if all cells are
|
|
|
|
* initially active.
|
|
|
|
* @param[in] tol Absolute tolerance of node-coincidence.
|
|
|
|
* @param[in,out] out Minimal grid representation featuring face-to-cell
|
|
|
|
* neighbourship definition, vertex geometry, face's
|
|
|
|
* constituent vertices, and local-to-global cell
|
|
|
|
* mapping.
|
|
|
|
*/
|
|
|
|
void process_grdecl(const struct grdecl *g ,
|
|
|
|
double tol,
|
|
|
|
struct processed_grid *out);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Release memory resources acquired in previous grid processing using
|
|
|
|
* function process_grdecl().
|
|
|
|
*
|
|
|
|
* Note: This function releases the resources associated to the individual
|
|
|
|
* fields of the processed_grid, but does not free() the structure itself.
|
|
|
|
*
|
|
|
|
* @param[in,out] g Prototypical grid representation obtained in an earlier
|
|
|
|
* call to function process_grdecl().
|
|
|
|
*/
|
|
|
|
void free_processed_grid(struct processed_grid *g);
|
2009-06-20 15:36:56 -05:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2013-01-29 06:42:24 -06:00
|
|
|
#endif /* OPM_PREPROCESS_HEADER */
|
2009-06-19 02:54:00 -05:00
|
|
|
|
2010-08-27 12:12:16 -05:00
|
|
|
|
|
|
|
/* Local Variables: */
|
|
|
|
/* c-basic-offset:4 */
|
|
|
|
/* End: */
|