Updated ERT to SVN revision 4077. Use new folder structure for ThirdParty/Ert, one folder for libs and one folder for includes. Minor application changes to be compatible with API changes in ERT.

This commit is contained in:
Magne Sjaastad 2012-09-13 10:56:39 +02:00
parent 3f96c61c72
commit 748f061a55
102 changed files with 1124 additions and 1146 deletions

View File

@ -32,9 +32,13 @@ include_directories(
# variable you can point to a different ERT distribution.
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(ERT_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../ThirdParty/Ert" CACHE PATH "Root path for ERT distribution to link with")
set(ERT_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../ThirdParty/Ert")
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(ERT_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../ThirdParty/Ert-windows" CACHE PATH "Root path for ERT distribution to link with")
if (${CMAKE_SIZEOF_VOID_P} MATCHES "8" )
set(ERT_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../ThirdParty/Ert-windows-x64")
else()
set(ERT_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../ThirdParty/Ert-windows")
endif()
endif()
@ -67,6 +71,7 @@ mark_as_advanced( ERT_UTIL_PREFIX ERT_ECL_PREFIX ERT_WELL_PREFIX ERT_GEO_PREFIX
# Setting up include directories for ERT
set( ERT_INCLUDE_LIST
${ERT_ROOT_PATH}/include
${ERT_ROOT_PATH}/${ERT_ECL_PREFIX}/include
${ERT_ROOT_PATH}/${ERT_UTIL_PREFIX}/include
${ERT_ROOT_PATH}/${ERT_WELL_PREFIX}/include
@ -75,16 +80,24 @@ set( ERT_INCLUDE_LIST
# Link to these ERT libraries
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set( ERT_LIBRARY_LIST
${ERT_ROOT_PATH}/${ERT_ECL_PREFIX}/lib/libecl.a
${ERT_ROOT_PATH}/${ERT_UTIL_PREFIX}/lib/libutil.a
${ERT_ROOT_PATH}/${ERT_GEO_PREFIX}/lib/libgeometry.a
${ERT_ROOT_PATH}/${ERT_WELL_PREFIX}/lib/libwell.a )
${ERT_ROOT_PATH}/lib/libecl.a
${ERT_ROOT_PATH}/lib/libert_util.a
${ERT_ROOT_PATH}/lib/libgeometry.a
${ERT_ROOT_PATH}/lib/libwell.a )
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
if (${CMAKE_SIZEOF_VOID_P} MATCHES "8" )
set( ERT_LIBRARY_LIST
${ERT_ROOT_PATH}/${ERT_ECL_PREFIX}/lib/ecl.lib
${ERT_ROOT_PATH}/${ERT_UTIL_PREFIX}/lib/ert_util.lib
${ERT_ROOT_PATH}/${ERT_GEO_PREFIX}/lib/geometry.lib
${ERT_ROOT_PATH}/${ERT_WELL_PREFIX}/lib/well.lib )
else()
set( ERT_LIBRARY_LIST
${ERT_ROOT_PATH}/${ERT_ECL_PREFIX}/lib/libecl.lib
${ERT_ROOT_PATH}/${ERT_UTIL_PREFIX}/lib/libutil.lib
${ERT_ROOT_PATH}/${ERT_GEO_PREFIX}/lib/libgeometry.lib
${ERT_ROOT_PATH}/${ERT_WELL_PREFIX}/lib/libwell.lib )
endif()
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")

View File

@ -27,15 +27,21 @@ include_directories(
#-----------------------------------------------------------------
# Ert configuration
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(ERT_ROOT_PATH "${ResInsight_SOURCE_DIR}/ThirdParty/Ert" CACHE PATH "Root path for ERT distribution to link with")
set(ERT_ROOT_PATH "${ResInsight_SOURCE_DIR}/ThirdParty/Ert")
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(ERT_ROOT_PATH "${ResInsight_SOURCE_DIR}/ThirdParty/Ert-windows" CACHE PATH "Root path for ERT distribution to link with")
if (${CMAKE_SIZEOF_VOID_P} MATCHES "8" )
set(ERT_ROOT_PATH "${ResInsight_SOURCE_DIR}/ThirdParty/Ert-windows-x64")
else()
set(ERT_ROOT_PATH "${ResInsight_SOURCE_DIR}/ThirdParty/Ert-windows")
endif()
endif()
set( ERT_ECL_PREFIX "ecl" CACHE STRING "Prefix path to use for ecl code in ert")
set( ERT_UTIL_PREFIX "util" CACHE STRING "Prefix path to use for util code in ert")
set( ERT_WELL_PREFIX "well" CACHE STRING "Prefix path to use for well code in ert")
set( ERT_INCLUDE_LIST
${ERT_ROOT_PATH}/include
${ERT_ROOT_PATH}/${ERT_ECL_PREFIX}/include
${ERT_ROOT_PATH}/${ERT_UTIL_PREFIX}/include
${ERT_ROOT_PATH}/${ERT_WELL_PREFIX}/include )
@ -43,16 +49,24 @@ set( ERT_INCLUDE_LIST
# Link to these ERT libraries
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set( ERT_LIBRARY_LIST
${ERT_ROOT_PATH}/${ERT_ECL_PREFIX}/lib/libecl.a
${ERT_ROOT_PATH}/${ERT_UTIL_PREFIX}/lib/libutil.a
${ERT_ROOT_PATH}/${ERT_GEO_PREFIX}/lib/libgeometry.a
${ERT_ROOT_PATH}/${ERT_WELL_PREFIX}/lib/libwell.a )
${ERT_ROOT_PATH}/lib/libecl.a
${ERT_ROOT_PATH}/lib/libert_util.a
${ERT_ROOT_PATH}/lib/libgeometry.a
${ERT_ROOT_PATH}/lib/libwell.a )
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
if (${CMAKE_SIZEOF_VOID_P} MATCHES "8" )
set( ERT_LIBRARY_LIST
${ERT_ROOT_PATH}/${ERT_ECL_PREFIX}/lib/ecl.lib
${ERT_ROOT_PATH}/${ERT_UTIL_PREFIX}/lib/ert_util.lib
${ERT_ROOT_PATH}/${ERT_GEO_PREFIX}/lib/geometry.lib
${ERT_ROOT_PATH}/${ERT_WELL_PREFIX}/lib/well.lib )
else()
set( ERT_LIBRARY_LIST
${ERT_ROOT_PATH}/${ERT_ECL_PREFIX}/lib/libecl.lib
${ERT_ROOT_PATH}/${ERT_UTIL_PREFIX}/lib/libutil.lib
${ERT_ROOT_PATH}/${ERT_GEO_PREFIX}/lib/libgeometry.lib
${ERT_ROOT_PATH}/${ERT_WELL_PREFIX}/lib/libwell.lib )
endif()
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")

View File

@ -186,9 +186,7 @@ bool RifEclipseOutputFileTools::timeStepsText(QStringList* timeSteps)
if (kwINTEHEAD)
{
// Get date info
time_t stepTime = util_make_date(ecl_kw_iget_int(kwINTEHEAD, INTEHEAD_DAY_INDEX),
ecl_kw_iget_int(kwINTEHEAD, INTEHEAD_MONTH_INDEX),
ecl_kw_iget_int(kwINTEHEAD, INTEHEAD_YEAR_INDEX));
time_t stepTime = ecl_intehead_date(kwINTEHEAD);
// Hack!!! We seem to get 01/01/1970 (time -1) for sub grids!
if (stepTime < 0) continue;
@ -235,9 +233,7 @@ bool RifEclipseOutputFileTools::timeSteps(QList<QDateTime>* timeSteps)
if (kwINTEHEAD)
{
// Get date info
time_t stepTime = util_make_date(ecl_kw_iget_int(kwINTEHEAD, INTEHEAD_DAY_INDEX),
ecl_kw_iget_int(kwINTEHEAD, INTEHEAD_MONTH_INDEX),
ecl_kw_iget_int(kwINTEHEAD, INTEHEAD_YEAR_INDEX));
time_t stepTime = ecl_intehead_date(kwINTEHEAD);
// Hack!!! We seem to get 01/01/1970 (time -1) for sub grids!
if (stepTime < 0) continue;

View File

@ -582,10 +582,13 @@ void RifReaderEclipseOutput::readWellCells(RigReservoir* reservoir)
if (ert_wellhead)
{
wellResFrame.m_wellHead.m_gridIndex = gridNr;
int gridK = CVF_MAX(0, ert_wellhead->k); // Why this ?
wellResFrame.m_wellHead.m_gridCellIndex = grids[gridNr]->cellIndexFromIJK(ert_wellhead->i, ert_wellhead->j, gridK);
int gridK = CVF_MAX(0, well_conn_get_k(ert_wellhead)); // Why this ?
int gridI = well_conn_get_i( ert_wellhead );
int gridJ = well_conn_get_j( ert_wellhead );
wellResFrame.m_wellHead.m_gridCellIndex = grids[gridNr]->cellIndexFromIJK(gridI, gridJ, gridK);
}
int branchCount = well_state_iget_lgr_num_branches(ert_well_state, gridNr);
if (branchCount > 0)
{
@ -611,10 +614,20 @@ void RifReaderEclipseOutput::readWellCells(RigReservoir* reservoir)
RigWellResultCell& data = wellSegment.m_wellCells[existingConnCount + connIdx];
data.m_gridIndex = gridNr;
data.m_gridCellIndex = grids[gridNr]->cellIndexFromIJK(ert_connection->i, ert_connection->j, ert_connection->k);
data.m_isOpen = ert_connection->open;
data.m_branchId = ert_connection->branch;
data.m_segmentId = ert_connection->segment;
{
int connI = well_conn_get_i( ert_connection );
int connJ = well_conn_get_j( ert_connection );
int connK = well_conn_get_k( ert_connection );
bool open = well_conn_open( ert_connection );
int branch = well_conn_get_branch( ert_connection );
int segment = well_conn_get_segment( ert_connection );
data.m_gridCellIndex = grids[gridNr]->cellIndexFromIJK(connI , connJ , connK);
data.m_isOpen = open;
data.m_branchId = branch;
data.m_segmentId = segment;
}
}
}
}

View File

@ -56,9 +56,9 @@ add_executable( ${ProjectName}
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set ( LINUX_LINK_LIBRARIES
${CMAKE_CURRENT_SOURCE_DIR}/../../../ThirdParty/Ert/ecl/lib/libecl.a
${CMAKE_CURRENT_SOURCE_DIR}/../../../ThirdParty/Ert/util/lib/libutil.a
${CMAKE_CURRENT_SOURCE_DIR}/../../../ThirdParty/Ert/well/lib/libwell.a
${CMAKE_CURRENT_SOURCE_DIR}/../../../ThirdParty/Ert/lib/libecl.a
${CMAKE_CURRENT_SOURCE_DIR}/../../../ThirdParty/Ert/lib/libert_util.a
${CMAKE_CURRENT_SOURCE_DIR}/../../../ThirdParty/Ert/lib/libwell.a
lapack
pthread
)

View File

@ -1,185 +0,0 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
The file 'ecl_region.h' is part of ERT - Ensemble based Reservoir Tool.
ERT 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.
ERT 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 at <http://www.gnu.org/licenses/gpl.html>
for more details.
*/
#ifndef __ECL_REGION_H__
#define __ECL_REGION_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include <int_vector.h>
#include <geo_polygon.h>
#include <ecl_box.h>
#include <ecl_grid.h>
typedef enum {
SELECT_ALL = 0,
DESELECT_ALL = 1,
SELECT_FROM_IJK = 2,
DESELECT_FROM_IJK = 3,
SELECT_FROM_I = 4,
DSELECT_FROM_I = 5,
SELECT_FROM_J = 6,
DSELECT_FROM_J = 7,
SELECT_FROM_K = 8,
DSELECT_FROM_K = 9,
SELECT_EQUAL = 10,
DESELECT_EQUAL = 11,
SELECT_IN_INTERVAL = 12,
DESELECT_IN_INTERVAL = 13,
INVERT_SELECTION = 14
} ecl_region_select_cmd;
typedef struct ecl_region_struct ecl_region_type;
void ecl_region_unlock( ecl_region_type * region );
void ecl_region_lock( ecl_region_type * region );
void ecl_region_reset( ecl_region_type * ecl_region );
ecl_region_type * ecl_region_alloc_copy( const ecl_region_type * ecl_region );
ecl_region_type * ecl_region_alloc( const ecl_grid_type * ecl_grid , bool preselect);
void ecl_region_free( ecl_region_type * region );
void ecl_region_free__( void * __region );
const int_vector_type * ecl_region_get_active_list( ecl_region_type * region );
const int_vector_type * ecl_region_get_global_list( ecl_region_type * region );
const int_vector_type * ecl_region_get_global_active_list( ecl_region_type * region );
bool ecl_region_contains_ijk( const ecl_region_type * ecl_region , int i , int j , int k);
bool ecl_region_contains_global( const ecl_region_type * ecl_region , int global_index);
bool ecl_region_contains_active( const ecl_region_type * ecl_region , int active_index);
void ecl_region_invert_selection( ecl_region_type * region );
void ecl_region_select_all( ecl_region_type * region);
void ecl_region_deselect_all( ecl_region_type * region );
void ecl_region_select_in_interval( ecl_region_type * region , const ecl_kw_type * ecl_kw, float min_value , float max_value);
void ecl_region_deselect_in_interval( ecl_region_type * region , const ecl_kw_type * ecl_kw, float min_value , float max_value);
void ecl_region_select_equal( ecl_region_type * region , const ecl_kw_type * ecl_kw, int value);
void ecl_region_deselect_equal( ecl_region_type * region , const ecl_kw_type * ecl_kw, int value);
void ecl_region_select_inactive_cells( ecl_region_type * region );
void ecl_region_deselect_inactive_cells( ecl_region_type * region );
void ecl_region_select_active_cells( ecl_region_type * region );
void ecl_region_deselect_active_cells( ecl_region_type * region );
void ecl_region_select_from_box( ecl_region_type * region , const ecl_box_type * ecl_box );
void ecl_region_deselect_from_box( ecl_region_type * region , const ecl_box_type * ecl_box );
void ecl_region_select_from_ijkbox( ecl_region_type * region , int i1 , int i2 , int j1 , int j2 , int k1 , int k2);
void ecl_region_deselect_from_ijkbox( ecl_region_type * region , int i1 , int i2 , int j1 , int j2 , int k1 , int k2);
void ecl_region_select_i1i2( ecl_region_type * region , int i1 , int i2);
void ecl_region_deselect_i1i2( ecl_region_type * region , int i1 , int i2);
void ecl_region_select_j1j2( ecl_region_type * region , int j1 , int j2);
void ecl_region_deselect_j1j2( ecl_region_type * region , int j1 , int i2);
void ecl_region_select_k1k2( ecl_region_type * region , int k1 , int k2);
void ecl_region_deselect_k1k2( ecl_region_type * region , int k1 , int i2);
void ecl_region_select_shallow_cells( ecl_region_type * region , double depth_limit );
void ecl_region_deselect_shallow_cells( ecl_region_type * region , double depth_limit );
void ecl_region_select_deep_cells( ecl_region_type * region , double depth_limit );
void ecl_region_deselect_deep_cells( ecl_region_type * region , double depth_limit );
void ecl_region_select_thin_cells( ecl_region_type * ecl_region , double dz_limit );
void ecl_region_deselect_thin_cells( ecl_region_type * ecl_region , double dz_limit );
void ecl_region_select_thick_cells( ecl_region_type * ecl_region , double dz_limit );
void ecl_region_deselect_thick_cells( ecl_region_type * ecl_region , double dz_limit );
void ecl_region_select_small_cells( ecl_region_type * ecl_region , double volum_limit );
void ecl_region_deselect_small_cells( ecl_region_type * ecl_region , double volum_limit );
void ecl_region_select_large_cells( ecl_region_type * ecl_region , double volum_limit );
void ecl_region_deselect_large_cells( ecl_region_type * ecl_region , double volum_limit );
void ecl_region_select_global_index( ecl_region_type * ecl_region , int global_index);
void ecl_region_deselect_global_index( ecl_region_type * ecl_region , int global_index);
void ecl_region_select_active_index( ecl_region_type * ecl_region , int active_index);
void ecl_region_deselect_active_index( ecl_region_type * ecl_region , int active_index);
void ecl_region_intersection( ecl_region_type * region , const ecl_region_type * new_region );
void ecl_region_union( ecl_region_type * region , const ecl_region_type * new_region );
void ecl_region_subtract( ecl_region_type * region , const ecl_region_type * new_region);
void ecl_region_xor( ecl_region_type * region , const ecl_region_type * new_region);
void ecl_region_select_smaller( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , float limit);
void ecl_region_deselect_smaller( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , float limit);
void ecl_region_select_larger( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , float limit);
void ecl_region_deselect_larger( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , float limit);
void ecl_region_cmp_select_less( ecl_region_type * ecl_region , const ecl_kw_type * kw1 , const ecl_kw_type * kw2);
void ecl_region_cmp_deselect_less( ecl_region_type * ecl_region , const ecl_kw_type * kw1 , const ecl_kw_type * kw2);
void ecl_region_cmp_select_more( ecl_region_type * ecl_region , const ecl_kw_type * kw1 , const ecl_kw_type * kw2);
void ecl_region_cmp_deselect_more( ecl_region_type * ecl_region , const ecl_kw_type * kw1 , const ecl_kw_type * kw2);
void ecl_region_select_in_cylinder( ecl_region_type * region , double x0 , double y0, double R);
void ecl_region_deselect_in_cylinder( ecl_region_type * region , double x0 , double y0, double R);
void ecl_region_select_in_zcylinder( ecl_region_type * region , double x0 , double y0, double R , double z1 , double z2);
void ecl_region_deselect_in_zcylinder( ecl_region_type * region , double x0 , double y0, double R, double z1 , double z2);
void ecl_region_select_above_plane( ecl_region_type * region, const double n[3] , const double p[3]);
void ecl_region_select_below_plane( ecl_region_type * region, const double n[3] , const double p[3]);
void ecl_region_deselect_above_plane( ecl_region_type * region, const double n[3] , const double p[3]);
void ecl_region_deselect_below_plane( ecl_region_type * region, const double n[3] , const double p[3]);
void ecl_region_select_inside_polygon( ecl_region_type * region , const geo_polygon_type * polygon);
void ecl_region_deselect_inside_polygon( ecl_region_type * region , const geo_polygon_type * polygon);
void ecl_region_select_outside_polygon( ecl_region_type * region , const geo_polygon_type * polygon);
void ecl_region_deselect_outside_polygon( ecl_region_type * region , const geo_polygon_type * polygon);
/*****************************************************************/
/* Functions to manipulate ecl_kw instances . */
void ecl_region_set_kw_int( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , int value, bool force_active);
void ecl_region_set_kw_float( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , float value , bool force_active);
void ecl_region_set_kw_double( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , double value , bool force_active);
void ecl_region_kw_copy( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , const ecl_kw_type * src_kw , bool force_active);
int ecl_region_get_kw_size( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , bool force_active);
/*****************************************************************/
/* set/get the name */
void ecl_region_set_name( ecl_region_type * region , const char * name );
const char * ecl_region_get_name( const ecl_region_type * region );
/*****************************************************************/
/* Stupid cpp compat/legacy/cruft functions. */
int ecl_region_get_active_size_cpp( ecl_region_type * region );
int ecl_region_get_global_size_cpp( ecl_region_type * region );
const int * ecl_region_get_active_list_cpp( ecl_region_type * region );
const int * ecl_region_get_global_list_cpp( ecl_region_type * region );
/*****************************************************************/
UTIL_IS_INSTANCE_HEADER( ecl_region );
UTIL_SAFE_CAST_HEADER( ecl_region );
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,133 +0,0 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
The file 'ecl_smspec.h' is part of ERT - Ensemble based Reservoir Tool.
ERT 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.
ERT 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 at <http://www.gnu.org/licenses/gpl.html>
for more details.
*/
#ifndef __ECL_SMSPEC__
#define __ECL_SMSPEC__
#ifdef __cplusplus
extern "C" {
#endif
#include <time.h>
#include <stdbool.h>
#include <stringlist.h>
typedef struct ecl_smspec_struct ecl_smspec_type;
/**
These are the different variable types, see table 3.4 in the
ECLIPFE file format docuemntation for naming conventions.
Only the variable types marked with "X" below are supported in the
remaining implementation. To add support for a new variable type
the functions smspec_node_alloc(), ecl_smsepec_fread_header() and
ecl_smspec_install_gen_key() must be updated.
*/
typedef enum {ECL_SMSPEC_INVALID_VAR = 0 ,
ECL_SMSPEC_AQUIFER_VAR = 1 ,
ECL_SMSPEC_WELL_VAR = 2 , /* X */
ECL_SMSPEC_REGION_VAR = 3 , /* X */
ECL_SMSPEC_FIELD_VAR = 4 , /* X */
ECL_SMSPEC_GROUP_VAR = 5 , /* X */
ECL_SMSPEC_BLOCK_VAR = 6 , /* X */
ECL_SMSPEC_COMPLETION_VAR = 7 , /* X */
ECL_SMSPEC_LOCAL_BLOCK_VAR = 8 , /* X */
ECL_SMSPEC_LOCAL_COMPLETION_VAR = 9 , /* X */
ECL_SMSPEC_LOCAL_WELL_VAR = 10 , /* X */
ECL_SMSPEC_NETWORK_VAR = 11 ,
ECL_SMSPEC_REGION_2_REGION_VAR = 12 ,
ECL_SMSPEC_SEGMENT_VAR = 13 , /* X */
ECL_SMSPEC_MISC_VAR = 14 /* X */} ecl_smspec_var_type;
ecl_smspec_var_type ecl_smspec_iget_var_type( const ecl_smspec_type * smspec , int index );
bool ecl_smspec_needs_num( ecl_smspec_var_type var_type );
bool ecl_smspec_needs_wgname( ecl_smspec_var_type var_type );
const char * ecl_smspec_get_var_type_name( ecl_smspec_var_type var_type );
ecl_smspec_var_type ecl_smspec_identify_var_type(const char * var);
bool ecl_smspec_general_is_total(const ecl_smspec_type * ecl_smspec , const char * gen_key);
bool ecl_smspec_is_rate(const ecl_smspec_type * smspec , int kw_index);
ecl_smspec_type * ecl_smspec_fread_alloc(const char * , const char *, bool include_restart);
void ecl_smspec_free( ecl_smspec_type *);
void ecl_smspec_set_time_info( const ecl_smspec_type * , const float * , double * , time_t * );
int ecl_smspec_get_well_var_index(const ecl_smspec_type * ecl_smspec , const char * well , const char *var);
bool ecl_smspec_has_well_var(const ecl_smspec_type * ecl_smspec , const char * well , const char *var);
int ecl_smspec_get_group_var_index(const ecl_smspec_type * ecl_smspec , const char * group , const char *var);
bool ecl_smspec_has_group_var(const ecl_smspec_type * ecl_smspec , const char * group , const char *var);
int ecl_smspec_get_field_var_index(const ecl_smspec_type * ecl_smspec , const char *var);
bool ecl_smspec_has_field_var(const ecl_smspec_type * ecl_smspec , const char *var);
int ecl_smspec_get_block_var_index(const ecl_smspec_type * ecl_smspec , const char * block_var , int block_nr);
bool ecl_smspec_has_block_var(const ecl_smspec_type * ecl_smspec , const char * block_var , int block_nr);
int ecl_smspec_get_block_var_index_ijk(const ecl_smspec_type * ecl_smspec , const char * block_var , int i , int j , int k);
bool ecl_smspec_has_block_var_ijk(const ecl_smspec_type * ecl_smspec , const char * block_var , int i , int j , int k);
int ecl_smspec_get_region_var_index(const ecl_smspec_type * ecl_smspec , int region_nr , const char *var);
bool ecl_smspec_has_region_var(const ecl_smspec_type * ecl_smspec , int region_nr , const char *var);
int ecl_smspec_get_misc_var_index(const ecl_smspec_type * ecl_smspec , const char *var);
bool ecl_smspec_has_misc_var(const ecl_smspec_type * ecl_smspec , const char *var);
int ecl_smspec_get_well_completion_var_index(const ecl_smspec_type * ecl_smspec , const char * well , const char *var, int cell_nr);
bool ecl_smspec_has_well_completion_var(const ecl_smspec_type * ecl_smspec , const char * well , const char *var, int cell_nr);
int ecl_smspec_get_general_var_index(const ecl_smspec_type * ecl_smspec , const char * lookup_kw);
bool ecl_smspec_has_general_var(const ecl_smspec_type * ecl_smspec , const char * lookup_kw);
const char * ecl_smspec_get_general_var_unit( const ecl_smspec_type * ecl_smspec , const char * lookup_kw);
ecl_smspec_var_type ecl_smspec_iget_var_type( const ecl_smspec_type * smspec , int index );
const char * ecl_smspec_iget_unit( const ecl_smspec_type * smspec , int index );
int ecl_smspec_iget_num( const ecl_smspec_type * smspec , int index );
const char * ecl_smspec_iget_wgname( const ecl_smspec_type * smspec , int index );
const char * ecl_smspec_iget_keyword( const ecl_smspec_type * smspec , int index );
void ecl_smspec_select_matching_general_var_list( const ecl_smspec_type * smspec , const char * pattern , stringlist_type * keys);
stringlist_type * ecl_smspec_alloc_matching_general_var_list(const ecl_smspec_type * smspec , const char * pattern);
time_t ecl_smspec_get_start_time(const ecl_smspec_type * );
/*****************************************************************/
bool ecl_smspec_get_formatted( const ecl_smspec_type * ecl_smspec);
const char * ecl_smspec_get_header_file( const ecl_smspec_type * ecl_smspec );
const char * ecl_smspec_get_simulation_case(const ecl_smspec_type * );
stringlist_type * ecl_smspec_alloc_well_list( const ecl_smspec_type * smspec , const char * pattern);
stringlist_type * ecl_smspec_alloc_group_list( const ecl_smspec_type * smspec , const char * pattern);
stringlist_type * ecl_smspec_alloc_well_var_list( const ecl_smspec_type * smspec );
const char * ecl_smspec_get_simulation_path(const ecl_smspec_type * ecl_smspec);
const char * ecl_smspec_get_base_name( const ecl_smspec_type * ecl_smspec);
const stringlist_type * ecl_smspec_get_restart_list( const ecl_smspec_type * ecl_smspec);
const char * ecl_smspec_get_join_string( const ecl_smspec_type * smspec);
int ecl_smspec_get_param_size( const ecl_smspec_type * smspec );
const char * ecl_smspec_iget_general_key( const ecl_smspec_type * smspec , int index);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,170 +0,0 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
The file 'ecl_sum.h' is part of ERT - Ensemble based Reservoir Tool.
ERT 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.
ERT 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 at <http://www.gnu.org/licenses/gpl.html>
for more details.
*/
#ifndef __ECL_SUM_H__
#define __ECL_SUM_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include <stdbool.h>
#include <time.h>
#include <ecl_smspec.h>
#include <stringlist.h>
#include <time_t_vector.h>
#include <double_vector.h>
typedef struct ecl_sum_struct ecl_sum_type;
bool ecl_sum_check_sim_time( const ecl_sum_type * sum , time_t sim_time);
bool ecl_sum_check_sim_days( const ecl_sum_type * sum , double sim_days);
const char * ecl_sum_get_keyword( const ecl_sum_type * sum , const char * gen_key );
const char * ecl_sum_get_wgname( const ecl_sum_type * sum , const char * gen_key );
const char * ecl_sum_get_unit( const ecl_sum_type * sum , const char * gen_key );
int ecl_sum_get_num( const ecl_sum_type * sum , const char * gen_key );
double ecl_sum_iiget( const ecl_sum_type * ecl_sum , int internal_index , int param_index);
const char * ecl_sum_iget_unit( const ecl_sum_type * ecl_sum , int param_index);
int ecl_sum_iget_num( const ecl_sum_type * sum , int param_index );
const char * ecl_sum_iget_wgname( const ecl_sum_type * sum , int param_index );
const char * ecl_sum_iget_keyword( const ecl_sum_type * sum , int param_index );
int ecl_sum_get_data_length( const ecl_sum_type * ecl_sum );
double ecl_sum_iget_from_sim_time( const ecl_sum_type * ecl_sum , time_t sim_time , int param_index);
double ecl_sum_iget_from_sim_days( const ecl_sum_type * ecl_sum , double sim_days , int param_index );
void ecl_sum_summarize( const ecl_sum_type * ecl_sum , FILE * stream );
bool ecl_sum_general_is_total(const ecl_sum_type * ecl_sum , const char * gen_key);
bool ecl_sum_var_is_total(const ecl_sum_type * ecl_sum , const char * gen_key);
void ecl_sum_free_data(ecl_sum_type * );
void ecl_sum_free__(void * );
void ecl_sum_free(ecl_sum_type * );
ecl_sum_type * ecl_sum_fread_alloc(const char * , const stringlist_type * data_files, const char * key_join_string);
ecl_sum_type * ecl_sum_fread_alloc_case(const char * , const char * key_join_string);
ecl_sum_type * ecl_sum_fread_alloc_case__(const char * , const char * key_join_string , bool include_restart);
/* Accessor functions : */
double ecl_sum_get_well_var(const ecl_sum_type * ecl_sum , int time_index , const char * well , const char *var);
int ecl_sum_get_well_var_index(const ecl_sum_type * ecl_sum , const char * well , const char *var);
bool ecl_sum_has_well_var(const ecl_sum_type * ecl_sum , const char * well , const char *var);
double ecl_sum_get_well_var_from_sim_days( const ecl_sum_type * ecl_sum , double sim_days , const char * well , const char * var);
double ecl_sum_get_well_var_from_sim_time( const ecl_sum_type * ecl_sum , time_t sim_time , const char * well , const char * var);
double ecl_sum_get_group_var(const ecl_sum_type * ecl_sum , int time_index , const char * group , const char *var);
int ecl_sum_get_group_var_index(const ecl_sum_type * ecl_sum , const char * group , const char *var);
bool ecl_sum_has_group_var(const ecl_sum_type * ecl_sum , const char * group , const char *var);
double ecl_sum_get_field_var(const ecl_sum_type * ecl_sum , int time_index , const char *var);
int ecl_sum_get_field_var_index(const ecl_sum_type * ecl_sum , const char *var);
bool ecl_sum_has_field_var(const ecl_sum_type * ecl_sum , const char *var);
double ecl_sum_get_field_var_from_sim_days( const ecl_sum_type * ecl_sum , double sim_days , const char * var);
double ecl_sum_get_field_var_from_sim_time( const ecl_sum_type * ecl_sum , time_t sim_time , const char * var);
double ecl_sum_get_block_var(const ecl_sum_type * ecl_sum , int time_index , const char * block_var , int block_nr);
int ecl_sum_get_block_var_index(const ecl_sum_type * ecl_sum , const char * block_var , int block_nr);
bool ecl_sum_has_block_var(const ecl_sum_type * ecl_sum , const char * block_var , int block_nr);
double ecl_sum_get_block_var_ijk(const ecl_sum_type * ecl_sum , int time_index , const char * block_var , int i , int j , int k);
int ecl_sum_get_block_var_index_ijk(const ecl_sum_type * ecl_sum , const char * block_var , int i , int j , int k);
bool ecl_sum_has_block_var_ijk(const ecl_sum_type * ecl_sum , const char * block_var , int i , int j , int k);
double ecl_sum_get_region_var(const ecl_sum_type * ecl_sum , int time_index , int region_nr , const char *var);
int ecl_sum_get_region_var_index(const ecl_sum_type * ecl_sum , int region_nr , const char *var);
bool ecl_sum_has_region_var(const ecl_sum_type * ecl_sum , int region_nr , const char *var);
double ecl_sum_get_misc_var(const ecl_sum_type * ecl_sum , int time_index , const char *var);
int ecl_sum_get_misc_var_index(const ecl_sum_type * ecl_sum , const char *var);
bool ecl_sum_has_misc_var(const ecl_sum_type * ecl_sum , const char *var);
double ecl_sum_get_well_completion_var(const ecl_sum_type * ecl_sum , int time_index , const char * well , const char *var, int cell_nr);
int ecl_sum_get_well_completion_var_index(const ecl_sum_type * ecl_sum , const char * well , const char *var, int cell_nr);
bool ecl_sum_has_well_completion_var(const ecl_sum_type * ecl_sum , const char * well , const char *var, int cell_nr);
double ecl_sum_get_general_var(const ecl_sum_type * ecl_sum , int time_index , const char * lookup_kw);
int ecl_sum_get_general_var_index(const ecl_sum_type * ecl_sum , const char * lookup_kw);
bool ecl_sum_has_general_var(const ecl_sum_type * ecl_sum , const char * lookup_kw);
bool ecl_sum_has_key(const ecl_sum_type * ecl_sum , const char * lookup_kw);
double ecl_sum_get_general_var_from_sim_days( const ecl_sum_type * ecl_sum , double sim_days , const char * var);
double ecl_sum_get_general_var_from_sim_time( const ecl_sum_type * ecl_sum , time_t sim_time , const char * var);
const char * ecl_sum_get_general_var_unit( const ecl_sum_type * ecl_sum , const char * var);
/***************/
void ecl_sum_fprintf(const ecl_sum_type * , FILE * , const stringlist_type * , bool report_only , bool print_header);
/* Time related functions */
int ecl_sum_get_first_gt( const ecl_sum_type * ecl_sum , int param_index , double limit);
int ecl_sum_get_first_lt( const ecl_sum_type * ecl_sum , int param_index , double limit);
int ecl_sum_get_last_report_step( const ecl_sum_type * ecl_sum );
int ecl_sum_get_first_report_step( const ecl_sum_type * ecl_sum );
bool ecl_sum_has_report_step(const ecl_sum_type * ecl_sum , int report_step );
time_t ecl_sum_get_report_time( const ecl_sum_type * ecl_sum , int report_step );
time_t ecl_sum_iget_sim_time( const ecl_sum_type * ecl_sum , int index );
double ecl_sum_iget_sim_days( const ecl_sum_type * ecl_sum , int time_index);
int ecl_sum_iget_report_step( const ecl_sum_type * ecl_sum , int internal_index );
int ecl_sum_iget_mini_step( const ecl_sum_type * ecl_sum , int internal_index );
double ecl_sum_iget_general_var(const ecl_sum_type * ecl_sum , int internal_index , const char * lookup_kw);
void ecl_sum_init_data_vector( const ecl_sum_type * ecl_sum , double_vector_type * data_vector , int data_index , bool report_only );
double_vector_type * ecl_sum_alloc_data_vector( const ecl_sum_type * ecl_sum , int data_index , bool report_only);
time_t_vector_type * ecl_sum_alloc_time_vector( const ecl_sum_type * ecl_sum , bool report_only);
time_t ecl_sum_get_data_start( const ecl_sum_type * ecl_sum );
time_t ecl_sum_get_end_time( const ecl_sum_type * ecl_sum);
time_t ecl_sum_get_start_time(const ecl_sum_type * );
const char * ecl_sum_get_case(const ecl_sum_type * );
bool ecl_sum_same_case( const ecl_sum_type * ecl_sum , const char * input_file );
void ecl_sum_resample_from_sim_days( const ecl_sum_type * ecl_sum , const double_vector_type * sim_days , double_vector_type * value , const char * gen_key);
void ecl_sum_resample_from_sim_time( const ecl_sum_type * ecl_sum , const time_t_vector_type * sim_time , double_vector_type * value , const char * gen_key);
time_t ecl_sum_time_from_days( const ecl_sum_type * ecl_sum , double sim_days );
double ecl_sum_days_from_time( const ecl_sum_type * ecl_sum , time_t sim_time );
double ecl_sum_get_sim_length( const ecl_sum_type * ecl_sum ) ;
double ecl_sum_get_first_day( const ecl_sum_type * ecl_sum );
/*****************************************************************/
stringlist_type * ecl_sum_alloc_well_list( const ecl_sum_type * ecl_sum , const char * pattern);
stringlist_type * ecl_sum_alloc_group_list( const ecl_sum_type * ecl_sum , const char * pattern);
stringlist_type * ecl_sum_alloc_well_var_list( const ecl_sum_type * ecl_sum );
stringlist_type * ecl_sum_alloc_matching_general_var_list(const ecl_sum_type * ecl_sum , const char * pattern);
void ecl_sum_select_matching_general_var_list( const ecl_sum_type * ecl_sum , const char * pattern , stringlist_type * keys);
const ecl_smspec_type * ecl_sum_get_smspec( const ecl_sum_type * ecl_sum );
ecl_smspec_var_type ecl_sum_identify_var_type(const char * var);
ecl_smspec_var_type ecl_sum_get_var_type( const ecl_sum_type * ecl_sum , const char * gen_key);
bool ecl_sum_var_is_rate( const ecl_sum_type * ecl_sum , const char * gen_key);
bool ecl_sum_var_is_total( const ecl_sum_type * ecl_sum , const char * gen_key);
int ecl_sum_iget_report_end( const ecl_sum_type * ecl_sum , int report_step );
int ecl_sum_iget_report_start( const ecl_sum_type * ecl_sum , int report_step );
UTIL_IS_INSTANCE_HEADER( ecl_sum );
#ifdef __cplusplus
}
#endif
#endif

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -38,6 +38,7 @@ typedef bool (bool_ftype) (bool);
void bool_vector_set_read_only( bool_vector_type * vector , bool read_only);
bool bool_vector_get_read_only( const bool_vector_type * vector );
void bool_vector_resize( bool_vector_type * vector , int new_alloc_size );
void bool_vector_memcpy_data( bool * target, const bool_vector_type * src );
void bool_vector_memcpy( bool_vector_type * target , const bool_vector_type * src);
void bool_vector_memcpy_data_block( bool_vector_type * target , const bool_vector_type * src , int target_offset , int src_offset , int len);
bool bool_vector_growable( const bool_vector_type * vector);

103
ThirdParty/Ert/include/buffer.h vendored Normal file
View File

@ -0,0 +1,103 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
The file 'buffer.h' is part of ERT - Ensemble based Reservoir Tool.
ERT 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.
ERT 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 at <http://www.gnu.org/licenses/gpl.html>
for more details.
*/
#ifndef __BUFFER_H__
#define __BUFFER_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>
#include <ssize_t.h>
typedef struct buffer_struct buffer_type;
buffer_type * buffer_alloc( size_t buffer_size );
buffer_type * buffer_alloc_private_wrapper(void * data , size_t buffer_size );
bool buffer_search_replace( buffer_type * buffer , const char * old_string , const char * new_string);
void buffer_shrink_to_fit( buffer_type * buffer );
void buffer_memshift(buffer_type * buffer , size_t offset, ssize_t shift);
bool buffer_strstr( buffer_type * buffer , const char * expr );
bool buffer_strchr( buffer_type * buffer , int c);
void buffer_replace_string( buffer_type * buffer , size_t offset , size_t old_size , const char * new_string);
void buffer_replace_data(buffer_type * buffer , size_t offset , size_t old_size , const void * new_data , size_t new_size);
void buffer_free_container( buffer_type * buffer );
void buffer_free( buffer_type * buffer);
size_t buffer_safe_fread(buffer_type * buffer , void * target_ptr , size_t item_size , size_t items);
size_t buffer_fread(buffer_type * buffer , void * target_ptr , size_t item_size , size_t items);
size_t buffer_safe_fwrite(buffer_type * buffer , const void * src_ptr , size_t item_size , size_t items);
size_t buffer_fwrite(buffer_type * buffer , const void * src_ptr , size_t item_size , size_t items);
const char * buffer_fread_string(buffer_type * buffer);
char * buffer_fread_alloc_string(buffer_type * buffer);
void buffer_fwrite_string(buffer_type * buffer , const char * string);
void buffer_summarize(const buffer_type * buffer , const char *);
void buffer_fwrite_char_ptr(buffer_type * buffer , const char * string_ptr );
void buffer_terminate_char_ptr( buffer_type * buffer );
void buffer_fwrite_char(buffer_type * buffer , char value);
void buffer_fwrite_int(buffer_type * buffer , int value);
void buffer_fskip_bool(buffer_type * buffer);
void buffer_fwrite_bool(buffer_type * buffer , bool value);
int buffer_fread_int(buffer_type * buffer );
bool buffer_fread_bool(buffer_type * buffer);
long int buffer_fread_long(buffer_type * buffer);
void buffer_fskip_long(buffer_type * buffer);
void buffer_store(const buffer_type * buffer , const char * filename);
size_t buffer_get_offset(const buffer_type * buffer);
size_t buffer_get_alloc_size(const buffer_type * buffer);
size_t buffer_get_size(const buffer_type * buffer);
size_t buffer_get_string_size( const buffer_type * buffer );
size_t buffer_get_remaining_size(const buffer_type * buffer);
void * buffer_get_data(const buffer_type * buffer);
void * buffer_alloc_data_copy(const buffer_type * buffer);
void buffer_stream_fwrite( const buffer_type * buffer , FILE * stream );
int buffer_fgetc( buffer_type * buffer );
void buffer_fseek(buffer_type * buffer , ssize_t offset , int whence);
void buffer_fskip(buffer_type * buffer, ssize_t offset);
void buffer_clear( buffer_type * buffer );
void buffer_fskip_int(buffer_type * buffer);
void buffer_fskip_time_t(buffer_type * buffer);
time_t buffer_fread_time_t(buffer_type * buffer);
void buffer_fwrite_time_t(buffer_type * buffer , time_t value);
void buffer_rewind(buffer_type * buffer );
double buffer_fread_double(buffer_type * buffer);
void buffer_fwrite_double(buffer_type * buffer , double value);
size_t buffer_stream_fwrite_n( const buffer_type * buffer , size_t offset , ssize_t write_size , FILE * stream );
void buffer_stream_fprintf( const buffer_type * buffer , FILE * stream );
void buffer_stream_fread( buffer_type * buffer , size_t byte_size , FILE * stream);
buffer_type * buffer_fread_alloc(const char * filename);
void buffer_fread_realloc(buffer_type * buffer , const char * filename);
#ifdef HAVE_ZLIB
size_t buffer_fwrite_compressed(buffer_type * buffer, const void * ptr , size_t byte_size);
size_t buffer_fread_compressed(buffer_type * buffer , size_t compressed_size , void * target_ptr , size_t target_size);
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -38,6 +38,7 @@ typedef double (double_ftype) (double);
void double_vector_set_read_only( double_vector_type * vector , bool read_only);
bool double_vector_get_read_only( const double_vector_type * vector );
void double_vector_resize( double_vector_type * vector , int new_alloc_size );
void double_vector_memcpy_data( double * target, const double_vector_type * src );
void double_vector_memcpy( double_vector_type * target , const double_vector_type * src);
void double_vector_memcpy_data_block( double_vector_type * target , const double_vector_type * src , int target_offset , int src_offset , int len);
bool double_vector_growable( const double_vector_type * vector);

View File

@ -36,6 +36,8 @@ extern "C" {
*/
#define ECLIPSE_BYTE_ORDER __BIG_ENDIAN // Alternatively: __LITTLE_ENDIAN
#define WIN32 1
#ifdef BYTE_ORDER
#if BYTE_ORDER == ECLIPSE_BYTE_ORDER

View File

@ -75,6 +75,7 @@ extern "C" {
int ecl_grid_get_nz( const ecl_grid_type * grid );
int ecl_grid_get_nx( const ecl_grid_type * grid );
int ecl_grid_get_ny( const ecl_grid_type * grid );
int ecl_grid_get_nactive( const ecl_grid_type * grid );
int ecl_grid_get_active_index(const ecl_grid_type * , int , int , int );
void ecl_grid_summarize(const ecl_grid_type * );
void ecl_grid_get_ijk1(const ecl_grid_type * , int global_index , int *, int * , int *);
@ -136,6 +137,7 @@ extern "C" {
void ecl_grid_fwrite_EGRID( const ecl_grid_type * grid , const char * filename);
void ecl_grid_fwrite_GRID( const ecl_grid_type * grid , const char * filename);
void ecl_grid_fprintf_grdecl( const ecl_grid_type * grid , FILE * stream );
void ecl_grid_fwrite_EGRID_header( int dims[3] , const float mapaxes[6], fortio_type * fortio);
float * ecl_grid_alloc_coord_data( const ecl_grid_type * grid );
ecl_kw_type * ecl_grid_alloc_coord_kw( const ecl_grid_type * grid );

View File

@ -1,7 +1,7 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
Copyright (C) 2012 Statoil ASA, Norway.
The file 'regression.h' is part of ERT - Ensemble based Reservoir Tool.
The file 'ecl_init_file.h' is part of ERT - Ensemble based Reservoir Tool.
ERT is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,19 +16,22 @@
for more details.
*/
#ifndef __REGRESSION_H__
#define __REGRESSION_H__
#ifndef __ECL_INIT_FILE_H__
#define __ECL_INIT_FILE_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <matrix.h>
#include <time.h>
#include <fortio.h>
#include <ecl_kw.h>
#include <ecl_grid.h>
double regression_scale( matrix_type * X , matrix_type * Y , matrix_type * X_mean , matrix_type * X_norm);
double regression_unscale(const matrix_type * beta , const matrix_type * X_norm , const matrix_type * X_mean , double Y_mean , matrix_type * beta0);
void regression_OLS(const matrix_type * X , const matrix_type * Y , matrix_type * beta);
void ecl_init_file_fwrite_header( fortio_type * fortio , const ecl_grid_type * grid , const ecl_kw_type * poro , int phases , time_t start_date);
#ifdef __cplusplus
}

View File

@ -65,31 +65,6 @@ extern "C" {
} ecl_intehead_type;
/* Some magic indices used to look up in the INTEHEAD keyword. */
#define INTEHEAD_DAY_INDEX 64
#define INTEHEAD_MONTH_INDEX 65
#define INTEHEAD_YEAR_INDEX 66
#define INTEHEAD_NX_INDEX 8
#define INTEHEAD_NY_INDEX 9
#define INTEHEAD_NZ_INDEX 10
#define INTEHEAD_NACTIVE_INDEX 11
#define INTEHEAD_PHASE_INDEX 14
#define INTEHEAD_VERSION_INDEX 94 /* This is ECLIPSE100 || ECLIPSE300 - not temporal version. */
#define INTEHEAD_NWELLS_INDEX 16
#define INTEHEAD_NIWELZ_INDEX 24
#define INTEHEAD_NZWELZ_INDEX 27
#define INTEHEAD_NCWMAX_INDEX 17
#define INTEHEAD_NICONZ_INDEX 32
#define INTEHEAD_NSWLMX_INDEX 175
#define INTEHEAD_NSEGMX_INDEX 176
#define INTEHEAD_NLBRMX_INDEX 177
#define INTEHEAD_NISEGZ_INDEX 178
#define INTEHEAD_NILBRZ_INDEX 180
void ecl_intehead_free( ecl_intehead_type * intehead );
ecl_intehead_type * ecl_intehead_alloc( const ecl_kw_type * intehead_kw );

View File

@ -35,6 +35,8 @@ extern "C" {
typedef struct ecl_kw_struct ecl_kw_type;
size_t ecl_kw_fortio_size( const ecl_kw_type * ecl_kw );
void * ecl_kw_get_ptr(const ecl_kw_type *ecl_kw);
void ecl_kw_set_data_ptr(ecl_kw_type * ecl_kw , void * data);
void ecl_kw_fwrite_data(const ecl_kw_type *_ecl_kw , fortio_type *fortio);
void ecl_kw_fread_realloc_data(ecl_kw_type *ecl_kw, fortio_type *fortio);
@ -78,7 +80,6 @@ extern "C" {
const char * ecl_kw_iget_char_ptr( const ecl_kw_type * ecl_kw , int i);
void * ecl_kw_iget_ptr(const ecl_kw_type *, int);
int ecl_kw_get_size(const ecl_kw_type *);
bool ecl_kw_header_eq(const ecl_kw_type *, const char *);
bool ecl_kw_ichar_eq(const ecl_kw_type *, int , const char *);
ecl_kw_type * ecl_kw_alloc( const char * header , int size , ecl_type_enum ecl_type );
ecl_kw_type * ecl_kw_alloc_new(const char * , int , ecl_type_enum , const void * );
@ -92,6 +93,7 @@ extern "C" {
void ecl_kw_get_data_as_double(const ecl_kw_type *, double *);
void ecl_kw_get_data_as_float(const ecl_kw_type * ecl_kw , float * float_data);
bool ecl_kw_equal(const ecl_kw_type *ecl_kw1, const ecl_kw_type *ecl_kw2);
bool ecl_kw_block_equal( const ecl_kw_type * ecl_kw1 , const ecl_kw_type * ecl_kw2 , int cmp_elements);
bool ecl_kw_data_equal( const ecl_kw_type * ecl_kw , const void * data);
void ecl_kw_fskip_data__( ecl_type_enum ecl_type , int size , fortio_type * fortio);
void ecl_kw_fskip_data(ecl_kw_type *ecl_kw, fortio_type *fortio);
@ -116,14 +118,17 @@ extern "C" {
ecl_kw_type * ecl_kw_buffer_alloc(buffer_type * buffer);
void ecl_kw_buffer_store(const ecl_kw_type * ecl_kw , buffer_type * buffer);
void ecl_kw_fprintf_data( const ecl_kw_type * ecl_kw , const char * fmt , FILE * stream);
void ecl_kw_memcpy_data( ecl_kw_type * target , const ecl_kw_type * src);
bool ecl_kw_assert_numeric( const ecl_kw_type * kw );
bool ecl_kw_assert_binary( const ecl_kw_type * kw1, const ecl_kw_type * kw2);
void ecl_kw_scalar_set_bool( ecl_kw_type * ecl_kw , bool bool_value);
void ecl_kw_scalar_set__(ecl_kw_type * ecl_kw , const void * value);
void ecl_kw_scalar_set_float_or_double( ecl_kw_type * ecl_kw , double value );
#define ECL_KW_SCALAR_SET_TYPED_HEADER( ctype ) void ecl_kw_scalar_set_ ## ctype( ecl_kw_type * ecl_kw , ctype value);
ECL_KW_SCALAR_SET_TYPED_HEADER( int )
ECL_KW_SCALAR_SET_TYPED_HEADER( float )
@ -133,8 +138,14 @@ extern "C" {
ecl_kw_type * ecl_kw_alloc_scatter_copy( const ecl_kw_type * src_kw , int target_size , const int * mapping, void * def_value);
void ecl_kw_inplace_add( ecl_kw_type * target_kw , const ecl_kw_type * add_kw);
void ecl_kw_inplace_sub( ecl_kw_type * target_kw , const ecl_kw_type * sub_kw);
void ecl_kw_inplace_div( ecl_kw_type * target_kw , const ecl_kw_type * div_kw);
void ecl_kw_inplace_mul( ecl_kw_type * target_kw , const ecl_kw_type * mul_kw);
void ecl_kw_inplace_add_indexed( ecl_kw_type * target_kw , const int_vector_type * index_set , const ecl_kw_type * add_kw);
void ecl_kw_inplace_sub_indexed( ecl_kw_type * target_kw , const int_vector_type * index_set , const ecl_kw_type * sub_kw);
void ecl_kw_inplace_mul_indexed( ecl_kw_type * target_kw , const int_vector_type * index_set , const ecl_kw_type * mul_kw);
void ecl_kw_inplace_div_indexed( ecl_kw_type * target_kw , const int_vector_type * index_set , const ecl_kw_type * div_kw);
void ecl_kw_copy_indexed( ecl_kw_type * target_kw , const int_vector_type * index_set , const ecl_kw_type * src_kw);
bool ecl_kw_assert_binary_numeric( const ecl_kw_type * kw1, const ecl_kw_type * kw2);

View File

@ -7,34 +7,145 @@ extern "C" {
/*
This header file contains names and indices of ECLIPSE keywords
which have special significance in various files; everything
related to the INTEHEAD keyword is in the ecl_intehead.h header
file.
which have special significance in various files. Observe that many
of the keywords like e.g. INTEHEAD occur in many different file
types, with partly overlapping layout and values.
*/
/*****************************************************************/
/* INIT files: */
/*****************************************************************/
#define PORO_KW "PORO"
#define PORV_KW "PORV"
#define AQUIFER_KW "AQUIFERN"
#define INTEHEAD_KW "INTEHEAD"
#define LOGIHEAD_KW "LOGIHEAD"
#define DOUBHEAD_KW "DOUBHEAD"
#define RPORV_KW "RPORV"
#define PORV_KW "PORV"
#define PORMOD_KW "PORV_MOD"
#define PVTNUM_KW "PVTNUM"
/*
Observe that many of the elements in the INTEHEAD keyword is shared
between the restart and init files. The ones listed below here are
in both the INIT and the restart files. In addition the restart
files have many well related items which are only in the restart
files.
*/
#define INTEHEAD_UNIT_INDEX 2
#define INTEHEAD_NX_INDEX 8
#define INTEHEAD_NY_INDEX 9
#define INTEHEAD_NZ_INDEX 10
#define INTEHEAD_NACTIVE_INDEX 11
#define INTEHEAD_PHASE_INDEX 14
#define INTEHEAD_DAY_INDEX 64
#define INTEHEAD_MONTH_INDEX 65
#define INTEHEAD_YEAR_INDEX 66
#define INTEHEAD_IPROG_INDEX 94
#define INTEHEAD_METRIC_VALUE 1
#define INTEHEAD_ECLIPSE100_VALUE 100
#define INTEHEAD_ECLIPSE300_VALUE 300
#define INTEHEAD_ECLIPSE300THERMAL_VALUE 500
#define INTEHEAD_INIT_SIZE 95
#define INTEHEAD_RESTART_SIZE 180
#define LOGIHEAD_ECLIPSE300_RADIAL_INDEX 3
#define LOGIHEAD_ECLIPSE100_RADIAL_INDEX 4
#define LOGIHEAD_DUALP_INDEX 14
#define LOGIHEAD_INIT_SIZE 80
#define LOGIHEAD_RESTART_SIZE 15
#define LOGIHEAD_RS_INDEX 0
#define LOGIHEAD_RV_INDEX 1
#define LOGIHEAD_DIR_RELPERM_INDEX 2
/*-----------------------------------------------------------------*/
#define LOGIHEAD_REV_RELPERM100_INDEX 3 /* The indices for reversible relperm and */
#define LOGIHEAD_RADIAL100_INDEX 4 /* use of radial grids is interchanged between */
#define LOGIHEAD_REV_RELPERM300_INDEX 4 /* ECLIPSE100 and ECLIPSE300. */
#define LOGIHEAD_RADIAL300_INDEX 3
/*-----------------------------------------------------------------*/
#define LOGIHEAD_HYSTERISIS_INDEX 6
#define LOGIHEAD_DUALP_INDEX 14
#define LOGIHEAD_ENDPOINT_SCALING_INDEX 16
#define LOGIHEAD_DIR_ENDPOINT_SCALING_INDEX 17
#define LOGIHEAD_REV_ENDPOINT_SCALING_INDEX 18
#define LOGIHEAD_ALT_ENDPOINT_SCALING_INDEX 19
#define LOGIHEAD_MISC_DISPLACEMENT_INDEX 35
#define LOGIHEAD_SCALE_WATER_PC_AT_MAX_SAT_INDEX 55
#define LOGIHEAD_SCALE_GAS_PC_AT_MAX_SAT_INDEX 56
#define DOUBHEAD_INIT_SIZE 1
#define DOUBHEAD_RESTART_SIZE 1
/*****************************************************************/
/* INIT and RESTART files: */
/* RESTART files: */
/*****************************************************************/
#define SEQNUM_KW "SEQNUM" /* Contains the report step as the only data;
not present in non-unified files, where the
report step can be inferred from the filename. */
#define SEQNUM_KW "SEQNUM" /* Contains the report step as the only data; not
present in non-unified files, where the report
step must be inferred from the filename. */
#define STARTSOL_KW "STARTSOL"
#define ENDSOL_KW "ENDSOL"
#define IWEL_KW "IWEL"
#define ZWEL_KW "ZWEL"
#define ICON_KW "ICON"
#define ISEG_KW "ISEG"
#define PORV_KW "PORV"
#define AQUIFER_KW "AQUIFERN"
#define ECLIPSE100_OIL_DEN_KW "OIL_DEN"
#define ECLIPSE100_GAS_DEN_KW "GAS_DEN"
#define ECLIPSE100_WATER_DEN_KW "WAT_DEN"
#define ECLIPSE300_OIL_DEN_KW "DENO"
#define ECLIPSE300_GAS_DEN_KW "DENG"
#define ECLIPSE300_WATER_DEN_KW "DENW"
#define FIPGAS_KW "FIPGAS"
#define FIPWAT_KW "FIPWAT"
#define FIPOIL_KW "FIPOIL"
#define RFIPGAS_KW "RFIPGAS"
#define RFIPWAT_KW "RFIPWAT"
#define RFIPOIL_KW "RFIPOIL"
#define INTEHEAD_NWELLS_INDEX 16 // Number of wells
#define INTEHEAD_NIWELZ_INDEX 24 // Number of elements pr. well in the IWEL array.
#define INTEHEAD_NZWELZ_INDEX 27 // Number of 8 character words pr. well
#define INTEHEAD_NCWMAX_INDEX 17 // Maximum number of completions per well
#define INTEHEAD_NWGMAX_INDEX 19 // Maximum number of wells in any group
#define INTEHEAD_NGMAXZ_INDEX 20 // Maximum number of groups in field
#define INTEHEAD_NICONZ_INDEX 32 // Number of elements pr completion in the ICON arra.y
#define INTEHEAD_NIGRPZ_INDEX 36 // Number of elements pr group in the IGRP array.
#define INTEHEAD_NSWLMX_INDEX 175
#define INTEHEAD_NSEGMX_INDEX 176
#define INTEHEAD_NLBRMX_INDEX 177
#define INTEHEAD_NISEGZ_INDEX 178
#define INTEHEAD_NILBRZ_INDEX 180
#define DOUBHEAD_DAYS_INDEX 0
/*****************************************************************/
/* Summary files */
/*****************************************************************/
/* Summary header file */
#define MINISTEP_KW "MINISTEP"
#define STARTDAT_KW "STARTDAT" /* Intgere keyword containing day,month,year. */
#define WGNAMES_KW "WGNAMES" /* The names of wells/groups for the summary vectors. */
#define KEYWORDS_KW "KEYWORDS" /* The variable type for the various summary vectors. */
@ -51,22 +162,31 @@ extern "C" {
#define STARTDAT_DAY_INDEX 0
#define STARTDAT_MONTH_INDEX 1
#define STARTDAT_YEAR_INDEX 2
#define STARTDAT_SIZE 3
/* Magic indices uset to locate the grid dimensions from the DIMENS
keyword in the SMSPEC files. Observe that these magic indices
differ from the magic indices used to look up grid dimensions from
the DIMENS keyword in GRID files. */
#define DIMENS_SMSPEC_SIZE_INDEX 0
#define DIMENS_SMSPEC_NX_INDEX 1
#define DIMENS_SMSPEC_NY_INDEX 2
#define DIMENS_SMSPEC_NZ_INDEX 3
#define DIMENS_SIZE 6 // Do not know what the two last items are?
/* Summary data files: */
#define SEQHDR_KW "SEQHDR" // Contains a single 'magic' integer - not used in libecl.
#define PARAMS_KW "PARAMS" // Contains the actual summary data for one timestep.
#define MINISTEP_KW "MINISTEP" // Scalar integer - contains the timestep number.
#define SEQHDR_SIZE 1
#define RESTART_KW "RESTART"
#define SUMMARY_RESTART_SIZE 8
/*
There are no magic indices in the summary data files, for all
interesting data the table created from the ecl_smspec file must be

191
ThirdParty/Ert/include/ecl_region.h vendored Normal file
View File

@ -0,0 +1,191 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
The file 'ecl_region.h' is part of ERT - Ensemble based Reservoir Tool.
ERT 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.
ERT 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 at <http://www.gnu.org/licenses/gpl.html>
for more details.
*/
#ifndef __ECL_REGION_H__
#define __ECL_REGION_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include <int_vector.h>
#include <geo_polygon.h>
#include <ecl_box.h>
#include <ecl_grid.h>
typedef enum {
SELECT_ALL = 0,
DESELECT_ALL = 1,
SELECT_FROM_IJK = 2,
DESELECT_FROM_IJK = 3,
SELECT_FROM_I = 4,
DSELECT_FROM_I = 5,
SELECT_FROM_J = 6,
DSELECT_FROM_J = 7,
SELECT_FROM_K = 8,
DSELECT_FROM_K = 9,
SELECT_EQUAL = 10,
DESELECT_EQUAL = 11,
SELECT_IN_INTERVAL = 12,
DESELECT_IN_INTERVAL = 13,
INVERT_SELECTION = 14
} ecl_region_select_cmd;
typedef struct ecl_region_struct ecl_region_type;
void ecl_region_unlock( ecl_region_type * region );
void ecl_region_lock( ecl_region_type * region );
void ecl_region_reset( ecl_region_type * ecl_region );
ecl_region_type * ecl_region_alloc_copy( const ecl_region_type * ecl_region );
ecl_region_type * ecl_region_alloc( const ecl_grid_type * ecl_grid , bool preselect);
void ecl_region_free( ecl_region_type * region );
void ecl_region_free__( void * __region );
const int_vector_type * ecl_region_get_active_list( ecl_region_type * region );
const int_vector_type * ecl_region_get_global_list( ecl_region_type * region );
const int_vector_type * ecl_region_get_global_active_list( ecl_region_type * region );
bool ecl_region_contains_ijk( const ecl_region_type * ecl_region , int i , int j , int k);
bool ecl_region_contains_global( const ecl_region_type * ecl_region , int global_index);
bool ecl_region_contains_active( const ecl_region_type * ecl_region , int active_index);
void ecl_region_invert_selection( ecl_region_type * region );
void ecl_region_select_all( ecl_region_type * region);
void ecl_region_deselect_all( ecl_region_type * region );
void ecl_region_select_in_interval( ecl_region_type * region , const ecl_kw_type * ecl_kw, float min_value , float max_value);
void ecl_region_deselect_in_interval( ecl_region_type * region , const ecl_kw_type * ecl_kw, float min_value , float max_value);
void ecl_region_select_equal( ecl_region_type * region , const ecl_kw_type * ecl_kw, int value);
void ecl_region_deselect_equal( ecl_region_type * region , const ecl_kw_type * ecl_kw, int value);
void ecl_region_select_inactive_cells( ecl_region_type * region );
void ecl_region_deselect_inactive_cells( ecl_region_type * region );
void ecl_region_select_active_cells( ecl_region_type * region );
void ecl_region_deselect_active_cells( ecl_region_type * region );
void ecl_region_select_from_box( ecl_region_type * region , const ecl_box_type * ecl_box );
void ecl_region_deselect_from_box( ecl_region_type * region , const ecl_box_type * ecl_box );
void ecl_region_select_from_ijkbox( ecl_region_type * region , int i1 , int i2 , int j1 , int j2 , int k1 , int k2);
void ecl_region_deselect_from_ijkbox( ecl_region_type * region , int i1 , int i2 , int j1 , int j2 , int k1 , int k2);
void ecl_region_select_i1i2( ecl_region_type * region , int i1 , int i2);
void ecl_region_deselect_i1i2( ecl_region_type * region , int i1 , int i2);
void ecl_region_select_j1j2( ecl_region_type * region , int j1 , int j2);
void ecl_region_deselect_j1j2( ecl_region_type * region , int j1 , int i2);
void ecl_region_select_k1k2( ecl_region_type * region , int k1 , int k2);
void ecl_region_deselect_k1k2( ecl_region_type * region , int k1 , int i2);
void ecl_region_select_shallow_cells( ecl_region_type * region , double depth_limit );
void ecl_region_deselect_shallow_cells( ecl_region_type * region , double depth_limit );
void ecl_region_select_deep_cells( ecl_region_type * region , double depth_limit );
void ecl_region_deselect_deep_cells( ecl_region_type * region , double depth_limit );
void ecl_region_select_thin_cells( ecl_region_type * ecl_region , double dz_limit );
void ecl_region_deselect_thin_cells( ecl_region_type * ecl_region , double dz_limit );
void ecl_region_select_thick_cells( ecl_region_type * ecl_region , double dz_limit );
void ecl_region_deselect_thick_cells( ecl_region_type * ecl_region , double dz_limit );
void ecl_region_select_small_cells( ecl_region_type * ecl_region , double volum_limit );
void ecl_region_deselect_small_cells( ecl_region_type * ecl_region , double volum_limit );
void ecl_region_select_large_cells( ecl_region_type * ecl_region , double volum_limit );
void ecl_region_deselect_large_cells( ecl_region_type * ecl_region , double volum_limit );
void ecl_region_select_global_index( ecl_region_type * ecl_region , int global_index);
void ecl_region_deselect_global_index( ecl_region_type * ecl_region , int global_index);
void ecl_region_select_active_index( ecl_region_type * ecl_region , int active_index);
void ecl_region_deselect_active_index( ecl_region_type * ecl_region , int active_index);
void ecl_region_intersection( ecl_region_type * region , const ecl_region_type * new_region );
void ecl_region_union( ecl_region_type * region , const ecl_region_type * new_region );
void ecl_region_subtract( ecl_region_type * region , const ecl_region_type * new_region);
void ecl_region_xor( ecl_region_type * region , const ecl_region_type * new_region);
void ecl_region_select_smaller( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , float limit);
void ecl_region_deselect_smaller( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , float limit);
void ecl_region_select_larger( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , float limit);
void ecl_region_deselect_larger( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , float limit);
void ecl_region_cmp_select_less( ecl_region_type * ecl_region , const ecl_kw_type * kw1 , const ecl_kw_type * kw2);
void ecl_region_cmp_deselect_less( ecl_region_type * ecl_region , const ecl_kw_type * kw1 , const ecl_kw_type * kw2);
void ecl_region_cmp_select_more( ecl_region_type * ecl_region , const ecl_kw_type * kw1 , const ecl_kw_type * kw2);
void ecl_region_cmp_deselect_more( ecl_region_type * ecl_region , const ecl_kw_type * kw1 , const ecl_kw_type * kw2);
void ecl_region_select_in_cylinder( ecl_region_type * region , double x0 , double y0, double R);
void ecl_region_deselect_in_cylinder( ecl_region_type * region , double x0 , double y0, double R);
void ecl_region_select_in_zcylinder( ecl_region_type * region , double x0 , double y0, double R , double z1 , double z2);
void ecl_region_deselect_in_zcylinder( ecl_region_type * region , double x0 , double y0, double R, double z1 , double z2);
void ecl_region_select_above_plane( ecl_region_type * region, const double n[3] , const double p[3]);
void ecl_region_select_below_plane( ecl_region_type * region, const double n[3] , const double p[3]);
void ecl_region_deselect_above_plane( ecl_region_type * region, const double n[3] , const double p[3]);
void ecl_region_deselect_below_plane( ecl_region_type * region, const double n[3] , const double p[3]);
void ecl_region_select_inside_polygon( ecl_region_type * region , const geo_polygon_type * polygon);
void ecl_region_deselect_inside_polygon( ecl_region_type * region , const geo_polygon_type * polygon);
void ecl_region_select_outside_polygon( ecl_region_type * region , const geo_polygon_type * polygon);
void ecl_region_deselect_outside_polygon( ecl_region_type * region , const geo_polygon_type * polygon);
/*****************************************************************/
/* Functions to manipulate ecl_kw instances . */
void ecl_region_set_kw_int( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , int value, bool force_active);
void ecl_region_set_kw_float( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , float value , bool force_active);
void ecl_region_set_kw_double( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , double value , bool force_active);
void ecl_region_kw_copy( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , const ecl_kw_type * src_kw , bool force_active);
int ecl_region_get_kw_size( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , bool force_active);
void ecl_region_kw_iadd( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , const ecl_kw_type * delta_kw , bool force_active);
void ecl_region_kw_idiv( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , const ecl_kw_type * div_kw , bool force_active);
void ecl_region_kw_imul( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , const ecl_kw_type * mul_kw , bool force_active);
void ecl_region_kw_isub( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , const ecl_kw_type * delta_kw , bool force_active);
/*****************************************************************/
/* set/get the name */
void ecl_region_set_name( ecl_region_type * region , const char * name );
const char * ecl_region_get_name( const ecl_region_type * region );
/*****************************************************************/
/* Stupid cpp compat/legacy/cruft functions. */
int ecl_region_get_active_size_cpp( ecl_region_type * region );
int ecl_region_get_global_size_cpp( ecl_region_type * region );
const int * ecl_region_get_active_list_cpp( ecl_region_type * region );
const int * ecl_region_get_global_list_cpp( ecl_region_type * region );
/*****************************************************************/
UTIL_IS_INSTANCE_HEADER( ecl_region );
UTIL_SAFE_CAST_HEADER( ecl_region );
#ifdef __cplusplus
}
#endif
#endif

44
ThirdParty/Ert/include/ecl_rst_file.h vendored Normal file
View File

@ -0,0 +1,44 @@
/*
Copyright (C) 2012 Statoil ASA, Norway.
The file 'ecl_rst_file.h' is part of ERT - Ensemble based Reservoir Tool.
ERT 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.
ERT 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 at <http://www.gnu.org/licenses/gpl.html>
for more details.
*/
#ifndef __ECL_RST_FILE_H__
#define __ECL_RST_FILE_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ecl_rst_file_struct ecl_rst_file_type;
ecl_rst_file_type * ecl_rst_file_open_read( const char * filename );
ecl_rst_file_type * ecl_rst_file_open_write( const char * filename );
ecl_rst_file_type * ecl_rst_file_open_append( const char * filename );
void ecl_rst_file_close( ecl_rst_file_type * rst_file );
void ecl_rst_file_start_solution( ecl_rst_file_type * rst_file );
void ecl_rst_file_end_solution( ecl_rst_file_type * rst_file );
void ecl_rst_file_fwrite_header( ecl_rst_file_type * rst_file , int seqnum , time_t date , double days , int nx , int ny ,int nz , int nactive , int phases);
void ecl_rst_file_add_kw(ecl_rst_file_type * rst_file , const ecl_kw_type * ecl_kw );
#ifdef __cplusplus
}
#endif
#endif

141
ThirdParty/Ert/include/ecl_smspec.h vendored Normal file
View File

@ -0,0 +1,141 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
The file 'ecl_smspec.h' is part of ERT - Ensemble based Reservoir Tool.
ERT 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.
ERT 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 at <http://www.gnu.org/licenses/gpl.html>
for more details.
*/
#ifndef __ECL_SMSPEC__
#define __ECL_SMSPEC__
#ifdef __cplusplus
extern "C" {
#endif
#include <time.h>
#include <stdbool.h>
#include <float_vector.h>
#include <stringlist.h>
#include <smspec_node.h>
typedef struct ecl_smspec_struct ecl_smspec_type;
/**
These are the different variable types, see table 3.4 in the
ECLIPFE file format docuemntation for naming conventions.
Only the variable types marked with "X" below are supported in the
remaining implementation. To add support for a new variable type
the functions smspec_node_alloc(), ecl_smsepec_fread_header() and
ecl_smspec_install_gen_key() must be updated.
*/
const int_vector_type * ecl_smspec_get_index_map( const ecl_smspec_type * smspec );
void ecl_smspec_add_node(ecl_smspec_type * ecl_smspec, smspec_node_type * smspec_node);
ecl_smspec_var_type ecl_smspec_iget_var_type( const ecl_smspec_type * smspec , int index );
bool ecl_smspec_needs_num( ecl_smspec_var_type var_type );
bool ecl_smspec_needs_wgname( ecl_smspec_var_type var_type );
const char * ecl_smspec_get_var_type_name( ecl_smspec_var_type var_type );
ecl_smspec_var_type ecl_smspec_identify_var_type(const char * var);
ecl_smspec_type * ecl_smspec_alloc_writer( const char * key_join_string , time_t sim_start , int nx , int ny , int nz);
void ecl_smspec_fwrite( const ecl_smspec_type * smspec , const char * ecl_case , bool fmt_file );
ecl_smspec_type * ecl_smspec_fread_alloc(const char *header_file, const char * key_join_string , bool include_restart);
void ecl_smspec_free( ecl_smspec_type *);
int ecl_smspec_get_sim_days_index( const ecl_smspec_type * smspec );
int ecl_smspec_get_date_day_index( const ecl_smspec_type * smspec );
int ecl_smspec_get_date_month_index( const ecl_smspec_type * smspec );
int ecl_smspec_get_date_year_index( const ecl_smspec_type * smspec );
const smspec_node_type * ecl_smspec_get_well_var_node( const ecl_smspec_type * smspec , const char * well , const char * var);
int ecl_smspec_get_well_var_params_index(const ecl_smspec_type * ecl_smspec , const char * well , const char *var);
bool ecl_smspec_has_well_var(const ecl_smspec_type * ecl_smspec , const char * well , const char *var);
const smspec_node_type * ecl_smspec_get_group_var_node( const ecl_smspec_type * smspec , const char * group , const char * var);
int ecl_smspec_get_group_var_params_index(const ecl_smspec_type * ecl_smspec , const char * group , const char *var);
bool ecl_smspec_has_group_var(const ecl_smspec_type * ecl_smspec , const char * group , const char *var);
const smspec_node_type * ecl_smspec_get_field_var_node( const ecl_smspec_type * smspec , const char * var);
int ecl_smspec_get_field_var_params_index(const ecl_smspec_type * ecl_smspec , const char *var);
bool ecl_smspec_has_field_var(const ecl_smspec_type * ecl_smspec , const char *var);
const smspec_node_type * ecl_smspec_get_region_var_node(const ecl_smspec_type * ecl_smspec , const char *region_var , int region_nr);
int ecl_smspec_get_region_var_params_index(const ecl_smspec_type * ecl_smspec , const char * region_var , int region_nr);
bool ecl_smspec_has_region_var(const ecl_smspec_type * ecl_smspec , const char * region_var , int region_nr);
const smspec_node_type * ecl_smspec_get_misc_var_node(const ecl_smspec_type * ecl_smspec , const char *var);
int ecl_smspec_get_misc_var_params_index(const ecl_smspec_type * ecl_smspec , const char *var);
bool ecl_smspec_has_misc_var(const ecl_smspec_type * ecl_smspec , const char *var);
const smspec_node_type * ecl_smspec_get_block_var_node(const ecl_smspec_type * ecl_smspec , const char * block_var , int block_nr);
int ecl_smspec_get_block_var_params_index(const ecl_smspec_type * ecl_smspec , const char * block_var , int block_nr);
bool ecl_smspec_has_block_var(const ecl_smspec_type * ecl_smspec , const char * block_var , int block_nr);
const smspec_node_type * ecl_smspec_get_block_var_node_ijk(const ecl_smspec_type * ecl_smspec , const char * block_var , int i , int j , int k);
int ecl_smspec_get_block_var_params_index_ijk(const ecl_smspec_type * ecl_smspec , const char * block_var , int i , int j , int k);
bool ecl_smspec_has_block_var_ijk(const ecl_smspec_type * ecl_smspec , const char * block_var , int i , int j , int k);
const smspec_node_type * ecl_smspec_get_well_completion_var_node(const ecl_smspec_type * ecl_smspec , const char * well , const char *var, int cell_nr);
int ecl_smspec_get_well_completion_var_params_index(const ecl_smspec_type * ecl_smspec , const char * well , const char *var, int cell_nr);
bool ecl_smspec_has_well_completion_var(const ecl_smspec_type * ecl_smspec , const char * well , const char *var, int cell_nr);
const smspec_node_type * ecl_smspec_get_general_var_node( const ecl_smspec_type * smspec , const char * lookup_kw );
int ecl_smspec_get_general_var_params_index(const ecl_smspec_type * ecl_smspec , const char * lookup_kw);
bool ecl_smspec_has_general_var(const ecl_smspec_type * ecl_smspec , const char * lookup_kw);
const char * ecl_smspec_get_general_var_unit( const ecl_smspec_type * ecl_smspec , const char * lookup_kw);
//bool ecl_smspec_general_is_total(const ecl_smspec_type * ecl_smspec , const char * gen_key);
//bool ecl_smspec_is_rate(const ecl_smspec_type * smspec , int kw_index);
//ecl_smspec_var_type ecl_smspec_iget_var_type( const ecl_smspec_type * smspec , int index );
//const char * ecl_smspec_iget_unit( const ecl_smspec_type * smspec , int index );
//int ecl_smspec_iget_num( const ecl_smspec_type * smspec , int index );
//const char * ecl_smspec_iget_wgname( const ecl_smspec_type * smspec , int index );
//const char * ecl_smspec_iget_keyword( const ecl_smspec_type * smspec , int index );
void ecl_smspec_select_matching_general_var_list( const ecl_smspec_type * smspec , const char * pattern , stringlist_type * keys);
stringlist_type * ecl_smspec_alloc_matching_general_var_list(const ecl_smspec_type * smspec , const char * pattern);
int ecl_smspec_get_time_index( const ecl_smspec_type * ecl_smspec );
time_t ecl_smspec_get_start_time(const ecl_smspec_type * );
/*****************************************************************/
bool ecl_smspec_get_formatted( const ecl_smspec_type * ecl_smspec);
const char * ecl_smspec_get_header_file( const ecl_smspec_type * ecl_smspec );
stringlist_type * ecl_smspec_alloc_well_list( const ecl_smspec_type * smspec , const char * pattern);
stringlist_type * ecl_smspec_alloc_group_list( const ecl_smspec_type * smspec , const char * pattern);
stringlist_type * ecl_smspec_alloc_well_var_list( const ecl_smspec_type * smspec );
const char * ecl_smspec_get_simulation_path(const ecl_smspec_type * ecl_smspec);
const stringlist_type * ecl_smspec_get_restart_list( const ecl_smspec_type * ecl_smspec);
const char * ecl_smspec_get_join_string( const ecl_smspec_type * smspec);
const float_vector_type * ecl_smspec_get_params_default( const ecl_smspec_type * ecl_smspec );
void ecl_smspec_update_wgname( ecl_smspec_type * smspec , smspec_node_type * node , const char * wgname );
const int * ecl_smspec_get_grid_dims( const ecl_smspec_type * smspec );
int ecl_smspec_get_params_size( const ecl_smspec_type * smspec );
const smspec_node_type * ecl_smspec_iget_node( const ecl_smspec_type * smspec , int index );
void ecl_smspec_lock( ecl_smspec_type * smspec );
#ifdef __cplusplus
}
#endif
#endif

184
ThirdParty/Ert/include/ecl_sum.h vendored Normal file
View File

@ -0,0 +1,184 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
The file 'ecl_sum.h' is part of ERT - Ensemble based Reservoir Tool.
ERT 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.
ERT 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 at <http://www.gnu.org/licenses/gpl.html>
for more details.
*/
#ifndef __ECL_SUM_H__
#define __ECL_SUM_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include <stdbool.h>
#include <time.h>
#include <stringlist.h>
#include <time_t_vector.h>
#include <double_vector.h>
#include <ecl_smspec.h>
#include <ecl_sum_tstep.h>
#include <smspec_node.h>
typedef struct ecl_sum_struct ecl_sum_type;
double ecl_sum_get_from_sim_time( const ecl_sum_type * ecl_sum , time_t sim_time , const smspec_node_type * node);
double ecl_sum_get_from_sim_days( const ecl_sum_type * ecl_sum , double sim_days , const smspec_node_type * node);
void ecl_sum_set_unified( ecl_sum_type * ecl_sum , bool unified );
void ecl_sum_set_fmt_case( ecl_sum_type * ecl_sum , bool fmt_case );
int ecl_sum_get_report_step_from_time( const ecl_sum_type * sum , time_t sim_time);
int ecl_sum_get_report_step_from_days( const ecl_sum_type * sum , double sim_days);
bool ecl_sum_check_sim_time( const ecl_sum_type * sum , time_t sim_time);
bool ecl_sum_check_sim_days( const ecl_sum_type * sum , double sim_days);
const char * ecl_sum_get_keyword( const ecl_sum_type * sum , const char * gen_key );
const char * ecl_sum_get_wgname( const ecl_sum_type * sum , const char * gen_key );
const char * ecl_sum_get_unit( const ecl_sum_type * sum , const char * gen_key );
int ecl_sum_get_num( const ecl_sum_type * sum , const char * gen_key );
double ecl_sum_iiget( const ecl_sum_type * ecl_sum , int internal_index , int param_index);
int ecl_sum_iget_num( const ecl_sum_type * sum , int param_index );
const char * ecl_sum_iget_wgname( const ecl_sum_type * sum , int param_index );
const char * ecl_sum_iget_keyword( const ecl_sum_type * sum , int param_index );
int ecl_sum_get_data_length( const ecl_sum_type * ecl_sum );
double ecl_sum_iget_from_sim_time( const ecl_sum_type * ecl_sum , time_t sim_time , int param_index);
double ecl_sum_iget_from_sim_days( const ecl_sum_type * ecl_sum , double sim_days , int param_index );
void ecl_sum_summarize( const ecl_sum_type * ecl_sum , FILE * stream );
bool ecl_sum_general_is_total(const ecl_sum_type * ecl_sum , const char * gen_key);
bool ecl_sum_var_is_total(const ecl_sum_type * ecl_sum , const char * gen_key);
void ecl_sum_free_data(ecl_sum_type * );
void ecl_sum_free__(void * );
void ecl_sum_free(ecl_sum_type * );
ecl_sum_type * ecl_sum_fread_alloc(const char * , const stringlist_type * data_files, const char * key_join_string);
ecl_sum_type * ecl_sum_fread_alloc_case(const char * , const char * key_join_string);
ecl_sum_type * ecl_sum_fread_alloc_case__(const char * , const char * key_join_string , bool include_restart);
/* Accessor functions : */
double ecl_sum_get_well_var(const ecl_sum_type * ecl_sum , int time_index , const char * well , const char *var);
bool ecl_sum_has_well_var(const ecl_sum_type * ecl_sum , const char * well , const char *var);
double ecl_sum_get_well_var_from_sim_days( const ecl_sum_type * ecl_sum , double sim_days , const char * well , const char * var);
double ecl_sum_get_well_var_from_sim_time( const ecl_sum_type * ecl_sum , time_t sim_time , const char * well , const char * var);
double ecl_sum_get_group_var(const ecl_sum_type * ecl_sum , int time_index , const char * group , const char *var);
bool ecl_sum_has_group_var(const ecl_sum_type * ecl_sum , const char * group , const char *var);
double ecl_sum_get_field_var(const ecl_sum_type * ecl_sum , int time_index , const char *var);
bool ecl_sum_has_field_var(const ecl_sum_type * ecl_sum , const char *var);
double ecl_sum_get_field_var_from_sim_days( const ecl_sum_type * ecl_sum , double sim_days , const char * var);
double ecl_sum_get_field_var_from_sim_time( const ecl_sum_type * ecl_sum , time_t sim_time , const char * var);
double ecl_sum_get_block_var(const ecl_sum_type * ecl_sum , int time_index , const char * block_var , int block_nr);
int ecl_sum_get_block_var_index(const ecl_sum_type * ecl_sum , const char * block_var , int block_nr);
bool ecl_sum_has_block_var(const ecl_sum_type * ecl_sum , const char * block_var , int block_nr);
double ecl_sum_get_block_var_ijk(const ecl_sum_type * ecl_sum , int time_index , const char * block_var , int i , int j , int k);
int ecl_sum_get_block_var_index_ijk(const ecl_sum_type * ecl_sum , const char * block_var , int i , int j , int k);
bool ecl_sum_has_block_var_ijk(const ecl_sum_type * ecl_sum , const char * block_var , int i , int j , int k);
double ecl_sum_get_region_var(const ecl_sum_type * ecl_sum , int time_index , const char *var , int region_nr);
bool ecl_sum_has_region_var(const ecl_sum_type * ecl_sum , const char *var , int region_nr);
double ecl_sum_get_misc_var(const ecl_sum_type * ecl_sum , int time_index , const char *var);
int ecl_sum_get_misc_var_index(const ecl_sum_type * ecl_sum , const char *var);
bool ecl_sum_has_misc_var(const ecl_sum_type * ecl_sum , const char *var);
double ecl_sum_get_well_completion_var(const ecl_sum_type * ecl_sum , int time_index , const char * well , const char *var, int cell_nr);
int ecl_sum_get_well_completion_var_index(const ecl_sum_type * ecl_sum , const char * well , const char *var, int cell_nr);
bool ecl_sum_has_well_completion_var(const ecl_sum_type * ecl_sum , const char * well , const char *var, int cell_nr);
double ecl_sum_get_general_var(const ecl_sum_type * ecl_sum , int time_index , const char * lookup_kw);
int ecl_sum_get_general_var_params_index(const ecl_sum_type * ecl_sum , const char * lookup_kw);
const smspec_node_type * ecl_sum_get_general_var_node(const ecl_sum_type * ecl_sum , const char * lookup_kw);
bool ecl_sum_has_general_var(const ecl_sum_type * ecl_sum , const char * lookup_kw);
bool ecl_sum_has_key(const ecl_sum_type * ecl_sum , const char * lookup_kw);
double ecl_sum_get_general_var_from_sim_days( const ecl_sum_type * ecl_sum , double sim_days , const char * var);
double ecl_sum_get_general_var_from_sim_time( const ecl_sum_type * ecl_sum , time_t sim_time , const char * var);
const char * ecl_sum_get_general_var_unit( const ecl_sum_type * ecl_sum , const char * var);
/***************/
void ecl_sum_fprintf(const ecl_sum_type * , FILE * , const stringlist_type * , bool report_only , bool print_header);
/* Time related functions */
int ecl_sum_get_first_gt( const ecl_sum_type * ecl_sum , int param_index , double limit);
int ecl_sum_get_first_lt( const ecl_sum_type * ecl_sum , int param_index , double limit);
int ecl_sum_get_last_report_step( const ecl_sum_type * ecl_sum );
int ecl_sum_get_first_report_step( const ecl_sum_type * ecl_sum );
bool ecl_sum_has_report_step(const ecl_sum_type * ecl_sum , int report_step );
time_t ecl_sum_get_report_time( const ecl_sum_type * ecl_sum , int report_step );
time_t ecl_sum_iget_sim_time( const ecl_sum_type * ecl_sum , int index );
double ecl_sum_iget_sim_days( const ecl_sum_type * ecl_sum , int time_index);
int ecl_sum_iget_report_step( const ecl_sum_type * ecl_sum , int internal_index );
int ecl_sum_iget_mini_step( const ecl_sum_type * ecl_sum , int internal_index );
double ecl_sum_iget_general_var(const ecl_sum_type * ecl_sum , int internal_index , const char * lookup_kw);
void ecl_sum_init_data_vector( const ecl_sum_type * ecl_sum , double_vector_type * data_vector , int data_index , bool report_only );
double_vector_type * ecl_sum_alloc_data_vector( const ecl_sum_type * ecl_sum , int data_index , bool report_only);
time_t_vector_type * ecl_sum_alloc_time_vector( const ecl_sum_type * ecl_sum , bool report_only);
time_t ecl_sum_get_data_start( const ecl_sum_type * ecl_sum );
time_t ecl_sum_get_end_time( const ecl_sum_type * ecl_sum);
time_t ecl_sum_get_start_time(const ecl_sum_type * );
const char * ecl_sum_get_base(const ecl_sum_type * ecl_sum );
const char * ecl_sum_get_path(const ecl_sum_type * ecl_sum );
const char * ecl_sum_get_abs_path(const ecl_sum_type * ecl_sum );
const char * ecl_sum_get_case(const ecl_sum_type * );
bool ecl_sum_same_case( const ecl_sum_type * ecl_sum , const char * input_file );
void ecl_sum_resample_from_sim_days( const ecl_sum_type * ecl_sum , const double_vector_type * sim_days , double_vector_type * value , const char * gen_key);
void ecl_sum_resample_from_sim_time( const ecl_sum_type * ecl_sum , const time_t_vector_type * sim_time , double_vector_type * value , const char * gen_key);
time_t ecl_sum_time_from_days( const ecl_sum_type * ecl_sum , double sim_days );
double ecl_sum_days_from_time( const ecl_sum_type * ecl_sum , time_t sim_time );
double ecl_sum_get_sim_length( const ecl_sum_type * ecl_sum ) ;
double ecl_sum_get_first_day( const ecl_sum_type * ecl_sum );
/*****************************************************************/
stringlist_type * ecl_sum_alloc_well_list( const ecl_sum_type * ecl_sum , const char * pattern);
stringlist_type * ecl_sum_alloc_group_list( const ecl_sum_type * ecl_sum , const char * pattern);
stringlist_type * ecl_sum_alloc_well_var_list( const ecl_sum_type * ecl_sum );
stringlist_type * ecl_sum_alloc_matching_general_var_list(const ecl_sum_type * ecl_sum , const char * pattern);
void ecl_sum_select_matching_general_var_list( const ecl_sum_type * ecl_sum , const char * pattern , stringlist_type * keys);
const ecl_smspec_type * ecl_sum_get_smspec( const ecl_sum_type * ecl_sum );
ecl_smspec_var_type ecl_sum_identify_var_type(const char * var);
ecl_smspec_var_type ecl_sum_get_var_type( const ecl_sum_type * ecl_sum , const char * gen_key);
bool ecl_sum_var_is_rate( const ecl_sum_type * ecl_sum , const char * gen_key);
bool ecl_sum_var_is_total( const ecl_sum_type * ecl_sum , const char * gen_key);
int ecl_sum_iget_report_end( const ecl_sum_type * ecl_sum , int report_step );
int ecl_sum_iget_report_start( const ecl_sum_type * ecl_sum , int report_step );
ecl_sum_type * ecl_sum_alloc_writer( const char * ecl_case , bool fmt_output , bool unified , const char * key_join_string , time_t sim_start , int nx , int ny , int nz);
void ecl_sum_set_case( ecl_sum_type * ecl_sum , const char * ecl_case);
void ecl_sum_fwrite( const ecl_sum_type * ecl_sum );
void ecl_sum_fwrite_smspec( const ecl_sum_type * ecl_sum );
smspec_node_type * ecl_sum_add_var( ecl_sum_type * ecl_sum , const char * keyword , const char * wgname , int num , const char * unit , float default_value);
ecl_sum_tstep_type * ecl_sum_add_tstep( ecl_sum_type * ecl_sum , int report_step , double sim_days);
void ecl_sum_update_wgname( ecl_sum_type * ecl_sum , smspec_node_type * node , const char * wgname );
UTIL_IS_INSTANCE_HEADER( ecl_sum );
#ifdef __cplusplus
}
#endif
#endif

View File

@ -30,8 +30,18 @@ extern "C" {
#include <double_vector.h>
#include <stringlist.h>
typedef struct ecl_sum_data_struct ecl_sum_data_type ;
#include <ecl_sum_tstep.h>
#include <smspec_node.h>
typedef struct ecl_sum_data_struct ecl_sum_data_type ;
void ecl_sum_data_fwrite_step( const ecl_sum_data_type * data , const char * ecl_case , bool fmt_case , bool unified, int report_step);
void ecl_sum_data_fwrite( const ecl_sum_data_type * data , const char * ecl_case , bool fmt_case , bool unified);
void ecl_sum_data_fread( ecl_sum_data_type * data , const stringlist_type * filelist);
void ecl_sum_data_fread_restart( ecl_sum_data_type * data , const stringlist_type * filelist);
ecl_sum_data_type * ecl_sum_data_alloc_writer( ecl_smspec_type * smspec );
ecl_sum_data_type * ecl_sum_data_alloc( ecl_smspec_type * smspec);
int ecl_sum_data_get_report_step_from_time(const ecl_sum_data_type * data , time_t sim_time);
int ecl_sum_data_get_report_step_from_days(const ecl_sum_data_type * data , double days);
bool ecl_sum_data_check_sim_time( const ecl_sum_data_type * data , time_t sim_time);
bool ecl_sum_data_check_sim_days( const ecl_sum_data_type * data , double sim_days);
int ecl_sum_data_get_num_ministep( const ecl_sum_data_type * data );
@ -40,6 +50,7 @@ typedef struct ecl_sum_data_struct ecl_sum_data_type ;
void ecl_sum_data_init_time_vector( const ecl_sum_data_type * data , time_t_vector_type * time_vector , bool report_only);
time_t_vector_type * ecl_sum_data_alloc_time_vector( const ecl_sum_data_type * data , bool report_only);
time_t ecl_sum_data_get_data_start( const ecl_sum_data_type * data );
time_t ecl_sum_data_get_report_time( const ecl_sum_data_type * data , int report_step);
double ecl_sum_data_get_first_day( const ecl_sum_data_type * data);
time_t ecl_sum_data_get_sim_start ( const ecl_sum_data_type * data );
time_t ecl_sum_data_get_sim_end ( const ecl_sum_data_type * data );
@ -53,22 +64,22 @@ typedef struct ecl_sum_data_struct ecl_sum_data_type ;
bool ecl_sum_data_has_report_step(const ecl_sum_data_type * , int );
ecl_sum_data_type * ecl_sum_data_fread_alloc(const ecl_smspec_type * , const stringlist_type * filelist , bool include_restart);
ecl_sum_data_type * ecl_sum_data_fread_alloc( ecl_smspec_type * , const stringlist_type * filelist , bool include_restart);
void ecl_sum_data_free( ecl_sum_data_type * );
int ecl_sum_data_get_last_report_step( const ecl_sum_data_type * data );
int ecl_sum_data_get_first_report_step( const ecl_sum_data_type * data );
int ecl_sum_data_get_first_ministep( const ecl_sum_data_type * data );
int ecl_sum_data_get_last_ministep( const ecl_sum_data_type * data );
double ecl_sum_data_get_from_sim_time( const ecl_sum_data_type * data , time_t sim_time , int params_index);
double ecl_sum_data_get_from_sim_days( const ecl_sum_data_type * data , double sim_days , int params_index);
double ecl_sum_data_get_from_sim_time( const ecl_sum_data_type * data , time_t sim_time , const smspec_node_type * smspec_node);
double ecl_sum_data_get_from_sim_days( const ecl_sum_data_type * data , double sim_days , const smspec_node_type * smspec_node);
int ecl_sum_data_get_length( const ecl_sum_data_type * data );
int ecl_sum_data_iget_report_step(const ecl_sum_data_type * data , int internal_index);
int ecl_sum_data_iget_mini_step(const ecl_sum_data_type * data , int internal_index);
int ecl_sum_data_iget_report_end( const ecl_sum_data_type * data , int report_step );
int ecl_sum_data_iget_report_start( const ecl_sum_data_type * data , int report_step );
ecl_sum_tstep_type * ecl_sum_data_add_new_tstep( ecl_sum_data_type * data , int report_step , double sim_days);
#ifdef __cplusplus
}

63
ThirdParty/Ert/include/ecl_sum_tstep.h vendored Normal file
View File

@ -0,0 +1,63 @@
/*
Copyright (C) 2012 Statoil ASA, Norway.
The file 'ecl_sum_tstep.h' is part of ERT - Ensemble based Reservoir Tool.
ERT 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.
ERT 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 at <http://www.gnu.org/licenses/gpl.html>
for more details.
*/
#ifndef __ECL_SUM_TSTEP_H__
#define __ECL_SUM_TSTEP_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <int_vector.h>
#include <ecl_smspec.h>
#include <ecl_kw.h>
typedef struct ecl_sum_tstep_struct ecl_sum_tstep_type;
void ecl_sum_tstep_free( ecl_sum_tstep_type * ministep );
void ecl_sum_tstep_free__( void * __ministep);
ecl_sum_tstep_type * ecl_sum_tstep_alloc_from_file(int report_step ,
int ministep_nr ,
const ecl_kw_type * params_kw ,
const char * src_file ,
const ecl_smspec_type * smspec);
ecl_sum_tstep_type * ecl_sum_tstep_alloc_new( int report_step , int ministep , float sim_days , const ecl_smspec_type * smspec );
double ecl_sum_tstep_iget(const ecl_sum_tstep_type * ministep , int index);
time_t ecl_sum_tstep_get_sim_time(const ecl_sum_tstep_type * ministep);
double ecl_sum_tstep_get_sim_days(const ecl_sum_tstep_type * ministep);
int ecl_sum_tstep_get_report(const ecl_sum_tstep_type * ministep);
int ecl_sum_tstep_get_ministep(const ecl_sum_tstep_type * ministep);
void ecl_sum_tstep_fwrite( const ecl_sum_tstep_type * ministep , const int_vector_type * index_map , fortio_type * fortio);
void ecl_sum_tstep_iset( ecl_sum_tstep_type * tstep , int index , float value);
void ecl_sum_tstep_set_from_node( ecl_sum_tstep_type * tstep , const smspec_node_type * smspec_node , float value);
void ecl_sum_tstep_set_from_key( ecl_sum_tstep_type * tstep , const char * gen_key , float value);
UTIL_SAFE_CAST_HEADER( ecl_sum_tstep );
UTIL_SAFE_CAST_HEADER_CONST( ecl_sum_tstep );
#ifdef __cplusplus
}
#endif
#endif

View File

@ -146,14 +146,13 @@ typedef enum {
#define ECL_COMMENT_CHAR '-' // Need to consecutive to make an ECLIPSE comment
#define ECL_DATA_TERMINATION "/"
int ecl_util_get_sizeof_ctype_fortio(ecl_type_enum ecl_type);
int ecl_util_get_sizeof_ctype(ecl_type_enum );
ecl_type_enum ecl_util_get_type_from_name( const char * type_name );
const char * ecl_util_get_type_name( ecl_type_enum ecl_type );
/*****************************************************************/
void ecl_util_init_stdin(const char * , const char *);
bool ecl_util_unified_file(const char *filename);
const char * ecl_util_file_type_name( ecl_file_enum file_type );
char * ecl_util_alloc_base_guess(const char *);
int ecl_util_filename_report_nr(const char *);

View File

@ -38,6 +38,7 @@ typedef float (float_ftype) (float);
void float_vector_set_read_only( float_vector_type * vector , bool read_only);
bool float_vector_get_read_only( const float_vector_type * vector );
void float_vector_resize( float_vector_type * vector , int new_alloc_size );
void float_vector_memcpy_data( float * target, const float_vector_type * src );
void float_vector_memcpy( float_vector_type * target , const float_vector_type * src);
void float_vector_memcpy_data_block( float_vector_type * target , const float_vector_type * src , int target_offset , int src_offset , int len);
bool float_vector_growable( const float_vector_type * vector);

View File

@ -49,6 +49,7 @@ typedef struct fortio_struct fortio_type;
fortio_type * fortio_open_reader(const char *, bool fmt_file , bool endian_flip_header);
fortio_type * fortio_open_writer(const char *, bool fmt_file , bool endian_flip_header);
fortio_type * fortio_open_readwrite(const char *, bool fmt_file , bool endian_flip_header);
fortio_type * fortio_open_append(const char *filename , bool fmt_file , bool endian_flip_header);
void fortio_free_FILE_wrapper(fortio_type *);
void fortio_fclose(fortio_type *);
int fortio_init_read(fortio_type *);
@ -70,6 +71,7 @@ typedef struct fortio_struct fortio_type;
long fortio_ftell( const fortio_type * fortio );
int fortio_fseek( fortio_type * fortio , long offset , int whence);
int fortio_get_mode( const fortio_type * fortio );
int fortio_fileno( fortio_type * fortio );
#ifdef __cplusplus
}

View File

@ -22,7 +22,7 @@
extern "C" {
#endif
#include <stdbool.h>
#include <inttypes.h>
#include <stdint.h>
#include <node_data.h>

View File

@ -38,6 +38,7 @@ typedef int (int_ftype) (int);
void int_vector_set_read_only( int_vector_type * vector , bool read_only);
bool int_vector_get_read_only( const int_vector_type * vector );
void int_vector_resize( int_vector_type * vector , int new_alloc_size );
void int_vector_memcpy_data( int * target, const int_vector_type * src );
void int_vector_memcpy( int_vector_type * target , const int_vector_type * src);
void int_vector_memcpy_data_block( int_vector_type * target , const int_vector_type * src , int target_offset , int src_offset , int len);
bool int_vector_growable( const int_vector_type * vector);

View File

@ -38,6 +38,7 @@ typedef long (long_ftype) (long);
void long_vector_set_read_only( long_vector_type * vector , bool read_only);
bool long_vector_get_read_only( const long_vector_type * vector );
void long_vector_resize( long_vector_type * vector , int new_alloc_size );
void long_vector_memcpy_data( long * target, const long_vector_type * src );
void long_vector_memcpy( long_vector_type * target , const long_vector_type * src);
void long_vector_memcpy_data_block( long_vector_type * target , const long_vector_type * src , int target_offset , int src_offset , int len);
bool long_vector_growable( const long_vector_type * vector);

View File

@ -43,6 +43,7 @@ typedef struct matrix_struct matrix_type;
bool matrix_safe_resize(matrix_type * matrix , int rows , int columns , bool copy_content);
matrix_type * matrix_alloc_copy(const matrix_type * src);
matrix_type * matrix_safe_alloc_copy(const matrix_type * src);
matrix_type * matrix_realloc_copy(matrix_type * T , const matrix_type * src);
matrix_type * matrix_alloc_shared(const matrix_type * src , int row , int column , int rows , int columns);
void matrix_free(matrix_type * matrix);
@ -53,8 +54,6 @@ typedef struct matrix_struct matrix_type;
void matrix_scale(matrix_type * matrix, double value);
void matrix_shift(matrix_type * matrix, double value);
void matrix_assert_finite( const matrix_type * matrix );
void matrix_assign(matrix_type * A , const matrix_type * B);
void matrix_inplace_add(matrix_type * A , const matrix_type * B);
void matrix_inplace_sub(matrix_type * A , const matrix_type * B);
@ -96,7 +95,6 @@ typedef struct matrix_struct matrix_type;
void matrix_set_const_row(matrix_type * matrix , const double value , int row);
double * matrix_get_data(const matrix_type * matrix);
bool matrix_is_finite(const matrix_type * matrix);
double matrix_orthonormality( const matrix_type * matrix );
matrix_type * matrix_alloc_steal_data(int rows , int columns , double * data , int data_size);
@ -128,6 +126,17 @@ typedef struct matrix_struct matrix_type;
const matrix_type * src_matrix , int src_row , int src_column);
void matrix_scalar_set( matrix_type * matrix , double value);
void matrix_inplace_diag_sqrt(matrix_type *Cd);
void matrix_create_identiy(int n,matrix_type *Id);
double matrix_trace(const matrix_type *matrix);
double matrix_diag_std(const matrix_type * Sk,double mean);
double matrix_det3( const matrix_type * A);
#ifdef HAVE_ISFINITE
bool matrix_is_finite(const matrix_type * matrix);
void matrix_assert_finite( const matrix_type * matrix );
#endif
UTIL_SAFE_CAST_HEADER( matrix );
#ifdef __cplusplus

View File

@ -33,6 +33,10 @@ menu_item_type * menu_add_item(menu_type *, const char * , const char * , menu_f
void menu_add_separator(menu_type * );
menu_item_type * menu_get_item(const menu_type * , char );
void menu_set_title(menu_type *, const char *);
void menu_item_set_label( menu_item_type * , const char *);
void menu_item_disable( menu_item_type * item );
void menu_item_enable( menu_item_type * item );
#endif

View File

@ -38,6 +38,7 @@ typedef size_t (size_t_ftype) (size_t);
void size_t_vector_set_read_only( size_t_vector_type * vector , bool read_only);
bool size_t_vector_get_read_only( const size_t_vector_type * vector );
void size_t_vector_resize( size_t_vector_type * vector , int new_alloc_size );
void size_t_vector_memcpy_data( size_t * target, const size_t_vector_type * src );
void size_t_vector_memcpy( size_t_vector_type * target , const size_t_vector_type * src);
void size_t_vector_memcpy_data_block( size_t_vector_type * target , const size_t_vector_type * src , int target_offset , int src_offset , int len);
bool size_t_vector_growable( const size_t_vector_type * vector);

View File

@ -29,6 +29,27 @@
extern "C" {
#endif
#define DUMMY_WELL ":+:+:+:+"
#define IS_DUMMY_WELL(well) (strcmp((well) , DUMMY_WELL) == 0)
#define SMSPEC_PARAMS_INDEX_INVALID -77
typedef enum {ECL_SMSPEC_INVALID_VAR = 0 ,
ECL_SMSPEC_AQUIFER_VAR = 1 ,
ECL_SMSPEC_WELL_VAR = 2 , /* X */
ECL_SMSPEC_REGION_VAR = 3 , /* X */
ECL_SMSPEC_FIELD_VAR = 4 , /* X */
ECL_SMSPEC_GROUP_VAR = 5 , /* X */
ECL_SMSPEC_BLOCK_VAR = 6 , /* X */
ECL_SMSPEC_COMPLETION_VAR = 7 , /* X */
ECL_SMSPEC_LOCAL_BLOCK_VAR = 8 , /* X */
ECL_SMSPEC_LOCAL_COMPLETION_VAR = 9 , /* X */
ECL_SMSPEC_LOCAL_WELL_VAR = 10 , /* X */
ECL_SMSPEC_NETWORK_VAR = 11 ,
ECL_SMSPEC_REGION_2_REGION_VAR = 12 ,
ECL_SMSPEC_SEGMENT_VAR = 13 , /* X */
ECL_SMSPEC_MISC_VAR = 14 /* X */} ecl_smspec_var_type;
#define SMSPEC_NUMS_INVALID -991199
@ -48,20 +69,13 @@ extern "C" {
smspec_node_type * smspec_node_alloc_empty(ecl_smspec_var_type var_type, const char * keyword , const char * unit , int param_index);
void smspec_node_set_wgname( smspec_node_type * index , const char * wgname );
void smspec_node_set_lgr_name( smspec_node_type * index , const char * lgr_name );
void smspec_node_set_num( smspec_node_type * index , int num);
void smspec_node_set_gen_key( smspec_node_type * smspec_node , const char * key_join_string);
void smspec_node_set_flags( smspec_node_type * smspec_node);
smspec_node_type * smspec_node_alloc( ecl_smspec_var_type var_type ,
const char * wgname ,
const char * keyword ,
const char * unit ,
const char * key_join_string ,
int num , int index);
const int grid_dims[3] ,
int num , int param_index, float default_value);
smspec_node_type * smspec_node_alloc_lgr( ecl_smspec_var_type var_type ,
const char * wgname ,
@ -70,19 +84,27 @@ extern "C" {
const char * lgr ,
const char * key_join_string ,
int lgr_i, int lgr_j , int lgr_k,
int index);
int param_index,
float default_value);
void smspec_node_free( smspec_node_type * index );
int smspec_node_get_index( const smspec_node_type * smspec_node );
const char * smspec_node_get_gen_key( const smspec_node_type * smspec_node);
void smspec_node_free__(void * arg);
void smspec_node_set_params_index( smspec_node_type * smspec_node , int params_index);
int smspec_node_get_params_index( const smspec_node_type * smspec_node );
const char * smspec_node_get_gen_key1( const smspec_node_type * smspec_node);
const char * smspec_node_get_gen_key2( const smspec_node_type * smspec_node);
ecl_smspec_var_type smspec_node_get_var_type( const smspec_node_type * smspec_node);
int smspec_node_get_num( const smspec_node_type * smspec_node);
const char * smspec_node_get_wgname( const smspec_node_type * smspec_node);
void smspec_node_update_wgname( smspec_node_type * index , const char * wgname , const char * key_join_string);
const char * smspec_node_get_keyword( const smspec_node_type * smspec_node);
const char * smspec_node_get_unit( const smspec_node_type * smspec_node);
bool smspec_node_is_rate( const smspec_node_type * smspec_node );
bool smspec_node_is_total( const smspec_node_type * smspec_node );
bool smspec_node_need_nums( const smspec_node_type * smspec_node );
float smspec_node_get_default_value( const smspec_node_type * smspec_node );
void smspec_node_fprintf( const smspec_node_type * smspec_node , FILE * stream);
#ifdef __cplusplus
}

View File

@ -38,6 +38,7 @@ typedef time_t (time_t_ftype) (time_t);
void time_t_vector_set_read_only( time_t_vector_type * vector , bool read_only);
bool time_t_vector_get_read_only( const time_t_vector_type * vector );
void time_t_vector_resize( time_t_vector_type * vector , int new_alloc_size );
void time_t_vector_memcpy_data( time_t * target, const time_t_vector_type * src );
void time_t_vector_memcpy( time_t_vector_type * target , const time_t_vector_type * src);
void time_t_vector_memcpy_data_block( time_t_vector_type * target , const time_t_vector_type * src , int target_offset , int src_offset , int len);
bool time_t_vector_growable( const time_t_vector_type * vector);

View File

@ -19,27 +19,30 @@
#ifndef __TIMER_H__
#define __TIMER_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
typedef struct timer_struct timer_type;
timer_type * timer_alloc( bool );
void timer_free(timer_type *);
void timer_start(timer_type *);
double timer_stop(timer_type *);
void timer_reset(timer_type *);
double timer_get_total_time(const timer_type *timer);
double timer_get_max_time(const timer_type *timer);
double timer_get_min_time(const timer_type *timer);
double timer_get_avg_time(const timer_type *timer);
timer_type * timer_alloc(const char *, bool );
void timer_free(timer_type *);
void timer_start(timer_type *);
double timer_stop(timer_type *);
void timer_reset(timer_type *);
void timer_report(const timer_type * , FILE *);
void timer_list_report(const timer_type ** , int , FILE *) ;
double timer_get_total_time(const timer_type *timer);
double timer_get_max_time(const timer_type *timer);
double timer_get_min_time(const timer_type *timer);
double timer_get_avg_time(const timer_type *timer);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -64,6 +64,7 @@ type ## _type * type ## _safe_cast( void * __arg ) {
util_abort("%s: runtime cast failed - tried to dereference NULL\n",__func__); \
return NULL; \
} \
{ \
type ## _type * arg = (type ## _type *) __arg; \
if ( arg->__type_id == TYPE_ID) \
return arg; \
@ -71,12 +72,18 @@ type ## _type * type ## _safe_cast( void * __arg ) {
util_abort("%s: runtime cast failed: File:%s Line:%d. Got:%d Expected:%d \n", __func__ , __FILE__ , __LINE__ , arg->__type_id , TYPE_ID); \
return NULL; \
} \
} \
}
#define UTIL_SAFE_CAST_HEADER( type ) type ## _type * type ## _safe_cast( void * __arg )
#define UTIL_SAFE_CAST_FUNCTION_CONST(type , TYPE_ID) \
const type ## _type * type ## _safe_cast_const( const void * __arg ) { \
if (__arg == NULL) { \
util_abort("%s: runtime cast failed - tried to dereference NULL\n",__func__); \
return NULL; \
} \
{ \
const type ## _type * arg = (const type ## _type *) __arg; \
if ( arg->__type_id == TYPE_ID) \
return arg; \
@ -84,6 +91,7 @@ const type ## _type * type ## _safe_cast_const( const void * __arg ) {
util_abort("%s: runtime cast failed: File:%s Line:%d. Got:%d Expected:%d \n", __func__ , __FILE__ , __LINE__ , arg->__type_id , TYPE_ID); \
return NULL; \
} \
} \
}
#define UTIL_SAFE_CAST_HEADER_CONST( type ) const type ## _type * type ## _safe_cast_const( const void * __arg )

View File

@ -21,6 +21,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <stdint.h>
#include <time.h>
#include <stdarg.h>
@ -34,7 +35,6 @@
#define UTIL_NEWLINE_STRING " \n"
#define UTIL_DEFAULT_MKDIR_MODE 0777 /* Directories are by default created with mode a+rwx - and then comes the umask ... */
//#include "type_macros.h"
#ifdef __cplusplus
extern"C" {
@ -63,7 +63,7 @@ typedef enum {left_pad = 0,
right_pad = 1,
center_pad = 2} string_alignement_type;
//#define UTIL_CXX_MALLOC(var , num_elm) (typeof (var)) util_malloc( (num_elm) * sizeof var, __func__)
//#define UTIL_CXX_MALLOC(var , num_elm) (typeof (var)) util_malloc( (num_elm) * sizeof var)
void util_bitmask_on(int * , int );
time_t util_make_datetime(int , int , int , int , int , int );
@ -73,6 +73,8 @@ typedef enum {left_pad = 0,
void util_inplace_forward_days(time_t * , double);
double util_difftime(time_t , time_t , int * , int * , int * , int *);
double util_difftime_days(time_t , time_t );
bool util_file_newer( const char * file , time_t t0);
bool util_file_older( const char * file , time_t t0);
char * util_alloc_date_string( time_t t );
char * util_alloc_date_stamp( );
double util_pow10(double x);
@ -85,7 +87,6 @@ typedef enum {left_pad = 0,
void util_fprintf_double(double , int , int , char , FILE *);
bool util_fscanf_date(FILE * , time_t *);
bool util_sscanf_date(const char * , time_t *);
char * util_blocking_alloc_stdin_line(unsigned long );
char * util_alloc_stdin_line();
char * util_realloc_stdin_line(char * );
bool util_is_executable(const char * );
@ -110,13 +111,32 @@ typedef enum {left_pad = 0,
void util_move_file(const char * src_file , const char * target_file);
void util_move_file4( const char * src_name , const char * target_name , const char *src_path , const char * target_path);
bool util_copy_file(const char * , const char * );
void util_copy_directory(const char * , const char * , const char *);
void util_walk_directory(const char * root_path , walk_file_callback_ftype * file_callback , void * file_callback_arg , walk_dir_callback_ftype * dir_callback , void * dir_callback_arg);
char * util_alloc_cwd(void);
char * util_alloc_realpath(const char * );
bool util_string_match(const char * string , const char * pattern);
bool util_string_has_wildcard( const char * s);
bool util_entry_readable( const char * entry );
void util_ftruncate(FILE * stream , long size);
void util_usleep( unsigned long micro_seconds );
char * util_blocking_alloc_stdin_line(unsigned long );
int util_roundf( float x );
int util_round( double x );
#ifdef HAVE_VA_COPY
#define UTIL_VA_COPY(target,src) va_copy(target,src)
#else
#define UTIL_VA_COPY(target,src) target = src
#endif
#ifdef HAVE_OPENDIR
void util_copy_directory(const char * , const char * , const char *);
void util_walk_directory(const char * root_path , walk_file_callback_ftype * file_callback , void * file_callback_arg , walk_dir_callback_ftype * dir_callback , void * dir_callback_arg);
#endif
#ifdef HAVE_GETUID
uid_t util_get_entry_uid( const char * file );
@ -187,12 +207,12 @@ typedef enum {left_pad = 0,
int util_string_replace_inplace(char ** , const char * , const char *);
char * util_string_strip_chars_alloc(const char *, const char * );
char * util_realloc_string_copy(char * , const char *);
char * util_realloc_substring_copy(char * , const char *, int );
char * util_realloc_substring_copy(char * , const char *, int N);
char * util_realloc_dequoted_string(char *);
char * util_alloc_dequoted_copy(const char *s);
void util_safe_free(void *);
void util_free_stringlist(char **, int );
char * util_alloc_substring_copy(const char *, int );
char * util_alloc_substring_copy(const char *, int offset , int N);
bool util_is_directory(const char * );
bool util_is_file(const char * );
void util_set_datetime_values(time_t , int * , int * , int * , int * , int * , int *);
@ -205,7 +225,6 @@ typedef enum {left_pad = 0,
void util_fread_dev_random(int , char * );
void util_fread_dev_urandom(int , char * );
char * util_alloc_string_copy(const char *);
void util_enkf_unlink_ensfiles(const char *, const char *, int , bool );
bool util_string_isspace(const char * s);
void util_exit(const char * fmt , ...);
@ -214,10 +233,11 @@ typedef enum {left_pad = 0,
void util_abort_append_version_info(const char * );
void util_abort_free_version_info();
void util_abort_set_executable( const char * executable );
void * util_realloc(void * , size_t , const char * );
void * util_malloc(size_t , const char * );
void * util_realloc_copy(void * org_ptr , const void * src , size_t byte_size , const char * caller);
void * util_alloc_copy(const void * , size_t , const char * );
void * util_realloc(void * , size_t );
void * util_malloc(size_t );
void * util_calloc( size_t elements , size_t element_size );
void * util_realloc_copy(void * org_ptr , const void * src , size_t byte_size );
void * util_alloc_copy(const void * , size_t );
void util_double_to_float(float * , const double * , int );
void util_float_to_double(double * , const float * , int );
@ -228,7 +248,7 @@ typedef enum {left_pad = 0,
char * util_fread_realloc_string(char * , FILE *);
char * util_fread_alloc_string(FILE *);
void util_fskip_string(FILE *stream);
void util_endian_flip_vector(void *, int , int );
void util_endian_flip_vector(void * data , int element_size , int elements);
int util_proc_mem_free(void);
@ -275,9 +295,6 @@ typedef enum {left_pad = 0,
int util_type_get_id( const void * data );
void util_block_growing_file(const char * );
void util_block_growing_directory(const char * );
char * util_alloc_realpath(const char * );
bool util_sscanf_bytesize(const char * , size_t *);
void util_sscanf_active_range(const char * , int , bool * );
@ -305,6 +322,8 @@ typedef enum {left_pad = 0,
char * util_alloc_envvar( const char * value );
bool util_is_link(const char * ); // Will always return false on windows
#define UTIL_FWRITE_SCALAR(s,stream) { if (fwrite(&s , sizeof s , 1 , stream) != 1) util_abort("%s: write failed: %s\n",__func__ , strerror(errno)); }
#define UTIL_FREAD_SCALAR(s,stream) { if (fread(&s , sizeof s , 1 , stream) != 1) util_abort("%s: read failed: %s\n",__func__ , strerror(errno)); }

View File

@ -30,7 +30,7 @@ extern "C" {
well_branch_type * well_branch_alloc(int branch_nr);
void well_branch_free( well_branch_type * branch );
void well_branch_add_conn( well_branch_type * branch , const well_conn_type * connection );
void well_branch_add_conn( well_branch_type * branch , well_conn_type * connection );
int well_branch_get_length( const well_branch_type * branch );
const well_conn_type ** well_branch_get_connections( const well_branch_type * branch );
int well_branch_get_nr( const well_branch_type * branch );

View File

@ -39,23 +39,7 @@ extern "C" {
} well_conn_dir_enum;
/*
Observe that when the (ijk) values are initialized they are
shifted to zero offset values, to be aligned with the rest of the
ert libraries.
*/
typedef struct {
int i;
int j;
int k;
int branch;
int segment; // -1: Ordinary well
bool open;
well_conn_dir_enum dir;
} well_conn_type;
typedef struct well_conn_struct well_conn_type;
void well_conn_free( well_conn_type * conn);
@ -63,6 +47,14 @@ extern "C" {
well_conn_type * well_conn_alloc( const ecl_kw_type * icon_kw , const ecl_kw_type * iseg_kw , const ecl_intehead_type * header , int well_nr , int seg_well_nr , int conn_nr);
well_conn_type * well_conn_alloc_wellhead( const ecl_kw_type * iwel_kw , const ecl_intehead_type * header , int well_nr);
int well_conn_get_branch(const well_conn_type * conn);
int well_conn_get_i(const well_conn_type * conn);
int well_conn_get_j(const well_conn_type * conn);
int well_conn_get_k(const well_conn_type * conn);
well_conn_dir_enum well_conn_get_dir(const well_conn_type * conn);
bool well_conn_open( const well_conn_type * conn );
int well_conn_get_segment( const well_conn_type * conn );
#ifdef __cplusplus
}
#endif

View File

@ -39,6 +39,7 @@ extern "C" {
#define IWEL_LGR_ITEM 42
#define IWEL_SEGMENTED_WELL_NR_ITEM 70
#define ISEG_OUTLET_ITEM 1
#define ISEG_BRANCH_ITEM 3
#define ICON_IC_ITEM 0

BIN
ThirdParty/Ert/lib/libecl.so vendored Normal file

Binary file not shown.

BIN
ThirdParty/Ert/lib/libert_util.so vendored Normal file

Binary file not shown.

BIN
ThirdParty/Ert/lib/libgeometry.so vendored Normal file

Binary file not shown.

BIN
ThirdParty/Ert/lib/libwell.so vendored Normal file

Binary file not shown.

View File

@ -1,97 +0,0 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
The file 'buffer.h' is part of ERT - Ensemble based Reservoir Tool.
ERT 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.
ERT 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 at <http://www.gnu.org/licenses/gpl.html>
for more details.
*/
#ifndef __BUFFER_H__
#define __BUFFER_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>
#include <ssize_t.h>
typedef struct buffer_struct buffer_type;
bool buffer_replace( buffer_type * buffer , const char * old_string , const char * new_string);
void buffer_shrink_to_fit( buffer_type * buffer );
void buffer_memshift(buffer_type * buffer , size_t offset, ssize_t shift);
bool buffer_strstr( buffer_type * buffer , const char * expr );
bool buffer_strchr( buffer_type * buffer , int c);
buffer_type * buffer_alloc( size_t buffer_size );
buffer_type * buffer_alloc_private_wrapper(void * data , size_t buffer_size );
void buffer_free_container( buffer_type * buffer );
void buffer_free( buffer_type * buffer);
size_t buffer_safe_fread(buffer_type * buffer , void * target_ptr , size_t item_size , size_t items);
size_t buffer_fread(buffer_type * buffer , void * target_ptr , size_t item_size , size_t items);
size_t buffer_safe_fwrite(buffer_type * buffer , const void * src_ptr , size_t item_size , size_t items);
size_t buffer_fwrite(buffer_type * buffer , const void * src_ptr , size_t item_size , size_t items);
const char * buffer_fread_string(buffer_type * buffer);
char * buffer_fread_alloc_string(buffer_type * buffer);
void buffer_fwrite_string(buffer_type * buffer , const char * string);
void buffer_summarize(const buffer_type * buffer , const char *);
void buffer_fwrite_char_ptr(buffer_type * buffer , const char * string_ptr );
void buffer_terminate_char_ptr( buffer_type * buffer );
void buffer_fwrite_char(buffer_type * buffer , char value);
void buffer_fwrite_int(buffer_type * buffer , int value);
void buffer_fskip_bool(buffer_type * buffer);
void buffer_fwrite_bool(buffer_type * buffer , bool value);
int buffer_fread_int(buffer_type * buffer );
bool buffer_fread_bool(buffer_type * buffer);
long int buffer_fread_long(buffer_type * buffer);
void buffer_store(const buffer_type * buffer , const char * filename);
size_t buffer_get_offset(const buffer_type * buffer);
size_t buffer_get_alloc_size(const buffer_type * buffer);
size_t buffer_get_size(const buffer_type * buffer);
size_t buffer_get_remaining_size(const buffer_type * buffer);
void * buffer_get_data(const buffer_type * buffer);
void * buffer_alloc_data_copy(const buffer_type * buffer);
void buffer_stream_fwrite( const buffer_type * buffer , FILE * stream );
int buffer_fgetc( buffer_type * buffer );
void buffer_fseek(buffer_type * buffer , ssize_t offset , int whence);
void buffer_fskip(buffer_type * buffer, ssize_t offset);
void buffer_clear( buffer_type * buffer );
void buffer_fskip_int(buffer_type * buffer);
void buffer_fskip_time_t(buffer_type * buffer);
time_t buffer_fread_time_t(buffer_type * buffer);
void buffer_fwrite_time_t(buffer_type * buffer , time_t value);
void buffer_rewind(buffer_type * buffer );
double buffer_fread_double(buffer_type * buffer);
void buffer_fwrite_double(buffer_type * buffer , double value);
size_t buffer_stream_fwrite_n( const buffer_type * buffer , size_t offset , ssize_t write_size , FILE * stream );
void buffer_stream_fprintf( const buffer_type * buffer , FILE * stream );
void buffer_stream_fread( buffer_type * buffer , size_t byte_size , FILE * stream);
buffer_type * buffer_fread_alloc(const char * filename);
void buffer_fread_realloc(buffer_type * buffer , const char * filename);
#ifdef HAVE_ZLIB
size_t buffer_fwrite_compressed(buffer_type * buffer, const void * ptr , size_t byte_size);
size_t buffer_fread_compressed(buffer_type * buffer , size_t compressed_size , void * target_ptr , size_t target_size);
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,49 +0,0 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
The file 'lars.h' is part of ERT - Ensemble based Reservoir Tool.
ERT 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.
ERT 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 at <http://www.gnu.org/licenses/gpl.html>
for more details.
*/
#ifndef __LARS_H__
#define __LARS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <matrix.h>
#include <stdbool.h>
typedef struct lars_struct lars_type;
int lars_get_sample( const lars_type * lars );
int lars_get_nvar( const lars_type * lars );
lars_type * lars_alloc1( int nsample , int nvars);
lars_type * lars_alloc2( matrix_type * X , matrix_type * Y , bool internal_copy );
void lars_estimate(lars_type * lars , int max_vars , double max_beta , bool verbose);
void lars_isetX( lars_type * lars, int sample, int var , double value);
void lars_isetY( lars_type * lars, int sample, double value);
void lars_select_beta( lars_type * lars , int beta_index);
void lars_free( lars_type * lars );
double lars_eval1( const lars_type * lars , const matrix_type * x);
double lars_eval2( const lars_type * lars , double * x);
double lars_getY0( const lars_type * lars);
double lars_iget_beta( const lars_type * lars , int index);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,40 +0,0 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
The file 'matrix_blas.h' is part of ERT - Ensemble based Reservoir Tool.
ERT 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.
ERT 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 at <http://www.gnu.org/licenses/gpl.html>
for more details.
*/
#include <stdbool.h>
#include <matrix.h>
#ifdef __cplusplus
extern "C" {
#endif
void matrix_dgemm(matrix_type *C , const matrix_type *A , const matrix_type * B , bool transA, bool transB , double alpha , double beta);
void matrix_matmul(matrix_type * A, const matrix_type *B , const matrix_type * C);
matrix_type * matrix_alloc_matmul(const matrix_type * A, const matrix_type * B);
void matrix_dgemv(const matrix_type * A , const double * x , double * y , bool transA , double alpha , double beta);
void matrix_mul_vector(const matrix_type * A , const double * x , double * y);
void matrix_gram_set( const matrix_type * X , matrix_type * G, bool col);
matrix_type * matrix_alloc_gram( const matrix_type * X , bool col);
#ifdef __cplusplus
}
#endif

View File

@ -1,93 +0,0 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
The file 'matrix_lapack.h' is part of ERT - Ensemble based Reservoir Tool.
ERT 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.
ERT 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 at <http://www.gnu.org/licenses/gpl.html>
for more details.
*/
#ifndef __MATRIX_LAPACK_H__
#define __MATRIX_LAPACK_H__
#include <matrix.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
This enum is just a simple way to label the different ways the
singular vectors in U and VT are returned to the calling scope. The
low level lapack routine uses a character variable, indicated
below.
*/
typedef enum {
/* A */ DGESVD_ALL, /* Returns all the singular vectors in U/VT. */
/* S */ DGESVD_MIN_RETURN, /* Return the first min(m,n) vectors in U/VT. */
/* O */ DGESVD_MIN_OVERWRITE, /* Return the first min(m,n) vectors of U/VT by overwriteing in A. */
/* N */ DGESVD_NONE} /* Do not compute any singular vectors for U/VT */
dgesvd_vector_enum;
typedef enum {
/* A */ DSYEVX_ALL, /* Compute all the eigenvalues */
/* V */ DSYEVX_VALUE_INTERVAL, /* Computes eigenvalues in half open interval <VL , VU] */
/* I */ DSYEVX_INDEX_INTERVAL} /* The IL-th through IU'th eigenvalue will be found. */
dsyevx_eig_enum;
typedef enum {
/* U */ DSYEVX_AUPPER, /* The data is stored in the upper right part of the A matrix. */
/* L */ DSYEVX_ALOWER} /* The data is stored in the lower left part of the A matrix. */
dsyevx_uplo_enum;
void matrix_dgesv(matrix_type * A , matrix_type * B);
void matrix_dgesvd(dgesvd_vector_enum jobv, dgesvd_vector_enum jobvt , matrix_type * A , double * S , matrix_type * U , matrix_type * VT);
int matrix_dsyevx(bool compute_eig_vectors ,
dsyevx_eig_enum which_values ,
dsyevx_uplo_enum uplo,
matrix_type * A ,
double VL ,
double VU ,
int IL ,
int IU ,
double *eig_values ,
matrix_type * Z ) ;
int matrix_dsyevx_all(dsyevx_uplo_enum uplo ,
matrix_type * A ,
double *eig_values ,
matrix_type * Z );
void matrix_dgeqrf(matrix_type * A , double * tau);
void matrix_dorgqr(matrix_type * A , double * tau, int num_reflectors);
double matrix_det( matrix_type *A );
int matrix_inv( matrix_type * A );
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,35 +0,0 @@
#ifndef __STEPWISE_H__
#define __STEPWISE_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <matrix.h>
#include <bool_vector.h>
typedef struct stepwise_struct stepwise_type;
stepwise_type * stepwise_alloc2( matrix_type * X , matrix_type * Y , bool internal_copy , rng_type * rng);
stepwise_type * stepwise_alloc1(int nsample, int nvar, rng_type * rng);
stepwise_type * stepwise_alloc0(rng_type * rng);
void stepwise_free( stepwise_type * stepwise);
void stepwise_estimate( stepwise_type * stepwise , double deltaR2_limit , int CV_blocks);
double stepwise_eval( const stepwise_type * stepwise , const matrix_type * x );
void stepwise_set_Y0( stepwise_type * stepwise , matrix_type * Y);
void stepwise_set_X0( stepwise_type * stepwise , matrix_type * X);
void stepwise_set_beta( stepwise_type * stepwise , matrix_type * b);
void stepwise_set_active_set( stepwise_type * stepwise , bool_vector_type * a);
void stepwise_isetY0( stepwise_type * stepwise , int i , double value );
int stepwise_get_nvar( stepwise_type * stepwise );
int stepwise_get_nsample( stepwise_type * stepwise );
#ifdef __cplusplus
}
#endif
#endif

Binary file not shown.

Binary file not shown.

View File

@ -1,172 +0,0 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
The file 'well_state.c' is part of ERT - Ensemble based Reservoir Tool.
ERT 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.
ERT 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 at <http://www.gnu.org/licenses/gpl.html>
for more details.
*/
/**
The well_state_type structure contains state information about one
well for one particular point in time.
*/
#include <time.h>
#include <stdbool.h>
#include <util.h>
#include <vector.h>
#include <int_vector.h>
#include <ecl_intehead.h>
#include <ecl_file.h>
#include <ecl_kw.h>
#include <ecl_kw_magic.h>
#include <ecl_util.h>
#include <well_const.h>
#include <well_conn.h>
#include <well_state.h>
#define WELL_STATE_TYPE_ID 613307832
struct well_state_struct {
UTIL_TYPE_ID_DECLARATION;
char * name;
time_t valid_from_time;
int valid_from_report;
bool open;
well_conn_type * wellhead;
vector_type * connections;
well_type_enum type;
};
UTIL_IS_INSTANCE_FUNCTION( well_state , WELL_STATE_TYPE_ID)
static well_state_type * well_state_alloc_empty() {
well_state_type * well_state = util_malloc( sizeof * well_state , __func__ );
UTIL_TYPE_ID_INIT( well_state , WELL_STATE_TYPE_ID );
well_state->connections = vector_alloc_new();
return well_state;
}
void well_state_add_conn( well_state_type * well_state , int grid_nr , well_conn_type * conn) {
vector_append_owned_ref( well_state->connections , conn , well_conn_free__);
}
well_state_type * well_state_alloc( const ecl_file_type * ecl_file , const ecl_intehead_type * header , int report_nr , int grid_nr , int well_nr) {
const ecl_kw_type * iwel_kw = ecl_file_iget_named_kw( ecl_file , IWEL_KW , grid_nr);
const ecl_kw_type * zwel_kw = ecl_file_iget_named_kw( ecl_file , ZWEL_KW , grid_nr);
const ecl_kw_type * icon_kw = ecl_file_iget_named_kw( ecl_file , ICON_KW , grid_nr);
{
well_state_type * well_state = well_state_alloc_empty();
const int iwel_offset = header->niwelz * well_nr;
const int zwel_offset = header->nzwelz * well_nr;
well_state->valid_from_time = header->sim_time;
well_state->valid_from_report = report_nr;
well_state->name = util_alloc_strip_copy(ecl_kw_iget_ptr( zwel_kw , zwel_offset )); // Hardwired max 8 characters in Well Name
{
well_state->wellhead = well_conn_alloc_wellhead( iwel_kw , header , well_nr );
}
{
int int_state = ecl_kw_iget_int( iwel_kw , iwel_offset + IWEL_STATUS_ITEM );
if (int_state > 0)
well_state->open = true;
else
well_state->open = false;
}
{
int num_connections = ecl_kw_iget_int( iwel_kw , iwel_offset + IWEL_CONNECTIONS_ITEM );
int lgr_index = ecl_kw_iget_int( iwel_kw , iwel_offset + IWEL_LGR_ITEM );
for (int conn_nr = 0; conn_nr < num_connections; conn_nr++) {
well_conn_type * conn = well_conn_alloc( icon_kw , header , well_nr , conn_nr );
well_state_add_conn( well_state , grid_nr , conn );
}
printf("lgr_index:%d \n",lgr_index);
}
{
int int_type = ecl_kw_iget_int( iwel_kw , iwel_offset + IWEL_TYPE_ITEM);
switch (int_type) {
case(IWEL_PRODUCER):
well_state->type = PRODUCER;
break;
case(IWEL_OIL_INJECTOR):
well_state->type = OIL_INJECTOR;
break;
case(IWEL_GAS_INJECTOR):
well_state->type = GAS_INJECTOR;
break;
case(IWEL_WATER_INJECTOR):
well_state->type = WATER_INJECTOR;
break;
default:
util_abort("%s: what the ...\n",__func__);
}
}
return well_state;
}
}
void well_state_free( well_state_type * well ) {
vector_free( well->connections );
well_conn_free( well->wellhead );
free( well->name );
free( well );
}
/*****************************************************************/
int well_state_get_report_nr( const well_state_type * well_state ) {
return well_state->valid_from_report;
}
time_t well_state_get_sim_time( const well_state_type * well_state ) {
return well_state->valid_from_time;
}
int well_state_get_num_connections( const well_state_type * well_state ) {
return vector_get_size( well_state->connections );
}
well_conn_type * well_get_wellhead( const well_state_type * well_state ) {
return well_state->wellhead;
}
well_conn_type * well_state_iget_connection( const well_state_type * well_state , int index) {
return vector_iget( well_state->connections , index );
}
well_type_enum well_state_get_type( const well_state_type * well_state){
return well_state->type;
}
bool well_state_is_open( const well_state_type * well_state ) {
return well_state->open;
}
const char * well_state_get_name( const well_state_type * well_state ) {
return well_state->name;
}

Some files were not shown because too many files have changed in this diff Show More