mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Upgraded ERT from GitHub master commit e71b881
This commit is contained in:
2
ThirdParty/Ert/.gitignore
vendored
2
ThirdParty/Ert/.gitignore
vendored
@@ -22,4 +22,4 @@ devel/python/lib64
|
||||
scratch.sparsebundle
|
||||
*.iml
|
||||
*.DS_Store
|
||||
TestCase
|
||||
|
||||
|
41
ThirdParty/Ert/devel/CMakeLists.txt
vendored
41
ThirdParty/Ert/devel/CMakeLists.txt
vendored
@@ -5,9 +5,16 @@ if(POLICY CMP0042)
|
||||
cmake_policy(SET CMP0042 OLD)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
set( ERT_VERSION_MAJOR 1 )
|
||||
set( ERT_VERSION_MINOR 8 )
|
||||
set( ERT_VERSION_MICRO X )
|
||||
set( ERT_VERSION_MINOR 10 )
|
||||
set( ERT_VERSION_MICRO git )
|
||||
|
||||
# If the micro version is not integer, that should be interpreted as a
|
||||
# development version leading towards version MAJOR.MINOR.0
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
|
||||
option( BUILD_ERT "Build the full ERT application - Linux only" OFF)
|
||||
@@ -21,7 +28,7 @@ option( INSTALL_ERT "Should anything be installed when issuing make inst
|
||||
option( ERT_BUILD_GUI "Should the pyQt based gui be compiled and installed" OFF )
|
||||
option( ERT_USE_OPENMP "Use OpenMP - currently only in EclGrid" OFF)
|
||||
option( ERT_DOC "Build ERT documantation" OFF)
|
||||
|
||||
option( ERT_BUILD_CXX "Build (some) CXX wrappers" ON)
|
||||
|
||||
include( CheckFunctionExists )
|
||||
include( CheckTypeSize )
|
||||
@@ -61,6 +68,7 @@ if (MSVC)
|
||||
add_definitions( -DCOMPILER_MSVC )
|
||||
elseif (CMAKE_COMPILER_IS_GNUCC)
|
||||
add_definitions( -DCOMPILER_GCC )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x" )
|
||||
endif()
|
||||
|
||||
|
||||
@@ -82,6 +90,24 @@ include(cmake/Modules/UseMultiArch.cmake)
|
||||
include(cmake/ert_link.cmake)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Should we build the block_fs filesystem; this is used extensively
|
||||
# by the ert application; but if you are only building the support
|
||||
# eclipse related support libraries you can safely leave this at the
|
||||
# default OFF value.
|
||||
|
||||
if (BUILD_ERT)
|
||||
set( ERT_BUILD_BLOCK_FS ON)
|
||||
else()
|
||||
if (WITH_PTHREAD)
|
||||
set( ERT_BUILD_BLOCK_FS OFF CACHE BOOL "Build the block_fs filesystem. Used by ERT application")
|
||||
else()
|
||||
set( ERT_BUILD_BLOCK_FS OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
set(INSTALL_GROUP "" CACHE STRING "Group to install as - blank to install as current group")
|
||||
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
|
||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin)
|
||||
@@ -136,6 +162,15 @@ endif()
|
||||
include_directories( ${PROJECT_SOURCE_DIR}/libecl/include )
|
||||
add_subdirectory( libecl )
|
||||
|
||||
if (ERT_BUILD_CXX)
|
||||
if (HAVE_CXX_SHARED_PTR)
|
||||
include_directories( ${PROJECT_SOURCE_DIR}/libeclxx/include )
|
||||
add_subdirectory( libeclxx )
|
||||
else()
|
||||
message(STATUS "Skipping CXX support - missing Cxx11 features.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include_directories( ${PROJECT_SOURCE_DIR}/libecl_well/include )
|
||||
add_subdirectory( libecl_well )
|
||||
|
||||
|
5
ThirdParty/Ert/devel/cmake/Tests/test_shared_ptr.cpp
vendored
Normal file
5
ThirdParty/Ert/devel/cmake/Tests/test_shared_ptr.cpp
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
#include <memory>
|
||||
|
||||
int main( int argc , char ** argv) {
|
||||
std::shared_ptr<int> ptr = std::make_shared<int>( 10 );
|
||||
}
|
1
ThirdParty/Ert/devel/cmake/cmake_pyc2
vendored
1
ThirdParty/Ert/devel/cmake/cmake_pyc2
vendored
@@ -18,6 +18,7 @@ if not os.path.exists( target_path ):
|
||||
pass
|
||||
|
||||
shutil.copyfile( src_file , target_file )
|
||||
shutil.copystat( src_file , target_file )
|
||||
try:
|
||||
py_compile.compile( target_file , doraise = True)
|
||||
except Exception,error:
|
||||
|
18
ThirdParty/Ert/devel/cmake/create_cmakelists.py
vendored
18
ThirdParty/Ert/devel/cmake/create_cmakelists.py
vendored
@@ -26,11 +26,11 @@ def findRelativeModulePath(directory):
|
||||
index += len("python/")
|
||||
return directory[index:len(directory)]
|
||||
|
||||
def createPythonSources(files):
|
||||
def createPythonSources(files, test_sources=False):
|
||||
result = ""
|
||||
|
||||
if len(files) > 0:
|
||||
result = "set(PYTHON_SOURCES\n"
|
||||
result = "set(%s\n" % ("PYTHON_SOURCES" if not test_sources else "TEST_SOURCES")
|
||||
|
||||
files = [f for f in files if f.endswith(".py")]
|
||||
|
||||
@@ -50,11 +50,14 @@ def addSubDirectories(directories):
|
||||
|
||||
return result
|
||||
|
||||
def addPythonPackage(relative_module_path):
|
||||
def addPythonPackage(relative_module_path, test_sources=False):
|
||||
module_name = ".".join(relative_module_path.split("/"))
|
||||
template = "add_python_package(\"python.%s\" ${PYTHON_INSTALL_PREFIX}/%s \"${PYTHON_SOURCES}\" True)"
|
||||
source_type = "PYTHON_SOURCES" if not test_sources else "TEST_SOURCES"
|
||||
template = "add_python_package(\"python.%s\" ${PYTHON_INSTALL_PREFIX}/%s \"${%s}\" %s)"
|
||||
|
||||
return template % (module_name, relative_module_path)
|
||||
install = "False" if test_sources else "True"
|
||||
|
||||
return template % (module_name, relative_module_path, source_type, install)
|
||||
|
||||
def addInclude(filename):
|
||||
with open(filename, "r") as include_file:
|
||||
@@ -65,10 +68,11 @@ files, directories = findFilesAndDirectories(sys.argv[1])
|
||||
module_path = findRelativeModulePath(sys.argv[1])
|
||||
|
||||
output_file = join(sys.argv[1], "CMakeLists.txt")
|
||||
test_sources = module_path.startswith("tests")
|
||||
with open(output_file, "w+") as text_file:
|
||||
text_file.write(createPythonSources(files))
|
||||
text_file.write(createPythonSources(files, test_sources=test_sources))
|
||||
text_file.write("\n\n")
|
||||
text_file.write(addPythonPackage(module_path))
|
||||
text_file.write(addPythonPackage(module_path, test_sources=test_sources))
|
||||
text_file.write("\n\n")
|
||||
text_file.write(addSubDirectories(directories))
|
||||
|
||||
|
3
ThirdParty/Ert/devel/cmake/ert_check.cmake
vendored
3
ThirdParty/Ert/devel/cmake/ert_check.cmake
vendored
@@ -129,7 +129,7 @@ set( CMAKE_CXX_FLAGS_main ${CMAKE_CXX_FLAGS} )
|
||||
|
||||
if (NOT ERT_WINDOWS)
|
||||
set( CMAKE_C_FLAGS "-std=gnu99" )
|
||||
set( CMAKE_CXX_FLAGS "")
|
||||
set( CMAKE_CXX_FLAGS "-std=c++0x")
|
||||
endif()
|
||||
|
||||
try_compile( HAVE_ISFINITE ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_isfinite.c )
|
||||
@@ -163,6 +163,7 @@ if (HAVE_SIGBUS)
|
||||
add_definitions( -DHAVE_SIGBUS )
|
||||
endif()
|
||||
|
||||
try_compile( HAVE_CXX_SHARED_PTR ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_shared_ptr.cpp )
|
||||
|
||||
check_type_size(time_t SIZE_OF_TIME_T)
|
||||
if (${SIZE_OF_TIME_T} EQUAL 8)
|
||||
|
7
ThirdParty/Ert/devel/docs/CMakeLists.txt
vendored
7
ThirdParty/Ert/devel/docs/CMakeLists.txt
vendored
@@ -13,10 +13,11 @@ else()
|
||||
set( ERT_DOC_LINK "" )
|
||||
endif()
|
||||
|
||||
configure_file(index.rst.in ${PROJECT_BINARY_DIR}/tmp_doc/index.rst )
|
||||
configure_file(index.rst.in ${PROJECT_BINARY_DIR}/tmp_doc/index.rst)
|
||||
configure_file(conf.py.in ${PROJECT_BINARY_DIR}/conf.py)
|
||||
|
||||
add_custom_target(doc_out ALL
|
||||
COMMAND ${CMAKE_COMMAND} -Dccsd=${CMAKE_CURRENT_SOURCE_DIR} -Dpbd=${PROJECT_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/build_doc.cmake
|
||||
add_custom_target(doc_out ALL
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/script/run-sphinx.py ${PROJECT_BINARY_DIR}/conf.py ${PROJECT_BINARY_DIR}/python ${PROJECT_BINARY_DIR}/tmp_doc
|
||||
DEPENDS enkf )
|
||||
|
||||
INSTALL( DIRECTORY ${PROJECT_BINARY_DIR}/tmp_doc/_build/ DESTINATION ${CMAKE_INSTALL_PREFIX}/documentation )
|
||||
|
8
ThirdParty/Ert/devel/docs/build_doc.cmake
vendored
8
ThirdParty/Ert/devel/docs/build_doc.cmake
vendored
@@ -1,8 +0,0 @@
|
||||
#set( ENV{PYTHONPATH} ${pbd}/python)
|
||||
execute_process(COMMAND cmake -E copy ${ccsd}/conf.py ${pbd}/tmp_doc/conf.py )
|
||||
|
||||
|
||||
# The api documentation is reeferenced from code/python/index.rst, i.e. the output path used when calling
|
||||
# sphinx-apidoc must match this.
|
||||
execute_process(COMMAND sphinx-apidoc -e -o API/python ${pbd}/python WORKING_DIRECTORY ${pbd}/tmp_doc/)
|
||||
execute_process(COMMAND sphinx-build -b html -d _build/doctrees . _build WORKING_DIRECTORY ${pbd}/tmp_doc/)
|
@@ -55,9 +55,9 @@ copyright = u'2014, Statoil ASA'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '1.1'
|
||||
version = '${ERT_VERSION_MAJOR}.${ERT_VERSION_MINOR}'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '1.7'
|
||||
release = '${ERT_VERSION_MAJOR}.${ERT_VERSION_MINOR}.${ERT_VERSION_MICRO}'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
19
ThirdParty/Ert/devel/docs/script/run-sphinx.py
vendored
Normal file
19
ThirdParty/Ert/devel/docs/script/run-sphinx.py
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
import shutil
|
||||
|
||||
config_file = sys.argv[1]
|
||||
PYTHONPATH = sys.argv[2]
|
||||
work_path = sys.argv[3]
|
||||
|
||||
os.environ["PYTHONPATH"] = PYTHONPATH
|
||||
shutil.copy(config_file , work_path)
|
||||
|
||||
os.chdir( work_path )
|
||||
if not os.path.isdir("_static"):
|
||||
os.mkdir("_static")
|
||||
|
||||
subprocess.call(["sphinx-apidoc" , "-e" , "-o" , "API/python" , PYTHONPATH ])
|
||||
subprocess.call(["sphinx-build" , "-b" , "html" , "-d" , "_build/doctrees" , "." , "_build"])
|
1
ThirdParty/Ert/devel/docs/user/index.rst
vendored
1
ThirdParty/Ert/devel/docs/user/index.rst
vendored
@@ -8,4 +8,5 @@ Contents:
|
||||
|
||||
tutorial/index
|
||||
keywords/index
|
||||
workflows/index
|
||||
observations/index
|
||||
|
2171
ThirdParty/Ert/devel/docs/user/keywords/index.rst
vendored
2171
ThirdParty/Ert/devel/docs/user/keywords/index.rst
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,463 @@
|
||||
Configuring observations for ERT
|
||||
================================
|
||||
|
||||
Adding observations ...
|
||||
General overview
|
||||
----------------
|
||||
|
||||
When using ERT to condition on dynamic data, it is necessary to
|
||||
specify which data to condition on. In particular, for a given piece
|
||||
of data to condition on, the ERT application needs to know:
|
||||
|
||||
- The actual measured value of the data.
|
||||
- The uncertainty of the measured data.
|
||||
- The time of measurement.
|
||||
- How to simulate a response of the data given a parametrized ECLIPSE model.
|
||||
|
||||
|
||||
To provide this observation to ERT, an observation file must be
|
||||
created. The observation file is a plain text file, and is in essence
|
||||
built around for different classes of observations and has an
|
||||
associated keyword for each class:
|
||||
|
||||
- Well or group rates from an existing ECLIPSE reference case: The
|
||||
HISTORY_OBSERVATION keyword.
|
||||
|
||||
- Well logs, RFTS and PLTs: The BLOCK_OBSERVATION keyword.
|
||||
|
||||
- Separator tests, region pressures, etc.: The SUMMARY_OBSERVATION
|
||||
keyword.
|
||||
|
||||
- Exotic observations (e.g. data from 4D seismic): The
|
||||
GENERAL_OBSERVATION keyword.
|
||||
|
||||
|
||||
The HISTORY_OBSERVATION keyword
|
||||
-------------------------------
|
||||
|
||||
The keyword HISTORY_OBSERVATION is used to condition on observations
|
||||
from the WCONHIST and WCONINJH keywords in schedule file provided to
|
||||
the enkf project (or alternatively an ECLIPSE summary file if you have
|
||||
changed the HISTORY_SOURCE keyword in the enkf project). The keyword
|
||||
is typically used to condition on production and injection rates for
|
||||
groups and wells, as well as bottom hole and tubing head pressures. An
|
||||
observation entered with the HISTORY_OBSERVATION keyword will be
|
||||
active at all report steps where data for the observation can be
|
||||
found.
|
||||
|
||||
In it's simplest form, a history observation is created as follows::
|
||||
|
||||
HISTORY_OBSERVATION WOPR:P1;
|
||||
|
||||
This will condition on WOPR in well P1 using a default observation
|
||||
error. The default observation error is a relative error of 10% to the
|
||||
measurement with a minimum error of 0.10. See below on how explicitly
|
||||
set the error.
|
||||
|
||||
In general, to condition on variable VAR in well or group WGNAME, one
|
||||
uses::
|
||||
|
||||
HISTORY_OBSERVATION VAR:WGNAME;
|
||||
|
||||
Note that there must be a colon ":" between VAR and WGNAME and that
|
||||
the statement shall end with a semi-colon ";". Thus, to condition on
|
||||
WOPR, WWCT and WGOR in well C-17, and for the GOPR for the whole
|
||||
field, one would add the following to the observation configuration::
|
||||
|
||||
HISTORY_OBSERVATION WOPR:C-17;
|
||||
HISTORY_OBSERVATION WWCT:C-17;
|
||||
HISTORY_OBSERVATION WGOR:C-17;
|
||||
|
||||
HISTORY_OBSERVATION GOPR:FIELD;
|
||||
|
||||
By default, the observation error is set to 10% of the observed value,
|
||||
with a minimum of 0.10. It can be changed as follows::
|
||||
|
||||
HISTORY_OBSERVATION GOPR:FIELD
|
||||
{
|
||||
ERROR = 1000;
|
||||
ERROR_MODE = ABS;
|
||||
};
|
||||
|
||||
This will set the observation error to 1000 for all observations of
|
||||
GOPR:FIELD. Note that both the items ERROR and ERROR_MODE as well as
|
||||
the whole definition shall end with a semi-colon.
|
||||
|
||||
The item ERROR_MODE can take three different values: ABS, REL or
|
||||
RELMIN. If set to REL, all observation errors will be set to the
|
||||
observed values multiplied by ERROR. Thus, the following will
|
||||
condition on water injection rate for the whole field with 20%
|
||||
observation uncertainity::
|
||||
|
||||
HISTORY_OBSERVATION GWIR:FIELD
|
||||
{
|
||||
ERROR = 0.20;
|
||||
ERROR_MODE = REL;
|
||||
};
|
||||
|
||||
If you do not want the observation error to drop below a given
|
||||
threshold, say 100, you can use RELMIN and the keyword ERROR_MIN::
|
||||
|
||||
HISTORY_OBSERVATION GWIR:FIELD
|
||||
{
|
||||
ERROR = 0.20;
|
||||
ERROR_MODE = RELMIN;
|
||||
ERROR_MIN = 100;
|
||||
};
|
||||
|
||||
Note that the configuration parser does not threat carriage return
|
||||
different from space. Thus, the following statement is equivalent to
|
||||
the previous::
|
||||
|
||||
HISTORY_OBSERVATION GWIR:FIELD { ERROR = 0.20; ERROR_MODE = RELMIN; ERROR_MIN = 100; };
|
||||
|
||||
|
||||
Also note that the special keyword include can be used to read an
|
||||
external file. This can be very useful if you want to change the
|
||||
standard configuration for a lot of observations in one go. For
|
||||
example, consider the following code::
|
||||
|
||||
HISTORY_OBSERVATION WOPR:P1 { include "hist_obs_wells.txt"; };
|
||||
HISTORY_OBSERVATION WOPR:P2 { include "hist_obs_wells.txt"; };
|
||||
HISTORY_OBSERVATION WOPR:P3 { include "hist_obs_wells.txt"; };
|
||||
HISTORY_OBSERVATION WOPR:P4 { include "hist_obs_wells.txt"; };
|
||||
HISTORY_OBSERVATION WOPR:P5 { include "hist_obs_wells.txt"; };
|
||||
|
||||
Where the contents of the file hist_obs_wells.txt may be something
|
||||
like::
|
||||
|
||||
ERROR_MODE = RELMIN;
|
||||
ERROR = 0.25;
|
||||
ERROR_MIN = 100;
|
||||
|
||||
In this case, changing the file hist_obs_wells.txt will affect all of
|
||||
the observations.
|
||||
|
||||
Note that the keyword include can be used anywhere in the
|
||||
configuration file. However, nested inclusion (use of include in a
|
||||
file that has already been included with include) is not allowed.
|
||||
|
||||
By default, an observation entered with the HISTORY_OBSERVATION
|
||||
keyword will get the observed values, i.e. the 'true' values, from the
|
||||
WCONHIST and WCONINJH keywords in the schedule file provided to the
|
||||
ERT project. However it also possible to get the observed values from
|
||||
a reference case. In that case you must set set HISTORY_SOURCE
|
||||
variable in the ERT configuration file, see Creating a configuration
|
||||
file for ERT.
|
||||
|
||||
To change the observation error for a HISTORY_OBSERVATION for one or
|
||||
more segments of the historic period, you can use the SEGMENT
|
||||
keyword. For example::
|
||||
|
||||
HISTORY_OBSERVATION GWIR:FIELD
|
||||
{
|
||||
ERROR = 0.20;
|
||||
ERROR_MODE = RELMIN;
|
||||
ERROR_MIN = 100;
|
||||
|
||||
SEGMENT FIRST_YEAR
|
||||
{
|
||||
START = 0;
|
||||
STOP = 10;
|
||||
ERROR = 0.50;
|
||||
ERROR_MODE = REL;
|
||||
};
|
||||
|
||||
SEGMENT SECOND_YEAR
|
||||
{
|
||||
START = 11;
|
||||
STOP = 20;
|
||||
ERRROR = 1000;
|
||||
ERROR_MODE = ABS;
|
||||
};
|
||||
};
|
||||
|
||||
The items START and STOP sets the start and stop of the segment in
|
||||
terms of ECLIPSE restart steps. The keywords ERROR, ERROR_MODE and
|
||||
ERROR_MIN behaves like before. If the segments overlap, they are
|
||||
computed in alphabetical order. Error covariance for "merged" updates
|
||||
|
||||
When merging the historical observations from several report steps
|
||||
together in one update the different steps are not independent, and it
|
||||
is beneficial to use a error covariance matrix, by using the keywords
|
||||
AUTO_CORRF and AUTO_CORRF_PARAM ERT will automatically estimate a
|
||||
error-covariance matrix based on the auto correlation function
|
||||
specified by the AUTO_CORRF keyword, with the parameter given by the
|
||||
AUTO_CORRF_PARAM parameter (i.e. the auto correlation length). The
|
||||
currently available auto correlation functions are:
|
||||
|
||||
EXP ~ exp(-x)
|
||||
GAUSS ~ exp(-x*x/2)
|
||||
|
||||
where the parameter x is given as:
|
||||
|
||||
x = (t2 - t1) / AUTO_CORRF_PARAM
|
||||
|
||||
|
||||
The SUMMARY_OBSERVATION keyword
|
||||
-------------------------------
|
||||
|
||||
The keyword SUMMARY_OBSERVATION can be used to condition on any
|
||||
observation whos simulated value is written to the ECLIPSE summary
|
||||
file, e.g. well rates, region properties, group and field rates etc. A
|
||||
quite typical usage of SUMMARY_OBSERVATION is to condition on the
|
||||
results of a separator test.
|
||||
|
||||
Note: Although it is possible to condition on well and group rates
|
||||
with SUMMARY_OBSERVATION, it is usually easier to use
|
||||
HISTORY_OBSERVATION for this.
|
||||
|
||||
In order to create a summary observation, four pieces of information
|
||||
are needed: The observed value, the observation error, the time of
|
||||
observation and a summary key. A typical summary observation is
|
||||
created as follows::
|
||||
|
||||
SUMMARY_OBSERVATION SEP_TEST_2005
|
||||
{
|
||||
VALUE = 100;
|
||||
ERROR = 5;
|
||||
DATE = 21/08/2005;
|
||||
KEY = GOPR:BRENT;
|
||||
};
|
||||
|
||||
This will create an observation of group oil production for the brent
|
||||
group on 21th of august 2005. The observed value was 100 with a
|
||||
standard deviation of 5. The name SEP_TEST_2005 will be used as a
|
||||
label for the observation within the ERT and must be unique.
|
||||
|
||||
Similarly to the name of a HISTORY_OBSERVATION, the item KEY in a
|
||||
SUMMARY_OBSERVATION is used to look up the simulated value from the
|
||||
summary file. And again, as when declaring a HISTORY_OBSERVATION, to
|
||||
condition on VAR in well, group or region WGRNAME, one uses::
|
||||
|
||||
KEY = VAR:WGRNAME;
|
||||
|
||||
For example, to condition on RPPW in region 8, one uses::
|
||||
|
||||
KEY = RPPW:8;
|
||||
|
||||
It is also possible to give the observation time as a restart number
|
||||
using the RESTART item or as time in days from simulation start using
|
||||
the DAYS item. Here are two examples::
|
||||
|
||||
-- Giving the observation time in terms of restart number.
|
||||
SUMMARY_OBSERVATION SEP_TEST_2005
|
||||
{
|
||||
VALUE = 100;
|
||||
ERROR = 5;
|
||||
RESTART = 42;
|
||||
KEY = GOPR:BRENT;
|
||||
};
|
||||
|
||||
|
||||
-- Giving the observation time in terms of days
|
||||
-- from simulation start.
|
||||
SUMMARY_OBSERVATION SEP_TEST_2008
|
||||
{
|
||||
VALUE = 213;
|
||||
ERROR = 10;
|
||||
DAYS = 911;
|
||||
KEY = GOPR:NESS;
|
||||
};
|
||||
|
||||
|
||||
|
||||
The BLOCK_OBSERVATION keyword
|
||||
------------------------------
|
||||
|
||||
This is observations of variables in grid blocks/cells. The
|
||||
observations can be of arbitrary ECLIPSE fields like PRESSURE
|
||||
(typically for an RFT), PORO or PERM. A block observation is entered
|
||||
with the BLOCK_OBSERVATION keyword. Here is an example of a typical
|
||||
block observation::
|
||||
|
||||
BLOCK_OBSERVATION RFT_2006
|
||||
{
|
||||
FIELD = PRESSURE;
|
||||
DATE = 22/10/2006;
|
||||
|
||||
OBS P1 { I = 1; J = 1; K = 1; VALUE = 100; ERROR = 5; };
|
||||
OBS P2 { I = 2; J = 2; K = 1; VALUE = 101; ERROR = 5; };
|
||||
OBS P3 { I = 2; J = 3; K = 1; VALUE = 102; ERROR = 5; };
|
||||
};
|
||||
|
||||
This will condition on observations of the pressure in grid blocks
|
||||
(1,1,1), (2,2,1) and (2,3,1) on the 22/10/2006.
|
||||
|
||||
By default the BLOCK_OBSERVATION requires that the specific field
|
||||
which has been observed (e.g. PRESSURE in the example above) must have
|
||||
been specified in main ERT configuration file using the FIELD keyword,
|
||||
and ECLIPSE must be configured to produce a restart file for this
|
||||
particular time. Alternatively it is possible to tell ERT to use the
|
||||
summary vector as source of the data::
|
||||
|
||||
BLOCK_OBSERVATION RFT_2006
|
||||
{
|
||||
FIELD = PRESSURE;
|
||||
DATE = 22/10/2006;
|
||||
SOURCE = SUMMARY;
|
||||
|
||||
OBS P1 { I = 1; J = 1; K = 1; VALUE = 100; ERROR = 5; };
|
||||
OBS P2 { I = 2; J = 2; K = 1; VALUE = 101; ERROR = 5; };
|
||||
OBS P3 { I = 2; J = 3; K = 1; VALUE = 102; ERROR = 5; };
|
||||
};
|
||||
|
||||
In this case the data will be loaded from the BPR vectors in the
|
||||
summary file.
|
||||
|
||||
Note the use of the sub class OBS to specify the actUal observed
|
||||
values, the observation errors and their grid location. Each OBS shall
|
||||
have a unique key within the BLOCK_OBSERVATION instance, and is
|
||||
required to have the items I, J, K, VALUE and ERROR. These are the
|
||||
grid i,j and k indicies for the observation point, the observed value
|
||||
and it's standard deviation.
|
||||
|
||||
As with a SUMMARY_OBSERVATION, the observation time can be given as
|
||||
either a date, days since simulation start or restart number. The
|
||||
respective keys for setting giving it as date, days or restart number
|
||||
are DATE, DAYS and RESTART. Note that each BLOCK_OBSERVATION instance
|
||||
must have an unique global name (RFT_2006 in the example above).
|
||||
|
||||
Block observations can often be quite long. Thus, it is often a good
|
||||
idea to use the special keyword include in order to store the OBS
|
||||
structures in a different file. This is done as follows::
|
||||
|
||||
BLOCK_OBSERVATION RFT_2006
|
||||
{
|
||||
FIELD = PRESSURE;
|
||||
RESTART = 20;
|
||||
|
||||
include 'RFT_2006_OBS_DATA.txt';
|
||||
};
|
||||
|
||||
Where the file RFT_2006_OBS_DATA.txt contains the OBS instances::
|
||||
|
||||
OBS P1 { I = 1; J = 1; K = 1; VALUE = 100; ERROR = 5; };
|
||||
OBS P2 { I = 2; J = 2; K = 1; VALUE = 101; ERROR = 5; };
|
||||
OBS P3 { I = 2; J = 3; K = 1; VALUE = 112; ERROR = 5; };
|
||||
OBS P4 { I = 3; J = 3; K = 1; VALUE = 122; ERROR = 5; };
|
||||
OBS P5 { I = 4; J = 3; K = 1; VALUE = 112; ERROR = 5; };
|
||||
OBS P6 { I = 5; J = 3; K = 1; VALUE = 122; ERROR = 5; };
|
||||
|
||||
|
||||
|
||||
The GENERAL_OBSERVATION keyword
|
||||
--------------------------------
|
||||
|
||||
The GENERAL_OBSERVATION keyword is used together with the GEN_DATA and
|
||||
GEN_PARAM type. This pair of observation and data types are typically
|
||||
used when you want to update something special which does not fit into
|
||||
any of the predefined enkf types. The ERT application just treats
|
||||
GENERAL_OBSERVATION (and also GEN_DATA) as a range of number with no
|
||||
particular structure, this is very flexible, but of course also a bit
|
||||
more complex to use::
|
||||
|
||||
GENERAL_OBSERVATION GEN_OBS1{
|
||||
DATA = SOME_FIELD;
|
||||
RESTART = 20;
|
||||
OBS_FILE = some_file.txt;
|
||||
};
|
||||
|
||||
This example a minimum GENERAL_OBSERVATION. The keyword DATA points to
|
||||
the GEN_DATA instance this observation is 'observing', RESTART gives
|
||||
the report step when this observation is active. OBS_FILE should be
|
||||
the name of a file with observation values, and the corresponding
|
||||
uncertainties. The file with observations should just be a plain text
|
||||
file with numbers in it, observations and corresponding uncertainties
|
||||
interleaved. An example of an OBS_FILE::
|
||||
|
||||
1.46 0.26
|
||||
25.0 5.0
|
||||
5.00 1.00
|
||||
|
||||
This OBS_FILE has three observations: 1.46 +/- 0.26, 25.0 +/- 5.0 and
|
||||
5.00 +/- 1.00. In the example above it is assumed that the DATA
|
||||
instance we are observing (i.e. comparing with) has the same number of
|
||||
elements as the observation, i.e. three in this case. By using the
|
||||
keywords INDEX_LIST or INDEX_FILE you can select the elements of the
|
||||
GEN_DATA instance you are interested in. Consider for example::
|
||||
|
||||
GENERAL_OBSERVATION GEN_OBS1{
|
||||
DATA = SOME_FIELD;
|
||||
INDEX_LIST = 0,3,9;
|
||||
RESTART = 20;
|
||||
OBS_FILE = some_file.txt;
|
||||
};
|
||||
|
||||
Here we use INDEX_LIST to indicate that we are interested in element
|
||||
0,3 and 9 of the GEN_DATA instance::
|
||||
|
||||
GEN_DATA GEN_OBS1
|
||||
======== ===========
|
||||
1.56 <---------------------> 1.46 0.26
|
||||
23.0 /--------------> 25.0 5.00
|
||||
56.0 | /---------> 5.00 1.00
|
||||
27.0 <------/ | ===========
|
||||
0.2 |
|
||||
1.56 |
|
||||
1.78 |
|
||||
6.78 |
|
||||
9.00 |
|
||||
4.50 <-----------/
|
||||
========
|
||||
|
||||
In addition to INDEX_LIST it is possible to use INDEX_FILE which
|
||||
should just point at an plain text file with indexes (without any ','
|
||||
or anything). Finally, if your observation only has one value, you can
|
||||
embed it in the config object with VALUE and ERROR.
|
||||
|
||||
Matching GEN_OBS and GEN_DATA
|
||||
.............................
|
||||
|
||||
It is important to match up the GEN_OBS observations with the
|
||||
corresponding GEN_DATA simulation data correctly. The GEN_DATA result
|
||||
files must have an embedded '%d' to indicate the report step in them -
|
||||
in the case of smoother based workflows the actual numerical value
|
||||
here is not important. To ensure that GEN_OBS and corresponding
|
||||
GEN_DATA values match up correctly only the RESTART method is allowed
|
||||
for GEN_OBS when specifying the time. So consider a setup like this::
|
||||
|
||||
-- Config file:
|
||||
GEN_DATA RFT_BH67 INPUT_FORMAT:ASCII RESULT_FILE:rft_BH67_%d REPORT_STEPS:20
|
||||
... /|\ /|\
|
||||
... | |
|
||||
-- Observation file: | |
|
||||
GENERAL_OBSERVATION GEN_OBS1{ +------------------/
|
||||
DATA = RFT_BH67; |
|
||||
RESTART = 20; <------------------------------------/
|
||||
OBS_FILE = some_file.txt;
|
||||
};
|
||||
|
||||
Here we see that the observation is active at report step 20, and we
|
||||
expect the forward model to create a file rft_BH67_20 in each
|
||||
realization directory. Error covariance
|
||||
|
||||
The optional keyword ERROR_COVAR can be used to point to an existing
|
||||
file, containing an error covariance matrix. The file should contain
|
||||
the elements of the matrix as formatted numbers; newline formatting is
|
||||
allowed but not necessary. Since the matrix should by construction be
|
||||
symmetric there is no difference between column-major and row-major
|
||||
order! The covariance matrix
|
||||
|
||||
[ 1 0.75 -0.25]
|
||||
C = [ 0.75 1.25 -0.50]
|
||||
[-0.25 -0.50 0.85]
|
||||
|
||||
Can be represented by the file::
|
||||
|
||||
1
|
||||
0.75
|
||||
-0.25
|
||||
0.75
|
||||
1.25
|
||||
-0.50
|
||||
-0.25
|
||||
-0.50
|
||||
0.85
|
||||
|
||||
without newlines, or alternatively::
|
||||
|
||||
1 0.75 -0.25
|
||||
0.75 1.25 -0.50
|
||||
-0.25 -0.50 0.85
|
||||
|
||||
with newlines.
|
||||
|
381
ThirdParty/Ert/devel/docs/user/workflows/index.rst
vendored
Normal file
381
ThirdParty/Ert/devel/docs/user/workflows/index.rst
vendored
Normal file
@@ -0,0 +1,381 @@
|
||||
----------------------
|
||||
Built in workflow jobs
|
||||
----------------------
|
||||
.. _built_in_workflow_jobs:
|
||||
|
||||
ERT comes with a list of default workflow jobs which invoke internal ERT functionality. The internal workflows include:
|
||||
|
||||
Jobs related to case management
|
||||
-------------------------------
|
||||
|
||||
**SELECT_CASE**
|
||||
|
||||
The job SELECT_CASE can be used to change the currently selected case. The SELECT_CASE job should be used as:
|
||||
|
||||
::
|
||||
|
||||
SELECT_CASE newCase
|
||||
|
||||
if the case newCase does not exist it will be created.
|
||||
|
||||
**CREATE_CASE**
|
||||
|
||||
The job CREATE_CASE can be used to create a new case without selecting it. The CREATE_CASE job should be used as:
|
||||
|
||||
::
|
||||
|
||||
CREATE_CASE newCase
|
||||
|
||||
|
||||
**INIT_CASE_FROM_EXISTING**
|
||||
|
||||
The job INIT_CASE_FROM_EXISTING can be used to initialize a case from an existing case. The argument to the workflow should be the name of the workflow you are initializing from; so to initialize the current case from the existing case "oldCase":
|
||||
|
||||
::
|
||||
|
||||
INIT_CASE_FROM_EXISTING oldCase
|
||||
|
||||
By default the job will initialize the 'current case', but optionally you can give the name of a second case which should be initialized. In this example we will initialize "newCase" from "oldCase":
|
||||
|
||||
::
|
||||
|
||||
INIT_CASE_FROM_EXISTING oldCase newCase
|
||||
|
||||
When giving the name of a second case as target for the initialization job the 'current' case will not be affected.
|
||||
|
||||
|
||||
Jobs related to export
|
||||
----------------------
|
||||
|
||||
**EXPORT_FIELD**
|
||||
|
||||
The EXPORT_FIELD workflow job exports field data to roff or grdecl format dependent on the extension of the export file argument.The job takes the following arguments:
|
||||
|
||||
#. Field to be exported
|
||||
#. Filename for export file, must contain %d
|
||||
#. Report_step
|
||||
#. State
|
||||
#. Realization range
|
||||
|
||||
The filename must contain a %d. This will be replaced with the realization number.
|
||||
|
||||
The state parameter is either FORECAST or ANALYZED, BOTH is not supported.
|
||||
|
||||
The realization range parameter is optional. Default is all realizations.
|
||||
|
||||
|
||||
Example use of this job in a workflow:
|
||||
|
||||
::
|
||||
|
||||
EXPORT_FIELD PERMZ path_to_export/filename%d.grdecl 0 FORECAST 0,2
|
||||
|
||||
**EXPORT_FIELD_RMS_ROFF**
|
||||
|
||||
The EXPORT_FIELD_RMS_ROFF workflow job exports field data to roff format. The job takes the following arguments:
|
||||
|
||||
#. Field to be exported
|
||||
#. Filename for export file, must contain %d
|
||||
#. Report_step
|
||||
#. State
|
||||
#. Realization range
|
||||
|
||||
The filename must contain a %d. This will be replaced with the realization number.
|
||||
|
||||
The state parameter is either FORECAST or ANALYZED, BOTH is not supported.
|
||||
|
||||
The realization range parameter is optional. Default is all realizations.
|
||||
|
||||
|
||||
Example uses of this job in a workflow:
|
||||
|
||||
::
|
||||
|
||||
EXPORT_FIELD_RMS_ROFF PERMZ path_to_export/filename%d.roff 0 FORECAST
|
||||
EXPORT_FIELD_RMS_ROFF PERMX path_to_export/filename%d 0 FORECAST 0-5
|
||||
|
||||
|
||||
**EXPORT_FIELD_ECL_GRDECL**
|
||||
|
||||
The EXPORT_FIELD_ECL_GRDECL workflow job exports field data to grdecl format. The job takes the following arguments:
|
||||
|
||||
#. Field to be exported
|
||||
#. Filename for export file, must contain %d
|
||||
#. Report_step
|
||||
#. State
|
||||
#. Realization range
|
||||
|
||||
The filename must contain a %d. This will be replaced with the realization number.
|
||||
|
||||
The state parameter is either FORECAST or ANALYZED, BOTH is not supported.
|
||||
|
||||
The realization range parameter is optional. Default is all realizations.
|
||||
|
||||
|
||||
Example uses of this job in a workflow:
|
||||
|
||||
::
|
||||
|
||||
EXPORT_FIELD_ECL_GRDECL PERMZ path_to_export/filename%d.grdecl 0 ANALYZED
|
||||
EXPORT_FIELD_ECL_GRDECL PERMX path_to_export/filename%d 0 ANALYZED 0-5
|
||||
|
||||
|
||||
**EXPORT_RUNPATH**
|
||||
|
||||
The EXPORT_RUNPATH workflow job writes the runpath file RUNPATH_FILE for the selected case.
|
||||
|
||||
The job can have no arguments, or one can set a range of realizations and a range of iterations as arguments.
|
||||
|
||||
Example uses of this job in a workflow:
|
||||
|
||||
::
|
||||
|
||||
EXPORT_RUNPATH
|
||||
|
||||
With no arguments, entries for all realizations are written to the runpath file. If the runpath supports iterations, entries for all realizations in iter0 are written to the runpath file.
|
||||
|
||||
::
|
||||
|
||||
EXPORT_RUNPATH 0-5 | *
|
||||
|
||||
A range of realizations and a range of iterations can be given. "|" is used as a delimiter to separate realizations and iterations. "*" can be used to select all realizations or iterations. In the example above, entries for realizations 0-5 for all iterations are written to the runpath file.
|
||||
|
||||
|
||||
Jobs related to analysis update
|
||||
-------------------------------
|
||||
|
||||
**ANALYSIS_UPDATE**
|
||||
|
||||
This job will perform a update based on the current case, it is assumed that you have already completed the necessary simulations. By default the job will use all available data in the conditioning and store the updated parameters as the new initial parameters of the current case. However you can use optional argument to control which case the parameters go to, at which report step they are stored and also which report steps are considered when assembling the data. In the simplest form the ANALYSIS_UPDATE job looks like this:
|
||||
|
||||
::
|
||||
|
||||
ANALYSIS_UPDATE
|
||||
|
||||
In this case the initial parameters in the current case will be updated; using all available data in the conditioning process. In the example below we redirect the updated parameters to the new case NewCase:
|
||||
|
||||
::
|
||||
|
||||
ANALYSIS_UPDATE NewCase
|
||||
|
||||
Optionally we can decide to update the parameters at a later stage, i.e. for instance at report step 100:
|
||||
|
||||
::
|
||||
|
||||
ANALYSIS_UPDATE * 100
|
||||
|
||||
The '*' above means that we should update parameters in the current case. Finally we can limit the report steps used for data:
|
||||
|
||||
::
|
||||
|
||||
ANALYSIS_UPDATE NewCaseII 0 10,20,30,40,100,120-200
|
||||
|
||||
In the last example 10,20,30,40,100,120-200 mean the report steps we are considering when updating. Observe that when we use the first argument to specify a new case the will be created if it does not exist, but not selected.
|
||||
|
||||
|
||||
**ANALYSIS_ENKF_UPDATE**
|
||||
|
||||
The ANALYSIS_ENKF_UPDATE job will do an EnKF update at the current report step. The job requires the report step as the first argument:
|
||||
|
||||
::
|
||||
|
||||
ANALYSIS_ENKF_UPDATE 10
|
||||
|
||||
by default the ENKF_UPDATE will use the observed data at the updatestep, but you can configure it use the report steps you like for data. In the example below the parameters at step 20 will be updated based on the observations at report step 0,5,10,15,16,17,18,19,20:
|
||||
|
||||
::
|
||||
|
||||
ANALYSIS_ENKF_UPDATE 20 0,5,10,15-20
|
||||
|
||||
The ANALYSIS_ENKF_UPDATE job is a special case of the ANALYSIS_UPDATE job, in principle the same can be achieved with the ENKF_UPDATE job.
|
||||
|
||||
|
||||
Jobs related to running simulations - including updates
|
||||
-------------------------------------------------------
|
||||
|
||||
**RUN_SMOOTHER**
|
||||
|
||||
The RUN_SMOOTHER job will run a simulation and perform an update. The updated parameters are default stored as the new initial parameters of the current case. Optionally the job can take 1 or 2 parameters. The case to store the updated parameters in can be specified as the first argument. A second argument can be specified to run a simulation with the updated parameters.
|
||||
|
||||
|
||||
Run a simulation and an update. The updated parameters are stored as the new initial parameters of the current case:
|
||||
|
||||
::
|
||||
|
||||
RUN_SMOOTHER
|
||||
|
||||
|
||||
Run a simulation and an update. Store the updated parameters in the specified case. This case is created if it does not exist:
|
||||
|
||||
::
|
||||
|
||||
RUN_SMOOTHER new_case
|
||||
|
||||
|
||||
Run a simulation and an update. Store the updated parameters in the specified case, then run a simulation on this case:
|
||||
|
||||
::
|
||||
|
||||
RUN_SMOOTHER new_case true
|
||||
|
||||
|
||||
Run a simulation and an update. Store the updated parameters in the current case, then run a simulation again. Specify "*" to use the current case:
|
||||
|
||||
::
|
||||
|
||||
RUN_SMOOTHER * true
|
||||
|
||||
|
||||
**RUN_SMOOTHER_WITH_ITER**
|
||||
|
||||
This is exactly like the RUN_SMOOTHER job, but it has an additional first argumeent iter which can be used to control the iter number in the RUNPATH. When using the RUN_SMOOTHER job the iter number will be defaultetd to zero, and one in the optional rerun.
|
||||
|
||||
**ENSEMBLE_RUN**
|
||||
|
||||
The ENSEMBLE_RUN job will run a simulation, no update. The job take as optional arguments a range and/or list of which realizations to run.
|
||||
|
||||
::
|
||||
|
||||
ENSEMBLE_RUN
|
||||
|
||||
::
|
||||
|
||||
ENSEMBLE_RUN 1-5, 8
|
||||
|
||||
|
||||
**LOAD_RESULTS**
|
||||
|
||||
The LOAD_RESULTS loads result from simulation(s). The job takes as optional arguments a range and/or list of which realizations to load results from. If no realizations are specified, results for all realizations are loaded.
|
||||
|
||||
::
|
||||
|
||||
LOAD_RESULTS
|
||||
|
||||
::
|
||||
|
||||
LOAD_RESULTS 1-5, 8
|
||||
|
||||
In the case of multi iteration jobs, like e.g. the integrated smoother update, the LOAD_RESULTS job will load the results from iter==0. To control which iteration is loaded from you can use the LOAD_RESULTS_ITER job.
|
||||
|
||||
|
||||
**LOAD_RESULTS_ITER**
|
||||
|
||||
The LOAD_RESULTS_ITER job is similar to the LOAD_RESULTS job, but it takes an additional first argument which is the iteration number to load from. This should be used when manually loading results from a multi iteration workflow:
|
||||
|
||||
::
|
||||
|
||||
LOAD_RESULTS_ITER
|
||||
|
||||
::
|
||||
|
||||
LOAD_RESULTS_ITER 3 1-3, 8-10
|
||||
|
||||
Will load the realisations 1,2,3 and 8,9,10 from the fourth iteration (counting starts at zero).
|
||||
|
||||
|
||||
**MDA_ES**
|
||||
|
||||
This workflow job (plugin) is used to run the *Multiple Data Assimilation Ensemble Smoother* :code:`MDA ES`.
|
||||
Only two arguments are required to start the MDA ES process; target case format and iteration weights.
|
||||
The weights implicitly indicate the number of iterations and the normalized global standard deviation scaling applied to the update step.
|
||||
|
||||
::
|
||||
|
||||
MDA_ES target_case_%d observations/obs.txt
|
||||
|
||||
This command will use the weights specified in the obs.txt file. This file should have a single floating point number per line.
|
||||
Alternatively the weights can be given as arguments as shown here.
|
||||
|
||||
::
|
||||
|
||||
MDA_ES target_case_%d 8,4,2,1
|
||||
|
||||
This command will use the normalized version of the weights 8,4,2,1 and run for four iterations.
|
||||
The prior will be in *target_case_0* and the results from the last iteration will be in *target_case_4*.
|
||||
**Note: the weights must be listed with no spaces and separated with commas.**
|
||||
|
||||
If this is run as a plugin from Ertshell or the GUI a convenient user interface can be shown.
|
||||
|
||||
|
||||
Jobs for ranking realizations
|
||||
-----------------------------
|
||||
|
||||
**OBSERVATION_RANKING**
|
||||
|
||||
The OBSERVATION_RANKING job will rank realizations based on the delta between observed and simulated values for selected variables and time steps. The data for selected variables and time steps are summarized for both observed and simulated values, and then the simulated versus observed delta is used for ranking the realizations in increasing order. The job takes a name for the ranking as the first parameter, then the time steps, a "|" character and then variables to rank on. If no time steps and/or no variables are given, all time steps and variables are taken into account.
|
||||
|
||||
|
||||
Rank the realizations on observation/simulation delta value for all WOPR data for time steps 0-20:
|
||||
|
||||
::
|
||||
|
||||
OBSERVATION_RANKING Ranking1 0-20 | WOPR:*
|
||||
|
||||
|
||||
Rank the simulations on observation/simulation delta value for all WOPR and WWCT data for time steps 1 and 10-50
|
||||
|
||||
::
|
||||
|
||||
OBSERVATION_RANKING Ranking2 1, 10-50 | WOPR:* WWCT:*
|
||||
|
||||
|
||||
Rank the realizations on observation/simulation delta value for WOPR:OP-1 data for all time steps
|
||||
|
||||
::
|
||||
|
||||
OBSERVATION_RANKING Ranking3 | WOPR:OP-1
|
||||
|
||||
**DATA_RANKING**
|
||||
|
||||
The DATA_RANKING job will rank realizations in increasing or decreasing order on selected data value for a selected time step. The job takes as parameters the name of the ranking, the data key to rank on, increasing order and selected time steps. If no time step is given, the default is the last timestep.
|
||||
|
||||
Rank the realizations on PORO:1,2,3 on time step 0 in decreasing order
|
||||
|
||||
::
|
||||
|
||||
DATA_RANKING Dataranking1 PORO:1,2,3 false 0
|
||||
|
||||
|
||||
**EXPORT_RANKING**
|
||||
|
||||
The EXPORT_RANKING job exports ranking results to file. The job takes two parameters; the name of the ranking to export and the file to export to.
|
||||
|
||||
::
|
||||
|
||||
EXPORT_RANKING Dataranking1 /tmp/dataranking1.txt
|
||||
|
||||
|
||||
**INIT_MISFIT_TABLE**
|
||||
|
||||
Calculating the misfit for all observations and all timesteps can potentially be a bit timeconsuming, the results are therefor cached internally. If you need to force the recalculation of this cache you can use the INIT_MISFIT_TABLE job to initialize the misfit table that is used in observation ranking.
|
||||
|
||||
::
|
||||
|
||||
INIT_MISFIT_TABLE
|
||||
|
||||
|
||||
**STD_SCALE_CORRELATED_OBS**
|
||||
|
||||
The workflow job :code:`STD_SCALE_CORRELATED_OBS` is used to scale the
|
||||
observation standard deviation in an attempt to reduce the effect of
|
||||
correlations in the observed data. The job expects the observation
|
||||
keys you want to consider as arguments:
|
||||
|
||||
::
|
||||
|
||||
STD_SCALE_CORRELATED_OBS WWCT:OP_1 WWCT:OP_2
|
||||
|
||||
In this example the observation uncertainty corresponding to
|
||||
:code:`WWCT:OP_1` and :code:`WWCT:OP_2` will be scaled. Observe that
|
||||
the :code:`STD_SCALE_CORRELATED_OBS` keyword will "flatten" in both
|
||||
time and spatial direction. Wildcards are allow, i.e.
|
||||
|
||||
::
|
||||
|
||||
STD_SCALE_CORRELATED_OBS W*:OP_1
|
||||
|
||||
Will scale based on all the observations of well 'OP_1'. For more
|
||||
advanced selections of observations, where you only want to scale
|
||||
based on parts of the observation - spatially or temporaly you must
|
||||
write your own plugin.
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#include <ert/util/double_vector.h>
|
||||
|
||||
|
||||
void enkf_linalg_get_PC( const matrix_type * S0,
|
||||
int enkf_linalg_get_PC( const matrix_type * S0,
|
||||
const matrix_type * dObs ,
|
||||
double truncation,
|
||||
int ncomp,
|
||||
@@ -14,6 +14,8 @@ void enkf_linalg_get_PC( const matrix_type * S0,
|
||||
matrix_type * PC_obs ,
|
||||
double_vector_type * singular_values);
|
||||
|
||||
int enkf_linalg_num_PC(const matrix_type * S , double truncation );
|
||||
|
||||
|
||||
void enkf_linalg_init_stdX( matrix_type * X ,
|
||||
const matrix_type * S ,
|
||||
|
106
ThirdParty/Ert/devel/libanalysis/src/enkf_linalg.c
vendored
106
ThirdParty/Ert/devel/libanalysis/src/enkf_linalg.c
vendored
@@ -134,15 +134,39 @@ int enkf_linalg_svd_truncation(const matrix_type * S ,
|
||||
}
|
||||
|
||||
|
||||
static int enkf_linalg_num_significant(int num_singular_values , const double * sig0 , double truncation ) {
|
||||
int num_significant = 0;
|
||||
double total_sigma2 = 0;
|
||||
for (int i=0; i < num_singular_values; i++)
|
||||
total_sigma2 += sig0[i] * sig0[i];
|
||||
|
||||
/*
|
||||
Determine the number of singular values by enforcing that
|
||||
less than a fraction @truncation of the total variance be
|
||||
accounted for.
|
||||
*/
|
||||
{
|
||||
double running_sigma2 = 0;
|
||||
for (int i=0; i < num_singular_values; i++) {
|
||||
if (running_sigma2 / total_sigma2 < truncation) { /* Include one more singular value ? */
|
||||
num_significant++;
|
||||
running_sigma2 += sig0[i] * sig0[i];
|
||||
} else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return num_significant;
|
||||
}
|
||||
|
||||
|
||||
int enkf_linalg_svdS(const matrix_type * S ,
|
||||
double truncation ,
|
||||
int ncomp ,
|
||||
dgesvd_vector_enum store_V0T ,
|
||||
double * inv_sig0,
|
||||
matrix_type * U0 ,
|
||||
matrix_type * V0T) {
|
||||
double truncation ,
|
||||
int ncomp ,
|
||||
dgesvd_vector_enum store_V0T ,
|
||||
double * inv_sig0,
|
||||
matrix_type * U0 ,
|
||||
matrix_type * V0T) {
|
||||
|
||||
double * sig0 = inv_sig0;
|
||||
int num_significant = 0;
|
||||
@@ -156,47 +180,50 @@ int enkf_linalg_svdS(const matrix_type * S ,
|
||||
matrix_dgesvd(DGESVD_MIN_RETURN , store_V0T , workS , sig0 , U0 , V0T);
|
||||
matrix_free( workS );
|
||||
}
|
||||
int i;
|
||||
|
||||
if (ncomp > 0)
|
||||
num_significant = ncomp;
|
||||
else {
|
||||
double total_sigma2 = 0;
|
||||
for (i=0; i < num_singular_values; i++)
|
||||
total_sigma2 += sig0[i] * sig0[i];
|
||||
else
|
||||
num_significant = enkf_linalg_num_significant( num_singular_values , sig0 , truncation );
|
||||
|
||||
/*
|
||||
Determine the number of singular values by enforcing that
|
||||
less than a fraction @truncation of the total variance be
|
||||
accounted for.
|
||||
*/
|
||||
num_significant = 0;
|
||||
{
|
||||
double running_sigma2 = 0;
|
||||
for (i=0; i < num_singular_values; i++) {
|
||||
if (running_sigma2 / total_sigma2 < truncation) { /* Include one more singular value ? */
|
||||
num_significant++;
|
||||
running_sigma2 += sig0[i] * sig0[i];
|
||||
} else
|
||||
break;
|
||||
}
|
||||
}
|
||||
{
|
||||
int i;
|
||||
/* Inverting the significant singular values */
|
||||
for (i = 0; i < num_significant; i++)
|
||||
inv_sig0[i] = 1.0 / sig0[i];
|
||||
|
||||
/* Explicitly setting the insignificant singular values to zero. */
|
||||
for (i=num_significant; i < num_singular_values; i++)
|
||||
inv_sig0[i] = 0;
|
||||
}
|
||||
|
||||
/* Inverting the significant singular values */
|
||||
for (i = 0; i < num_significant; i++)
|
||||
inv_sig0[i] = 1.0 / sig0[i];
|
||||
|
||||
/* Explicitly setting the insignificant singular values to zero. */
|
||||
for (i=num_significant; i < num_singular_values; i++)
|
||||
inv_sig0[i] = 0;
|
||||
|
||||
} else
|
||||
|
||||
util_abort("%s: truncation:%g ncomp:%d - invalid ambigous input.\n",__func__ , truncation , ncomp );
|
||||
|
||||
return num_significant;
|
||||
}
|
||||
|
||||
|
||||
int enkf_linalg_num_PC(const matrix_type * S , double truncation ) {
|
||||
int num_singular_values = util_int_min( matrix_get_rows( S ) , matrix_get_columns( S ));
|
||||
int num_significant;
|
||||
double * sig0 = util_calloc( num_singular_values , sizeof * sig0);
|
||||
|
||||
{
|
||||
matrix_type * workS = matrix_alloc_copy( S );
|
||||
matrix_dgesvd(DGESVD_NONE , DGESVD_NONE , workS , sig0 , NULL , NULL);
|
||||
matrix_free( workS );
|
||||
}
|
||||
|
||||
num_significant = enkf_linalg_num_significant( num_singular_values , sig0 , truncation );
|
||||
free( sig0 );
|
||||
return num_significant;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void enkf_linalg_Cee(matrix_type * B, int nrens , const matrix_type * R , const matrix_type * U0 , const double * inv_sig0) {
|
||||
const int nrmin = matrix_get_rows( B );
|
||||
{
|
||||
@@ -588,7 +615,7 @@ void enkf_linalg_checkX(const matrix_type * X , bool bootstrap) {
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
void enkf_linalg_get_PC( const matrix_type * S0,
|
||||
int enkf_linalg_get_PC( const matrix_type * S0,
|
||||
const matrix_type * dObs ,
|
||||
double truncation,
|
||||
int ncomp,
|
||||
@@ -603,6 +630,7 @@ void enkf_linalg_get_PC( const matrix_type * S0,
|
||||
matrix_type * U0 = matrix_alloc( nrobs , nrens );
|
||||
matrix_type * S = matrix_alloc_copy( S0 );
|
||||
double * inv_sig0;
|
||||
int num_PC;
|
||||
|
||||
double_vector_iset( singular_values , nrmin - 1 , 0 );
|
||||
matrix_subtract_row_mean( S );
|
||||
@@ -610,7 +638,7 @@ void enkf_linalg_get_PC( const matrix_type * S0,
|
||||
inv_sig0 = double_vector_get_ptr( singular_values );
|
||||
{
|
||||
matrix_type * S_mean = matrix_alloc( nrobs , 1 );
|
||||
int num_PC = enkf_linalg_svdS(S , truncation , ncomp, DGESVD_NONE , inv_sig0 , U0 , NULL);
|
||||
num_PC = enkf_linalg_svdS(S , truncation , ncomp, DGESVD_NONE , inv_sig0 , U0 , NULL);
|
||||
|
||||
matrix_assign( S , S0); // The svd routine will overwrite S - we therefor must pick it up again from S0.
|
||||
matrix_subtract_and_store_row_mean( S , S_mean);
|
||||
@@ -642,6 +670,8 @@ void enkf_linalg_get_PC( const matrix_type * S0,
|
||||
}
|
||||
matrix_free( S );
|
||||
matrix_free( U0 );
|
||||
|
||||
return num_PC;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -31,6 +31,7 @@ define extern "C" {
|
||||
|
||||
typedef struct config_content_node_struct config_content_node_type;
|
||||
|
||||
config_item_types config_content_node_iget_type( const config_content_node_type * node , int index);
|
||||
config_content_node_type * config_content_node_alloc( const config_schema_item_type * schema , const config_path_elm_type * cwd);
|
||||
void config_content_node_add_value(config_content_node_type * node , const char * value);
|
||||
void config_content_node_set(config_content_node_type * node , const stringlist_type * token_list);
|
||||
|
24
ThirdParty/Ert/devel/libconfig/src/conf.c
vendored
24
ThirdParty/Ert/devel/libconfig/src/conf.c
vendored
@@ -1190,7 +1190,16 @@ bool conf_instance_has_valid_mutexes(
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
static bool __instance_has_sub_instance_of_type(
|
||||
const conf_class_type * __conf_class, int num_sub_instances, conf_class_type ** class_signatures)
|
||||
{
|
||||
for(int sub_instance_nr = 0; sub_instance_nr < num_sub_instances; sub_instance_nr++)
|
||||
{
|
||||
if(class_signatures[sub_instance_nr] == __conf_class)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static
|
||||
bool conf_instance_has_required_sub_instances(
|
||||
@@ -1218,16 +1227,7 @@ bool conf_instance_has_required_sub_instances(
|
||||
}
|
||||
|
||||
|
||||
bool __instance_has_sub_instance_of_type(
|
||||
const conf_class_type * __conf_class)
|
||||
{
|
||||
for(int sub_instance_nr = 0; sub_instance_nr < num_sub_instances; sub_instance_nr++)
|
||||
{
|
||||
if(class_signatures[sub_instance_nr] == __conf_class)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1243,7 +1243,7 @@ bool conf_instance_has_required_sub_instances(
|
||||
const conf_class_type * sub_conf_class = hash_get(conf_class->sub_classes, sub_class_name);
|
||||
if(sub_conf_class->require_instance)
|
||||
{
|
||||
if(!__instance_has_sub_instance_of_type(sub_conf_class))
|
||||
if(!__instance_has_sub_instance_of_type(sub_conf_class, num_sub_instances, class_signatures))
|
||||
{
|
||||
printf("ERROR: Missing required instance of sub class \"%s\" in instance \"%s\" of class \"%s\".\n",
|
||||
sub_conf_class->class_name, conf_instance->name, conf_instance->conf_class->class_name);
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2012 Statoil ASA, Norway.
|
||||
|
||||
The file 'config_content_item.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.
|
||||
Copyright (C) 2012 Statoil ASA, Norway.
|
||||
|
||||
The file 'config_content_item.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.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
@@ -53,7 +53,7 @@ struct config_content_item_struct {
|
||||
|
||||
config_content_item_get_occurences( "KEY1" )
|
||||
|
||||
will return 2.
|
||||
will return 2.
|
||||
*/
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ const config_content_node_type * config_content_item_iget_node_const(const confi
|
||||
|
||||
|
||||
char * config_content_item_ialloc_joined_string(const config_content_item_type * item , const char * sep , int occurence) {
|
||||
const config_content_node_type * node = config_content_item_iget_node(item , occurence);
|
||||
const config_content_node_type * node = config_content_item_iget_node(item , occurence);
|
||||
return config_content_node_alloc_joined_string(node , sep);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ char * config_content_item_ialloc_joined_string(const config_content_item_type *
|
||||
char * config_content_item_alloc_joined_string(const config_content_item_type * item , const char * sep) {
|
||||
const int occurences = config_content_item_get_size( item );
|
||||
char * joined_string = NULL;
|
||||
|
||||
|
||||
for (int i =0; i < occurences ; i++) {
|
||||
char * element = config_content_item_ialloc_joined_string(item , sep , i);
|
||||
joined_string = util_strcat_realloc( joined_string , element);
|
||||
@@ -98,18 +98,18 @@ char * config_content_item_alloc_joined_string(const config_content_item_type *
|
||||
joined_string = util_strcat_realloc( joined_string , sep );
|
||||
free( element );
|
||||
}
|
||||
|
||||
|
||||
return joined_string;
|
||||
}
|
||||
|
||||
const stringlist_type * config_content_item_iget_stringlist_ref(const config_content_item_type * item, int occurence) {
|
||||
const config_content_node_type * node = config_content_item_iget_node(item , occurence);
|
||||
const config_content_node_type * node = config_content_item_iget_node(item , occurence);
|
||||
return config_content_node_get_stringlist( node );
|
||||
}
|
||||
|
||||
|
||||
const stringlist_type * config_content_item_get_stringlist_ref(const config_content_item_type * item) {
|
||||
const config_content_node_type * node = config_content_item_get_last_node( item );
|
||||
const config_content_node_type * node = config_content_item_get_last_node( item );
|
||||
return config_content_node_get_stringlist( node );
|
||||
}
|
||||
|
||||
@@ -125,12 +125,12 @@ stringlist_type * config_content_item_alloc_complete_stringlist(const config_con
|
||||
for (inode = 0; inode < vector_get_size( item->nodes ); inode++) {
|
||||
const config_content_node_type * node = config_content_item_iget_node(item , inode);
|
||||
const stringlist_type * src_list = config_content_node_get_stringlist( node );
|
||||
|
||||
|
||||
if (copy)
|
||||
stringlist_append_stringlist_copy( stringlist , src_list );
|
||||
else
|
||||
stringlist_append_stringlist_ref( stringlist , src_list );
|
||||
|
||||
stringlist_append_stringlist_ref( stringlist , src_list );
|
||||
|
||||
}
|
||||
|
||||
return stringlist;
|
||||
@@ -146,12 +146,12 @@ stringlist_type * config_content_item_alloc_stringlist(const config_content_item
|
||||
const config_content_node_type * node = config_content_item_get_last_node( item );
|
||||
stringlist_type * stringlist = stringlist_alloc_new();
|
||||
const stringlist_type * src_list = config_content_node_get_stringlist( node );
|
||||
|
||||
|
||||
if (copy)
|
||||
stringlist_append_stringlist_copy( stringlist , src_list );
|
||||
else
|
||||
stringlist_append_stringlist_ref( stringlist , src_list );
|
||||
|
||||
stringlist_append_stringlist_ref( stringlist , src_list );
|
||||
|
||||
return stringlist;
|
||||
}
|
||||
|
||||
@@ -170,15 +170,15 @@ hash_type * config_content_item_alloc_hash(const config_content_item_type * item
|
||||
const stringlist_type * src_list = config_content_node_get_stringlist( node );
|
||||
const char * key = stringlist_iget(src_list , 0);
|
||||
const char * value = stringlist_iget(src_list , 1);
|
||||
|
||||
|
||||
if (copy) {
|
||||
hash_insert_hash_owned_ref(hash ,
|
||||
hash_insert_hash_owned_ref(hash ,
|
||||
key ,
|
||||
util_alloc_string_copy(value) ,
|
||||
util_alloc_string_copy(value) ,
|
||||
free);
|
||||
} else
|
||||
hash_insert_ref(hash , key , value );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return hash;
|
||||
@@ -191,7 +191,7 @@ hash_type * config_content_item_alloc_hash(const config_content_item_type * item
|
||||
|
||||
|
||||
const char * config_content_item_iget(const config_content_item_type * item , int occurence , int index) {
|
||||
const config_content_node_type * node = config_content_item_iget_node(item , occurence);
|
||||
const config_content_node_type * node = config_content_item_iget_node(item , occurence);
|
||||
const stringlist_type * src_list = config_content_node_get_stringlist( node );
|
||||
return stringlist_iget( src_list , index );
|
||||
}
|
||||
@@ -228,7 +228,7 @@ double config_content_item_iget_as_double(const config_content_item_type * item
|
||||
|
||||
OPTION V1
|
||||
OPTION V2 V3 V4
|
||||
OPTION __RESET__
|
||||
OPTION __RESET__
|
||||
OPTION V6
|
||||
|
||||
In this case OPTION will get the value 'V6'. The example given
|
||||
|
@@ -506,7 +506,8 @@ static void config_parse__(config_parser_type * config ,
|
||||
|
||||
|
||||
{
|
||||
basic_parser_type * parser = basic_parser_alloc(" \t" , "\"", NULL , NULL , "--" , "\n");
|
||||
const char * comment_end = comment_string ? "\n" : NULL;
|
||||
basic_parser_type * parser = basic_parser_alloc(" \t" , "\"", NULL , NULL , comment_string , comment_end);
|
||||
FILE * stream = util_fopen(config_file , "r");
|
||||
bool at_eof = false;
|
||||
|
||||
|
@@ -31,7 +31,6 @@
|
||||
|
||||
void file_convert(const char * src_file , const char * target_file, ecl_file_enum file_type , bool fmt_src) {
|
||||
fortio_type *src , *target;
|
||||
ecl_kw_type * ecl_kw;
|
||||
bool formatted_src;
|
||||
|
||||
printf("Converting %s -> %s \n",src_file , target_file);
|
||||
|
@@ -60,7 +60,7 @@ int main(int argc, char ** argv) {
|
||||
}
|
||||
printf("----\n");
|
||||
*/
|
||||
ecl_grid_fwrite_EGRID( ecl_grid , "/tmp/INFO.EGRID");
|
||||
ecl_grid_fwrite_EGRID( ecl_grid , "/tmp/INFO.EGRID", true);
|
||||
ecl_grid_free(ecl_grid);
|
||||
}
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ int main(int argc, char ** argv) {
|
||||
char * EGRID_file = util_alloc_filename( path , basename , "EGRID");
|
||||
|
||||
printf("Writing file: %s ...",EGRID_file); fflush(stdout);
|
||||
ecl_grid_fwrite_EGRID( ecl_grid , EGRID_file );
|
||||
ecl_grid_fwrite_EGRID( ecl_grid , EGRID_file, true );
|
||||
free( EGRID_file );
|
||||
}
|
||||
|
||||
|
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
Copyright (C) 2012 Statoil ASA, Norway.
|
||||
The file 'sum_write' 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.
|
||||
Copyright (C) 2012 Statoil ASA, Norway.
|
||||
The file 'sum_write' 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 <stdlib.h>
|
||||
@@ -58,7 +58,7 @@
|
||||
|
||||
|
||||
CASE.SMSPEC CASE.S0001 CASE.S0002
|
||||
------------------------------ -------------------------- ---------------------------------------
|
||||
------------------------------ -------------------------- ---------------------------------------
|
||||
| KEYWORD | WGNAMES | NUMS | | MINISTEP 1| MINISTEP 2| | MINISTEP 3| MINISTEP 4| MINISTEP 5|
|
||||
+----------------------------+ +------------------------+ +-------------------------------------+
|
||||
| TIME | | | --> | | | --> | | | |
|
||||
@@ -106,7 +106,8 @@
|
||||
5. The header contains a "TIME" variable; to some extent this looks
|
||||
like just any other variable, but it must be present in the
|
||||
SMSPEC header. In the example above the first element in every
|
||||
data block is the current time (in days) for that datablock.
|
||||
data block is the current time (in days) for that datablock; if
|
||||
labunits is used the stored value is the elapsed time in hours.
|
||||
|
||||
6. In the ecl_sum library the concept of a 'gen_key' is used quite
|
||||
extensively. The gen_key is a string combination of the KEYWORD,
|
||||
@@ -114,7 +115,7 @@
|
||||
relevant elements are combined when forming a gen_key; i.e. for
|
||||
the example above we will have:
|
||||
|
||||
------------------------------
|
||||
------------------------------
|
||||
| KEYWORD | WGNAMES | NUMS | General key
|
||||
+----------------------------+ ------------
|
||||
| TIME | | | --> TIME
|
||||
@@ -122,7 +123,7 @@
|
||||
| GOPR | P-North | | --> GOPR:P-North
|
||||
| BPR | | 5423 | --> BPR:5423 , BPR:i,j,k
|
||||
| WGPR | GasW | | --> WGPR:GasW
|
||||
+----------------------------+
|
||||
+----------------------------+
|
||||
|
||||
Note the following:
|
||||
|
||||
@@ -132,7 +133,7 @@
|
||||
never inverted, so the join string can be arbitrary.
|
||||
|
||||
o For the block quantities, like the BPR in the example above
|
||||
the NUMS value is the cell number in (i,j,k) ordering:
|
||||
the NUMS value is the cell number in (i,j,k) ordering:
|
||||
|
||||
NUMS = i + (j - 1)*nx + (k-1)*nx*ny
|
||||
|
||||
@@ -148,11 +149,11 @@
|
||||
|
||||
2. Use your simulator to step forward in time, and add timesteps
|
||||
with ecl_sum_add_tstep().
|
||||
|
||||
|
||||
Now - the important thing is that steps 1 and 2 two can not be
|
||||
interchanged, that will lead to crash and burn.
|
||||
interchanged, that will lead to crash and burn.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
int main( int argc , char ** argv) {
|
||||
@@ -160,7 +161,7 @@ int main( int argc , char ** argv) {
|
||||
int nx = 10;
|
||||
int ny = 10;
|
||||
int nz = 10;
|
||||
|
||||
|
||||
|
||||
smspec_node_type * wwct_wellx;
|
||||
smspec_node_type * wopr_wellx;
|
||||
@@ -173,7 +174,7 @@ int main( int argc , char ** argv) {
|
||||
|
||||
1: The case - this an ECLIPSE basename, with an optional leading
|
||||
path component. Can later be modified with ecl_sum_set_case().
|
||||
|
||||
|
||||
2: Should formatted files be used? Can be modified with
|
||||
ecl_sum_set_fmt_output().
|
||||
|
||||
@@ -190,18 +191,19 @@ int main( int argc , char ** argv) {
|
||||
|
||||
6-8: Grid dimensions.
|
||||
*/
|
||||
ecl_sum_type * ecl_sum = ecl_sum_alloc_writer( "/tmp/CASE" , false , true , ":" , start_time , nx , ny , nz );
|
||||
bool time_in_days = true;
|
||||
ecl_sum_type * ecl_sum = ecl_sum_alloc_writer( "/tmp/CASE" , false , true , ":" , start_time , time_in_days , nx , ny , nz );
|
||||
|
||||
|
||||
/*
|
||||
We add the variables we wish to measure. Due to the rather
|
||||
inflexible nature of the format we must add all the variables we
|
||||
are interested in before we start adding data.
|
||||
|
||||
are interested in before we start adding data.
|
||||
|
||||
The arguments to this function are:
|
||||
|
||||
1. self / this
|
||||
|
||||
|
||||
2. The KEYWORD value for the variable we are considering; the
|
||||
function ecl_smspec_identify_var_type() will be called with
|
||||
this string - i.e. you must follow the ECLIPSE rules (see
|
||||
@@ -216,7 +218,7 @@ int main( int argc , char ** argv) {
|
||||
4. The NUMS value for this variable.
|
||||
|
||||
5. The unit for this variable.
|
||||
|
||||
|
||||
6. A defualt value for this variable.
|
||||
|
||||
Observe that as an alternative to ecl_sum_add_var() you can use
|
||||
@@ -229,11 +231,11 @@ int main( int argc , char ** argv) {
|
||||
This is an alternative when e.g. the name of wells is not known in
|
||||
advance.
|
||||
*/
|
||||
ecl_sum_add_var( ecl_sum , "FOPT" , NULL , 0 , "Barrels" , 99.0 );
|
||||
ecl_sum_add_var( ecl_sum , "FOPT" , NULL , 0 , "Barrels" , 99.0 );
|
||||
ecl_sum_add_var( ecl_sum , "BPR" , NULL , 567 , "BARS" , 0.0 );
|
||||
ecl_sum_add_var( ecl_sum , "WWCT" , "OP-1" , 0 , "(1)" , 0.0 );
|
||||
ecl_sum_add_var( ecl_sum , "WOPR" , "OP-1" , 0 , "Barrels" , 0.0 );
|
||||
|
||||
|
||||
|
||||
/*
|
||||
The return value from the ecl_sum_add_var() function is an
|
||||
@@ -246,15 +248,15 @@ int main( int argc , char ** argv) {
|
||||
1. You can just ignore it - that is not very clean; in this
|
||||
case you must make an assumption of gen_key format at a
|
||||
later stage.
|
||||
|
||||
|
||||
2. You can use the smspec_node_get_gen_key1() or
|
||||
smspec_node_get_params_index() and hold on to the gen_key or
|
||||
params_index values. You will need these later.
|
||||
|
||||
3. You can hold on to the complete smspec_node instance, and
|
||||
then later on call one of the smspec_node_get_params_index()
|
||||
or smspec_node_get_gen_key1() functions.
|
||||
|
||||
or smspec_node_get_gen_key1() functions.
|
||||
|
||||
If you wish to change the WGNAME value with
|
||||
ecl_sum_update_wgname() a later stage you must hold on to
|
||||
the smspec_node instance.
|
||||
@@ -277,7 +279,7 @@ int main( int argc , char ** argv) {
|
||||
Here we add a collection of ten variables which are not
|
||||
initialized. Before they can be actually used you must initialize
|
||||
them with:
|
||||
|
||||
|
||||
ecl_sum_init_var( ecl_sum , node , keyword , wgname , num , unit );
|
||||
|
||||
If you do not init them at all they will appear in the SMSPEC file
|
||||
@@ -291,9 +293,9 @@ int main( int argc , char ** argv) {
|
||||
vector_append_ref( blank_nodes , blank_node );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
int num_dates = 10;
|
||||
int num_step = 10;
|
||||
@@ -325,7 +327,7 @@ int main( int argc , char ** argv) {
|
||||
*/
|
||||
ecl_sum_tstep_type * tstep = ecl_sum_add_tstep( ecl_sum , report_step + 1 , sim_days );
|
||||
|
||||
|
||||
|
||||
/*
|
||||
We can just set a value by it's index using the
|
||||
ecl_sum_tstep_iset() function. The index value should come
|
||||
|
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
The file 'view_summary.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.
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
The file 'view_summary.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.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -34,7 +34,7 @@
|
||||
void install_SIGNALS(void) {
|
||||
signal(SIGSEGV , util_abort_signal); /* Segmentation violation, i.e. overwriting memory ... */
|
||||
signal(SIGINT , util_abort_signal); /* Control C */
|
||||
signal(SIGTERM , util_abort_signal); /* If killing the program with SIGTERM (the default kill signal) you will get a backtrace.
|
||||
signal(SIGTERM , util_abort_signal); /* If killing the program with SIGTERM (the default kill signal) you will get a backtrace.
|
||||
Killing with SIGKILL (-9) will not give a backtrace.*/
|
||||
}
|
||||
|
||||
@@ -144,23 +144,22 @@ int main(int argc , char ** argv) {
|
||||
bool report_only = false;
|
||||
bool list_mode = false;
|
||||
bool include_restart = true;
|
||||
ecl_sum_fmt_type fmt;
|
||||
int arg_offset = 1;
|
||||
bool print_header = true;
|
||||
int arg_offset = 1;
|
||||
|
||||
ecl_sum_fmt_init_summary_x( &fmt );
|
||||
#ifdef HAVE_GETOPT
|
||||
if (argc == 1)
|
||||
print_help_and_exit();
|
||||
else {
|
||||
|
||||
|
||||
static struct option long_options[] = {
|
||||
{"no-restart" , 0 , 0 , 'n'} ,
|
||||
{"list" , 0 , 0 , 'l'} ,
|
||||
{"report-only" , 0 , 0 , 'r'} ,
|
||||
{"no-header" , 0 , 0 , 'x'} ,
|
||||
{"no-header" , 0 , 0 , 'x'} ,
|
||||
{"help" , 0 , 0 , 'h'} ,
|
||||
{ 0 , 0 , 0 , 0} };
|
||||
|
||||
|
||||
while (1) {
|
||||
int c;
|
||||
int option_index = 0;
|
||||
@@ -180,7 +179,7 @@ int main(int argc , char ** argv) {
|
||||
list_mode = true;
|
||||
break;
|
||||
case 'x':
|
||||
fmt.print_header = false;
|
||||
print_header = false;
|
||||
break;
|
||||
case 'h':
|
||||
print_help_and_exit();
|
||||
@@ -193,38 +192,38 @@ int main(int argc , char ** argv) {
|
||||
arg_offset = optind; /* External static variable in the getopt scope*/
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (arg_offset >= argc)
|
||||
print_help_and_exit();
|
||||
|
||||
{
|
||||
char * data_file = argv[arg_offset];
|
||||
ecl_sum_type * ecl_sum;
|
||||
int num_keys = argc - arg_offset - 1;
|
||||
int num_keys = argc - arg_offset - 1;
|
||||
const char ** arg_list = (const char **) &argv[arg_offset + 1];
|
||||
|
||||
|
||||
|
||||
|
||||
ecl_sum = ecl_sum_fread_alloc_case__( data_file , ":" , include_restart);
|
||||
/** If no keys have been presented the function will list available keys. */
|
||||
if (num_keys == 0)
|
||||
list_mode = true;
|
||||
|
||||
|
||||
if (ecl_sum != NULL) {
|
||||
if (list_mode) {
|
||||
/*
|
||||
/*
|
||||
The program is called in list mode, we only print the
|
||||
(matching) keys in a table on stdout. If no arguments
|
||||
have been given on the commandline, all internalized keys
|
||||
will be printed.
|
||||
will be printed.
|
||||
*/
|
||||
|
||||
|
||||
stringlist_type * keys = stringlist_alloc_new();
|
||||
if (num_keys == 0) {
|
||||
ecl_sum_select_matching_general_var_list( ecl_sum , "*" , keys);
|
||||
stringlist_sort(keys , NULL );
|
||||
} else
|
||||
} else
|
||||
build_key_list( ecl_sum , keys , num_keys , arg_list);
|
||||
|
||||
|
||||
{
|
||||
int columns = 5;
|
||||
int i;
|
||||
@@ -238,14 +237,21 @@ int main(int argc , char ** argv) {
|
||||
stringlist_free( keys );
|
||||
} else {
|
||||
/* Normal operation print results for the various keys on stdout. */
|
||||
ecl_sum_fmt_type fmt;
|
||||
stringlist_type * key_list = stringlist_alloc_new( );
|
||||
build_key_list( ecl_sum , key_list , num_keys , arg_list);
|
||||
|
||||
if (print_header)
|
||||
ecl_sum_fmt_init_summary_x(ecl_sum , &fmt );
|
||||
else
|
||||
fmt.print_header = false;
|
||||
|
||||
ecl_sum_fprintf(ecl_sum , stdout , key_list , report_only , &fmt);
|
||||
|
||||
stringlist_free( key_list );
|
||||
}
|
||||
ecl_sum_free(ecl_sum);
|
||||
} else
|
||||
} else
|
||||
fprintf(stderr,"summary.x: No summary data found for case:%s\n", data_file );
|
||||
}
|
||||
}
|
||||
|
@@ -1,2 +0,0 @@
|
||||
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/src )
|
||||
add_subdirectory( src )
|
@@ -1,10 +0,0 @@
|
||||
find_package(VTK REQUIRED)
|
||||
include(${VTK_USE_FILE})
|
||||
|
||||
add_executable(vtu2ecl vtu2ecl.cxx)
|
||||
if (VTK_LIBRARIES)
|
||||
target_link_libraries(vtu2ecl ${VTK_LIBRARIES} eclxx_static )
|
||||
else()
|
||||
target_link_libraries(vtu2ecl vtkHybrid eclxx_static )
|
||||
endif()
|
||||
|
@@ -1,110 +0,0 @@
|
||||
#include <vtkXMLUnstructuredGridReader.h>
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <vtkDataSetMapper.h>
|
||||
#include <vtkActor.h>
|
||||
#include <vtkRenderWindow.h>
|
||||
#include <vtkRenderer.h>
|
||||
#include <vtkRenderWindowInteractor.h>
|
||||
#include <vtkUnstructuredGrid.h>
|
||||
#include <vtkCellData.h>
|
||||
#include <vtkDataArray.h>
|
||||
#include <vtkFloatArray.h>
|
||||
#include <vtkIntArray.h>
|
||||
|
||||
#include <ecl_kw.hpp>
|
||||
#include <fortio.hpp>
|
||||
|
||||
|
||||
|
||||
EclKW getKW(vtkCellData * cellData , std::string sourceName , std::string targetName , ecl_type_enum type) {
|
||||
vtkDataArray * dataArray = cellData->GetArray( sourceName.c_str() );
|
||||
if (dataArray) {
|
||||
vtkFloatArray * floatArray = vtkFloatArray::SafeDownCast( dataArray );
|
||||
|
||||
return EclKW::create( targetName.c_str() , floatArray->GetSize() , type , floatArray->GetPointer(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int main ( int argc, char *argv[] )
|
||||
{
|
||||
//parse command line arguments
|
||||
if(argc != 2)
|
||||
{
|
||||
std::cerr << "Usage: " << argv[0]
|
||||
<< " Filename(.vtu)" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
vtkDataSet * dataSet;
|
||||
std::string filename = argv[1];
|
||||
|
||||
//read all the data from the file
|
||||
vtkSmartPointer<vtkXMLUnstructuredGridReader> reader = vtkSmartPointer<vtkXMLUnstructuredGridReader>::New();
|
||||
reader->SetFileName(filename.c_str());
|
||||
reader->Update();
|
||||
reader->GetOutput()->Register(reader);
|
||||
|
||||
dataSet = vtkDataSet::SafeDownCast(reader->GetOutput());
|
||||
|
||||
std::cout << "Number of cells: " << dataSet->GetNumberOfCells() << std::endl;
|
||||
std::cout << "Classname: " << dataSet->GetClassName() << std::endl;
|
||||
|
||||
// Now check for cell data
|
||||
|
||||
vtkCellData *cd = dataSet->GetCellData();
|
||||
if (cd)
|
||||
{
|
||||
FortIO writer = FortIO::writer("/tmp/file" , true);
|
||||
std::cout << " contains cell data with "
|
||||
<< cd->GetNumberOfArrays()
|
||||
<< " arrays." << std::endl;
|
||||
|
||||
{
|
||||
EclKW poro = getKW( cd , "PORO" , "PORO" , ECL_FLOAT_TYPE );
|
||||
EclKW permx = getKW( cd , "PERMX" , "PERMX" , ECL_FLOAT_TYPE );
|
||||
EclKW permy = getKW( cd , "PERMY" , "PERMY" , ECL_FLOAT_TYPE );
|
||||
EclKW permz = getKW( cd , "PERMZ" , "PERMZ" , ECL_FLOAT_TYPE );
|
||||
}
|
||||
|
||||
for (int i = 0; i < cd->GetNumberOfArrays(); i++)
|
||||
{
|
||||
vtkFloatArray * array = vtkFloatArray::SafeDownCast( cd->GetArray(i));
|
||||
float * data;
|
||||
|
||||
if (!array)
|
||||
std::cout << "SafeDownCast() failed" << std::endl;
|
||||
|
||||
std::cout << "\tArray " << i
|
||||
<< " is named "
|
||||
<< (cd->GetArrayName(i) ? cd->GetArrayName(i) : "NULL")
|
||||
<< "Value: "
|
||||
<< array->GetTuple1( 0 );
|
||||
|
||||
|
||||
array->SetTuple1( 0 , 0.25 );
|
||||
std::cout << " Updated value: " << array->GetTuple1( 0 ) << std::endl;
|
||||
|
||||
data = array->GetPointer( 0 );
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < 10; i++)
|
||||
std::cout << " data[" << i << "] = " << data[i] << std::endl;
|
||||
}
|
||||
{
|
||||
EclKW kw = EclKW::wrap_data("KJELL" , array->GetSize( ) , ECL_FLOAT_TYPE , data);
|
||||
|
||||
|
||||
kw.fwrite( writer );
|
||||
}
|
||||
}
|
||||
writer.close();
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
@@ -1,57 +0,0 @@
|
||||
#ifndef __ECL_KW_HPP__
|
||||
#define __ECL_KW_HPP__
|
||||
#include <iostream>
|
||||
|
||||
#include <ecl_util.h>
|
||||
#include <ecl_kw.h>
|
||||
|
||||
#include <fortio.hpp>
|
||||
|
||||
|
||||
class EclKW {
|
||||
private:
|
||||
ecl_kw_type * c_ptr;
|
||||
bool owner;
|
||||
|
||||
EclKW(ecl_kw_type * c_ptr , bool owner) {
|
||||
this->c_ptr = c_ptr;
|
||||
this->owner = owner;
|
||||
std::cout << "Have created: " << ecl_kw_get_header( c_ptr ) << "\n";
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
ecl_kw_type * C_PTR( ) { return c_ptr; }
|
||||
|
||||
//EclKW( const std::string& name , size_t size , ecl_type_enum type , void * data = NULL);
|
||||
|
||||
static EclKW create (const char * name , int size , ecl_type_enum type , void * data = NULL);
|
||||
static EclKW wrap (ecl_kw_type * c_ptr , bool owner = false);
|
||||
static EclKW wrap_data(const char * name , int size , ecl_type_enum type, void * data);
|
||||
|
||||
|
||||
//EclKW( EclKW& src);
|
||||
~EclKW();
|
||||
void fwrite( FortIO& fortio );
|
||||
|
||||
int size( ) { return ecl_kw_get_size( c_ptr ); }
|
||||
ecl_type_enum type() { return ecl_kw_get_type( c_ptr ); }
|
||||
|
||||
|
||||
template <typename T> void set_data( const T * data ) {
|
||||
ecl_kw_set_memcpy_data( c_ptr , data );
|
||||
}
|
||||
|
||||
template <typename T> void iset(int i , T value) {
|
||||
ecl_kw_iset( c_ptr , i , &value);
|
||||
}
|
||||
|
||||
template <typename T> T iget(int i ) {
|
||||
T value;
|
||||
ecl_kw_iget( c_ptr , i , &value);
|
||||
return value;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,33 +0,0 @@
|
||||
#ifndef __FORTIO_HPP__
|
||||
#define __FORTIO_HPP__
|
||||
#include <string>
|
||||
|
||||
#include <fortio.h>
|
||||
|
||||
#ifndef BYTE_ORDER
|
||||
#define BYTE_ORDER __LITTLE_ENDIAN
|
||||
#endif
|
||||
#include <ecl_endian_flip.h>
|
||||
|
||||
class FortIO {
|
||||
|
||||
private:
|
||||
fortio_type * c_ptr;
|
||||
|
||||
FortIO(fortio_type * c_ptr) {
|
||||
this->c_ptr = c_ptr;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
~FortIO() { close(); }
|
||||
|
||||
fortio_type * C_PTR( ) { return c_ptr; }
|
||||
|
||||
static FortIO writer(const std::string & filename , bool fmt_file = false , bool endian_flip_header = ECL_ENDIAN_FLIP );
|
||||
static FortIO reader(const char * filename , bool fmt_file = false , bool endian_flip_header = ECL_ENDIAN_FLIP );
|
||||
static FortIO readwrite( const char * filename , bool fmt_file = false , bool endian_flip_header = ECL_ENDIAN_FLIP );
|
||||
void close();
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,20 +0,0 @@
|
||||
set( source_files fortio.cxx ecl_kw.cxx )
|
||||
set( header_files fortio.hpp ecl_kw.hpp )
|
||||
|
||||
add_library( eclxx_static STATIC ${source_files})
|
||||
add_library( eclxx_shared SHARED ${source_files})
|
||||
|
||||
set_target_properties( eclxx_static PROPERTIES OUTPUT_NAME eclxx )
|
||||
set_target_properties( eclxx_shared PROPERTIES OUTPUT_NAME eclxx )
|
||||
|
||||
target_link_libraries( eclxx_static ecl_static )
|
||||
target_link_libraries( eclxx_shared ecl_shared )
|
||||
|
||||
if (ECL_INSTALL_PREFIX)
|
||||
install(TARGETS eclxx_static eclxx_shared DESTINATION ${ECL_INSTALL_PREFIX}/lib)
|
||||
install(FILES ${header_files} DESTINATION ${ECL_INSTALL_PREFIX}/include)
|
||||
else()
|
||||
#
|
||||
install(TARGETS eclxx_static DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(FILES ${header_files} DESTINATION include)
|
||||
endif()
|
58
ThirdParty/Ert/devel/libecl/cxx/src/ecl_kw.cxx
vendored
58
ThirdParty/Ert/devel/libecl/cxx/src/ecl_kw.cxx
vendored
@@ -1,58 +0,0 @@
|
||||
#include <iostream>
|
||||
|
||||
#include <ecl_kw.h>
|
||||
#include <ecl_kw.hpp>
|
||||
|
||||
|
||||
EclKW EclKW::wrap( ecl_kw_type * c_ptr , bool owner) {
|
||||
return EclKW( c_ptr , owner );
|
||||
}
|
||||
|
||||
|
||||
EclKW EclKW::wrap_data(const char * name , int size , ecl_type_enum type, void * data) {
|
||||
ecl_kw_type * c_ptr = ecl_kw_alloc_new_shared( name , size , type , data );
|
||||
return EclKW( c_ptr , true );
|
||||
}
|
||||
|
||||
|
||||
EclKW EclKW::create( const char * name , int size , ecl_type_enum type , void * data) {
|
||||
ecl_kw_type * c_ptr = ecl_kw_alloc( name , size , type );
|
||||
if (data != NULL)
|
||||
ecl_kw_set_memcpy_data( c_ptr , data );
|
||||
return EclKW( c_ptr , true );
|
||||
}
|
||||
|
||||
/*EclKW::EclKW( const std::string& name , size_t size , ecl_type_enum type , void * data) {
|
||||
c_ptr = ecl_kw_alloc( name.c_str() , (int) size , type );
|
||||
if (data != NULL)
|
||||
ecl_kw_set_memcpy_data( c_ptr , data );
|
||||
}
|
||||
*/
|
||||
|
||||
EclKW::~EclKW() {
|
||||
std::cout << "Calling destructor: " << ecl_kw_get_header( c_ptr ) << "\n";
|
||||
if (owner)
|
||||
ecl_kw_free( c_ptr );
|
||||
}
|
||||
|
||||
/*EclKW::EclKW( EclKW & src ) {
|
||||
owner = src.owner;
|
||||
src.owner = false;
|
||||
|
||||
c_ptr = src.c_ptr;
|
||||
}
|
||||
*/
|
||||
|
||||
/*EclKW::EclKW( EclKW src ) {
|
||||
owner = sr.>owner;
|
||||
src.owner = false;
|
||||
|
||||
c_ptr = src.c_ptr;
|
||||
}
|
||||
*/
|
||||
|
||||
void EclKW::fwrite(FortIO& fortio) {
|
||||
ecl_kw_fwrite( c_ptr , fortio.C_PTR());
|
||||
}
|
||||
|
||||
|
57
ThirdParty/Ert/devel/libecl/cxx/src/ecl_kw.hpp
vendored
57
ThirdParty/Ert/devel/libecl/cxx/src/ecl_kw.hpp
vendored
@@ -1,57 +0,0 @@
|
||||
#ifndef __ECL_KW_HPP__
|
||||
#define __ECL_KW_HPP__
|
||||
#include <iostream>
|
||||
|
||||
#include <ecl_util.h>
|
||||
#include <ecl_kw.h>
|
||||
|
||||
#include <fortio.hpp>
|
||||
|
||||
|
||||
class EclKW {
|
||||
private:
|
||||
ecl_kw_type * c_ptr;
|
||||
bool owner;
|
||||
|
||||
EclKW(ecl_kw_type * c_ptr , bool owner) {
|
||||
this->c_ptr = c_ptr;
|
||||
this->owner = owner;
|
||||
std::cout << "Have created: " << ecl_kw_get_header( c_ptr ) << "\n";
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
ecl_kw_type * C_PTR( ) { return c_ptr; }
|
||||
|
||||
//EclKW( const std::string& name , size_t size , ecl_type_enum type , void * data = NULL);
|
||||
|
||||
static EclKW create (const char * name , int size , ecl_type_enum type , void * data = NULL);
|
||||
static EclKW wrap (ecl_kw_type * c_ptr , bool owner = false);
|
||||
static EclKW wrap_data(const char * name , int size , ecl_type_enum type, void * data);
|
||||
|
||||
|
||||
//EclKW( EclKW& src);
|
||||
~EclKW();
|
||||
void fwrite( FortIO& fortio );
|
||||
|
||||
int size( ) { return ecl_kw_get_size( c_ptr ); }
|
||||
ecl_type_enum type() { return ecl_kw_get_type( c_ptr ); }
|
||||
|
||||
|
||||
template <typename T> void set_data( const T * data ) {
|
||||
ecl_kw_set_memcpy_data( c_ptr , data );
|
||||
}
|
||||
|
||||
template <typename T> void iset(int i , T value) {
|
||||
ecl_kw_iset( c_ptr , i , &value);
|
||||
}
|
||||
|
||||
template <typename T> T iget(int i ) {
|
||||
T value;
|
||||
ecl_kw_iget( c_ptr , i , &value);
|
||||
return value;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
11
ThirdParty/Ert/devel/libecl/cxx/src/fortio.cpp
vendored
11
ThirdParty/Ert/devel/libecl/cxx/src/fortio.cpp
vendored
@@ -1,11 +0,0 @@
|
||||
#include <string.h>
|
||||
#include <fortio.hpp>
|
||||
|
||||
static FortIO reader( const char * filename , bool endian_flip_header , bool fmt_file) {
|
||||
c_ptr = fortio_open_reader( filename , endian_flip_header , fmt_file );
|
||||
}
|
||||
|
||||
|
||||
static FortIO writer( const std::string & filename , bool endian_flip_header , bool fmt_file) {
|
||||
c_ptr = fortio_open_reader( filename.c_str() , endian_flip_header , fmt_file );
|
||||
}
|
27
ThirdParty/Ert/devel/libecl/cxx/src/fortio.cxx
vendored
27
ThirdParty/Ert/devel/libecl/cxx/src/fortio.cxx
vendored
@@ -1,27 +0,0 @@
|
||||
#include <fortio.hpp>
|
||||
|
||||
|
||||
void FortIO::close() {
|
||||
if (c_ptr)
|
||||
fortio_fclose( c_ptr );
|
||||
c_ptr = NULL;
|
||||
}
|
||||
|
||||
|
||||
FortIO FortIO::reader( const char * filename , bool fmt_file , bool endian_flip_header) {
|
||||
fortio_type * c_ptr = fortio_open_reader( filename , fmt_file , endian_flip_header);
|
||||
return FortIO( c_ptr );
|
||||
}
|
||||
|
||||
|
||||
FortIO FortIO::writer( const std::string & filename , bool fmt_file , bool endian_flip_header ) {
|
||||
fortio_type * c_ptr = fortio_open_writer( filename.c_str() , fmt_file , endian_flip_header);
|
||||
return FortIO( c_ptr );
|
||||
}
|
||||
|
||||
|
||||
FortIO FortIO::readwrite( const char * filename , bool fmt_file , bool endian_flip_header) {
|
||||
fortio_type * c_ptr = fortio_open_readwrite( filename , fmt_file , endian_flip_header);
|
||||
return FortIO( c_ptr );
|
||||
}
|
||||
|
33
ThirdParty/Ert/devel/libecl/cxx/src/fortio.hpp
vendored
33
ThirdParty/Ert/devel/libecl/cxx/src/fortio.hpp
vendored
@@ -1,33 +0,0 @@
|
||||
#ifndef __FORTIO_HPP__
|
||||
#define __FORTIO_HPP__
|
||||
#include <string>
|
||||
|
||||
#include <fortio.h>
|
||||
|
||||
#ifndef BYTE_ORDER
|
||||
#define BYTE_ORDER __LITTLE_ENDIAN
|
||||
#endif
|
||||
#include <ecl_endian_flip.h>
|
||||
|
||||
class FortIO {
|
||||
|
||||
private:
|
||||
fortio_type * c_ptr;
|
||||
|
||||
FortIO(fortio_type * c_ptr) {
|
||||
this->c_ptr = c_ptr;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
~FortIO() { close(); }
|
||||
|
||||
fortio_type * C_PTR( ) { return c_ptr; }
|
||||
|
||||
static FortIO writer(const std::string & filename , bool fmt_file = false , bool endian_flip_header = ECL_ENDIAN_FLIP );
|
||||
static FortIO reader(const char * filename , bool fmt_file = false , bool endian_flip_header = ECL_ENDIAN_FLIP );
|
||||
static FortIO readwrite( const char * filename , bool fmt_file = false , bool endian_flip_header = ECL_ENDIAN_FLIP );
|
||||
void close();
|
||||
};
|
||||
|
||||
#endif
|
@@ -70,6 +70,7 @@ extern "C" {
|
||||
bool ecl_grid_cell_contains1(const ecl_grid_type * grid , int global_index , double x , double y , double z);
|
||||
bool ecl_grid_cell_contains3(const ecl_grid_type * grid , int i , int j ,int k , double x , double y , double z);
|
||||
int ecl_grid_get_global_index_from_xyz(ecl_grid_type * grid , double x , double y , double z , int start_index);
|
||||
bool ecl_grid_get_ij_from_xy( const ecl_grid_type * grid , double x , double y , int k , int* i, int* j);
|
||||
const char * ecl_grid_get_name( const ecl_grid_type * );
|
||||
int ecl_grid_get_active_index3(const ecl_grid_type * ecl_grid , int i , int j , int k);
|
||||
int ecl_grid_get_active_index1(const ecl_grid_type * ecl_grid , int global_index);
|
||||
@@ -171,7 +172,7 @@ extern "C" {
|
||||
void ecl_grid_grdecl_fprintf_kw( const ecl_grid_type * ecl_grid , const ecl_kw_type * ecl_kw , const char * special_header , FILE * stream , double double_default);
|
||||
bool ecl_grid_test_lgr_consistency( const ecl_grid_type * ecl_grid );
|
||||
|
||||
void ecl_grid_fwrite_EGRID( ecl_grid_type * grid , const char * filename);
|
||||
void ecl_grid_fwrite_EGRID( ecl_grid_type * grid , const char * filename, bool metric_output);
|
||||
void ecl_grid_fwrite_GRID( const ecl_grid_type * grid , const char * filename);
|
||||
void ecl_grid_fprintf_grdecl( ecl_grid_type * grid , FILE * stream );
|
||||
void ecl_grid_fwrite_EGRID_header__( int dims[3] , const float mapaxes[6], int dualp_flag , fortio_type * fortio);
|
||||
@@ -206,6 +207,8 @@ extern "C" {
|
||||
bool ecl_grid_use_mapaxes( const ecl_grid_type * grid );
|
||||
void ecl_grid_init_mapaxes_data_double( const ecl_grid_type * grid , double * mapaxes);
|
||||
void ecl_grid_reset_actnum( ecl_grid_type * grid , const int * actnum );
|
||||
void ecl_grid_compressed_kw_copy( const ecl_grid_type * grid , ecl_kw_type * target_kw , const ecl_kw_type * src_kw);
|
||||
void ecl_grid_global_kw_copy( const ecl_grid_type * grid , ecl_kw_type * target_kw , const ecl_kw_type * src_kw);
|
||||
|
||||
UTIL_IS_INSTANCE_HEADER( ecl_grid );
|
||||
UTIL_SAFE_CAST_HEADER( ecl_grid );
|
||||
|
@@ -226,6 +226,8 @@ extern "C" {
|
||||
ECL_KW_MAX_MIN_HEADER( double );
|
||||
#undef ECL_KW_MAX_MIN_HEADER
|
||||
|
||||
void ecl_kw_fix_uninitialized(ecl_kw_type * ecl_kw , int nx , int ny , int nz, const int * actnum);
|
||||
|
||||
#include <ert/ecl/ecl_kw_grdecl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
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.
|
||||
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__
|
||||
@@ -29,29 +29,30 @@ extern "C" {
|
||||
|
||||
#include <ert/ecl/ecl_box.h>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/layer.h>
|
||||
|
||||
|
||||
|
||||
typedef enum {
|
||||
SELECT_ALL = 0,
|
||||
DESELECT_ALL = 1,
|
||||
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_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,
|
||||
SELECT_IN_INTERVAL = 12,
|
||||
DESELECT_IN_INTERVAL = 13,
|
||||
INVERT_SELECTION = 14
|
||||
} ecl_region_select_cmd;
|
||||
|
||||
|
||||
|
||||
typedef struct ecl_region_struct ecl_region_type;
|
||||
typedef struct ecl_region_struct ecl_region_type;
|
||||
|
||||
void ecl_region_unlock( ecl_region_type * region );
|
||||
void ecl_region_lock( ecl_region_type * region );
|
||||
@@ -60,34 +61,34 @@ typedef struct ecl_region_struct ecl_region_type;
|
||||
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);
|
||||
|
||||
@@ -97,58 +98,62 @@ typedef struct ecl_region_struct ecl_region_type;
|
||||
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);
|
||||
|
||||
void ecl_region_select_from_layer( ecl_region_type * region , const layer_type * layer , int k , int layer_value);
|
||||
void ecl_region_deselect_from_layer( ecl_region_type * region , const layer_type * layer , int k , int layer_value);
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
/* Functions to manipulate ecl_kw instances . */
|
||||
|
||||
@@ -172,11 +177,11 @@ typedef struct ecl_region_struct ecl_region_type;
|
||||
|
||||
/*****************************************************************/
|
||||
/* Stupid cpp compat/legacy/cruft functions. */
|
||||
int ecl_region_get_active_size_cpp( ecl_region_type * region );
|
||||
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 );
|
||||
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
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.
|
||||
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__
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
|
||||
#include <ert/ecl/smspec_node.h>
|
||||
|
||||
typedef struct ecl_smspec_struct ecl_smspec_type;
|
||||
typedef struct ecl_smspec_struct ecl_smspec_type;
|
||||
|
||||
|
||||
/**
|
||||
@@ -45,20 +45,19 @@ typedef struct ecl_smspec_struct ecl_smspec_type;
|
||||
*/
|
||||
const int_vector_type * ecl_smspec_get_index_map( const ecl_smspec_type * smspec );
|
||||
void ecl_smspec_index_node( ecl_smspec_type * ecl_smspec , smspec_node_type * smspec_node);
|
||||
void ecl_smspec_insert_node(ecl_smspec_type * ecl_smspec, smspec_node_type * smspec_node);
|
||||
void ecl_smspec_insert_node(ecl_smspec_type * ecl_smspec, smspec_node_type * smspec_node);
|
||||
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);
|
||||
ecl_smspec_type * ecl_smspec_alloc_writer( const char * key_join_string , time_t sim_start , bool time_in_days , 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 );
|
||||
@@ -79,7 +78,7 @@ typedef struct ecl_smspec_struct ecl_smspec_type;
|
||||
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);
|
||||
@@ -87,21 +86,21 @@ typedef struct ecl_smspec_struct ecl_smspec_type;
|
||||
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 );
|
||||
@@ -109,14 +108,15 @@ typedef struct ecl_smspec_struct ecl_smspec_type;
|
||||
//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_init_var( ecl_smspec_type * ecl_smspec , smspec_node_type * smspec_node , const char * keyword , const char * wgname , int num, const char * unit );
|
||||
|
||||
void ecl_smspec_init_var( ecl_smspec_type * ecl_smspec , smspec_node_type * smspec_node , const char * keyword , const char * wgname , int num, const char * unit );
|
||||
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_seconds( const ecl_smspec_type * ecl_smspec );
|
||||
int ecl_smspec_get_time_index( const ecl_smspec_type * ecl_smspec );
|
||||
time_t ecl_smspec_get_start_time(const ecl_smspec_type * );
|
||||
/*****************************************************************/
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
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.
|
||||
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__
|
||||
@@ -51,17 +51,18 @@ extern "C" {
|
||||
char * date_dash;
|
||||
char * value_dash;
|
||||
} ecl_sum_fmt_type;
|
||||
|
||||
|
||||
void ecl_sum_fmt_init_csv( ecl_sum_fmt_type * fmt );
|
||||
void ecl_sum_fmt_init_summary_x( ecl_sum_fmt_type * fmt );
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
typedef struct ecl_sum_struct ecl_sum_type;
|
||||
|
||||
void ecl_sum_fmt_init_summary_x( const ecl_sum_type * ecl_sum , ecl_sum_fmt_type * fmt );
|
||||
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);
|
||||
double ecl_sum_time2days( const ecl_sum_type * ecl_sum , time_t sim_time);
|
||||
|
||||
|
||||
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 );
|
||||
|
||||
@@ -93,39 +94,39 @@ typedef struct ecl_sum_struct ecl_sum_type;
|
||||
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);
|
||||
bool ecl_sum_case_exists( const char * input_file );
|
||||
|
||||
|
||||
/* 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);
|
||||
@@ -139,9 +140,9 @@ typedef struct ecl_sum_struct ecl_sum_type;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* 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_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 );
|
||||
@@ -152,8 +153,8 @@ typedef struct ecl_sum_struct ecl_sum_type;
|
||||
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);
|
||||
@@ -167,7 +168,7 @@ typedef struct ecl_sum_struct ecl_sum_type;
|
||||
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 );
|
||||
@@ -179,25 +180,25 @@ typedef struct ecl_sum_struct ecl_sum_type;
|
||||
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);
|
||||
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);
|
||||
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 , bool time_in_days , 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);
|
||||
smspec_node_type * ecl_sum_add_blank_var( ecl_sum_type * ecl_sum , float default_value);
|
||||
void ecl_sum_init_var( ecl_sum_type * ecl_sum , smspec_node_type * smspec_node , const char * keyword , const char * wgname , int num , const char * unit);
|
||||
ecl_sum_tstep_type * ecl_sum_add_tstep( ecl_sum_type * ecl_sum , int report_step , double sim_days);
|
||||
ecl_sum_tstep_type * ecl_sum_add_tstep( ecl_sum_type * ecl_sum , int report_step , double sim_seconds);
|
||||
void ecl_sum_update_wgname( ecl_sum_type * ecl_sum , smspec_node_type * node , const char * wgname );
|
||||
|
||||
bool ecl_sum_is_oil_producer( const ecl_sum_type * ecl_sum , const char * well);
|
||||
|
@@ -83,7 +83,7 @@ typedef struct ecl_sum_data_struct ecl_sum_data_type ;
|
||||
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);
|
||||
ecl_sum_tstep_type * ecl_sum_data_add_new_tstep( ecl_sum_data_type * data , int report_step , double sim_seconds);
|
||||
bool ecl_sum_data_report_step_equal( const ecl_sum_data_type * data1 , const ecl_sum_data_type * data2);
|
||||
bool ecl_sum_data_report_step_compatible( const ecl_sum_data_type * data1 , const ecl_sum_data_type * data2);
|
||||
void ecl_sum_data_write_csv_file(const ecl_sum_data_type * data , time_t sim_time, const ecl_sum_vector_type * keylist, FILE *fp);
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
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.
|
||||
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__
|
||||
@@ -35,15 +35,17 @@ typedef struct ecl_sum_tstep_struct ecl_sum_tstep_type;
|
||||
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_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 );
|
||||
|
||||
|
||||
ecl_sum_tstep_type * ecl_sum_tstep_alloc_new( int report_step , int ministep , float sim_seconds , 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);
|
||||
double ecl_sum_tstep_get_sim_seconds(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);
|
||||
|
||||
|
@@ -26,6 +26,8 @@ extern "C" {
|
||||
#include <ert/util/double_vector.h>
|
||||
#include <ert/util/type_macros.h>
|
||||
|
||||
#include <ert/geometry/geo_polygon_collection.h>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
|
||||
@@ -49,7 +51,7 @@ extern "C" {
|
||||
bool fault_block_trace_edge( const fault_block_type * block , double_vector_type * x_list , double_vector_type * y_list, int_vector_type * cell_list);
|
||||
const int_vector_type * fault_block_get_global_index_list( const fault_block_type * fault_block);
|
||||
void fault_block_copy_content(fault_block_type * target_block , const fault_block_type * src_block );
|
||||
void fault_block_list_neighbours( const fault_block_type * block, int_vector_type * neighbour_list);
|
||||
void fault_block_list_neighbours( const fault_block_type * block , bool connected_only , const geo_polygon_collection_type * polylines , int_vector_type * neighbour_list);
|
||||
|
||||
UTIL_IS_INSTANCE_HEADER(fault_block);
|
||||
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'layer.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.
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'layer.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 __LAYER_H__
|
||||
@@ -27,10 +27,11 @@ extern "C" {
|
||||
#include <ert/util/struct_vector.h>
|
||||
#include <ert/util/type_macros.h>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
|
||||
/*
|
||||
/*
|
||||
The elements in this enum are (ab)used as indexes into a int[] vector;
|
||||
i.e. the must span the values 0..3.
|
||||
i.e. the must span the values 0..3.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
@@ -46,9 +47,11 @@ extern "C" {
|
||||
} int_point2d_type;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct layer_struct layer_type;
|
||||
|
||||
bool layer_iget_left_barrier( const layer_type * layer, int i , int j);
|
||||
bool layer_iget_bottom_barrier( const layer_type * layer, int i , int j);
|
||||
int layer_get_nx( const layer_type * layer );
|
||||
int layer_get_ny( const layer_type * layer );
|
||||
void layer_fprintf_cell( const layer_type * layer , int i , int j , FILE * stream);
|
||||
@@ -57,6 +60,7 @@ extern "C" {
|
||||
layer_type * layer_alloc(int nx , int ny);
|
||||
void layer_free( layer_type * layer );
|
||||
int layer_replace_cell_values( layer_type * layer , int old_value , int new_value);
|
||||
bool layer_iget_active( const layer_type * layer, int i , int j);
|
||||
int layer_iget_cell_value( const layer_type * layer, int i , int j);
|
||||
void layer_iset_cell_value( layer_type * layer , int i , int j , int value);
|
||||
int layer_iget_edge_value( const layer_type * layer , int i , int j , edge_dir_enum dir);
|
||||
@@ -66,8 +70,15 @@ extern "C" {
|
||||
int layer_get_cell_sum( const layer_type * layer );
|
||||
bool layer_trace_block_content( layer_type * layer , bool erase , int start_i , int start_j , int value , int_vector_type * i_list , int_vector_type * j_list);
|
||||
bool layer_trace_block_edge( const layer_type * layer , int i , int j , int value , struct_vector_type * corner_list , int_vector_type * cell_list);
|
||||
|
||||
|
||||
bool layer_cell_contact( const layer_type * layer , int i1 , int j1 , int i2 , int j2);
|
||||
void layer_add_interp_barrier( layer_type * layer , int c1 , int c2);
|
||||
void layer_add_ijbarrier( layer_type * layer , int i1 , int j1 , int i2 , int j2 );
|
||||
void layer_add_barrier( layer_type * layer , int c1 , int c2);
|
||||
void layer_memcpy(layer_type * target_layer , const layer_type * src_layer);
|
||||
void layer_update_active( layer_type * layer , const ecl_grid_type * grid , int k);
|
||||
|
||||
void layer_cells_equal( const layer_type * layer , int value , int_vector_type * i_list , int_vector_type * j_list);
|
||||
|
||||
UTIL_IS_INSTANCE_HEADER( layer );
|
||||
UTIL_SAFE_CAST_HEADER( layer );
|
||||
|
||||
|
154
ThirdParty/Ert/devel/libecl/src/ecl_grid.c
vendored
154
ThirdParty/Ert/devel/libecl/src/ecl_grid.c
vendored
@@ -1,5 +1,3 @@
|
||||
// Fauilure Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-A3.EGRID
|
||||
|
||||
/*
|
||||
Copyright (c) 2011 statoil asa, norway.
|
||||
|
||||
@@ -32,6 +30,7 @@
|
||||
#include <ert/util/stringlist.h>
|
||||
|
||||
#include <ert/geometry/geo_util.h>
|
||||
#include <ert/geometry/geo_polygon.h>
|
||||
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
@@ -566,6 +565,7 @@ typedef struct ecl_cell_struct ecl_cell_type;
|
||||
|
||||
#define GET_CELL_FLAG(cell,flag) (((cell->cell_flags & (flag)) == 0) ? false : true)
|
||||
#define SET_CELL_FLAG(cell,flag) ((cell->cell_flags |= (flag)))
|
||||
#define METER_TO_FEET_SCALE_FACTOR 3.28084
|
||||
|
||||
struct ecl_cell_struct {
|
||||
point_type center;
|
||||
@@ -638,6 +638,7 @@ struct ecl_grid_struct {
|
||||
recalculate this from the cell coordinates,
|
||||
but in cases with skewed cells this has proved
|
||||
numerically challenging. */
|
||||
bool is_metric;
|
||||
};
|
||||
|
||||
|
||||
@@ -1297,6 +1298,7 @@ static ecl_grid_type * ecl_grid_alloc_empty(ecl_grid_type * global_grid , int du
|
||||
grid->fracture_index_map = NULL;
|
||||
grid->inv_fracture_index_map = NULL;
|
||||
ecl_grid_alloc_cells( grid , init_valid );
|
||||
grid->is_metric = true;
|
||||
|
||||
|
||||
if (global_grid != NULL) {
|
||||
@@ -3697,9 +3699,90 @@ int ecl_grid_get_global_index_from_xyz(ecl_grid_type * grid , double x , double
|
||||
}
|
||||
|
||||
|
||||
static bool ecl_grid_sublayer_contanins_xy__(const ecl_grid_type * grid , double x , double y , int k , int i1 , int i2 , int j1 , int j2, geo_polygon_type * polygon) {
|
||||
int i,j;
|
||||
|
||||
geo_polygon_reset( polygon );
|
||||
|
||||
/* Bottom edge */
|
||||
for (i=i1; i < i2; i++) {
|
||||
double corner_pos[3];
|
||||
ecl_grid_get_corner_xyz( grid , i , j1 , k , &corner_pos[0] , &corner_pos[1] , &corner_pos[2]);
|
||||
geo_polygon_add_point( polygon , corner_pos[0] , corner_pos[1]);
|
||||
}
|
||||
|
||||
/* Right edge */
|
||||
for (j=j1; j < j2; j++) {
|
||||
double corner_pos[3];
|
||||
ecl_grid_get_corner_xyz( grid , i2 , j , k , &corner_pos[0] , &corner_pos[1] , &corner_pos[2]);
|
||||
geo_polygon_add_point( polygon , corner_pos[0] , corner_pos[1]);
|
||||
}
|
||||
|
||||
/* Top edge */
|
||||
for (i=i2; i > i1; i--) {
|
||||
double corner_pos[3];
|
||||
ecl_grid_get_corner_xyz( grid , i , j2 , k , &corner_pos[0] , &corner_pos[1] , &corner_pos[2]);
|
||||
geo_polygon_add_point( polygon , corner_pos[0] , corner_pos[1]);
|
||||
}
|
||||
|
||||
/* Left edge */
|
||||
for (j=j2; j > j1; j--) {
|
||||
double corner_pos[3];
|
||||
ecl_grid_get_corner_xyz( grid , i1 , j , k , &corner_pos[0] , &corner_pos[1] , &corner_pos[2]);
|
||||
geo_polygon_add_point( polygon , corner_pos[0] , corner_pos[1]);
|
||||
}
|
||||
geo_polygon_close( polygon );
|
||||
return geo_polygon_contains_point__( polygon , x , y , true );
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool ecl_grid_get_ij_from_xy( const ecl_grid_type * grid , double x , double y , int k , int* i, int* j) {
|
||||
geo_polygon_type * polygon = geo_polygon_alloc( NULL );
|
||||
int nx = ecl_grid_get_nx( grid );
|
||||
int ny = ecl_grid_get_ny( grid );
|
||||
bool inside = ecl_grid_sublayer_contanins_xy__(grid , x , y , k , 0 , nx , 0 , ny , polygon);
|
||||
if (inside) {
|
||||
int i1 = 0;
|
||||
int i2 = nx;
|
||||
int j1 = 0;
|
||||
int j2 = ny;
|
||||
|
||||
while (true) {
|
||||
if ((i2 - i1) > 1) {
|
||||
int ic = (i1 + i2) / 2;
|
||||
if (ecl_grid_sublayer_contanins_xy__(grid , x , y , k , i1 , ic , j1 , j2 , polygon))
|
||||
i2 = ic;
|
||||
else {
|
||||
if (!ecl_grid_sublayer_contanins_xy__(grid , x , y , k , ic , i2 , j1 , j2 , polygon))
|
||||
util_abort("%s: point nowhere to be found ... \n",__func__);
|
||||
i1 = ic;
|
||||
}
|
||||
}
|
||||
|
||||
if ((j2 - j1) > 1) {
|
||||
int jc = (j1 + j2) / 2;
|
||||
if (ecl_grid_sublayer_contanins_xy__(grid , x , y , k , i1 , i2 , j1 , jc , polygon))
|
||||
j2 = jc;
|
||||
else {
|
||||
if (!ecl_grid_sublayer_contanins_xy__(grid , x , y , k , i1 , i2 , jc , j2 , polygon))
|
||||
util_abort("%s: point nowhere to be found ... \n",__func__);
|
||||
j1 = jc;
|
||||
}
|
||||
}
|
||||
|
||||
if ((i2 - i1) == 1 && (j2 - j1) == 1) {
|
||||
*i = i1;
|
||||
*j = j1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
geo_polygon_free( polygon );
|
||||
return inside;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ecl_grid_alloc_blocking_variables(ecl_grid_type * grid, int block_dim) {
|
||||
@@ -5526,6 +5609,37 @@ ecl_kw_type * ecl_grid_alloc_actnum_kw( const ecl_grid_type * grid ) {
|
||||
return actnum_kw;
|
||||
}
|
||||
|
||||
|
||||
void ecl_grid_compressed_kw_copy( const ecl_grid_type * grid , ecl_kw_type * target_kw , const ecl_kw_type * src_kw) {
|
||||
if ((ecl_kw_get_size( target_kw ) == ecl_grid_get_nactive(grid)) && (ecl_kw_get_size( src_kw ) == ecl_grid_get_global_size(grid))) {
|
||||
int active_index = 0;
|
||||
int global_index;
|
||||
for (global_index = 0; global_index < ecl_grid_get_global_size( grid ); global_index++) {
|
||||
if (ecl_grid_cell_active1(grid, global_index)) {
|
||||
ecl_kw_iset( target_kw , active_index , ecl_kw_iget_ptr(src_kw , global_index));
|
||||
active_index++;
|
||||
}
|
||||
}
|
||||
} else
|
||||
util_abort("%s: size mismatch target:%d src:%d expected %d,%d \n",ecl_kw_get_size( target_kw ), ecl_kw_get_size( src_kw ) , ecl_grid_get_nactive(grid) , ecl_grid_get_global_size(grid));
|
||||
}
|
||||
|
||||
|
||||
void ecl_grid_global_kw_copy( const ecl_grid_type * grid , ecl_kw_type * target_kw , const ecl_kw_type * src_kw) {
|
||||
if ((ecl_kw_get_size( src_kw ) == ecl_grid_get_nactive(grid)) && (ecl_kw_get_size( target_kw ) == ecl_grid_get_global_size(grid))) {
|
||||
int active_index = 0;
|
||||
int global_index;
|
||||
for (global_index = 0; global_index < ecl_grid_get_global_size( grid ); global_index++) {
|
||||
if (ecl_grid_cell_active1(grid, global_index)) {
|
||||
ecl_kw_iset( target_kw , global_index , ecl_kw_iget_ptr(src_kw , active_index));
|
||||
active_index++;
|
||||
}
|
||||
}
|
||||
} else
|
||||
util_abort("%s: size mismatch target:%d src:%d expected %d,%d \n",ecl_kw_get_size( target_kw ), ecl_kw_get_size( src_kw ) , ecl_grid_get_global_size(grid), ecl_grid_get_nactive(grid));
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
static void ecl_grid_init_hostnum_data( const ecl_grid_type * grid , int * hostnum ) {
|
||||
@@ -5604,7 +5718,8 @@ void ecl_grid_reset_actnum( ecl_grid_type * grid , const int * actnum ) {
|
||||
}
|
||||
|
||||
|
||||
static void ecl_grid_fwrite_EGRID__( ecl_grid_type * grid , fortio_type * fortio) {
|
||||
|
||||
static void ecl_grid_fwrite_EGRID__( ecl_grid_type * grid , fortio_type * fortio, bool metric_output) {
|
||||
bool is_lgr = true;
|
||||
if (grid->parent_grid == NULL)
|
||||
is_lgr = false;
|
||||
@@ -5637,11 +5752,36 @@ static void ecl_grid_fwrite_EGRID__( ecl_grid_type * grid , fortio_type * fortio
|
||||
{
|
||||
{
|
||||
ecl_grid_assert_coord_kw( grid );
|
||||
ecl_kw_fwrite( grid->coord_kw , fortio );
|
||||
if(metric_output != grid->is_metric){
|
||||
ecl_kw_type * coord_kw = ecl_kw_alloc_copy(grid->coord_kw);
|
||||
double scale_factor = 0.0;
|
||||
if (grid->is_metric){
|
||||
scale_factor = METER_TO_FEET_SCALE_FACTOR;
|
||||
} else{
|
||||
scale_factor = (1 / METER_TO_FEET_SCALE_FACTOR);
|
||||
}
|
||||
ecl_kw_scale_float(coord_kw, scale_factor);
|
||||
ecl_kw_fwrite(coord_kw, fortio);
|
||||
ecl_kw_free(coord_kw);
|
||||
}else{
|
||||
ecl_kw_fwrite( grid->coord_kw , fortio );
|
||||
}
|
||||
}
|
||||
{
|
||||
ecl_kw_type * zcorn_kw = ecl_grid_alloc_zcorn_kw( grid );
|
||||
if(metric_output != grid->is_metric){
|
||||
double scale_factor = 0.0;
|
||||
if (grid->is_metric){
|
||||
scale_factor = METER_TO_FEET_SCALE_FACTOR;
|
||||
} else{
|
||||
scale_factor = (1 / METER_TO_FEET_SCALE_FACTOR);
|
||||
}
|
||||
ecl_kw_scale_float(zcorn_kw, scale_factor);
|
||||
}
|
||||
ecl_kw_fwrite( zcorn_kw , fortio );
|
||||
|
||||
|
||||
|
||||
ecl_kw_free( zcorn_kw );
|
||||
}
|
||||
{
|
||||
@@ -5675,16 +5815,16 @@ static void ecl_grid_fwrite_EGRID__( ecl_grid_type * grid , fortio_type * fortio
|
||||
}
|
||||
|
||||
|
||||
void ecl_grid_fwrite_EGRID( ecl_grid_type * grid , const char * filename) {
|
||||
void ecl_grid_fwrite_EGRID( ecl_grid_type * grid , const char * filename, bool output_metric) {
|
||||
bool fmt_file = false;
|
||||
fortio_type * fortio = fortio_open_writer( filename , fmt_file , ECL_ENDIAN_FLIP );
|
||||
|
||||
ecl_grid_fwrite_EGRID__( grid , fortio );
|
||||
ecl_grid_fwrite_EGRID__( grid , fortio, output_metric );
|
||||
{
|
||||
int grid_nr;
|
||||
for (grid_nr = 0; grid_nr < vector_get_size( grid->LGR_list ); grid_nr++) {
|
||||
ecl_grid_type * igrid = vector_iget( grid->LGR_list , grid_nr );
|
||||
ecl_grid_fwrite_EGRID__( igrid , fortio );
|
||||
ecl_grid_fwrite_EGRID__( igrid , fortio, output_metric );
|
||||
}
|
||||
}
|
||||
fortio_fclose( fortio );
|
||||
|
15
ThirdParty/Ert/devel/libecl/src/ecl_kw.c
vendored
15
ThirdParty/Ert/devel/libecl/src/ecl_kw.c
vendored
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/buffer.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
@@ -209,7 +210,6 @@ const char * ecl_kw_get_write_fmt( ecl_type_enum ecl_type ) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int get_blocksize( ecl_type_enum ecl_type ) {
|
||||
if (ecl_type == ECL_CHAR_TYPE)
|
||||
return BLOCKSIZE_CHAR;
|
||||
@@ -404,22 +404,23 @@ bool ecl_kw_equal(const ecl_kw_type *ecl_kw1, const ecl_kw_type *ecl_kw2) {
|
||||
}
|
||||
|
||||
|
||||
#define CMP(ctype) \
|
||||
#define CMP(ctype,ABS) \
|
||||
static bool CMP_ ## ctype( ctype v1, ctype v2 , ctype epsilon) { \
|
||||
if ((abs(v1) + abs(v2)) == 0) \
|
||||
if ((ABS(v1) + ABS(v2)) == 0) \
|
||||
return true; \
|
||||
else { \
|
||||
ctype d = fabs(v1 - v2) / (fabs(v1) + fabs(v2)); \
|
||||
ctype d = ABS(v1 - v2) / (ABS(v1) + ABS(v2)); \
|
||||
if (d < epsilon) \
|
||||
return true; \
|
||||
else \
|
||||
return false; \
|
||||
} \
|
||||
}
|
||||
CMP(float)
|
||||
CMP(double)
|
||||
CMP(float,fabsf)
|
||||
CMP(double,fabs)
|
||||
#undef CMP
|
||||
|
||||
|
||||
#define ECL_KW_NUMERIC_CMP(ctype) \
|
||||
static bool ecl_kw_numeric_equal_ ## ctype( const ecl_kw_type * ecl_kw1 , const ecl_kw_type * ecl_kw2 , ctype rel_diff) { \
|
||||
int index; \
|
||||
@@ -2687,3 +2688,5 @@ void ecl_kw_fprintf_data( const ecl_kw_type * ecl_kw , const char * fmt , FILE *
|
||||
ecl_kw_fprintf_data_char( ecl_kw , fmt , stream );
|
||||
}
|
||||
|
||||
|
||||
#include "ecl_kw_functions.c"
|
||||
|
130
ThirdParty/Ert/devel/libecl/src/ecl_kw_functions.c
vendored
Normal file
130
ThirdParty/Ert/devel/libecl/src/ecl_kw_functions.c
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
This file is included from the ecl_kw.c file during compilation. It
|
||||
contains functions which are not really related to the ecl_kw as a
|
||||
datastructure, but rather use an ecl_kw instance in a function.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
This is an extremely special-case function written for the region
|
||||
creation code. Given a completed ecl_kw regions keyword, the purpose
|
||||
of this function is to "detect and correct" uninitialized cells with
|
||||
value 0. This function is purely heuristic:
|
||||
|
||||
1. It only considers cells which are active in the grid, i.e. where
|
||||
actnum[] != 0.
|
||||
|
||||
2. It will scan the four neighbours in the xy plane, if all
|
||||
neighbours agree on region value this value will be applied;
|
||||
otherwise the value will not be changed. Neighbouring cells with
|
||||
value zero are not considered when comparing.
|
||||
*/
|
||||
|
||||
|
||||
void ecl_kw_fix_uninitialized(ecl_kw_type * ecl_kw , int nx , int ny , int nz, const int * actnum) {
|
||||
int i,j,k;
|
||||
int * data = ecl_kw_get_ptr( ecl_kw );
|
||||
|
||||
int_vector_type * undetermined1 = int_vector_alloc(0,0);
|
||||
int_vector_type * undetermined2 = int_vector_alloc(0,0);
|
||||
|
||||
for (k=0; k < nz; k++) {
|
||||
int_vector_reset( undetermined1 );
|
||||
for (j=0; j < ny; j++) {
|
||||
for (i=0; i < nx; i++) {
|
||||
int g0 = i + j * nx + k* nx*ny;
|
||||
|
||||
if (data[g0] == 0 && actnum[g0])
|
||||
int_vector_append( undetermined1 , g0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
while (true) {
|
||||
int index;
|
||||
bool finished = true;
|
||||
|
||||
int_vector_reset( undetermined2 );
|
||||
for (index = 0; index < int_vector_size( undetermined1 ); index++) {
|
||||
int g0 = int_vector_iget( undetermined1 , index );
|
||||
int j = (g0 - k * nx*ny) / nx;
|
||||
int i = g0 - k * nx*ny - j * nx;
|
||||
|
||||
if (data[g0] == 0 && actnum[g0]) {
|
||||
int n1 = 0;
|
||||
int n2 = 0;
|
||||
int n3 = 0;
|
||||
int n4 = 0;
|
||||
|
||||
if (i > 0) {
|
||||
int g1 = g0 - 1;
|
||||
if (actnum[g1])
|
||||
n1 = data[g1];
|
||||
}
|
||||
|
||||
if (i < (nx - 1)) {
|
||||
int g2 = g0 + 1;
|
||||
if (actnum[g2])
|
||||
n2 = data[g2];
|
||||
}
|
||||
|
||||
if (j > 0) {
|
||||
int g3 = g0 - nx;
|
||||
if (actnum[g3])
|
||||
n3 = data[g3];
|
||||
}
|
||||
|
||||
if (j < (ny - 1)) {
|
||||
int g4 = g0 + nx;
|
||||
if (actnum[g4])
|
||||
n4 = data[g4];
|
||||
}
|
||||
|
||||
{
|
||||
int new_value = 0;
|
||||
|
||||
if (n1)
|
||||
new_value = n1;
|
||||
|
||||
if (n2) {
|
||||
if (new_value == 0)
|
||||
new_value = n2;
|
||||
else if (new_value != n2)
|
||||
new_value = -1;
|
||||
}
|
||||
|
||||
if (n3) {
|
||||
if (new_value == 0)
|
||||
new_value = n3;
|
||||
else if (new_value != n3)
|
||||
new_value = -1;
|
||||
}
|
||||
|
||||
if (n4) {
|
||||
if (new_value == 0)
|
||||
new_value = n4;
|
||||
else if (new_value != n4)
|
||||
new_value = -1;
|
||||
}
|
||||
|
||||
if (new_value > 0) {
|
||||
data[g0] = new_value;
|
||||
finished = false;
|
||||
}
|
||||
}
|
||||
if ((n1 + n2 + n3 + n4) == 0)
|
||||
int_vector_append( undetermined2 , g0 );
|
||||
}
|
||||
}
|
||||
{
|
||||
int_vector_type * tmp = undetermined2;
|
||||
undetermined2 = undetermined1;
|
||||
undetermined1 = tmp;
|
||||
}
|
||||
if (finished || (int_vector_size( undetermined1) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
int_vector_free( undetermined1 );
|
||||
int_vector_free( undetermined2 );
|
||||
}
|
@@ -414,10 +414,12 @@ static char * fscanf_alloc_grdecl_data( const char * header , bool strict , ecl_
|
||||
} else
|
||||
util_abort("%s: sorry type:%s not supported \n",__func__ , ecl_util_get_type_name(ecl_type));
|
||||
|
||||
|
||||
if (char_input)
|
||||
/*
|
||||
Removing this warning on user request:
|
||||
if (char_input)
|
||||
fprintf(stderr,"Warning: character string: \'%s\' ignored when reading keyword:%s \n",buffer , header);
|
||||
else {
|
||||
*/
|
||||
if (!char_input) {
|
||||
if (data_index + multiplier >= data_size) {
|
||||
data_size = 2*(data_index + multiplier);
|
||||
data = util_realloc( data , sizeof_ctype * data_size * sizeof * data);
|
||||
|
273
ThirdParty/Ert/devel/libecl/src/ecl_region.c
vendored
273
ThirdParty/Ert/devel/libecl/src/ecl_region.c
vendored
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_region.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.
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_region.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.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -55,7 +55,7 @@
|
||||
the indices. You can also get the results in term of global
|
||||
indices. (Refer to ecl_grid for the difference between active and
|
||||
global indices).
|
||||
|
||||
|
||||
For the functions which take ecl_kw input, the ecl_kw instance must
|
||||
have either nx*ny*nz elements, or nactive(from the grid)
|
||||
elements. This is checked, and the program will fail hard if it is
|
||||
@@ -63,7 +63,7 @@
|
||||
|
||||
Example:
|
||||
--------
|
||||
|
||||
|
||||
ecl_grid_type * ecl_grid;
|
||||
ecl_kw_type * soil;
|
||||
ecl_kw_type * regions;
|
||||
@@ -71,18 +71,18 @@
|
||||
|
||||
// Load grid, soil and regions somehow.
|
||||
|
||||
ecl_region = ecl_region_alloc( ecl_grid , false ); // Start with nothing selected
|
||||
ecl_region = ecl_region_alloc( ecl_grid , false ); // Start with nothing selected
|
||||
ecl_region_select_in_interval( ecl_region , soil , 0.50, 1.00); // Select all cells with soil > 0.50
|
||||
ecl_region_select_equal( ecl_region , regions , 3 ); // Only consider ECLIPSE region 3.
|
||||
ecl_region_select_k1k2( ecl_region , 5 , 8); // Select layers 5,6,7,8
|
||||
{
|
||||
int num_cells = ecl_region_get_global_size( ecl_region ); // How many cells are active
|
||||
int num_cells = ecl_region_get_global_size( ecl_region ); // How many cells are active
|
||||
const int * cell_list = ecl_region_get_global_list( ecl_region ); // Get a list of indices
|
||||
int i;
|
||||
printf("%d cells satisfy your selection. The cells are: \n");
|
||||
|
||||
for (i=0; i < num_cells; i++)
|
||||
printf("Cell: %d \n",cell_list[i]);
|
||||
for (i=0; i < num_cells; i++)
|
||||
printf("Cell: %d \n",cell_list[i]);
|
||||
}
|
||||
|
||||
ecl_region_free( ecl_region );
|
||||
@@ -117,8 +117,8 @@ UTIL_SAFE_CAST_FUNCTION( ecl_region , ECL_REGION_TYPE_ID)
|
||||
|
||||
|
||||
static void ecl_region_invalidate_index_list( ecl_region_type * region ) {
|
||||
region->global_index_list_valid = false;
|
||||
region->active_index_list_valid = false;
|
||||
region->global_index_list_valid = false;
|
||||
region->active_index_list_valid = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ ecl_region_type * ecl_region_alloc( const ecl_grid_type * ecl_grid , bool presel
|
||||
ecl_region_reset( region ); /* This MUST be called to ensure that xxx_valid is correctly initialized. */
|
||||
return region;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -183,17 +183,17 @@ void ecl_region_free__( void * __region ) {
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
|
||||
|
||||
static void ecl_region_assert_global_index_list( ecl_region_type * region ) {
|
||||
if (!region->global_index_list_valid) {
|
||||
int global_index;
|
||||
|
||||
int_vector_reset( region->global_index_list );
|
||||
for (global_index = 0; global_index < region->grid_vol; global_index++)
|
||||
if (region->active_mask[ global_index ])
|
||||
for (global_index = 0; global_index < region->grid_vol; global_index++)
|
||||
if (region->active_mask[ global_index ])
|
||||
int_vector_append( region->global_index_list , global_index );
|
||||
|
||||
|
||||
region->global_index_list_valid = true;
|
||||
}
|
||||
}
|
||||
@@ -269,15 +269,15 @@ static void ecl_region_assert_kw( const ecl_region_type * region , const ecl_kw_
|
||||
*global_kw = true;
|
||||
else
|
||||
*global_kw = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
/*****************************************************************/
|
||||
|
||||
void ecl_region_reset( ecl_region_type * ecl_region ) {
|
||||
int i;
|
||||
for (i=0; i < ecl_region->grid_vol; i++)
|
||||
for (i=0; i < ecl_region->grid_vol; i++)
|
||||
ecl_region->active_mask[i] = ecl_region->preselect;
|
||||
ecl_region_invalidate_index_list( ecl_region );
|
||||
}
|
||||
@@ -306,7 +306,7 @@ void ecl_region_deselect_cell( ecl_region_type * region , int i , int j , int k)
|
||||
static void ecl_region_select_equal__( ecl_region_type * region , const ecl_kw_type * ecl_kw, int value , bool select) {
|
||||
bool global_kw;
|
||||
ecl_region_assert_kw( region , ecl_kw , &global_kw);
|
||||
if (ecl_kw_get_type( ecl_kw ) != ECL_INT_TYPE)
|
||||
if (ecl_kw_get_type( ecl_kw ) != ECL_INT_TYPE)
|
||||
util_abort("%s: sorry - select by equality is only supported for integer keywords \n",__func__);
|
||||
{
|
||||
const int * kw_data = ecl_kw_get_int_ptr( ecl_kw );
|
||||
@@ -339,13 +339,60 @@ void ecl_region_deselect_equal( ecl_region_type * region , const ecl_kw_type * e
|
||||
ecl_region_select_equal__( region , ecl_kw , value , false );
|
||||
}
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
static void ecl_region_select_bool_equal__( ecl_region_type * region , const ecl_kw_type * ecl_kw, bool value , bool select) {
|
||||
bool global_kw;
|
||||
ecl_region_assert_kw( region , ecl_kw , &global_kw);
|
||||
if (ecl_kw_get_type( ecl_kw ) != ECL_BOOL_TYPE)
|
||||
util_abort("%s: sorry - select by equality is only supported for boolean keywords \n",__func__);
|
||||
{
|
||||
if (global_kw) {
|
||||
int global_index;
|
||||
for (global_index = 0; global_index < region->grid_vol; global_index++) {
|
||||
if (ecl_kw_iget_bool(ecl_kw , global_index) == value)
|
||||
region->active_mask[ global_index ] = select;
|
||||
}
|
||||
} else {
|
||||
int active_index;
|
||||
for (active_index = 0; active_index < region->grid_active; active_index++) {
|
||||
if (ecl_kw_iget_bool(ecl_kw , active_index) == value) {
|
||||
int global_index = ecl_grid_get_global_index1A( region->parent_grid , active_index );
|
||||
region->active_mask[ global_index ] = select;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ecl_region_invalidate_index_list( region );
|
||||
}
|
||||
|
||||
|
||||
void ecl_region_select_true( ecl_region_type * region , const ecl_kw_type * ecl_kw) {
|
||||
ecl_region_select_bool_equal__( region , ecl_kw , true , true );
|
||||
}
|
||||
|
||||
|
||||
void ecl_region_deselect_true( ecl_region_type * region , const ecl_kw_type * ecl_kw) {
|
||||
ecl_region_select_bool_equal__( region , ecl_kw , true , false );
|
||||
}
|
||||
|
||||
|
||||
void ecl_region_select_false( ecl_region_type * region , const ecl_kw_type * ecl_kw) {
|
||||
ecl_region_select_bool_equal__( region , ecl_kw , false , true );
|
||||
}
|
||||
|
||||
|
||||
void ecl_region_deselect_false( ecl_region_type * region , const ecl_kw_type * ecl_kw) {
|
||||
ecl_region_select_bool_equal__( region , ecl_kw , false , false );
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
static void ecl_region_select_in_interval__( ecl_region_type * region , const ecl_kw_type * ecl_kw, float min_value , float max_value , bool select) {
|
||||
bool global_kw;
|
||||
ecl_region_assert_kw( region , ecl_kw , &global_kw);
|
||||
if (ecl_kw_get_type( ecl_kw ) != ECL_FLOAT_TYPE)
|
||||
if (ecl_kw_get_type( ecl_kw ) != ECL_FLOAT_TYPE)
|
||||
util_abort("%s: sorry - select by in_interval is only supported for float keywords \n",__func__);
|
||||
{
|
||||
const float * kw_data = ecl_kw_get_float_ptr( ecl_kw );
|
||||
@@ -368,7 +415,7 @@ static void ecl_region_select_in_interval__( ecl_region_type * region , const ec
|
||||
ecl_region_invalidate_index_list( region );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ecl_region_select_in_interval( ecl_region_type * region , const ecl_kw_type * ecl_kw, float min_value , float max_value) {
|
||||
ecl_region_select_in_interval__( region , ecl_kw , min_value , max_value , true );
|
||||
}
|
||||
@@ -396,7 +443,7 @@ static void ecl_region_select_with_limit__( ecl_region_type * region , const ecl
|
||||
ecl_region_assert_kw( region , ecl_kw , &global_kw);
|
||||
if (!((ecl_type == ECL_FLOAT_TYPE) || (ecl_type == ECL_INT_TYPE) || (ecl_type == ECL_DOUBLE_TYPE)))
|
||||
util_abort("%s: sorry - select by in_interval is only supported for float and integer keywords \n",__func__);
|
||||
|
||||
|
||||
{
|
||||
if (ecl_type == ECL_FLOAT_TYPE) {
|
||||
const float * kw_data = ecl_kw_get_float_ptr( ecl_kw );
|
||||
@@ -512,22 +559,22 @@ void ecl_region_deselect_larger( ecl_region_type * ecl_region , const ecl_kw_typ
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
/**
|
||||
Selection based on comparing two keywords.
|
||||
/**
|
||||
Selection based on comparing two keywords.
|
||||
*/
|
||||
|
||||
static void ecl_region_cmp_select__( ecl_region_type * region , const ecl_kw_type * kw1 , const ecl_kw_type * kw2 , bool select_less , bool select) {
|
||||
bool global_kw;
|
||||
ecl_region_assert_kw( region , kw1 , &global_kw);
|
||||
if (ecl_kw_get_type( kw1 ) != ECL_FLOAT_TYPE)
|
||||
if (ecl_kw_get_type( kw1 ) != ECL_FLOAT_TYPE)
|
||||
util_abort("%s: sorry - select by cmp() is only supported for float keywords \n",__func__);
|
||||
{
|
||||
if ((ecl_kw_get_size( kw1 ) == ecl_kw_get_size( kw2 )) &&
|
||||
if ((ecl_kw_get_size( kw1 ) == ecl_kw_get_size( kw2 )) &&
|
||||
(ecl_kw_get_type( kw1 ) == ecl_kw_get_type( kw2 ))) {
|
||||
|
||||
|
||||
const float * kw1_data = ecl_kw_get_float_ptr( kw1 );
|
||||
const float * kw2_data = ecl_kw_get_float_ptr( kw2 );
|
||||
|
||||
|
||||
if (global_kw) {
|
||||
int global_index;
|
||||
for (global_index = 0; global_index < region->grid_vol; global_index++) {
|
||||
@@ -555,7 +602,7 @@ static void ecl_region_cmp_select__( ecl_region_type * region , const ecl_kw_typ
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
} else
|
||||
util_abort("%s: type/size mismatch between keywords. \n",__func__);
|
||||
}
|
||||
ecl_region_invalidate_index_list( region );
|
||||
@@ -592,9 +639,9 @@ static void ecl_region_select_from_box__( ecl_region_type * region , const ecl_b
|
||||
const int * active_list = ecl_box_get_global_list( ecl_box );
|
||||
int box_index;
|
||||
|
||||
for (box_index = 0; box_index < box_size; box_index++)
|
||||
for (box_index = 0; box_index < box_size; box_index++)
|
||||
region->active_mask[ active_list[box_index] ] = select;
|
||||
|
||||
|
||||
ecl_region_invalidate_index_list( region );
|
||||
}
|
||||
|
||||
@@ -611,11 +658,11 @@ void ecl_region_deselect_from_box( ecl_region_type * region , const ecl_box_type
|
||||
|
||||
/**
|
||||
Observe that:
|
||||
|
||||
|
||||
1. All the indices are inclusive.
|
||||
2. All the indices have zero offset.
|
||||
|
||||
Only a thin wrapper around the ecl_region_select_from_box() function.
|
||||
Only a thin wrapper around the ecl_region_select_from_box() function.
|
||||
*/
|
||||
|
||||
static void ecl_region_select_from_ijkbox__( ecl_region_type * region , int i1 , int i2 , int j1 , int j2 , int k1 , int k2 , bool select) {
|
||||
@@ -640,15 +687,15 @@ void ecl_region_deselect_from_ijkbox( ecl_region_type * region , int i1 , int i2
|
||||
|
||||
/**
|
||||
Observe that i1 and i2 are:
|
||||
|
||||
|
||||
* ZERO offset.
|
||||
* An inclusive interval : [i1,i2]
|
||||
|
||||
Input values below zero or above the upper limit are truncated.
|
||||
|
||||
Input values below zero or above the upper limit are truncated.
|
||||
*/
|
||||
|
||||
static void ecl_region_select_i1i2__( ecl_region_type * region , int i1 , int i2 , bool select) {
|
||||
if (i1 > i2)
|
||||
if (i1 > i2)
|
||||
util_abort("%s: i1 > i2 - this is illogical ... \n",__func__);
|
||||
i1 = util_int_max(0 , i1);
|
||||
i2 = util_int_min(region->grid_nx - 1 , i2);
|
||||
@@ -679,15 +726,15 @@ void ecl_region_deselect_i1i2( ecl_region_type * region , int i1 , int i2) {
|
||||
|
||||
/**
|
||||
Observe that j1 and j2 are:
|
||||
|
||||
|
||||
* ZERO offset.
|
||||
* An inclusive interval : [i1,i2]
|
||||
|
||||
Input values below zero or above the upper limit are truncated.
|
||||
|
||||
Input values below zero or above the upper limit are truncated.
|
||||
*/
|
||||
|
||||
static void ecl_region_select_j1j2__( ecl_region_type * region , int j1 , int j2 , bool select) {
|
||||
if (j1 > j2)
|
||||
if (j1 > j2)
|
||||
util_abort("%s: i1 > i2 - this is illogical ... \n",__func__);
|
||||
|
||||
j1 = util_int_max(0 , j1);
|
||||
@@ -719,15 +766,15 @@ void ecl_region_deselect_j1j2( ecl_region_type * region , int j1 , int j2) {
|
||||
|
||||
/**
|
||||
Observe that k1 and k2 are:
|
||||
|
||||
|
||||
* ZERO offset.
|
||||
* An inclusive interval : [i1,i2]
|
||||
|
||||
Input values below zero or above the upper limit are truncated.
|
||||
|
||||
Input values below zero or above the upper limit are truncated.
|
||||
*/
|
||||
|
||||
static void ecl_region_select_k1k2__( ecl_region_type * region , int k1 , int k2 , bool select) {
|
||||
if (k1 > k2)
|
||||
if (k1 > k2)
|
||||
util_abort("%s: i1 > i2 - this is illogical ... \n",__func__);
|
||||
k1 = util_int_max(0 , k1);
|
||||
k2 = util_int_min(region->grid_nz - 1 , k2);
|
||||
@@ -933,7 +980,7 @@ void ecl_region_deselect_global_index( ecl_region_type * region , int global_ind
|
||||
cylinder piercing the complete reservoir.
|
||||
|
||||
Currently all user-exported functions call the
|
||||
ecl_region_clyinder_select__() with select_inside == true.
|
||||
ecl_region_clyinder_select__() with select_inside == true.
|
||||
*/
|
||||
|
||||
static void ecl_region_cylinder_select__( ecl_region_type * region , double x0 , double y0, double R , double z1 , double z2 , bool select_inside , bool select) {
|
||||
@@ -946,7 +993,7 @@ static void ecl_region_cylinder_select__( ecl_region_type * region , double x0 ,
|
||||
ecl_grid_get_xyz1( region->parent_grid , global_index , &x , &y , &z);
|
||||
if ((z >= z1) && (z <= z2)) {
|
||||
double pointR2 = (x - x0) * (x - x0) + (y - y0) * (y - y0);
|
||||
if ((pointR2 < R2) && (select_inside))
|
||||
if ((pointR2 < R2) && (select_inside))
|
||||
region->active_mask[ global_index ] = select;
|
||||
else if ((pointR2 > R2) && (!select_inside))
|
||||
region->active_mask[ global_index ] = select;
|
||||
@@ -962,22 +1009,22 @@ static void ecl_region_cylinder_select__( ecl_region_type * region , double x0 ,
|
||||
double x,y,z;
|
||||
ecl_grid_get_xyz3( region->parent_grid , i,j,0 , &x , &y , &z);
|
||||
{
|
||||
double pointR2 = (x - x0) * (x - x0) + (y - y0) * (y - y0);
|
||||
bool select_column = false;
|
||||
double pointR2 = (x - x0) * (x - x0) + (y - y0) * (y - y0);
|
||||
bool select_column = false;
|
||||
|
||||
if ((pointR2 < R2) && (select_inside))
|
||||
select_column = true;
|
||||
else if ((pointR2 > R2) && (!select_inside))
|
||||
select_column = true;
|
||||
|
||||
if (select_column) {
|
||||
int k;
|
||||
for (k=0; k < nz; k++) {
|
||||
int global_index = ecl_grid_get_global_index3( region->parent_grid , i,j,k);
|
||||
region->active_mask[ global_index ] = select;
|
||||
if ((pointR2 < R2) && (select_inside))
|
||||
select_column = true;
|
||||
else if ((pointR2 > R2) && (!select_inside))
|
||||
select_column = true;
|
||||
|
||||
if (select_column) {
|
||||
int k;
|
||||
for (k=0; k < nz; k++) {
|
||||
int global_index = ecl_grid_get_global_index3( region->parent_grid , i,j,k);
|
||||
region->active_mask[ global_index ] = select;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1009,10 +1056,10 @@ void ecl_region_deselect_in_zcylinder( ecl_region_type * region , double x0 , do
|
||||
|
||||
/**
|
||||
Select or deselect points based on their distance to the plane
|
||||
specified by normal vector @n and point @p.
|
||||
specified by normal vector @n and point @p.
|
||||
*/
|
||||
|
||||
static void ecl_region_plane_select__( ecl_region_type * region, const double n[3] , const double p[3], bool select_above , bool select){
|
||||
static void ecl_region_plane_select__( ecl_region_type * region, const double n[3] , const double p[3], bool select_above , bool select){
|
||||
const double a = n[0];
|
||||
const double b = n[1];
|
||||
const double c = -n[2];
|
||||
@@ -1062,7 +1109,7 @@ void ecl_region_deselect_below_plane( ecl_region_type * region, const double n[3
|
||||
follows:
|
||||
|
||||
1. The defining polygon is layed out at the top of the reservoir.
|
||||
|
||||
|
||||
2. The set {(i,j,0)} of cells in the top layer inside the polygon
|
||||
is selected by checking the polygon perimeter.
|
||||
|
||||
@@ -1077,13 +1124,13 @@ void ecl_region_deselect_below_plane( ecl_region_type * region, const double n[3
|
||||
*/
|
||||
|
||||
|
||||
static void ecl_region_polygon_select__( ecl_region_type * region ,
|
||||
const geo_polygon_type * polygon ,
|
||||
static void ecl_region_polygon_select__( ecl_region_type * region ,
|
||||
const geo_polygon_type * polygon ,
|
||||
bool select_inside , bool select) {
|
||||
|
||||
const int define_k = 0; // The k-level where the polygon is checked.
|
||||
const int k1 = 0; // Selection range in k
|
||||
const int k2 = region->grid_nz;
|
||||
const int k2 = region->grid_nz;
|
||||
|
||||
{
|
||||
int i,j;
|
||||
@@ -1092,10 +1139,10 @@ static void ecl_region_polygon_select__( ecl_region_type * region ,
|
||||
double x,y,z;
|
||||
bool inside;
|
||||
int global_index = ecl_grid_get_global_index3( region->parent_grid , i , j , define_k);
|
||||
|
||||
|
||||
ecl_grid_get_xyz1( region->parent_grid , global_index , &x , &y , &z);
|
||||
inside = geo_polygon_contains_point( polygon , x , y );
|
||||
|
||||
|
||||
if (select_inside == inside) {
|
||||
int k;
|
||||
for (k=k1; k < k2; k++) {
|
||||
@@ -1146,13 +1193,45 @@ void ecl_region_select_active_index( ecl_region_type * region , int active_index
|
||||
void ecl_region_deselect_active_index( ecl_region_type * region , int active_index) {
|
||||
ecl_region_select_active_index__( region , active_index , false );
|
||||
}
|
||||
/*****************************************************************/
|
||||
|
||||
static void ecl_region_select_from_layer__( ecl_region_type * region , const layer_type * layer , int k , int layer_value, bool select) {
|
||||
int_vector_type * i_list = int_vector_alloc(0,0);
|
||||
int_vector_type * j_list = int_vector_alloc(0,0);
|
||||
|
||||
layer_cells_equal(layer, layer_value, i_list , j_list);
|
||||
{
|
||||
const int * i = int_vector_get_ptr( i_list );
|
||||
const int * j = int_vector_get_ptr( j_list );
|
||||
|
||||
int index;
|
||||
for (index = 0; index < int_vector_size( i_list ); index++) {
|
||||
int global_index = ecl_grid_get_global_index3( region->parent_grid , i[index] , j[index] , k);
|
||||
region->active_mask[ global_index ] = select;
|
||||
}
|
||||
|
||||
}
|
||||
if (int_vector_size( i_list ) > 0)
|
||||
ecl_region_invalidate_index_list( region );
|
||||
|
||||
int_vector_free( i_list );
|
||||
int_vector_free( j_list );
|
||||
}
|
||||
|
||||
|
||||
void ecl_region_select_from_layer( ecl_region_type * region , const layer_type * layer , int k , int layer_value) {
|
||||
ecl_region_select_from_layer__( region , layer , k , layer_value , true );
|
||||
}
|
||||
|
||||
void ecl_region_deselect_from_layer( ecl_region_type * region , const layer_type * layer , int k , int layer_value) {
|
||||
ecl_region_select_from_layer__( region , layer , k , layer_value , false );
|
||||
}
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
static void ecl_region_select_all__( ecl_region_type * region , bool select) {
|
||||
int global_index;
|
||||
for (global_index = 0; global_index < region->grid_vol; global_index++)
|
||||
for (global_index = 0; global_index < region->grid_vol; global_index++)
|
||||
region->active_mask[ global_index ] = select;
|
||||
ecl_region_invalidate_index_list( region );
|
||||
}
|
||||
@@ -1171,7 +1250,7 @@ void ecl_region_deselect_all( ecl_region_type * region ) {
|
||||
|
||||
void ecl_region_invert_selection( ecl_region_type * region ) {
|
||||
int global_index;
|
||||
for (global_index = 0; global_index < region->grid_vol; global_index++)
|
||||
for (global_index = 0; global_index < region->grid_vol; global_index++)
|
||||
region->active_mask[ global_index ] = !region->active_mask[ global_index ];
|
||||
ecl_region_invalidate_index_list( region );
|
||||
}
|
||||
@@ -1209,7 +1288,7 @@ bool ecl_region_contains_active( const ecl_region_type * ecl_region , int active
|
||||
Will update the selection in @region to ONLY contain the elements
|
||||
which are also present in @new_region. Will FAIL hard if the two
|
||||
regions do not share the same grid instance (checked by pointer
|
||||
equality).
|
||||
equality).
|
||||
|
||||
A &= B
|
||||
*/
|
||||
@@ -1217,9 +1296,9 @@ bool ecl_region_contains_active( const ecl_region_type * ecl_region , int active
|
||||
void ecl_region_intersection( ecl_region_type * region , const ecl_region_type * new_region ) {
|
||||
if (region->parent_grid == new_region->parent_grid) {
|
||||
int global_index;
|
||||
for (global_index = 0; global_index < region->grid_vol; global_index++)
|
||||
for (global_index = 0; global_index < region->grid_vol; global_index++)
|
||||
region->active_mask[global_index] = (region->active_mask[global_index] && new_region->active_mask[global_index]);
|
||||
|
||||
|
||||
ecl_region_invalidate_index_list( region );
|
||||
} else
|
||||
util_abort("%s: The two regions do not share grid - aborting \n",__func__);
|
||||
@@ -1237,9 +1316,9 @@ void ecl_region_union( ecl_region_type * region , const ecl_region_type * new_re
|
||||
int global_index;
|
||||
for (global_index = 0; global_index < region->grid_vol; global_index++)
|
||||
region->active_mask[global_index] = (region->active_mask[global_index] || new_region->active_mask[global_index]);
|
||||
|
||||
|
||||
ecl_region_invalidate_index_list( region );
|
||||
} else
|
||||
} else
|
||||
util_abort("%s: The two regions do not share grid - aborting \n",__func__);
|
||||
}
|
||||
|
||||
@@ -1255,9 +1334,9 @@ void ecl_region_subtract( ecl_region_type * region , const ecl_region_type * new
|
||||
int global_index;
|
||||
for (global_index = 0; global_index < region->grid_vol; global_index++)
|
||||
region->active_mask[global_index] &= !new_region->active_mask[global_index];
|
||||
|
||||
|
||||
ecl_region_invalidate_index_list( region );
|
||||
} else
|
||||
} else
|
||||
util_abort("%s: The two regions do not share grid - aborting \n",__func__);
|
||||
}
|
||||
|
||||
@@ -1266,16 +1345,16 @@ void ecl_region_subtract( ecl_region_type * region , const ecl_region_type * new
|
||||
Will update the selection in @region to seselect the elements which
|
||||
are either in region or new_region:
|
||||
|
||||
A ^= B
|
||||
A ^= B
|
||||
*/
|
||||
void ecl_region_xor( ecl_region_type * region , const ecl_region_type * new_region) {
|
||||
if (region->parent_grid == new_region->parent_grid) {
|
||||
int global_index;
|
||||
for (global_index = 0; global_index < region->grid_vol; global_index++)
|
||||
region->active_mask[global_index] ^= !new_region->active_mask[global_index];
|
||||
|
||||
|
||||
ecl_region_invalidate_index_list( region );
|
||||
} else
|
||||
} else
|
||||
util_abort("%s: The two regions do not share grid - aborting \n",__func__);
|
||||
}
|
||||
|
||||
@@ -1289,16 +1368,16 @@ const int_vector_type * ecl_region_get_kw_index_list( ecl_region_type * ecl_regi
|
||||
int grid_active = ecl_grid_get_active_size( ecl_region->parent_grid );
|
||||
int grid_global = ecl_grid_get_global_size( ecl_region->parent_grid );
|
||||
|
||||
if (kw_size == grid_active)
|
||||
if (kw_size == grid_active)
|
||||
index_set = ecl_region_get_active_list( ecl_region );
|
||||
else if (kw_size == grid_global) {
|
||||
if (force_active)
|
||||
index_set = ecl_region_get_global_active_list( ecl_region );
|
||||
else
|
||||
index_set = ecl_region_get_global_list( ecl_region );
|
||||
} else
|
||||
util_abort("%s: size mismatch: grid_active:%d grid_global:%d kw_size:%d \n",__func__ , grid_active , grid_global , kw_size);
|
||||
|
||||
} else
|
||||
util_abort("%s: size mismatch: grid_active:%d grid_global:%d kw_size:%d \n",__func__ , grid_active , grid_global , kw_size);
|
||||
|
||||
return index_set;
|
||||
}
|
||||
|
||||
|
69
ThirdParty/Ert/devel/libecl/src/ecl_rsthead.c
vendored
69
ThirdParty/Ert/devel/libecl/src/ecl_rsthead.c
vendored
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_rsthead.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.
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_rsthead.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.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -31,8 +31,8 @@ static time_t rsthead_date( int day , int month , int year) {
|
||||
|
||||
|
||||
time_t ecl_rsthead_date( const ecl_kw_type * intehead_kw ) {
|
||||
return rsthead_date( ecl_kw_iget_int( intehead_kw , INTEHEAD_DAY_INDEX) ,
|
||||
ecl_kw_iget_int( intehead_kw , INTEHEAD_MONTH_INDEX) ,
|
||||
return rsthead_date( ecl_kw_iget_int( intehead_kw , INTEHEAD_DAY_INDEX) ,
|
||||
ecl_kw_iget_int( intehead_kw , INTEHEAD_MONTH_INDEX) ,
|
||||
ecl_kw_iget_int( intehead_kw , INTEHEAD_YEAR_INDEX) );
|
||||
}
|
||||
|
||||
@@ -46,48 +46,47 @@ double ecl_rsthead_get_sim_days( const ecl_rsthead_type * header ) {
|
||||
ecl_rsthead_type * ecl_rsthead_ialloc( const ecl_file_type * rst_file , int occurence) {
|
||||
if (ecl_file_get_num_named_kw( rst_file , INTEHEAD_KW) > occurence) {
|
||||
const ecl_kw_type * intehead_kw = ecl_file_iget_named_kw( rst_file , INTEHEAD_KW , occurence);
|
||||
|
||||
const ecl_kw_type * doubhead_kw = ecl_file_iget_named_kw( rst_file , DOUBHEAD_KW , occurence);
|
||||
|
||||
ecl_rsthead_type * rsthead = util_malloc( sizeof * rsthead );
|
||||
|
||||
|
||||
{
|
||||
const int * data = (const int *) ecl_kw_get_void_ptr( intehead_kw );
|
||||
|
||||
|
||||
rsthead->day = data[INTEHEAD_DAY_INDEX];
|
||||
rsthead->month = data[INTEHEAD_MONTH_INDEX];
|
||||
rsthead->year = data[INTEHEAD_YEAR_INDEX];
|
||||
rsthead->version = data[INTEHEAD_IPROG_INDEX];
|
||||
rsthead->phase_sum = data[INTEHEAD_PHASE_INDEX];
|
||||
|
||||
|
||||
rsthead->nx = data[INTEHEAD_NX_INDEX];
|
||||
rsthead->ny = data[INTEHEAD_NY_INDEX];
|
||||
rsthead->nz = data[INTEHEAD_NZ_INDEX];
|
||||
rsthead->nactive = data[INTEHEAD_NACTIVE_INDEX];
|
||||
|
||||
|
||||
rsthead->nwells = data[INTEHEAD_NWELLS_INDEX];
|
||||
rsthead->niwelz = data[INTEHEAD_NIWELZ_INDEX];
|
||||
rsthead->nzwelz = data[INTEHEAD_NZWELZ_INDEX];
|
||||
|
||||
|
||||
rsthead->nsconz = data[INTEHEAD_NSCONZ_INDEX];
|
||||
rsthead->niconz = data[INTEHEAD_NICONZ_INDEX];
|
||||
rsthead->ncwmax = data[INTEHEAD_NCWMAX_INDEX];
|
||||
|
||||
|
||||
rsthead->nisegz = data[INTEHEAD_NISEGZ_INDEX];
|
||||
rsthead->nsegmx = data[INTEHEAD_NSEGMX_INDEX];
|
||||
rsthead->nswlmx = data[INTEHEAD_NSWLMX_INDEX];
|
||||
rsthead->nrsegz = data[INTEHEAD_NRSEGZ_INDEX];
|
||||
|
||||
|
||||
// The only derived quantity
|
||||
rsthead->sim_time = rsthead_date( rsthead->day , rsthead->month , rsthead->year );
|
||||
}
|
||||
rsthead->sim_days = ecl_kw_iget_double( doubhead_kw , DOUBHEAD_DAYS_INDEX );
|
||||
if (ecl_file_get_num_named_kw(rst_file, LOGIHEAD_KW) > occurence) {
|
||||
const ecl_kw_type * logihead_kw = ecl_file_iget_named_kw( rst_file , LOGIHEAD_KW , occurence);
|
||||
rsthead->dualp = ecl_kw_iget_bool( logihead_kw , LOGIHEAD_DUALP_INDEX);
|
||||
} else
|
||||
rsthead->dualp = false;
|
||||
|
||||
if ( ecl_file_get_num_named_kw(rst_file, LOGIHEAD_KW) > occurence
|
||||
&& ecl_file_get_num_named_kw(rst_file, DOUBHEAD_KW) > occurence){
|
||||
const ecl_kw_type * logihead_kw = ecl_file_iget_named_kw(rst_file, LOGIHEAD_KW, occurence);
|
||||
const ecl_kw_type * doubhead_kw = ecl_file_iget_named_kw(rst_file, DOUBHEAD_KW, occurence);
|
||||
|
||||
rsthead->dualp = ecl_kw_iget_bool(logihead_kw, LOGIHEAD_DUALP_INDEX);
|
||||
rsthead->sim_days = ecl_kw_iget_double(doubhead_kw, DOUBHEAD_DAYS_INDEX);
|
||||
}
|
||||
|
||||
return rsthead;
|
||||
} else
|
||||
@@ -183,9 +182,9 @@ void ecl_rsthead_fprintf_struct( const ecl_rsthead_type * header , FILE * stream
|
||||
fprintf(stream , ".nz = %d,\n",header->nz);
|
||||
fprintf(stream , ".nactive = %d,\n",header->nactive);
|
||||
fprintf(stream , ".nwells = %d,\n",header->nwells);
|
||||
fprintf(stream , ".niwelz = %d,\n",header->niwelz);
|
||||
fprintf(stream , ".niwelz = %d,\n",header->niwelz);
|
||||
fprintf(stream , ".nzwelz = %d,\n",header->nzwelz);
|
||||
fprintf(stream , ".niconz = %d,\n",header->niconz);
|
||||
fprintf(stream , ".niconz = %d,\n",header->niconz);
|
||||
fprintf(stream , ".ncwmax = %d,\n",header->ncwmax);
|
||||
fprintf(stream , ".nisegz = %d,\n",header->nisegz);
|
||||
fprintf(stream , ".nsegmx = %d,\n",header->nsegmx);
|
||||
|
100
ThirdParty/Ert/devel/libecl/src/ecl_smspec.c
vendored
100
ThirdParty/Ert/devel/libecl/src/ecl_smspec.c
vendored
@@ -120,6 +120,7 @@ struct ecl_smspec_struct {
|
||||
|
||||
/*-----------------------------------------------------------------*/
|
||||
|
||||
int time_seconds;
|
||||
int grid_dims[3]; /* Grid dimensions - in DIMENS[1,2,3] */
|
||||
int num_regions;
|
||||
int Nwells , param_offset;
|
||||
@@ -258,11 +259,12 @@ static ecl_smspec_type * ecl_smspec_alloc_empty(bool write_mode , const char * k
|
||||
|
||||
ecl_smspec->smspec_nodes = vector_alloc_new();
|
||||
|
||||
ecl_smspec->time_index = -1;
|
||||
ecl_smspec->day_index = -1;
|
||||
ecl_smspec->year_index = -1;
|
||||
ecl_smspec->month_index = -1;
|
||||
ecl_smspec->locked = false;
|
||||
ecl_smspec->time_index = -1;
|
||||
ecl_smspec->day_index = -1;
|
||||
ecl_smspec->year_index = -1;
|
||||
ecl_smspec->month_index = -1;
|
||||
ecl_smspec->locked = false;
|
||||
ecl_smspec->time_seconds = -1;
|
||||
|
||||
ecl_smspec->index_map = int_vector_alloc(0,0);
|
||||
ecl_smspec->restart_list = stringlist_alloc_new();
|
||||
@@ -432,7 +434,7 @@ void ecl_smspec_fwrite( const ecl_smspec_type * smspec , const char * ecl_case ,
|
||||
free( filename );
|
||||
}
|
||||
|
||||
ecl_smspec_type * ecl_smspec_alloc_writer( const char * key_join_string , time_t sim_start , int nx , int ny , int nz) {
|
||||
ecl_smspec_type * ecl_smspec_alloc_writer( const char * key_join_string , time_t sim_start , bool time_in_days , int nx , int ny , int nz) {
|
||||
ecl_smspec_type * ecl_smspec = ecl_smspec_alloc_empty( true , key_join_string );
|
||||
|
||||
ecl_smspec->grid_dims[0] = nx;
|
||||
@@ -441,15 +443,31 @@ ecl_smspec_type * ecl_smspec_alloc_writer( const char * key_join_string , time_t
|
||||
ecl_smspec->sim_start_time = sim_start;
|
||||
|
||||
{
|
||||
smspec_node_type * time_node = smspec_node_alloc( ECL_SMSPEC_MISC_VAR ,
|
||||
NULL ,
|
||||
"TIME" ,
|
||||
"DAYS" , // There are significant hardcoded assumptions of days around; would have been cool to be able to set seconds.
|
||||
key_join_string ,
|
||||
ecl_smspec->grid_dims ,
|
||||
0 ,
|
||||
-1 ,
|
||||
0 );
|
||||
smspec_node_type * time_node;
|
||||
if (time_in_days) {
|
||||
time_node = smspec_node_alloc( ECL_SMSPEC_MISC_VAR ,
|
||||
NULL ,
|
||||
"TIME" ,
|
||||
"DAYS" ,
|
||||
key_join_string ,
|
||||
ecl_smspec->grid_dims ,
|
||||
0 ,
|
||||
-1 ,
|
||||
0 );
|
||||
ecl_smspec->time_seconds = 3600 * 24;
|
||||
} else {
|
||||
time_node = smspec_node_alloc( ECL_SMSPEC_MISC_VAR ,
|
||||
NULL ,
|
||||
"TIME" ,
|
||||
"HOURS" ,
|
||||
key_join_string ,
|
||||
ecl_smspec->grid_dims ,
|
||||
0 ,
|
||||
-1 ,
|
||||
0 );
|
||||
ecl_smspec->time_seconds = 3600;
|
||||
}
|
||||
|
||||
ecl_smspec_add_node( ecl_smspec , time_node );
|
||||
ecl_smspec->time_index = smspec_node_get_params_index( time_node );
|
||||
}
|
||||
@@ -500,7 +518,6 @@ static ecl_smspec_var_type ecl_smspec_identify_special_var( const char * var ) {
|
||||
|
||||
ecl_smspec_var_type ecl_smspec_identify_var_type(const char * var) {
|
||||
ecl_smspec_var_type var_type = ecl_smspec_identify_special_var( var );
|
||||
int str_length = strlen(var);
|
||||
if (var_type == ECL_SMSPEC_INVALID_VAR) {
|
||||
switch(var[0]) {
|
||||
case('A'):
|
||||
@@ -544,12 +561,30 @@ ecl_smspec_var_type ecl_smspec_identify_var_type(const char * var) {
|
||||
var_type = ECL_SMSPEC_NETWORK_VAR;
|
||||
break;
|
||||
case('R'):
|
||||
if (((3 == str_length) && var[2] == 'F') ||
|
||||
((4 == str_length) && var[3] == 'F')) {
|
||||
var_type = ECL_SMSPEC_REGION_2_REGION_VAR;
|
||||
}
|
||||
else {
|
||||
var_type = ECL_SMSPEC_REGION_VAR;
|
||||
{
|
||||
/*
|
||||
The distinction between region-to-region variables and plain
|
||||
region variables is less than clear: The current
|
||||
interpretation is that the cases:
|
||||
|
||||
1. Any variable matching:
|
||||
|
||||
a) Starts with 'R'
|
||||
b) Has 'F' as the third character
|
||||
|
||||
2. The variable "RNLF"
|
||||
|
||||
Get variable type ECL_SMSPEC_REGION_2_REGION_VAR. The rest
|
||||
get the type ECL_SMSPEC_REGION_VAR.
|
||||
*/
|
||||
|
||||
if (util_string_equal( var , "RNLF"))
|
||||
var_type = ECL_SMSPEC_REGION_2_REGION_VAR;
|
||||
else if (var[2] == 'F')
|
||||
var_type = ECL_SMSPEC_REGION_2_REGION_VAR;
|
||||
else
|
||||
var_type = ECL_SMSPEC_REGION_VAR;
|
||||
|
||||
}
|
||||
break;
|
||||
case('S'):
|
||||
@@ -1166,8 +1201,18 @@ ecl_smspec_type * ecl_smspec_fread_alloc(const char *header_file, const char * k
|
||||
|
||||
if (ecl_smspec_fread_header(ecl_smspec , header_file , include_restart)) {
|
||||
|
||||
if (hash_has_key( ecl_smspec->misc_var_index , "TIME"))
|
||||
ecl_smspec->time_index = smspec_node_get_params_index( hash_get(ecl_smspec->misc_var_index , "TIME") );
|
||||
if (hash_has_key( ecl_smspec->misc_var_index , "TIME")) {
|
||||
const smspec_node_type * time_node = hash_get(ecl_smspec->misc_var_index , "TIME");
|
||||
const char * time_unit = smspec_node_get_unit( time_node );
|
||||
ecl_smspec->time_index = smspec_node_get_params_index( time_node );
|
||||
|
||||
if (util_string_equal( time_unit , "DAYS"))
|
||||
ecl_smspec->time_seconds = 3600 * 24;
|
||||
else if (util_string_equal( time_unit , "HOURS"))
|
||||
ecl_smspec->time_seconds = 3600;
|
||||
else
|
||||
util_abort("%s: time_unit:%s not recognized \n",__func__ , time_unit);
|
||||
}
|
||||
|
||||
if (hash_has_key(ecl_smspec->misc_var_index , "DAY")) {
|
||||
ecl_smspec->day_index = smspec_node_get_params_index( hash_get(ecl_smspec->misc_var_index , "DAY") );
|
||||
@@ -1549,6 +1594,10 @@ const char * ecl_smspec_get_general_var_unit( const ecl_smspec_type * ecl_smspec
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
int ecl_smspec_get_time_seconds( const ecl_smspec_type * ecl_smspec ) {
|
||||
return ecl_smspec->time_seconds;
|
||||
}
|
||||
|
||||
int ecl_smspec_get_time_index( const ecl_smspec_type * ecl_smspec ) {
|
||||
return ecl_smspec->time_index;
|
||||
}
|
||||
@@ -1601,9 +1650,6 @@ void ecl_smspec_free__(void * __ecl_smspec) {
|
||||
ecl_smspec_free( ecl_smspec );
|
||||
}
|
||||
|
||||
int ecl_smspec_get_sim_days_index( const ecl_smspec_type * smspec ) {
|
||||
return smspec->time_index;
|
||||
}
|
||||
|
||||
int ecl_smspec_get_date_day_index( const ecl_smspec_type * smspec ) {
|
||||
return smspec->day_index;
|
||||
|
17
ThirdParty/Ert/devel/libecl/src/ecl_sum.c
vendored
17
ThirdParty/Ert/devel/libecl/src/ecl_sum.c
vendored
@@ -284,17 +284,17 @@ smspec_node_type * ecl_sum_add_blank_var( ecl_sum_type * ecl_sum , float default
|
||||
|
||||
|
||||
|
||||
ecl_sum_tstep_type * ecl_sum_add_tstep( ecl_sum_type * ecl_sum , int report_step , double sim_days) {
|
||||
return ecl_sum_data_add_new_tstep( ecl_sum->data , report_step , sim_days );
|
||||
ecl_sum_tstep_type * ecl_sum_add_tstep( ecl_sum_type * ecl_sum , int report_step , double sim_seconds) {
|
||||
return ecl_sum_data_add_new_tstep( ecl_sum->data , report_step , sim_seconds );
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
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 , bool time_in_days , int nx , int ny , int nz) {
|
||||
ecl_sum_type * ecl_sum = ecl_sum_alloc__( ecl_case , key_join_string );
|
||||
ecl_sum_set_unified( ecl_sum , unified );
|
||||
ecl_sum_set_fmt_case( ecl_sum , fmt_output );
|
||||
|
||||
ecl_sum->smspec = ecl_smspec_alloc_writer( key_join_string , sim_start , nx , ny , nz );
|
||||
ecl_sum->smspec = ecl_smspec_alloc_writer( key_join_string , sim_start , time_in_days , nx , ny , nz );
|
||||
ecl_sum->data = ecl_sum_data_alloc_writer( ecl_sum->smspec );
|
||||
|
||||
return ecl_sum;
|
||||
@@ -884,12 +884,17 @@ void ecl_sum_fmt_init_csv( ecl_sum_fmt_type * fmt ) {
|
||||
|
||||
|
||||
|
||||
void ecl_sum_fmt_init_summary_x( ecl_sum_fmt_type * fmt ) {
|
||||
void ecl_sum_fmt_init_summary_x( const ecl_sum_type * ecl_sum , ecl_sum_fmt_type * fmt ) {
|
||||
fmt->locale = NULL;
|
||||
fmt->sep = "";
|
||||
fmt->date_fmt = "%d/%m/%Y ";
|
||||
fmt->value_fmt = " %15.6g ";
|
||||
fmt->days_fmt = "%7.2f ";
|
||||
|
||||
if (util_string_equal( ecl_sum_get_unit( ecl_sum , "TIME") , "DAYS"))
|
||||
fmt->days_fmt = "%7.2f ";
|
||||
else
|
||||
fmt->days_fmt = "%7.4f ";
|
||||
|
||||
fmt->header_fmt = " %15s ";
|
||||
|
||||
fmt->newline = "\n";
|
||||
|
@@ -798,9 +798,9 @@ static void ecl_sum_data_build_index( ecl_sum_data_type * sum_data ) {
|
||||
ecl_sum_tstep_iset() to set elements in the tstep.
|
||||
*/
|
||||
|
||||
ecl_sum_tstep_type * ecl_sum_data_add_new_tstep( ecl_sum_data_type * data , int report_step , double sim_days) {
|
||||
ecl_sum_tstep_type * ecl_sum_data_add_new_tstep( ecl_sum_data_type * data , int report_step , double sim_seconds) {
|
||||
int ministep_nr = vector_get_size( data->data );
|
||||
ecl_sum_tstep_type * tstep = ecl_sum_tstep_alloc_new( report_step , ministep_nr , sim_days , data->smspec );
|
||||
ecl_sum_tstep_type * tstep = ecl_sum_tstep_alloc_new( report_step , ministep_nr , sim_seconds , data->smspec );
|
||||
ecl_sum_tstep_type * prev_tstep = NULL;
|
||||
|
||||
if (vector_get_size( data->data ) > 0)
|
||||
|
96
ThirdParty/Ert/devel/libecl/src/ecl_sum_tstep.c
vendored
96
ThirdParty/Ert/devel/libecl/src/ecl_sum_tstep.c
vendored
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2012 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_sum_tstep.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.
|
||||
Copyright (C) 2012 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_sum_tstep.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.
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
@@ -35,19 +35,19 @@
|
||||
summary information for all summary vectors at one instant in
|
||||
time. If we view the summary data as this:
|
||||
|
||||
|
||||
Header direction: ecl_smspec DAYS WWCT:OP_3 FOPT BPR:15,10,25
|
||||
|
||||
Header direction: ecl_smspec DAYS WWCT:OP_3 FOPT BPR:15,10,25
|
||||
--------------------------------------------
|
||||
/|\ 0.00 0.00 0.00 256.00 <-- One timestep ecl_sum_tstep
|
||||
| 10.00 0.56 10.00 255.00
|
||||
Time direction: ecl_sum_data 20.00 0.61 18.70 253.00
|
||||
| 30.00 0.63 21.20 251.00
|
||||
| ...
|
||||
\|/ 90.00 0.80 39.70 244.00
|
||||
\|/ 90.00 0.80 39.70 244.00
|
||||
--------------------------------------------
|
||||
|
||||
The ecl_sum_tstep structure corresponds to one 'horizontal line' in
|
||||
the summary data.
|
||||
the summary data.
|
||||
|
||||
These timesteps correspond exactly to the simulators timesteps,
|
||||
i.e. when convergence is poor they are closely spaced. In the
|
||||
@@ -59,13 +59,13 @@ Header direction: ecl_smspec DAYS WWCT:OP_3 FOPT BPR:15,10,25
|
||||
struct ecl_sum_tstep_struct {
|
||||
UTIL_TYPE_ID_DECLARATION;
|
||||
float * data; /* A memcpy copy of the PARAMS vector in ecl_kw instance - the raw data. */
|
||||
time_t sim_time; /* The true time (i.e. 20.th of october 2010) of corresponding to this timestep. */
|
||||
time_t sim_time; /* The true time (i.e. 20.th of october 2010) of corresponding to this timestep. */
|
||||
int ministep; /* The ECLIPSE internal time-step number; one ministep per numerical timestep. */
|
||||
int report_step; /* The report step this time-step is part of - in general there can be many timestep for each report step. */
|
||||
double sim_days; /* Accumulated simulation time up to this ministep. */
|
||||
double sim_seconds; /* Accumulated simulation time up to this ministep. */
|
||||
int data_size; /* Number of elements in data - only used for checking indices. */
|
||||
int internal_index; /* Used for lookups of the next / previous ministep based on an existing ministep. */
|
||||
const ecl_smspec_type * smspec; /* The smespec header information for this tstep - must be compatible. */
|
||||
const ecl_smspec_type * smspec; /* The smespec header information for this tstep - must be compatible. */
|
||||
};
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ static ecl_sum_tstep_type * ecl_sum_tstep_alloc( int report_step , int ministep_
|
||||
tstep->report_step = report_step;
|
||||
tstep->ministep = ministep_nr;
|
||||
tstep->data_size = ecl_smspec_get_params_size( smspec );
|
||||
tstep->data = util_calloc( tstep->data_size , sizeof * tstep->data );
|
||||
tstep->data = util_calloc( tstep->data_size , sizeof * tstep->data );
|
||||
return tstep;
|
||||
}
|
||||
|
||||
@@ -106,13 +106,14 @@ void ecl_sum_tstep_free__( void * __ministep) {
|
||||
element like e.g. the FOPT or GGPR:NAME - on the other hand the
|
||||
time information is strictly required and the summary file will
|
||||
fall to pieces if it is missing.
|
||||
|
||||
|
||||
The time can be provided in using (at least) two different
|
||||
keywords:
|
||||
|
||||
DAYS: The data vector will contain the number of days since the
|
||||
simulation start.
|
||||
|
||||
DAYS/HOURS: The data vector will contain the number of
|
||||
days/hours since the simulation start (hours in the case
|
||||
of lab units).
|
||||
|
||||
DAY,MONTH,YEAR: The data vector will contain the true date of
|
||||
the tstep.
|
||||
|
||||
@@ -120,16 +121,16 @@ void ecl_sum_tstep_free__( void * __ministep) {
|
||||
will select the DAYS variety if both are present.
|
||||
*/
|
||||
|
||||
static void ecl_sum_tstep_set_time_info_from_days( ecl_sum_tstep_type * tstep , time_t sim_start , float sim_days) {
|
||||
tstep->sim_days = sim_days;
|
||||
static void ecl_sum_tstep_set_time_info_from_seconds( ecl_sum_tstep_type * tstep , time_t sim_start , float sim_seconds) {
|
||||
tstep->sim_seconds = sim_seconds;
|
||||
tstep->sim_time = sim_start;
|
||||
util_inplace_forward_days( &tstep->sim_time , tstep->sim_days );
|
||||
util_inplace_forward_seconds( &tstep->sim_time , tstep->sim_seconds );
|
||||
}
|
||||
|
||||
|
||||
static void ecl_sum_tstep_set_time_info_from_date( ecl_sum_tstep_type * tstep , time_t sim_start , time_t sim_time) {
|
||||
tstep->sim_time = sim_time;
|
||||
tstep->sim_days = util_difftime_days( sim_start , tstep->sim_time);
|
||||
tstep->sim_seconds = util_difftime_seconds( sim_start , tstep->sim_time);
|
||||
}
|
||||
|
||||
|
||||
@@ -137,21 +138,22 @@ static void ecl_sum_tstep_set_time_info( ecl_sum_tstep_type * tstep , const ecl_
|
||||
int date_day_index = ecl_smspec_get_date_day_index( smspec );
|
||||
int date_month_index = ecl_smspec_get_date_month_index( smspec );
|
||||
int date_year_index = ecl_smspec_get_date_year_index( smspec );
|
||||
int sim_days_index = ecl_smspec_get_sim_days_index( smspec );
|
||||
int sim_time_index = ecl_smspec_get_time_index( smspec );
|
||||
time_t sim_start = ecl_smspec_get_start_time( smspec );
|
||||
|
||||
if (sim_days_index >= 0) {
|
||||
float sim_days = tstep->data[ sim_days_index ];
|
||||
ecl_sum_tstep_set_time_info_from_days( tstep , sim_start , sim_days );
|
||||
if (sim_time_index >= 0) {
|
||||
float sim_time = tstep->data[ sim_time_index ];
|
||||
double sim_seconds = sim_time * ecl_smspec_get_time_seconds( smspec );
|
||||
ecl_sum_tstep_set_time_info_from_seconds( tstep , sim_start , sim_seconds );
|
||||
} else if ( date_day_index >= 0) {
|
||||
int sec = 0;
|
||||
int min = 0;
|
||||
int hour = 0;
|
||||
|
||||
|
||||
int day = util_roundf(tstep->data[date_day_index]);
|
||||
int month = util_roundf(tstep->data[date_month_index]);
|
||||
int year = util_roundf(tstep->data[date_year_index]);
|
||||
|
||||
|
||||
time_t sim_time = util_make_datetime(sec , min , hour , day , month , year);
|
||||
ecl_sum_tstep_set_time_info_from_date( tstep , sim_start , sim_time );
|
||||
} else
|
||||
@@ -169,19 +171,19 @@ static void ecl_sum_tstep_set_time_info( ecl_sum_tstep_type * tstep , const ecl_
|
||||
|
||||
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_kw_type * params_kw ,
|
||||
const char * src_file ,
|
||||
const ecl_smspec_type * smspec) {
|
||||
|
||||
int data_size = ecl_kw_get_size( params_kw );
|
||||
|
||||
|
||||
if (data_size == ecl_smspec_get_params_size( smspec )) {
|
||||
ecl_sum_tstep_type * ministep = ecl_sum_tstep_alloc( report_step , ministep_nr , smspec);
|
||||
ecl_kw_get_memcpy_data( params_kw , ministep->data );
|
||||
ecl_sum_tstep_set_time_info( ministep , smspec );
|
||||
return ministep;
|
||||
} else {
|
||||
/*
|
||||
/*
|
||||
This is actually a fatal error / bug; the difference in smspec
|
||||
header structure should have been detected already in the
|
||||
ecl_smspec_load_restart() function and the restart case
|
||||
@@ -197,13 +199,13 @@ ecl_sum_tstep_type * ecl_sum_tstep_alloc_from_file( int report_step ,
|
||||
Should be called in write mode.
|
||||
*/
|
||||
|
||||
ecl_sum_tstep_type * ecl_sum_tstep_alloc_new( int report_step , int ministep , float sim_days , const ecl_smspec_type * smspec ) {
|
||||
ecl_sum_tstep_type * ecl_sum_tstep_alloc_new( int report_step , int ministep , float sim_seconds , const ecl_smspec_type * smspec ) {
|
||||
ecl_sum_tstep_type * tstep = ecl_sum_tstep_alloc( report_step , ministep , smspec );
|
||||
const float_vector_type * default_data = ecl_smspec_get_params_default( smspec );
|
||||
float_vector_memcpy_data( tstep->data , default_data );
|
||||
|
||||
ecl_sum_tstep_set_time_info_from_days( tstep , ecl_smspec_get_start_time( smspec ) , sim_days );
|
||||
ecl_sum_tstep_iset( tstep , ecl_smspec_get_time_index( smspec ) , sim_days );
|
||||
ecl_sum_tstep_set_time_info_from_seconds( tstep , ecl_smspec_get_start_time( smspec ) , sim_seconds );
|
||||
ecl_sum_tstep_iset( tstep , ecl_smspec_get_time_index( smspec ) , sim_seconds / ecl_smspec_get_time_seconds( smspec ) );
|
||||
return tstep;
|
||||
}
|
||||
|
||||
@@ -226,7 +228,11 @@ 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) {
|
||||
return ministep->sim_days;
|
||||
return ministep->sim_seconds / (24 * 3600);
|
||||
}
|
||||
|
||||
double ecl_sum_tstep_get_sim_seconds(const ecl_sum_tstep_type * ministep) {
|
||||
return ministep->sim_seconds;
|
||||
}
|
||||
|
||||
int ecl_sum_tstep_get_report(const ecl_sum_tstep_type * ministep) {
|
||||
|
181
ThirdParty/Ert/devel/libecl/src/fault_block.c
vendored
181
ThirdParty/Ert/devel/libecl/src/fault_block.c
vendored
@@ -1,25 +1,27 @@
|
||||
/*
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'fault_block.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.
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'fault_block.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.
|
||||
*/
|
||||
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
|
||||
#include <ert/geometry/geo_util.h>
|
||||
#include <ert/geometry/geo_polygon.h>
|
||||
#include <ert/geometry/geo_polygon_collection.h>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
@@ -55,7 +57,7 @@ static fault_block_type * fault_block_alloc( const fault_block_layer_type * pare
|
||||
block->grid = fault_block_layer_get_grid( parent_layer );
|
||||
block->k = fault_block_layer_get_k( parent_layer );
|
||||
block->block_id = block_id;
|
||||
|
||||
|
||||
block->i_list = int_vector_alloc(0,0);
|
||||
block->j_list = int_vector_alloc(0,0);
|
||||
block->global_index_list = int_vector_alloc(0,0);
|
||||
@@ -66,7 +68,7 @@ static fault_block_type * fault_block_alloc( const fault_block_layer_type * pare
|
||||
|
||||
|
||||
int fault_block_get_size( const fault_block_type * block ) {
|
||||
return int_vector_size( block->i_list );
|
||||
return int_vector_size( block->i_list );
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +122,7 @@ static void fault_block_assert_center( fault_block_type * fault_block ) {
|
||||
int index;
|
||||
double xc = 0;
|
||||
double yc = 0;
|
||||
|
||||
|
||||
for (index = 0; index < int_vector_size( fault_block->i_list ); index++) {
|
||||
int i = int_vector_iget( fault_block->i_list , index);
|
||||
int j = int_vector_iget( fault_block->j_list , index);
|
||||
@@ -131,7 +133,7 @@ static void fault_block_assert_center( fault_block_type * fault_block ) {
|
||||
xc += x;
|
||||
yc += y;
|
||||
}
|
||||
|
||||
|
||||
fault_block->xc = xc / int_vector_size( fault_block->i_list );
|
||||
fault_block->yc = yc / int_vector_size( fault_block->i_list );
|
||||
}
|
||||
@@ -184,71 +186,114 @@ bool fault_block_trace_edge( const fault_block_type * block , double_vector_type
|
||||
{
|
||||
int start_i = fault_block_iget_i( block , 0 );
|
||||
int start_j = fault_block_iget_j( block , 0 );
|
||||
|
||||
|
||||
layer_trace_block_edge(fault_block_layer_get_layer( block->parent_layer ) , start_i , start_j , block->block_id , corner_list , cell_list);
|
||||
}
|
||||
|
||||
double_vector_reset( x_list );
|
||||
double_vector_reset( y_list );
|
||||
for (c=0; c < struct_vector_get_size( corner_list ); c++) {
|
||||
double x,y,z;
|
||||
int_point2d_type ij;
|
||||
struct_vector_iget( corner_list , c , &ij );
|
||||
|
||||
ecl_grid_get_corner_xyz( block->grid , ij.i , ij.j , block->k , &x , &y , &z);
|
||||
double_vector_append( x_list , x);
|
||||
double_vector_append( y_list , y);
|
||||
|
||||
if (x_list && y_list) {
|
||||
double_vector_reset( x_list );
|
||||
double_vector_reset( y_list );
|
||||
for (c=0; c < struct_vector_get_size( corner_list ); c++) {
|
||||
double x,y,z;
|
||||
int_point2d_type ij;
|
||||
struct_vector_iget( corner_list , c , &ij );
|
||||
|
||||
ecl_grid_get_corner_xyz( block->grid , ij.i , ij.j , block->k , &x , &y , &z);
|
||||
double_vector_append( x_list , x);
|
||||
double_vector_append( y_list , y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct_vector_free( corner_list );
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool fault_block_neighbour_xpolyline( const fault_block_type * block , int i1, int j1, int i2 , int j2, const geo_polygon_collection_type * polylines) {
|
||||
int g1 = ecl_grid_get_global_index3( block->grid , i1 , j1 , block->k );
|
||||
int g2 = ecl_grid_get_global_index3( block->grid , i2 , j2 , block->k );
|
||||
double x1,y1,z1;
|
||||
double x2,y2,z2;
|
||||
|
||||
ecl_grid_get_xyz1( block->grid , g1 , &x1 , &y1 , &z1);
|
||||
ecl_grid_get_xyz1( block->grid , g2 , &x2 , &y2 , &z2);
|
||||
|
||||
void fault_block_list_neighbours( const fault_block_type * block, int_vector_type * neighbour_list) {
|
||||
int_vector_reset( neighbour_list );
|
||||
{
|
||||
int_vector_type * cell_list = int_vector_alloc(0,0);
|
||||
double_vector_type * x_list = double_vector_alloc(0,0);
|
||||
double_vector_type * y_list = double_vector_alloc(0,0);
|
||||
int polyline_index = 0;
|
||||
bool intersection = false;
|
||||
while (true) {
|
||||
if (polyline_index >= geo_polygon_collection_size(polylines))
|
||||
break;
|
||||
|
||||
fault_block_trace_edge( block , x_list , y_list , cell_list );
|
||||
{
|
||||
int c;
|
||||
layer_type * layer = fault_block_layer_get_layer( block->parent_layer );
|
||||
for (c = 0; c < int_vector_size( cell_list ); c++) {
|
||||
int j = int_vector_iget( cell_list , c) / layer_get_nx(layer);
|
||||
int i = int_vector_iget( cell_list , c) % layer_get_nx(layer);
|
||||
|
||||
if (i > 0) {
|
||||
int neighbour_id = layer_iget_cell_value(layer , i - 1, j);
|
||||
int_vector_append( neighbour_list , neighbour_id );
|
||||
}
|
||||
|
||||
if (i < (layer_get_nx( layer) - 1)) {
|
||||
int neighbour_id = layer_iget_cell_value(layer , i + 1, j);
|
||||
int_vector_append( neighbour_list , neighbour_id );
|
||||
}
|
||||
|
||||
if (j > 0) {
|
||||
int neighbour_id = layer_iget_cell_value(layer , i, j - 1);
|
||||
int_vector_append( neighbour_list , neighbour_id );
|
||||
}
|
||||
|
||||
if (j < (layer_get_ny( layer) - 1)) {
|
||||
int neighbour_id = layer_iget_cell_value(layer , i, j + 1);
|
||||
int_vector_append( neighbour_list , neighbour_id );
|
||||
{
|
||||
const geo_polygon_type * polyline = geo_polygon_collection_iget_polygon( polylines , polyline_index );
|
||||
if (geo_polygon_segment_intersects( polyline , x1,y1,x2,y2 )) {
|
||||
intersection = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
polyline_index++;
|
||||
}
|
||||
|
||||
return intersection;
|
||||
}
|
||||
}
|
||||
|
||||
double_vector_free( x_list );
|
||||
double_vector_free( y_list );
|
||||
int_vector_free( cell_list );
|
||||
|
||||
static bool fault_block_connected_neighbour( const fault_block_type * block , int i1 , int j1 , int i2 , int j2 , bool connected_only , const geo_polygon_collection_type * polylines ) {
|
||||
const layer_type * layer = fault_block_layer_get_layer( block->parent_layer );
|
||||
if ((i2 < 0) || (i2 >= layer_get_nx( layer )))
|
||||
return false;
|
||||
|
||||
if ((j2 < 0) || (j2 >= layer_get_ny( layer )))
|
||||
return false;
|
||||
|
||||
/*
|
||||
Inactive cells do "not exist" - can not be connected neighbour
|
||||
with an inactive cell.
|
||||
*/
|
||||
if (!ecl_grid_cell_active3( block->grid , i2,j2,block->k))
|
||||
return false;
|
||||
|
||||
{
|
||||
int cell_id = layer_iget_cell_value( layer , i1 , j1 );
|
||||
int neighbour_id = layer_iget_cell_value(layer , i2 , j2);
|
||||
if (cell_id == neighbour_id)
|
||||
return false;
|
||||
|
||||
if (!connected_only)
|
||||
return true;
|
||||
|
||||
return (layer_cell_contact( layer , i1 , j1 , i2 , j2) && !fault_block_neighbour_xpolyline( block , i1,j1,i2,j2,polylines ));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void fault_block_list_neighbours( const fault_block_type * block, bool connected_only , const geo_polygon_collection_type * polylines , int_vector_type * neighbour_list) {
|
||||
int_vector_reset( neighbour_list );
|
||||
{
|
||||
int c;
|
||||
layer_type * layer = fault_block_layer_get_layer( block->parent_layer );
|
||||
for (c = 0; c < int_vector_size( block->i_list ); c++) {
|
||||
int i = int_vector_iget( block->i_list , c);
|
||||
int j = int_vector_iget( block->j_list , c);
|
||||
|
||||
if (fault_block_connected_neighbour( block , i , j , i - 1 , j , connected_only , polylines ))
|
||||
int_vector_append( neighbour_list , layer_iget_cell_value( layer , i - 1 , j));
|
||||
|
||||
if (fault_block_connected_neighbour( block , i , j , i + 1 , j , connected_only , polylines ))
|
||||
int_vector_append( neighbour_list , layer_iget_cell_value( layer , i + 1 , j));
|
||||
|
||||
if (fault_block_connected_neighbour( block , i , j , i , j - 1, connected_only , polylines ))
|
||||
int_vector_append( neighbour_list , layer_iget_cell_value( layer , i , j - 1));
|
||||
|
||||
if (fault_block_connected_neighbour( block , i , j , i , j + 1, connected_only , polylines ))
|
||||
int_vector_append( neighbour_list , layer_iget_cell_value( layer , i , j + 1));
|
||||
|
||||
}
|
||||
}
|
||||
int_vector_select_unique( neighbour_list );
|
||||
int_vector_del_value( neighbour_list , 0 );
|
||||
@@ -259,9 +304,9 @@ void fault_block_list_neighbours( const fault_block_type * block, int_vector_typ
|
||||
|
||||
void fault_block_copy_content(fault_block_type * target_block , const fault_block_type * src_block ) {
|
||||
int b;
|
||||
for (b = 0; b < int_vector_size( src_block->i_list ); b++)
|
||||
for (b = 0; b < int_vector_size( src_block->i_list ); b++)
|
||||
fault_block_add_cell( target_block , int_vector_iget( src_block->i_list , b) , int_vector_iget( src_block->j_list , b));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'fault_block_layer.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.
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'fault_block_layer.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.
|
||||
*/
|
||||
|
||||
#include <ert/util/type_macros.h>
|
||||
@@ -29,7 +29,7 @@
|
||||
#define FAULT_BLOCK_LAYER_ID 2297476
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
The fault_block object is implemented as a separate object type in
|
||||
the fault_block.c file; however the fault blocks should be closely
|
||||
linked to the layer object in the fault_block_layer structure - it
|
||||
@@ -68,10 +68,10 @@ fault_block_type * fault_block_layer_add_block( fault_block_layer_type * layer ,
|
||||
if (int_vector_safe_iget( layer->block_map , block_id) < 0) {
|
||||
fault_block_type * block = fault_block_alloc( layer , block_id );
|
||||
int storage_index = vector_get_size( layer->blocks );
|
||||
|
||||
|
||||
int_vector_iset( layer->block_map , block_id , storage_index );
|
||||
vector_append_owned_ref( layer->blocks , block , fault_block_free__ );
|
||||
|
||||
|
||||
return block;
|
||||
} else
|
||||
return NULL;
|
||||
@@ -95,9 +95,9 @@ void fault_block_layer_scan_layer( fault_block_layer_type * fault_layer , layer_
|
||||
int c;
|
||||
int block_id = fault_block_layer_get_next_id( fault_layer );
|
||||
fault_block_type * fault_block = fault_block_layer_add_block( fault_layer , block_id );
|
||||
for (c=0; c < int_vector_size( i_list ); c++)
|
||||
for (c=0; c < int_vector_size( i_list ); c++)
|
||||
fault_block_add_cell( fault_block , int_vector_iget( i_list , c ), int_vector_iget( j_list , c ));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ void fault_block_layer_scan_layer( fault_block_layer_type * fault_layer , layer_
|
||||
retained; the fault_block_layer instance gets new block id numbers,
|
||||
including a nonzero value for the cells which have value zero in the
|
||||
keyword.
|
||||
|
||||
|
||||
|
||||
- The blocks in the fault_block_layer instance are guaranteed to be
|
||||
singly connected.
|
||||
@@ -127,7 +127,7 @@ void fault_block_layer_scan_layer( fault_block_layer_type * fault_layer , layer_
|
||||
|
||||
bool fault_block_layer_scan_kw( fault_block_layer_type * layer , const ecl_kw_type * fault_block_kw) {
|
||||
bool assign_zero = true;
|
||||
|
||||
|
||||
if (ecl_kw_get_size( fault_block_kw) != ecl_grid_get_global_size(layer->grid))
|
||||
return false;
|
||||
else if (ecl_kw_get_type( fault_block_kw ) != ECL_INT_TYPE)
|
||||
@@ -141,18 +141,18 @@ bool fault_block_layer_scan_kw( fault_block_layer_type * layer , const ecl_kw_ty
|
||||
for (i=0; i < ecl_grid_get_nx( layer->grid ); i++) {
|
||||
int g = ecl_grid_get_global_index3( layer->grid , i , j , layer->k );
|
||||
int block_id = ecl_kw_iget_int( fault_block_kw , g );
|
||||
|
||||
|
||||
|
||||
|
||||
if (block_id > 0) {
|
||||
layer_iset_cell_value( work_layer , i , j , block_id );
|
||||
max_block_id = util_int_max( block_id , max_block_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (assign_zero)
|
||||
layer_replace_cell_values( work_layer , 0 , max_block_id + 1);
|
||||
|
||||
|
||||
fault_block_layer_scan_layer( layer , work_layer );
|
||||
layer_free( work_layer );
|
||||
return true;
|
||||
@@ -189,7 +189,7 @@ bool fault_block_layer_load_kw( fault_block_layer_type * layer , const ecl_kw_ty
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -297,7 +297,7 @@ void fault_block_layer_free( fault_block_layer_type * layer ) {
|
||||
int_vector_free( layer->block_map );
|
||||
vector_free( layer->blocks );
|
||||
layer_free( layer->layer );
|
||||
free(layer);
|
||||
free(layer);
|
||||
}
|
||||
|
||||
|
||||
@@ -305,7 +305,7 @@ void fault_block_layer_free__( void * arg ) {
|
||||
fault_block_layer_type * layer = fault_block_layer_safe_cast( arg );
|
||||
fault_block_layer_free( layer );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void fault_block_layer_insert_block_content( fault_block_layer_type * layer , const fault_block_type * src_block) {
|
||||
int next_block_id = fault_block_layer_get_next_id( layer );
|
||||
|
406
ThirdParty/Ert/devel/libecl/src/layer.c
vendored
406
ThirdParty/Ert/devel/libecl/src/layer.c
vendored
@@ -1,21 +1,22 @@
|
||||
/*
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'layer.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.
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'layer.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.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
@@ -27,9 +28,13 @@
|
||||
|
||||
|
||||
typedef struct {
|
||||
int cell_value;
|
||||
int edges[4];
|
||||
} cell_type;
|
||||
int cell_value;
|
||||
int edges[4];
|
||||
bool bottom_barrier;
|
||||
bool left_barrier;
|
||||
bool active;
|
||||
} cell_type;
|
||||
|
||||
|
||||
|
||||
struct layer_struct {
|
||||
@@ -50,19 +55,26 @@ layer_type * layer_alloc(int nx , int ny) {
|
||||
layer->nx = nx;
|
||||
layer->ny = ny;
|
||||
layer->cell_sum = 0;
|
||||
layer->data = util_malloc( (layer->nx + 1)* (layer->ny + 1) * sizeof * layer->data );
|
||||
{
|
||||
int g;
|
||||
for (g=0; g < (layer->nx + 1)*(layer->ny + 1); g++) {
|
||||
cell_type * cell = &layer->data[g];
|
||||
cell->cell_value = 0;
|
||||
cell->edges[RIGHT_EDGE] = 0;
|
||||
cell->edges[LEFT_EDGE] = 0;
|
||||
cell->edges[TOP_EDGE] = 0;
|
||||
cell->edges[BOTTOM_EDGE] = 0;
|
||||
int data_size = (layer->nx + 1)* (layer->ny + 1);
|
||||
layer->data = util_malloc( data_size * sizeof * layer->data );
|
||||
{
|
||||
int g;
|
||||
for (g=0; g < data_size; g++) {
|
||||
cell_type * cell = &layer->data[g];
|
||||
cell->cell_value = 0;
|
||||
cell->edges[RIGHT_EDGE] = 0;
|
||||
cell->edges[LEFT_EDGE] = 0;
|
||||
cell->edges[TOP_EDGE] = 0;
|
||||
cell->edges[BOTTOM_EDGE] = 0;
|
||||
|
||||
cell->active = true;
|
||||
cell->bottom_barrier = false;
|
||||
cell->left_barrier = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
@@ -73,24 +85,67 @@ void layer_free( layer_type * layer ) {
|
||||
free( layer->data );
|
||||
free(layer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int layer_get_global_cell_index( const layer_type * layer , int i , int j) {
|
||||
if ((i < 0) || (i >= layer->nx))
|
||||
util_abort("%s: invalid i value:%d Valid range: [0,%d) \n",__func__ , i , layer->nx);
|
||||
|
||||
if ((j < 0) || (j >= layer->ny))
|
||||
util_abort("%s: invalid j value:%d Valid range: [0,%d) \n",__func__ , j , layer->ny);
|
||||
|
||||
|
||||
return i + j*(layer->nx + 1);
|
||||
}
|
||||
|
||||
|
||||
static int layer_get_global_cell_index__( const layer_type * layer , int i , int j) {
|
||||
if ((i < 0) || (i > layer->nx))
|
||||
util_abort("%s: invalid i value:%d Valid range: [0,%d] \n",__func__ , i , layer->nx);
|
||||
|
||||
if ((j < 0) || (j > layer->ny))
|
||||
util_abort("%s: invalid j value:%d Valid range: [0,%d] \n",__func__ , j , layer->ny);
|
||||
|
||||
return i + j*(layer->nx + 1);
|
||||
}
|
||||
|
||||
|
||||
static cell_type* layer_iget_cell( const layer_type * layer , int i , int j) {
|
||||
int g = layer_get_global_cell_index( layer , i , j );
|
||||
return &layer->data[g];
|
||||
}
|
||||
|
||||
/*
|
||||
To be able to update barriers on the edge we need access to the i =
|
||||
nx and j = ny cells.
|
||||
*/
|
||||
static cell_type* layer_iget_cell__( const layer_type * layer , int i , int j) {
|
||||
int g = layer_get_global_cell_index__( layer , i , j );
|
||||
return &layer->data[g];
|
||||
}
|
||||
|
||||
|
||||
bool layer_iget_left_barrier( const layer_type * layer, int i , int j) {
|
||||
cell_type * cell = layer_iget_cell(layer , i,j);
|
||||
return cell->left_barrier;
|
||||
}
|
||||
|
||||
|
||||
bool layer_iget_bottom_barrier( const layer_type * layer, int i , int j) {
|
||||
cell_type * cell = layer_iget_cell(layer,i,j);
|
||||
return cell->bottom_barrier;
|
||||
}
|
||||
|
||||
|
||||
int layer_iget_cell_value( const layer_type * layer, int i , int j) {
|
||||
int g = layer_get_global_cell_index( layer , i , j );
|
||||
return layer->data[g].cell_value;
|
||||
}
|
||||
|
||||
bool layer_iget_active( const layer_type * layer, int i , int j) {
|
||||
int g = layer_get_global_cell_index( layer , i , j );
|
||||
return layer->data[g].active;
|
||||
}
|
||||
|
||||
|
||||
int layer_get_cell_sum( const layer_type * layer ) {
|
||||
return layer->cell_sum;
|
||||
@@ -115,10 +170,10 @@ int layer_get_ny( const layer_type * layer ) {
|
||||
void layer_iset_cell_value( layer_type * layer , int i , int j , int value) {
|
||||
int g = layer_get_global_cell_index( layer , i , j );
|
||||
cell_type * cell = &layer->data[g];
|
||||
|
||||
|
||||
layer->cell_sum += (value - cell->cell_value);
|
||||
cell->cell_value = value;
|
||||
|
||||
|
||||
|
||||
if (i > 0) {
|
||||
int neighbour_value = layer_iget_cell_value( layer , i - 1 , j);
|
||||
@@ -140,7 +195,7 @@ void layer_iset_cell_value( layer_type * layer , int i , int j , int value) {
|
||||
cell->edges[RIGHT_EDGE] = value;
|
||||
} else
|
||||
cell->edges[RIGHT_EDGE] = value;
|
||||
|
||||
|
||||
|
||||
if (j < (layer->ny - 1)) {
|
||||
int neighbour_value = layer_iget_cell_value( layer , i , j + 1);
|
||||
@@ -151,8 +206,8 @@ void layer_iset_cell_value( layer_type * layer , int i , int j , int value) {
|
||||
cell->edges[TOP_EDGE] = -value;
|
||||
} else
|
||||
cell->edges[TOP_EDGE] = -value;
|
||||
|
||||
|
||||
|
||||
|
||||
if (j > 0) {
|
||||
int neighbour_value = layer_iget_cell_value( layer , i , j - 1);
|
||||
if (value == neighbour_value) {
|
||||
@@ -169,10 +224,11 @@ void layer_iset_cell_value( layer_type * layer , int i , int j , int value) {
|
||||
static int layer_get_global_edge_index( const layer_type * layer , int i , int j , edge_dir_enum dir) {
|
||||
if ((i < 0) || (j < 0))
|
||||
util_abort("%s: invalid value for i,j \n",__func__);
|
||||
|
||||
|
||||
if ((i > layer->nx) || (j > layer->ny))
|
||||
util_abort("%s: invalid value for i,j \n",__func__);
|
||||
|
||||
|
||||
if (i == layer->nx) {
|
||||
if (j == layer->ny)
|
||||
util_abort("%s: invalid value for i,j \n",__func__);
|
||||
@@ -196,14 +252,14 @@ static int layer_get_global_edge_index( const layer_type * layer , int i , int j
|
||||
|
||||
|
||||
int layer_iget_edge_value( const layer_type * layer , int i , int j , edge_dir_enum dir) {
|
||||
int g = layer_get_global_edge_index( layer , i , j , dir);
|
||||
int g = layer_get_global_edge_index( layer , i , j , dir);
|
||||
cell_type * cell = &layer->data[g];
|
||||
return cell->edges[dir];
|
||||
}
|
||||
|
||||
|
||||
bool layer_cell_on_edge( const layer_type * layer , int i , int j) {
|
||||
int g = layer_get_global_cell_index( layer , i , j);
|
||||
int g = layer_get_global_cell_index( layer , i , j);
|
||||
cell_type * cell = &layer->data[g];
|
||||
|
||||
if (cell->cell_value == cell->edges[LEFT_EDGE])
|
||||
@@ -214,7 +270,7 @@ bool layer_cell_on_edge( const layer_type * layer , int i , int j) {
|
||||
return true;
|
||||
if (cell->cell_value == cell->edges[TOP_EDGE])
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -239,7 +295,7 @@ static bool point_equal(int_point2d_type * p1 , int_point2d_type *p2) {
|
||||
RIGHT_EDGE -> TOP_EDGE{i,j} , RIGHT_EDGE{i,j+1} , BOTTOM_EDGE{i+1 , j+1}
|
||||
TOP_EDGE -> LEFT_EDGE{i,j} , TOP_EDGE{i-1,j} , RIGHT_EDGE{i-1,j+1}
|
||||
LEFT_EDGE -> BOTTOM_EDGE{i,j} , LEFT_EDGE{i,j-1} , TOP_EDGE{i-1 , j-1}
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
@@ -250,8 +306,8 @@ static void layer_trace_block_edge__( const layer_type * layer , int_point2d_typ
|
||||
current_point.i = i;
|
||||
current_point.j = j;
|
||||
next_point = current_point;
|
||||
|
||||
if (dir == BOTTOM_EDGE)
|
||||
|
||||
if (dir == BOTTOM_EDGE)
|
||||
point_shift( &next_point , 1 , 0 );
|
||||
else if (dir == RIGHT_EDGE) {
|
||||
point_shift( ¤t_point , 1 , 0 );
|
||||
@@ -267,9 +323,9 @@ static void layer_trace_block_edge__( const layer_type * layer , int_point2d_typ
|
||||
int cell_index = i + j*layer->nx;
|
||||
int_vector_append( cell_list , cell_index );
|
||||
}
|
||||
|
||||
|
||||
if ( !point_equal(&start_point , &next_point) ) {
|
||||
|
||||
|
||||
if (dir == BOTTOM_EDGE) {
|
||||
if (layer_iget_edge_value( layer , i,j,RIGHT_EDGE) == value)
|
||||
layer_trace_block_edge__( layer , start_point , i , j , value , RIGHT_EDGE , corner_list , cell_list);
|
||||
@@ -277,9 +333,9 @@ static void layer_trace_block_edge__( const layer_type * layer , int_point2d_typ
|
||||
layer_trace_block_edge__( layer , start_point , i + 1 , j , value , BOTTOM_EDGE , corner_list , cell_list);
|
||||
else if (layer_iget_edge_value( layer , i + 1 , j - 1 , LEFT_EDGE) == -value)
|
||||
layer_trace_block_edge__( layer , start_point , i + 1 , j -1 , value , LEFT_EDGE , corner_list , cell_list);
|
||||
else
|
||||
else
|
||||
util_abort("%s: dir == BOTTOM_EDGE \n",__func__);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (dir == RIGHT_EDGE) {
|
||||
@@ -289,7 +345,7 @@ static void layer_trace_block_edge__( const layer_type * layer , int_point2d_typ
|
||||
layer_trace_block_edge__( layer , start_point , i , j + 1, value , RIGHT_EDGE , corner_list , cell_list);
|
||||
else if (layer_iget_edge_value( layer , i + 1 , j + 1 ,BOTTOM_EDGE) == value)
|
||||
layer_trace_block_edge__( layer , start_point , i + 1 , j + 1, value , BOTTOM_EDGE , corner_list , cell_list);
|
||||
else
|
||||
else
|
||||
util_abort("%s: dir == RIGHT_EDGE \n",__func__);
|
||||
}
|
||||
|
||||
@@ -301,11 +357,11 @@ static void layer_trace_block_edge__( const layer_type * layer , int_point2d_typ
|
||||
layer_trace_block_edge__( layer , start_point , i - 1 , j , value , TOP_EDGE , corner_list , cell_list);
|
||||
else if (layer_iget_edge_value( layer , i - 1 , j + 1 ,RIGHT_EDGE) == value)
|
||||
layer_trace_block_edge__( layer , start_point , i - 1 , j + 1, value , RIGHT_EDGE , corner_list , cell_list);
|
||||
else
|
||||
else
|
||||
util_abort("%s: dir == TOP_EDGE \n",__func__);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (dir == LEFT_EDGE) {
|
||||
if (layer_iget_edge_value( layer , i , j , BOTTOM_EDGE) == value)
|
||||
layer_trace_block_edge__( layer , start_point , i , j , value , BOTTOM_EDGE , corner_list , cell_list);
|
||||
@@ -325,7 +381,7 @@ static void layer_trace_block_edge__( const layer_type * layer , int_point2d_typ
|
||||
static void layer_fprintf_dash( const layer_type * layer , FILE * stream, int i1 , int i2) {
|
||||
int i;
|
||||
fprintf(stream," --");
|
||||
for (i=i1; i <= i2; i++)
|
||||
for (i=i1; i <= i2; i++)
|
||||
fprintf(stream , "----");
|
||||
fprintf(stream , "----\n");
|
||||
}
|
||||
@@ -334,7 +390,7 @@ static void layer_fprintf_dash( const layer_type * layer , FILE * stream, int i1
|
||||
static void layer_fprintf_header( const layer_type * layer , FILE * stream, int i1 , int i2) {
|
||||
int i;
|
||||
fprintf(stream," ");
|
||||
for (i=i1; i <= i2; i++)
|
||||
for (i=i1; i <= i2; i++)
|
||||
fprintf(stream , " %3d" , i);
|
||||
fprintf(stream , "\n");
|
||||
}
|
||||
@@ -344,12 +400,12 @@ void layer_fprintf_box( const layer_type * layer , FILE * stream , int i1 , int
|
||||
int i,j;
|
||||
layer_fprintf_header( layer , stream , i1 , i2);
|
||||
layer_fprintf_dash( layer , stream , i1 , i2);
|
||||
|
||||
|
||||
|
||||
for (j=j2; j >= j1; j--) {
|
||||
fprintf(stream , " %3d | " , j);
|
||||
for (i=i1; i <= i2; i++) {
|
||||
int g = layer_get_global_cell_index( layer , i , j);
|
||||
int g = layer_get_global_cell_index( layer , i , j);
|
||||
cell_type * cell = &layer->data[g];
|
||||
fprintf(stream , " %3d" , cell->cell_value);
|
||||
}
|
||||
@@ -367,9 +423,9 @@ void layer_fprintf( const layer_type * layer , FILE * stream) {
|
||||
|
||||
|
||||
void layer_fprintf_cell( const layer_type * layer , int i , int j , FILE * stream) {
|
||||
int g = layer_get_global_cell_index( layer , i , j);
|
||||
int g = layer_get_global_cell_index( layer , i , j);
|
||||
cell_type * cell = &layer->data[g];
|
||||
|
||||
|
||||
fprintf(stream , " i:%d j:%d \n",i,j);
|
||||
fprintf(stream , " *--- %4d ---* \n",cell->edges[TOP_EDGE]);
|
||||
fprintf(stream , " | | \n");
|
||||
@@ -380,13 +436,13 @@ void layer_fprintf_cell( const layer_type * layer , int i , int j , FILE * strea
|
||||
|
||||
|
||||
static bool layer_find_edge( const layer_type * layer , int *i , int *j , int value) {
|
||||
int g = layer_get_global_cell_index( layer , *i , *j);
|
||||
int g = layer_get_global_cell_index( layer , *i , *j);
|
||||
cell_type * cell = &layer->data[g];
|
||||
if (cell->cell_value == value) {
|
||||
|
||||
while (!layer_cell_on_edge( layer , *i , *j))
|
||||
(*i) += 1;
|
||||
|
||||
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
@@ -394,16 +450,16 @@ static bool layer_find_edge( const layer_type * layer , int *i , int *j , int va
|
||||
|
||||
|
||||
bool layer_trace_block_edge( const layer_type * layer , int start_i , int start_j , int value , struct_vector_type * corner_list , int_vector_type * cell_list) {
|
||||
int g = layer_get_global_cell_index( layer , start_i , start_j);
|
||||
int g = layer_get_global_cell_index( layer , start_i , start_j);
|
||||
cell_type * cell = &layer->data[g];
|
||||
if ((cell->cell_value == value)) {
|
||||
int i = start_i;
|
||||
int j = start_j;
|
||||
|
||||
|
||||
if (layer_find_edge( layer , &i , &j , value)) {
|
||||
int_point2d_type start_corner;
|
||||
|
||||
g = layer_get_global_cell_index( layer , i , j);
|
||||
g = layer_get_global_cell_index( layer , i , j);
|
||||
cell = &layer->data[g];
|
||||
|
||||
start_corner.i = i;
|
||||
@@ -411,7 +467,7 @@ bool layer_trace_block_edge( const layer_type * layer , int start_i , int start_
|
||||
struct_vector_reset( corner_list );
|
||||
int_vector_reset( cell_list );
|
||||
|
||||
|
||||
|
||||
if (cell->edges[BOTTOM_EDGE] == value) {
|
||||
point_shift( &start_corner , 0 , 0 );
|
||||
layer_trace_block_edge__(layer , start_corner , i , j , value , BOTTOM_EDGE , corner_list , cell_list);
|
||||
@@ -426,19 +482,19 @@ bool layer_trace_block_edge( const layer_type * layer , int start_i , int start_
|
||||
layer_trace_block_edge__(layer , start_corner , i , j , value , LEFT_EDGE , corner_list , cell_list);
|
||||
} else
|
||||
util_abort("%s: what the fuck - internal error \n",__func__);
|
||||
|
||||
|
||||
int_vector_select_unique( cell_list );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void layer_trace_block_content__( layer_type * layer , bool erase , int i , int j , int value , bool * visited , int_vector_type * i_list , int_vector_type * j_list) {
|
||||
int g = layer_get_global_cell_index( layer , i , j);
|
||||
int g = layer_get_global_cell_index( layer , i , j);
|
||||
cell_type * cell = &layer->data[g];
|
||||
if (cell->cell_value != value || visited[g])
|
||||
return;
|
||||
@@ -446,7 +502,7 @@ static void layer_trace_block_content__( layer_type * layer , bool erase , int i
|
||||
visited[g] = true;
|
||||
if (erase)
|
||||
layer_iset_cell_value( layer , i , j , 0);
|
||||
|
||||
|
||||
int_vector_append( i_list , i );
|
||||
int_vector_append( j_list , j );
|
||||
|
||||
@@ -461,7 +517,7 @@ static void layer_trace_block_content__( layer_type * layer , bool erase , int i
|
||||
|
||||
if (j < (layer->ny - 1))
|
||||
layer_trace_block_content__( layer , erase , i , j + 1, value , visited , i_list , j_list);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,7 +528,7 @@ static bool * layer_alloc_visited_mask( const layer_type * layer ) {
|
||||
int g;
|
||||
for (g = 0; g < total_size; g++)
|
||||
visited[g] = false;
|
||||
|
||||
|
||||
return visited;
|
||||
}
|
||||
|
||||
@@ -481,7 +537,7 @@ static bool * layer_alloc_visited_mask( const layer_type * layer ) {
|
||||
|
||||
bool layer_trace_block_content( layer_type * layer , bool erase , int start_i , int start_j , int value , int_vector_type * i_list, int_vector_type * j_list) {
|
||||
bool start_tracing = false;
|
||||
int g = layer_get_global_cell_index( layer , start_i , start_j);
|
||||
int g = layer_get_global_cell_index( layer , start_i , start_j);
|
||||
cell_type * cell = &layer->data[g];
|
||||
|
||||
if ((value == 0) && (cell->cell_value != 0))
|
||||
@@ -496,7 +552,7 @@ bool layer_trace_block_content( layer_type * layer , bool erase , int start_i ,
|
||||
int_vector_reset( i_list );
|
||||
int_vector_reset( j_list );
|
||||
layer_trace_block_content__(layer , erase , start_i , start_j , value , visited , i_list , j_list );
|
||||
|
||||
|
||||
free( visited );
|
||||
return true;
|
||||
} else
|
||||
@@ -519,3 +575,211 @@ int layer_replace_cell_values( layer_type * layer , int old_value , int new_valu
|
||||
|
||||
return replace_count;
|
||||
}
|
||||
|
||||
|
||||
static void layer_assert_cell_index( const layer_type * layer , int i , int j ) {
|
||||
if ((i < 0) || (j < 0))
|
||||
util_abort("%s: invalid value for i,j i:%d [0,%d) j:%d [0,%d) \n",__func__ , i , layer->nx , j , layer->ny);
|
||||
|
||||
if ((i >= layer->nx) || (j >= layer->ny))
|
||||
util_abort("%s: invalid value for i,j i:%d [0,%d) j:%d [0,%d) \n",__func__ , i , layer->nx , j , layer->ny);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool layer_cell_contact( const layer_type * layer , int i1 , int j1 , int i2 , int j2) {
|
||||
layer_assert_cell_index( layer , i1 , j1 );
|
||||
layer_assert_cell_index( layer , i2 , j2 );
|
||||
{
|
||||
|
||||
if ((abs(i1 - i2) == 1) && (j1 == j2)) {
|
||||
int i = util_int_max( i1,i2 );
|
||||
const cell_type * cell = layer_iget_cell( layer , i , j1 );
|
||||
return !cell->left_barrier;
|
||||
}
|
||||
|
||||
if ((i1 == i2) && (abs(j1 - j2) == 1)) {
|
||||
int j = util_int_max( j1 , j2 );
|
||||
const cell_type * cell = layer_iget_cell( layer , i1 , j );
|
||||
return !cell->bottom_barrier;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void layer_add_ijbarrier( layer_type * layer , int i1 , int j1 , int i2 , int j2 ) {
|
||||
if ((j1 == j2) || (i1 == i2)) {
|
||||
if (i1 == i2) {
|
||||
int j;
|
||||
int jmin = util_int_min(j1,j2);
|
||||
int jmax = util_int_max(j1,j2);
|
||||
|
||||
for (j=jmin; j < jmax; j++) {
|
||||
cell_type * cell = layer_iget_cell__( layer , i1 , j );
|
||||
cell->left_barrier = true;
|
||||
}
|
||||
} else {
|
||||
int i;
|
||||
int imin = util_int_min(i1,i2);
|
||||
int imax = util_int_max(i1,i2);
|
||||
|
||||
for (i=imin; i < imax; i++) {
|
||||
cell_type * cell = layer_iget_cell__( layer , i , j1 );
|
||||
cell->bottom_barrier = true;
|
||||
}
|
||||
}
|
||||
} else
|
||||
util_abort("%s: fatal error must have i1 == i2 || j1 == j2 \n",__func__);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void layer_add_barrier( layer_type * layer , int c1 , int c2) {
|
||||
int dimx = layer->nx + 1;
|
||||
int j1 = c1 / dimx;
|
||||
int i1 = c1 % dimx;
|
||||
|
||||
int j2 = c2 / dimx;
|
||||
int i2 = c2 % dimx;
|
||||
|
||||
layer_add_ijbarrier( layer , i1 , j1 , i2 , j2 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Line is parameterized as: ax + by + c = 0
|
||||
*/
|
||||
static double distance_to_line(double a , double b , double c , int i , int j) {
|
||||
double x0 = 1.0 * i;
|
||||
double y0 = 1.0 * j;
|
||||
|
||||
|
||||
return fabs(a*x0 + b*y0 + c) / sqrt(a*a + b*b);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void layer_add_interp_barrier( layer_type * layer , int c1 , int c2) {
|
||||
int dimx = layer->nx + 1;
|
||||
int j1 = c1 / dimx;
|
||||
int i1 = c1 % dimx;
|
||||
|
||||
int j2 = c2 / dimx;
|
||||
int i2 = c2 % dimx;
|
||||
|
||||
if ((j1 == j2) || (i1 == i2))
|
||||
layer_add_barrier( layer , c1 , c2 );
|
||||
else {
|
||||
int di = abs(i2 - i1) / (i2 - i1);
|
||||
int dj = abs(j2 - j1) / (j2 - j1);
|
||||
double a = 1.0 * (j2 - j1) / (i2 - i1);
|
||||
double b = 1.0 * (j1 - a*i1);
|
||||
|
||||
int i = i1;
|
||||
int j = j1;
|
||||
int c = c1;
|
||||
|
||||
while (c != c2) {
|
||||
double dx = distance_to_line( a , -1 , b , i + di , j );
|
||||
double dy = distance_to_line( a , -1 , b , i , j + dj);
|
||||
|
||||
if (dx <= dy)
|
||||
i += di;
|
||||
else
|
||||
j += dj;
|
||||
|
||||
layer_add_barrier( layer , c , i + j*dimx);
|
||||
c = i + j*dimx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void layer_memcpy(layer_type * target_layer , const layer_type * src_layer) {
|
||||
if ((target_layer->nx == src_layer->nx) && (target_layer->ny == src_layer->ny)) {
|
||||
size_t data_size = target_layer->nx * target_layer->ny * sizeof(cell_type);
|
||||
memcpy(target_layer->data , src_layer->data , data_size );
|
||||
target_layer->cell_sum = src_layer->cell_sum;
|
||||
} else
|
||||
util_abort("%s: fatal error - tried to copy elements between layers of different size\n",__func__);
|
||||
}
|
||||
|
||||
|
||||
static void layer_assign__( layer_type * layer, int value) {
|
||||
int i,j;
|
||||
for (j=0; j < layer->ny; j++) {
|
||||
for (i=0; i < layer->nx; i++) {
|
||||
cell_type * cell = layer_iget_cell( layer , i , j );
|
||||
cell->cell_value = value;
|
||||
{
|
||||
int e;
|
||||
for (e=0; e < 4; e++)
|
||||
cell->edges[e] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
layer->cell_sum = value * layer->nx*layer->ny;
|
||||
}
|
||||
|
||||
void layer_clear_cells( layer_type * layer) {
|
||||
layer_assign__(layer , 0 );
|
||||
}
|
||||
|
||||
void layer_assign( layer_type * layer, int value) {
|
||||
layer_assign__( layer , value );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void layer_update_connected_cells( layer_type * layer , int i , int j , int org_value , int new_value) {
|
||||
if (org_value != new_value) {
|
||||
if (layer_iget_cell_value( layer , i , j ) == org_value) {
|
||||
layer_iset_cell_value( layer , i , j , new_value);
|
||||
|
||||
if (i < (layer->nx - 1) && layer_cell_contact( layer , i,j,i+1,j))
|
||||
layer_update_connected_cells( layer , i + 1 , j , org_value , new_value);
|
||||
|
||||
if (i > 0 && layer_cell_contact( layer , i,j,i-1,j))
|
||||
layer_update_connected_cells( layer , i - 1 , j , org_value , new_value);
|
||||
|
||||
if (j < (layer->ny - 1) && layer_cell_contact( layer , i,j,i,j+1))
|
||||
layer_update_connected_cells( layer , i , j + 1, org_value , new_value);
|
||||
|
||||
if (j > 0 && layer_cell_contact( layer , i,j,i,j-1))
|
||||
layer_update_connected_cells( layer , i , j - 1, org_value , new_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void layer_cells_equal( const layer_type * layer , int value , int_vector_type * i_list , int_vector_type * j_list) {
|
||||
int i,j;
|
||||
for (j=0; j < layer->ny; j++) {
|
||||
for (i=0; i < layer->nx; i++) {
|
||||
cell_type * cell = layer_iget_cell( layer , i , j );
|
||||
if (cell->cell_value == value) {
|
||||
int_vector_append( i_list , i );
|
||||
int_vector_append( j_list , j );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void layer_update_active( layer_type * layer , const ecl_grid_type * grid , int k) {
|
||||
int i,j;
|
||||
for (j=0; j< ecl_grid_get_ny( grid ); j++) {
|
||||
for (i=0; i < ecl_grid_get_nx( grid ); i++) {
|
||||
cell_type * cell = layer_iget_cell( layer , i , j );
|
||||
cell->active = ecl_grid_cell_active3( grid , i , j , k );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
6
ThirdParty/Ert/devel/libecl/src/point.c
vendored
6
ThirdParty/Ert/devel/libecl/src/point.c
vendored
@@ -53,9 +53,9 @@ void point_mapaxes_invtransform( point_type * p , const double origo[2], const d
|
||||
void point_compare( const point_type *p1 , const point_type * p2, bool * equal) {
|
||||
const double tolerance = 0.001;
|
||||
|
||||
double diff_x = (abs(p1->x - p2->x) / abs(p1->x + p2->x + 1));
|
||||
double diff_y = (abs(p1->y - p2->y) / abs(p1->y + p2->y + 1));
|
||||
double diff_z = (abs(p1->z - p2->z) / abs(p1->z + p2->z + 1));
|
||||
double diff_x = (fabs(p1->x - p2->x) / fabs(p1->x + p2->x + 1));
|
||||
double diff_y = (fabs(p1->y - p2->y) / fabs(p1->y + p2->y + 1));
|
||||
double diff_z = (fabs(p1->z - p2->z) / fabs(p1->z + p2->z + 1));
|
||||
|
||||
if (diff_x + diff_y + diff_z > tolerance)
|
||||
*equal = false;
|
||||
|
274
ThirdParty/Ert/devel/libecl/src/smspec_node.c
vendored
274
ThirdParty/Ert/devel/libecl/src/smspec_node.c
vendored
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2012 Statoil ASA, Norway.
|
||||
|
||||
The file 'smspec_node.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.
|
||||
Copyright (C) 2012 Statoil ASA, Norway.
|
||||
|
||||
The file 'smspec_node.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.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
@@ -44,7 +44,7 @@
|
||||
file; the content is based on the smspec vectors WGNAMES, KEYWORDS, UNIT
|
||||
and NUMS. The index field of this struct points to where the actual data
|
||||
can be found in the PARAMS vector of the *.Snnnn / *.UNSMRY files;
|
||||
probably the most important field.
|
||||
probably the most important field.
|
||||
*/
|
||||
|
||||
#define SMSPEC_TYPE_ID 61550451
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
struct smspec_node_struct {
|
||||
UTIL_TYPE_ID_DECLARATION;
|
||||
char * gen_key1; /* The main composite key, i.e. WWCT:OP3 for this element. */
|
||||
char * gen_key1; /* The main composite key, i.e. WWCT:OP3 for this element. */
|
||||
char * gen_key2; /* Some of the ijk based elements will have both a xxx:i,j,k and a xxx:num key. Some of the region_2_region elements will have both a xxx:num and a xxx:r2-r2 key. Mostly NULL. */
|
||||
ecl_smspec_var_type var_type; /* The variable type */
|
||||
char * wgname; /* The value of the WGNAMES vector for this element. */
|
||||
@@ -83,7 +83,7 @@ struct smspec_node_struct {
|
||||
#define ECL_SUM_KEYFMT_BLOCK_IJK "%s%s%d,%d,%d"
|
||||
#define ECL_SUM_KEYFMT_BLOCK_NUM "%s%s%d"
|
||||
#define ECL_SUM_KEYFMT_LOCAL_BLOCK "%s%s%s%s%d,%d,%d"
|
||||
#define ECL_SUM_KEYFMT_COMPLETION_IJK "%s%s%s%s%d,%d,%d"
|
||||
#define ECL_SUM_KEYFMT_COMPLETION_IJK "%s%s%s%s%d,%d,%d"
|
||||
#define ECL_SUM_KEYFMT_COMPLETION_NUM "%s%s%s%s%d"
|
||||
#define ECL_SUM_KEYFMT_LOCAL_COMPLETION "%s%s%s%s%s%s%d,%d,%d"
|
||||
#define ECL_SUM_KEYFMT_GROUP "%s%s%s"
|
||||
@@ -99,49 +99,49 @@ UTIL_SAFE_CAST_FUNCTION( smspec_node , SMSPEC_TYPE_ID )
|
||||
|
||||
char * smspec_alloc_block_num_key( const char * join_string , const char * keyword , int num) {
|
||||
return util_alloc_sprintf(ECL_SUM_KEYFMT_BLOCK_NUM,
|
||||
keyword ,
|
||||
join_string ,
|
||||
keyword ,
|
||||
join_string ,
|
||||
num );
|
||||
}
|
||||
|
||||
char * smspec_alloc_local_block_key( const char * join_string , const char * keyword , const char * lgr_name , int i , int j , int k) {
|
||||
return util_alloc_sprintf(ECL_SUM_KEYFMT_LOCAL_BLOCK ,
|
||||
keyword ,
|
||||
join_string ,
|
||||
lgr_name ,
|
||||
join_string ,
|
||||
return util_alloc_sprintf(ECL_SUM_KEYFMT_LOCAL_BLOCK ,
|
||||
keyword ,
|
||||
join_string ,
|
||||
lgr_name ,
|
||||
join_string ,
|
||||
i,j,k);
|
||||
}
|
||||
|
||||
|
||||
char * smspec_alloc_region_key( const char * join_string , const char * keyword , int num) {
|
||||
return util_alloc_sprintf(ECL_SUM_KEYFMT_REGION ,
|
||||
keyword ,
|
||||
join_string ,
|
||||
return util_alloc_sprintf(ECL_SUM_KEYFMT_REGION ,
|
||||
keyword ,
|
||||
join_string ,
|
||||
num );
|
||||
}
|
||||
|
||||
char * smspec_alloc_region_2_region_r1r2_key( const char * join_string , const char * keyword , int r1, int r2) {
|
||||
return util_alloc_sprintf(ECL_SUM_KEYFMT_REGION_2_REGION_R1R2,
|
||||
keyword,
|
||||
join_string,
|
||||
r1,
|
||||
join_string,
|
||||
r1,
|
||||
r2);
|
||||
}
|
||||
|
||||
char * smspec_alloc_region_2_region_num_key( const char * join_string , const char * keyword , int num) {
|
||||
return util_alloc_sprintf(ECL_SUM_KEYFMT_REGION_2_REGION_NUM,
|
||||
keyword ,
|
||||
join_string ,
|
||||
return util_alloc_sprintf(ECL_SUM_KEYFMT_REGION_2_REGION_NUM,
|
||||
keyword ,
|
||||
join_string ,
|
||||
num);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
char * smspec_alloc_block_ijk_key( const char * join_string , const char * keyword , int i , int j , int k) {
|
||||
return util_alloc_sprintf(ECL_SUM_KEYFMT_BLOCK_IJK ,
|
||||
return util_alloc_sprintf(ECL_SUM_KEYFMT_BLOCK_IJK ,
|
||||
keyword,
|
||||
join_string ,
|
||||
join_string ,
|
||||
i,j,k);
|
||||
}
|
||||
|
||||
@@ -149,11 +149,11 @@ char * smspec_alloc_block_ijk_key( const char * join_string , const char * keywo
|
||||
|
||||
char * smspec_alloc_completion_ijk_key( const char * join_string , const char * keyword, const char * wgname , int i , int j , int k) {
|
||||
if (wgname != NULL)
|
||||
return util_alloc_sprintf( ECL_SUM_KEYFMT_COMPLETION_IJK ,
|
||||
keyword ,
|
||||
join_string ,
|
||||
wgname ,
|
||||
join_string ,
|
||||
return util_alloc_sprintf( ECL_SUM_KEYFMT_COMPLETION_IJK ,
|
||||
keyword ,
|
||||
join_string ,
|
||||
wgname ,
|
||||
join_string ,
|
||||
i , j , k );
|
||||
else
|
||||
return NULL;
|
||||
@@ -164,10 +164,10 @@ char * smspec_alloc_completion_ijk_key( const char * join_string , const char *
|
||||
char * smspec_alloc_completion_num_key( const char * join_string , const char * keyword, const char * wgname , int num) {
|
||||
if (wgname != NULL)
|
||||
return util_alloc_sprintf(ECL_SUM_KEYFMT_COMPLETION_NUM,
|
||||
keyword ,
|
||||
join_string ,
|
||||
wgname ,
|
||||
join_string ,
|
||||
keyword ,
|
||||
join_string ,
|
||||
wgname ,
|
||||
join_string ,
|
||||
num );
|
||||
else
|
||||
return NULL;
|
||||
@@ -181,10 +181,10 @@ char * smspec_alloc_completion_num_key( const char * join_string , const char *
|
||||
*/
|
||||
|
||||
static char * smspec_alloc_wgname_key( const char * join_string , const char * keyword , const char * wgname) {
|
||||
if (wgname != NULL)
|
||||
if (wgname != NULL)
|
||||
return util_alloc_sprintf(ECL_SUM_KEYFMT_WELL,
|
||||
keyword ,
|
||||
join_string ,
|
||||
keyword ,
|
||||
join_string ,
|
||||
wgname );
|
||||
else
|
||||
return NULL;
|
||||
@@ -200,11 +200,11 @@ char * smspec_alloc_well_key( const char * join_string , const char * keyword ,
|
||||
|
||||
char * smspec_alloc_segment_key( const char * join_string , const char * keyword , const char * wgname , int num) {
|
||||
if (wgname != NULL)
|
||||
return util_alloc_sprintf(ECL_SUM_KEYFMT_SEGMENT ,
|
||||
keyword ,
|
||||
join_string ,
|
||||
wgname ,
|
||||
join_string ,
|
||||
return util_alloc_sprintf(ECL_SUM_KEYFMT_SEGMENT ,
|
||||
keyword ,
|
||||
join_string ,
|
||||
wgname ,
|
||||
join_string ,
|
||||
num );
|
||||
else
|
||||
return NULL;
|
||||
@@ -213,11 +213,11 @@ char * smspec_alloc_segment_key( const char * join_string , const char * keyword
|
||||
|
||||
char * smspec_alloc_local_well_key( const char * join_string , const char * keyword , const char * lgr_name , const char * wgname) {
|
||||
if (wgname != NULL)
|
||||
return util_alloc_sprintf( ECL_SUM_KEYFMT_LOCAL_WELL ,
|
||||
keyword ,
|
||||
join_string ,
|
||||
lgr_name ,
|
||||
join_string ,
|
||||
return util_alloc_sprintf( ECL_SUM_KEYFMT_LOCAL_WELL ,
|
||||
keyword ,
|
||||
join_string ,
|
||||
lgr_name ,
|
||||
join_string ,
|
||||
wgname);
|
||||
else
|
||||
return NULL;
|
||||
@@ -225,12 +225,12 @@ char * smspec_alloc_local_well_key( const char * join_string , const char * keyw
|
||||
|
||||
char * smspec_alloc_local_completion_key( const char * join_string, const char * keyword , const char * lgr_name , const char * wgname , int i , int j , int k) {
|
||||
if (wgname != NULL)
|
||||
return util_alloc_sprintf(ECL_SUM_KEYFMT_LOCAL_COMPLETION ,
|
||||
keyword ,
|
||||
join_string ,
|
||||
lgr_name ,
|
||||
return util_alloc_sprintf(ECL_SUM_KEYFMT_LOCAL_COMPLETION ,
|
||||
keyword ,
|
||||
join_string ,
|
||||
wgname ,
|
||||
lgr_name ,
|
||||
join_string ,
|
||||
wgname ,
|
||||
join_string ,
|
||||
i,j,k);
|
||||
else
|
||||
@@ -244,7 +244,7 @@ static void smspec_node_set_keyword( smspec_node_type * smspec_node , const char
|
||||
// This function can __ONLY__ be called on time; run-time chaning of keyword is not
|
||||
// allowed.
|
||||
if (smspec_node->keyword == NULL)
|
||||
smspec_node->keyword = util_alloc_substring_copy( keyword , 0 , 8);
|
||||
smspec_node->keyword = util_alloc_substring_copy( keyword , 0 , 8);
|
||||
else
|
||||
util_abort("%s: fatal error - attempt to change keyword runtime detected - aborting\n",__func__);
|
||||
}
|
||||
@@ -262,9 +262,9 @@ static char LAST_CHAR(const char * s) {
|
||||
}
|
||||
|
||||
static void smspec_node_set_flags( smspec_node_type * smspec_node) {
|
||||
/*
|
||||
/*
|
||||
Check if this is a rate variabel - that info is used when
|
||||
interpolating results to true_time between ministeps.
|
||||
interpolating results to true_time between ministeps.
|
||||
*/
|
||||
{
|
||||
const char *rate_vars[] = {"OPR" , "GPR" , "WPR" , "GOR" , "WCT"};
|
||||
@@ -280,7 +280,7 @@ static void smspec_node_set_flags( smspec_node_type * smspec_node) {
|
||||
}
|
||||
smspec_node->rate_variable = is_rate;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
if (LAST_CHAR(smspec_node->keyword) == 'H')
|
||||
smspec_node->historical = true;
|
||||
@@ -291,7 +291,7 @@ static void smspec_node_set_flags( smspec_node_type * smspec_node) {
|
||||
variable represents a total accumulated quantity. Only the last three
|
||||
characters in the variable is considered (i.e. the leading 'W', 'G' or
|
||||
'F' is discarded).
|
||||
|
||||
|
||||
The list below is all the keyowrds with 'Total' in the information from
|
||||
the tables 2.7 - 2.11 in the ECLIPSE fileformat documentation. Have
|
||||
skipped some of the most exotic keywords.
|
||||
@@ -300,7 +300,7 @@ static void smspec_node_set_flags( smspec_node_type * smspec_node) {
|
||||
bool is_total = false;
|
||||
if (smspec_node->var_type == ECL_SMSPEC_WELL_VAR || smspec_node->var_type == ECL_SMSPEC_GROUP_VAR || smspec_node->var_type == ECL_SMSPEC_FIELD_VAR) {
|
||||
const char *total_vars[] = {"OPT" , "GPT" , "WPT" , "OPTF" , "OPTS" , "OIT" , "OVPT" , "OVIT" , "MWT" , "WIT" ,
|
||||
"WVPT" , "WVIT" , "GMT" , "GPTF" , "GIT" , "SGT" , "GST" , "FGT" , "GCT" , "GIMT" ,
|
||||
"WVPT" , "WVIT" , "GMT" , "GPTF" , "GIT" , "SGT" , "GST" , "FGT" , "GCT" , "GIMT" ,
|
||||
"WGPT" , "WGIT" , "EGT" , "EXGT" , "GVPT" , "GVIT" , "LPT" , "VPT" , "VIT" };
|
||||
|
||||
int num_total_vars = sizeof( total_vars ) / sizeof( total_vars[0] );
|
||||
@@ -324,15 +324,15 @@ static void smspec_node_set_flags( smspec_node_type * smspec_node) {
|
||||
/*
|
||||
Check if this node needs the nums field; if at least one of the
|
||||
nodes need the NUMS field must be stored when writing a SMSPEC
|
||||
file.
|
||||
file.
|
||||
*/
|
||||
{
|
||||
if (smspec_node->var_type == ECL_SMSPEC_COMPLETION_VAR ||
|
||||
smspec_node->var_type == ECL_SMSPEC_SEGMENT_VAR ||
|
||||
if (smspec_node->var_type == ECL_SMSPEC_COMPLETION_VAR ||
|
||||
smspec_node->var_type == ECL_SMSPEC_SEGMENT_VAR ||
|
||||
smspec_node->var_type == ECL_SMSPEC_REGION_VAR ||
|
||||
smspec_node->var_type == ECL_SMSPEC_REGION_2_REGION_VAR ||
|
||||
smspec_node->var_type == ECL_SMSPEC_BLOCK_VAR ||
|
||||
smspec_node->var_type == ECL_SMSPEC_AQUIFER_VAR)
|
||||
smspec_node->var_type == ECL_SMSPEC_AQUIFER_VAR)
|
||||
smspec_node->need_nums = true;
|
||||
else
|
||||
smspec_node->need_nums = false;
|
||||
@@ -357,15 +357,15 @@ float smspec_node_get_default( const smspec_node_type * smspec_node ) {
|
||||
|
||||
smspec_node_type * smspec_node_alloc_new(int params_index, float default_value) {
|
||||
smspec_node_type * node = util_malloc( sizeof * node );
|
||||
|
||||
|
||||
UTIL_TYPE_ID_INIT( node , SMSPEC_TYPE_ID);
|
||||
node->params_index = params_index;
|
||||
smspec_node_set_default( node , default_value );
|
||||
|
||||
node->wgname = NULL;
|
||||
node->num = SMSPEC_NUMS_INVALID;
|
||||
node->ijk = NULL;
|
||||
|
||||
node->ijk = NULL;
|
||||
|
||||
node->gen_key1 = NULL;
|
||||
node->gen_key2 = NULL;
|
||||
|
||||
@@ -373,8 +373,8 @@ smspec_node_type * smspec_node_alloc_new(int params_index, float default_value)
|
||||
node->unit = NULL;
|
||||
node->keyword = NULL;
|
||||
node->lgr_name = NULL;
|
||||
node->lgr_ijk = NULL;
|
||||
|
||||
node->lgr_ijk = NULL;
|
||||
|
||||
smspec_node_set_invalid_flags( node );
|
||||
return node; // This is NOT usable
|
||||
}
|
||||
@@ -382,7 +382,7 @@ smspec_node_type * smspec_node_alloc_new(int params_index, float default_value)
|
||||
|
||||
/**
|
||||
Observe that the wellname can have max 8 characters; anything
|
||||
beyond that is silently dropped.
|
||||
beyond that is silently dropped.
|
||||
*/
|
||||
|
||||
static void smspec_node_set_wgname( smspec_node_type * index , const char * wgname ) {
|
||||
@@ -390,7 +390,7 @@ static void smspec_node_set_wgname( smspec_node_type * index , const char * wgna
|
||||
util_safe_free( index->wgname );
|
||||
index->wgname = NULL;
|
||||
} else {
|
||||
if (strlen(wgname) > 8)
|
||||
if (strlen(wgname) > 8)
|
||||
index->wgname = util_realloc_substring_copy(index->wgname , wgname , 8);
|
||||
else
|
||||
index->wgname = util_realloc_string_copy(index->wgname , wgname );
|
||||
@@ -407,7 +407,7 @@ static void smspec_node_set_lgr_name( smspec_node_type * index , const char * lg
|
||||
static void smspec_node_set_lgr_ijk( smspec_node_type * index , int lgr_i , int lgr_j , int lgr_k) {
|
||||
if (index->lgr_ijk == NULL)
|
||||
index->lgr_ijk = util_calloc( 3 , sizeof * index->lgr_ijk );
|
||||
|
||||
|
||||
index->lgr_ijk[0] = lgr_i;
|
||||
index->lgr_ijk[1] = lgr_j;
|
||||
index->lgr_ijk[2] = lgr_k;
|
||||
@@ -417,12 +417,12 @@ static void smspec_node_set_lgr_ijk( smspec_node_type * index , int lgr_i , int
|
||||
static void smspec_node_set_num( smspec_node_type * index , const int grid_dims[3] , int num) {
|
||||
if (num == SMSPEC_NUMS_INVALID)
|
||||
util_abort("%s: explicitly trying to set nums == SMSPEC_NUMS_INVALID - seems like a bug?!\n",__func__);
|
||||
|
||||
|
||||
index->num = num;
|
||||
if ((index->var_type == ECL_SMSPEC_COMPLETION_VAR) || (index->var_type == ECL_SMSPEC_BLOCK_VAR)) {
|
||||
int global_index = num - 1;
|
||||
index->ijk = util_calloc( 3 , sizeof * index->ijk );
|
||||
|
||||
|
||||
index->ijk[2] = global_index / ( grid_dims[0] * grid_dims[1] ); global_index -= index->ijk[2] * (grid_dims[0] * grid_dims[1]);
|
||||
index->ijk[1] = global_index / grid_dims[0] ; global_index -= index->ijk[1] * grid_dims[0];
|
||||
index->ijk[0] = global_index;
|
||||
@@ -455,20 +455,20 @@ static void smspec_node_set_gen_keys( smspec_node_type * smspec_node , const cha
|
||||
smspec_node->gen_key1 = util_alloc_string_copy( smspec_node->keyword );
|
||||
break;
|
||||
case(ECL_SMSPEC_GROUP_VAR):
|
||||
// KEYWORD:WGNAME
|
||||
// KEYWORD:WGNAME
|
||||
smspec_node->gen_key1 = smspec_alloc_group_key( key_join_string , smspec_node->keyword , smspec_node->wgname);
|
||||
break;
|
||||
case(ECL_SMSPEC_WELL_VAR):
|
||||
// KEYWORD:WGNAME
|
||||
// KEYWORD:WGNAME
|
||||
smspec_node->gen_key1 = smspec_alloc_well_key( key_join_string , smspec_node->keyword , smspec_node->wgname);
|
||||
break;
|
||||
case(ECL_SMSPEC_REGION_VAR):
|
||||
// KEYWORD:NUM
|
||||
smspec_node->gen_key1 = smspec_alloc_region_key( key_join_string , smspec_node->keyword , smspec_node->num);
|
||||
break;
|
||||
case (ECL_SMSPEC_SEGMENT_VAR):
|
||||
// KEYWORD:WGNAME:NUM
|
||||
smspec_node->gen_key1 = smspec_alloc_segment_key( key_join_string , smspec_node->keyword , smspec_node->wgname , smspec_node->num);
|
||||
case (ECL_SMSPEC_SEGMENT_VAR):
|
||||
// KEYWORD:WGNAME:NUM
|
||||
smspec_node->gen_key1 = smspec_alloc_segment_key( key_join_string , smspec_node->keyword , smspec_node->wgname , smspec_node->num);
|
||||
break;
|
||||
case(ECL_SMSPEC_REGION_2_REGION_VAR):
|
||||
// KEYWORDS:RXF:NUM and RXF:R1-R2
|
||||
@@ -495,23 +495,23 @@ static void smspec_node_set_gen_keys( smspec_node_type * smspec_node , const cha
|
||||
break;
|
||||
case(ECL_SMSPEC_LOCAL_BLOCK_VAR):
|
||||
/* KEYWORD:LGR:i,j,k */
|
||||
smspec_node->gen_key1 = smspec_alloc_local_block_key( key_join_string ,
|
||||
smspec_node->keyword ,
|
||||
smspec_node->lgr_name ,
|
||||
smspec_node->lgr_ijk[0] ,
|
||||
smspec_node->lgr_ijk[1] ,
|
||||
smspec_node->gen_key1 = smspec_alloc_local_block_key( key_join_string ,
|
||||
smspec_node->keyword ,
|
||||
smspec_node->lgr_name ,
|
||||
smspec_node->lgr_ijk[0] ,
|
||||
smspec_node->lgr_ijk[1] ,
|
||||
smspec_node->lgr_ijk[2] );
|
||||
break;
|
||||
case(ECL_SMSPEC_LOCAL_COMPLETION_VAR):
|
||||
/* KEYWORD:LGR:WELL:i,j,k */
|
||||
smspec_node->gen_key1 = smspec_alloc_local_completion_key( key_join_string ,
|
||||
smspec_node->keyword ,
|
||||
smspec_node->lgr_name ,
|
||||
smspec_node->wgname ,
|
||||
smspec_node->gen_key1 = smspec_alloc_local_completion_key( key_join_string ,
|
||||
smspec_node->keyword ,
|
||||
smspec_node->lgr_name ,
|
||||
smspec_node->wgname ,
|
||||
smspec_node->lgr_ijk[0],
|
||||
smspec_node->lgr_ijk[1],
|
||||
smspec_node->lgr_ijk[2]);
|
||||
|
||||
|
||||
break;
|
||||
default:
|
||||
util_abort("%s: internal error - should not be here? \n" , __func__);
|
||||
@@ -539,20 +539,20 @@ static void smspec_node_common_init( smspec_node_type * node , ecl_smspec_var_ty
|
||||
|
||||
|
||||
|
||||
bool smspec_node_init( smspec_node_type * smspec_node,
|
||||
ecl_smspec_var_type var_type ,
|
||||
const char * wgname ,
|
||||
const char * keyword ,
|
||||
const char * unit ,
|
||||
const char * key_join_string ,
|
||||
const int grid_dims[3] ,
|
||||
bool smspec_node_init( smspec_node_type * smspec_node,
|
||||
ecl_smspec_var_type var_type ,
|
||||
const char * wgname ,
|
||||
const char * keyword ,
|
||||
const char * unit ,
|
||||
const char * key_join_string ,
|
||||
const int grid_dims[3] ,
|
||||
int num) {
|
||||
|
||||
|
||||
bool initOK = true;
|
||||
bool wgnameOK = true;
|
||||
if ((wgname != NULL) && (IS_DUMMY_WELL(wgname)))
|
||||
wgnameOK = false;
|
||||
|
||||
|
||||
smspec_node_common_init( smspec_node , var_type , keyword , unit );
|
||||
switch (var_type) {
|
||||
case(ECL_SMSPEC_COMPLETION_VAR):
|
||||
@@ -565,14 +565,14 @@ bool smspec_node_init( smspec_node_type * smspec_node,
|
||||
break;
|
||||
case(ECL_SMSPEC_GROUP_VAR):
|
||||
/* Group variable : WGNAME */
|
||||
if (wgnameOK)
|
||||
if (wgnameOK)
|
||||
smspec_node_set_wgname( smspec_node , wgname );
|
||||
else
|
||||
initOK = false;
|
||||
break;
|
||||
case(ECL_SMSPEC_WELL_VAR):
|
||||
/* Well variable : WGNAME */
|
||||
if (wgnameOK)
|
||||
if (wgnameOK)
|
||||
smspec_node_set_wgname( smspec_node , wgname );
|
||||
else
|
||||
initOK = false;
|
||||
@@ -613,7 +613,7 @@ bool smspec_node_init( smspec_node_type * smspec_node,
|
||||
smspec_node_set_gen_keys( smspec_node , key_join_string );
|
||||
return initOK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function will allocate a smspec_node instance, and initialize
|
||||
all the elements. Observe that the function can return NULL, in the
|
||||
@@ -630,12 +630,12 @@ bool smspec_node_init( 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 ,
|
||||
const int grid_dims[3] ,
|
||||
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 ,
|
||||
const int grid_dims[3] ,
|
||||
int num , int param_index, float default_value) {
|
||||
/*
|
||||
Well and group names in the wgname parameter is quite messy. The
|
||||
@@ -643,10 +643,10 @@ smspec_node_type * smspec_node_alloc( ecl_smspec_var_type var_type ,
|
||||
|
||||
o The ECLIPSE SMSPEC files are very verbose, and contain many
|
||||
entries like this:
|
||||
|
||||
|
||||
KEYWORD : "WWCT"
|
||||
WGNAME : ":+:+:+:+"
|
||||
|
||||
|
||||
i.e. the keyword indicates that this is a perfectly legitimate
|
||||
well variable, however the special wgname value ":+:+:+:+"
|
||||
shows that this just a rubbish entry. We do not want to
|
||||
@@ -666,7 +666,7 @@ smspec_node_type * smspec_node_alloc( ecl_smspec_var_type var_type ,
|
||||
at all, e.g. like "FOPT" - the wgname input value is ignored
|
||||
completely.
|
||||
*/
|
||||
|
||||
|
||||
smspec_node_type * smspec_node = smspec_node_alloc_new( param_index , default_value );
|
||||
if (smspec_node_init( smspec_node , var_type , wgname , keyword , unit , key_join_string , grid_dims, num))
|
||||
return smspec_node;
|
||||
@@ -678,20 +678,20 @@ smspec_node_type * smspec_node_alloc( ecl_smspec_var_type var_type ,
|
||||
|
||||
|
||||
|
||||
bool smspec_node_init_lgr( smspec_node_type * smspec_node ,
|
||||
ecl_smspec_var_type var_type ,
|
||||
const char * wgname ,
|
||||
const char * keyword ,
|
||||
const char * unit ,
|
||||
const char * lgr ,
|
||||
const char * key_join_string ,
|
||||
bool smspec_node_init_lgr( smspec_node_type * smspec_node ,
|
||||
ecl_smspec_var_type var_type ,
|
||||
const char * wgname ,
|
||||
const char * keyword ,
|
||||
const char * unit ,
|
||||
const char * lgr ,
|
||||
const char * key_join_string ,
|
||||
int lgr_i, int lgr_j , int lgr_k
|
||||
) {
|
||||
bool initOK = true;
|
||||
bool wgnameOK = true;
|
||||
if ((wgname != NULL) && (IS_DUMMY_WELL(wgname)))
|
||||
wgnameOK = false;
|
||||
|
||||
|
||||
smspec_node_common_init( smspec_node , var_type , keyword , unit );
|
||||
switch (var_type) {
|
||||
case(ECL_SMSPEC_LOCAL_WELL_VAR):
|
||||
@@ -723,15 +723,15 @@ bool smspec_node_init_lgr( smspec_node_type * smspec_node ,
|
||||
|
||||
|
||||
|
||||
smspec_node_type * smspec_node_alloc_lgr( ecl_smspec_var_type var_type ,
|
||||
const char * wgname ,
|
||||
const char * keyword ,
|
||||
const char * unit ,
|
||||
const char * lgr ,
|
||||
const char * key_join_string ,
|
||||
smspec_node_type * smspec_node_alloc_lgr( ecl_smspec_var_type var_type ,
|
||||
const char * wgname ,
|
||||
const char * keyword ,
|
||||
const char * unit ,
|
||||
const char * lgr ,
|
||||
const char * key_join_string ,
|
||||
int lgr_i, int lgr_j , int lgr_k,
|
||||
int param_index , float default_value) {
|
||||
|
||||
|
||||
smspec_node_type * smspec_node = smspec_node_alloc_new( param_index , default_value );
|
||||
if (smspec_node_init_lgr( smspec_node , var_type , wgname , keyword , unit , lgr , key_join_string , lgr_i, lgr_j , lgr_k))
|
||||
return smspec_node;
|
||||
@@ -805,11 +805,11 @@ 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_is_total( const smspec_node_type * smspec_node ){
|
||||
return smspec_node->total_variable;
|
||||
}
|
||||
|
||||
bool smspec_node_is_historical( const smspec_node_type * smspec_node ){
|
||||
bool smspec_node_is_historical( const smspec_node_type * smspec_node ){
|
||||
return smspec_node->historical;
|
||||
}
|
||||
|
||||
@@ -821,7 +821,7 @@ const char * smspec_node_get_unit( const smspec_node_type * smspec_node) {
|
||||
void smspec_node_set_unit( smspec_node_type * smspec_node , const char * unit ) {
|
||||
// ECLIPSE Standard: Max eight characters - everything beyond is silently dropped
|
||||
util_safe_free( smspec_node->unit );
|
||||
smspec_node->unit = util_alloc_substring_copy( unit , 0 , 8);
|
||||
smspec_node->unit = util_alloc_substring_copy( unit , 0 , 8);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -21,6 +21,8 @@
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
|
||||
#include <ert/geometry/geo_polygon_collection.h>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/fault_block_layer.h>
|
||||
@@ -138,6 +140,7 @@ void test_export( const ecl_grid_type * grid) {
|
||||
void test_neighbours( const ecl_grid_type * grid) {
|
||||
const int k = 0;
|
||||
fault_block_layer_type * layer = fault_block_layer_alloc( grid , k );
|
||||
geo_polygon_collection_type * polylines = geo_polygon_collection_alloc();
|
||||
ecl_kw_type * ecl_kw = ecl_kw_alloc("FAULTBLK" , ecl_grid_get_global_size( grid ) , ECL_INT_TYPE );
|
||||
|
||||
ecl_kw_iset_int( ecl_kw , 0 , 1);
|
||||
@@ -153,14 +156,14 @@ void test_neighbours( const ecl_grid_type * grid) {
|
||||
fault_block_type * block = fault_block_layer_get_block( layer , 1 );
|
||||
|
||||
test_assert_int_equal( 0 , int_vector_size( neighbours ));
|
||||
fault_block_list_neighbours( block , neighbours );
|
||||
fault_block_list_neighbours( block , false , polylines , neighbours );
|
||||
test_assert_int_equal( 0 , int_vector_size( neighbours ));
|
||||
}
|
||||
|
||||
{
|
||||
fault_block_type * block = fault_block_layer_get_block( layer , 2 );
|
||||
|
||||
fault_block_list_neighbours( block , neighbours );
|
||||
fault_block_list_neighbours( block , false , polylines , neighbours );
|
||||
test_assert_int_equal( 1 , int_vector_size( neighbours ));
|
||||
test_assert_true( int_vector_contains( neighbours , 3 ));
|
||||
}
|
||||
@@ -169,7 +172,7 @@ void test_neighbours( const ecl_grid_type * grid) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
geo_polygon_collection_free( polylines );
|
||||
fault_block_layer_free( layer );
|
||||
ecl_kw_free( ecl_kw );
|
||||
}
|
||||
|
2
ThirdParty/Ert/devel/libecl/tests/ecl_file.c
vendored
2
ThirdParty/Ert/devel/libecl/tests/ecl_file.c
vendored
@@ -133,7 +133,7 @@ void test_truncated() {
|
||||
test_work_area_type * work_area = test_work_area_alloc("ecl_file_truncated" );
|
||||
{
|
||||
ecl_grid_type * grid = ecl_grid_alloc_rectangular(20,20,20,1,1,1,NULL);
|
||||
ecl_grid_fwrite_EGRID( grid , "TEST.EGRID");
|
||||
ecl_grid_fwrite_EGRID( grid , "TEST.EGRID", true);
|
||||
ecl_grid_free( grid );
|
||||
}
|
||||
{
|
||||
|
@@ -136,7 +136,7 @@ void test_compare() {
|
||||
for (int i = 0; i < nx*ny; i++) {
|
||||
int g2 = k*nx*ny + i;
|
||||
int g1 = (k- 1)*nx*ny + i;
|
||||
TOPS[g2] = TOPS[g1];
|
||||
TOPS[g2] = TOPS[g1] + DZ[g2];
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -28,7 +28,7 @@
|
||||
void test_fwrite_EGRID(ecl_grid_type * grid ) {
|
||||
test_work_area_type * work_area = test_work_area_alloc("grid-has-mapaxes");
|
||||
|
||||
ecl_grid_fwrite_EGRID( grid , "TEST.EGRID");
|
||||
ecl_grid_fwrite_EGRID( grid , "TEST.EGRID", true);
|
||||
{
|
||||
ecl_grid_type * copy = ecl_grid_alloc( "TEST.EGRID" );
|
||||
test_assert_true( ecl_grid_compare( grid , copy , false , false , true ));
|
||||
|
53
ThirdParty/Ert/devel/libecl/tests/ecl_grid_layer_contains.c
vendored
Normal file
53
ThirdParty/Ert/devel/libecl/tests/ecl_grid_layer_contains.c
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_layer_contains' 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 <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
|
||||
|
||||
void test_layer(const ecl_grid_type * grid ) {
|
||||
int g;
|
||||
|
||||
for (g=0; g < ecl_grid_get_global_size( grid ); g += 25) {
|
||||
double x,y,z;
|
||||
int i,j,k;
|
||||
|
||||
ecl_grid_get_xyz1( grid , g , &x , &y , &z );
|
||||
ecl_grid_get_ijk1( grid , g , &i , &j , &k);
|
||||
{
|
||||
int find_i , find_j;
|
||||
test_assert_true( ecl_grid_get_ij_from_xy( grid , x , y , k , &find_i , &find_j ));
|
||||
test_assert_int_equal( i , find_i );
|
||||
test_assert_int_equal( j , find_j );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc , char ** argv) {
|
||||
ecl_grid_type * grid = ecl_grid_alloc( argv[1] );
|
||||
test_layer( grid );
|
||||
ecl_grid_free( grid );
|
||||
}
|
||||
|
103
ThirdParty/Ert/devel/libecl/tests/ecl_layer.c
vendored
103
ThirdParty/Ert/devel/libecl/tests/ecl_layer.c
vendored
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_layer.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.
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_layer.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.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
@@ -143,7 +143,7 @@ void test_edge() {
|
||||
test_assert_int_equal( layer_iget_edge_value(layer , 3 , 2 , BOTTOM_EDGE) , 100);
|
||||
test_assert_int_equal( layer_iget_edge_value(layer , 3 , 2 , RIGHT_EDGE) , 100);
|
||||
test_assert_int_equal( layer_iget_edge_value(layer , 3 , 2 , TOP_EDGE) , -100);
|
||||
|
||||
|
||||
layer_iset_cell_value( layer , 1 , 2 , 100);
|
||||
test_assert_int_equal( layer_iget_edge_value(layer , 2 , 2 , LEFT_EDGE) , 0);
|
||||
test_assert_int_equal( layer_iget_edge_value(layer , 2 , 2 , BOTTOM_EDGE) , 100);
|
||||
@@ -154,7 +154,7 @@ void test_edge() {
|
||||
test_assert_int_equal( layer_iget_edge_value(layer , 1 , 2 , BOTTOM_EDGE) , 100);
|
||||
test_assert_int_equal( layer_iget_edge_value(layer , 1 , 2 , RIGHT_EDGE) , 0);
|
||||
test_assert_int_equal( layer_iget_edge_value(layer , 1 , 2 , TOP_EDGE) , -100);
|
||||
|
||||
|
||||
layer_iset_cell_value( layer , 2 , 3 , 100);
|
||||
test_assert_int_equal( layer_iget_edge_value(layer , 2 , 2 , LEFT_EDGE) , 0);
|
||||
test_assert_int_equal( layer_iget_edge_value(layer , 2 , 2 , BOTTOM_EDGE) , 100);
|
||||
@@ -177,7 +177,7 @@ void test_edge() {
|
||||
test_assert_int_equal( layer_iget_edge_value(layer , 2 , 1 , BOTTOM_EDGE) , 100);
|
||||
test_assert_int_equal( layer_iget_edge_value(layer , 2 , 1 , RIGHT_EDGE) , 100);
|
||||
test_assert_int_equal( layer_iget_edge_value(layer , 2 , 1 , TOP_EDGE) , 0);
|
||||
|
||||
|
||||
layer_iset_cell_value(layer , 2,2,100);
|
||||
test_assert_int_equal( layer_iget_edge_value(layer , 2 , 2 , LEFT_EDGE) , 0);
|
||||
test_assert_int_equal( layer_iget_edge_value(layer , 2 , 2 , BOTTOM_EDGE) , 0);
|
||||
@@ -211,37 +211,37 @@ void test_walk() {
|
||||
test_assert_int_equal( int_vector_size( cell_list ) , 1 );
|
||||
{
|
||||
int_point2d_type point;
|
||||
|
||||
struct_vector_iget( corner_list , 0 , &point);
|
||||
|
||||
struct_vector_iget( corner_list , 0 , &point);
|
||||
test_assert_int_equal( 4 , point.i );
|
||||
test_assert_int_equal( 4 , point.j );
|
||||
|
||||
struct_vector_iget( corner_list , 1 , &point);
|
||||
struct_vector_iget( corner_list , 1 , &point);
|
||||
test_assert_int_equal( 5 , point.i );
|
||||
test_assert_int_equal( 4 , point.j );
|
||||
|
||||
struct_vector_iget( corner_list , 2 , &point);
|
||||
struct_vector_iget( corner_list , 2 , &point);
|
||||
test_assert_int_equal( 5 , point.i );
|
||||
test_assert_int_equal( 5 , point.j );
|
||||
|
||||
struct_vector_iget( corner_list , 3 , &point);
|
||||
struct_vector_iget( corner_list , 3 , &point);
|
||||
test_assert_int_equal( 4 , point.i );
|
||||
test_assert_int_equal( 5 , point.j );
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
int i,j;
|
||||
int_vector_type * true_cell_list = int_vector_alloc(0,0);
|
||||
for (j= 3; j < 7; j++) {
|
||||
for (i = 3; i < 7; i++) {
|
||||
layer_iset_cell_value( layer , i , j , 100 );
|
||||
layer_iset_cell_value( layer , i , j , 100 );
|
||||
|
||||
if (i == 3 || j == 3)
|
||||
int_vector_append( true_cell_list , i + j*layer_get_nx( layer ));
|
||||
|
||||
if (i == 6 || j == 6)
|
||||
int_vector_append( true_cell_list , i + j*layer_get_nx( layer ));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
int_vector_select_unique( true_cell_list );
|
||||
@@ -256,7 +256,7 @@ void test_walk() {
|
||||
test_assert_true( int_vector_equal( cell_list , true_cell_list ));
|
||||
int_vector_free( true_cell_list );
|
||||
}
|
||||
|
||||
|
||||
int_vector_free( cell_list );
|
||||
struct_vector_free( corner_list );
|
||||
layer_free( layer );
|
||||
@@ -270,12 +270,12 @@ void test_content1() {
|
||||
for (j=4; j < 8; j++)
|
||||
for (i=4; i < 8; i++)
|
||||
layer_iset_cell_value( layer , i , j , 1 );
|
||||
|
||||
|
||||
test_assert_int_equal( 16 , layer_get_cell_sum( layer ));
|
||||
{
|
||||
int_vector_type * i_list = int_vector_alloc(0,0);
|
||||
int_vector_type * j_list = int_vector_alloc(0,0);
|
||||
|
||||
|
||||
test_assert_false( layer_trace_block_content( layer , false , 4,4, 10 , i_list , j_list));
|
||||
test_assert_true( layer_trace_block_content( layer , false , 4,4, 1 , i_list , j_list ));
|
||||
test_assert_int_equal( 16 , int_vector_size( i_list ));
|
||||
@@ -288,11 +288,11 @@ void test_content1() {
|
||||
test_assert_int_equal( int_vector_iget(i_list , i + j*4) , j + 4);
|
||||
test_assert_int_equal( int_vector_iget(j_list , i + j*4) , j + 4);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
test_assert_true( layer_trace_block_content( layer , false , 4,4, 0 , i_list , j_list ));
|
||||
test_assert_int_equal( 16 , int_vector_size( i_list ));
|
||||
|
||||
|
||||
test_assert_true( layer_trace_block_content( layer ,true , 4,4, 0 , i_list , j_list ));
|
||||
test_assert_int_equal( 16 , int_vector_size( i_list ));
|
||||
test_assert_int_equal( 0 , layer_get_cell_sum( layer ));
|
||||
@@ -300,7 +300,7 @@ void test_content1() {
|
||||
int_vector_free( i_list );
|
||||
int_vector_free( j_list );
|
||||
}
|
||||
|
||||
|
||||
layer_free( layer );
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ void test_content2() {
|
||||
int i,j;
|
||||
for (j=0; j < 5; j++)
|
||||
layer_iset_cell_value( layer , 2 , j , 1 );
|
||||
|
||||
|
||||
for (i=0; i < 5; i++)
|
||||
layer_iset_cell_value( layer , i , 2 , 1 );
|
||||
|
||||
@@ -321,7 +321,7 @@ void test_content2() {
|
||||
int_vector_type * j_list = int_vector_alloc(0,0);
|
||||
int_vector_type * cell_list = int_vector_alloc(0,0);
|
||||
struct_vector_type * corner_list = struct_vector_alloc( sizeof(int_point2d_type) );
|
||||
|
||||
|
||||
|
||||
for (j=0; j < 5; j++) {
|
||||
for (i=0; i < 5; i++) {
|
||||
@@ -333,7 +333,7 @@ void test_content2() {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct_vector_free( corner_list );
|
||||
int_vector_free( i_list );
|
||||
@@ -342,7 +342,7 @@ void test_content2() {
|
||||
}
|
||||
test_assert_int_equal( 0 , layer_get_cell_sum( layer ));
|
||||
|
||||
|
||||
|
||||
layer_free( layer );
|
||||
}
|
||||
|
||||
@@ -365,6 +365,33 @@ void test_replace() {
|
||||
|
||||
|
||||
|
||||
void test_interp_barrier() {
|
||||
layer_type * layer = layer_alloc(10,10);
|
||||
|
||||
layer_add_interp_barrier( layer , 0 , 22 );
|
||||
|
||||
layer_free( layer );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void test_copy( ) {
|
||||
layer_type * layer1 = layer_alloc(10,10);
|
||||
layer_type * layer2 = layer_alloc(10,10);
|
||||
|
||||
layer_iset_cell_value( layer1 , 5,5,10 );
|
||||
layer_memcpy( layer2 , layer1 );
|
||||
|
||||
test_assert_int_equal( 10 , layer_iget_edge_value( layer2 , 5,5,BOTTOM_EDGE));
|
||||
test_assert_int_equal( 10 , layer_iget_edge_value( layer2 , 5,5,RIGHT_EDGE));
|
||||
test_assert_int_equal( -10 , layer_iget_edge_value( layer2 , 5,5,TOP_EDGE));
|
||||
test_assert_int_equal( -10 , layer_iget_edge_value( layer2 , 5,5,LEFT_EDGE));
|
||||
|
||||
layer_free( layer2 );
|
||||
layer_free( layer1 );
|
||||
}
|
||||
|
||||
|
||||
int main(int argc , char ** argv) {
|
||||
test_create();
|
||||
test_get_invalid_cell();
|
||||
@@ -375,4 +402,6 @@ int main(int argc , char ** argv) {
|
||||
test_content1();
|
||||
test_content2();
|
||||
test_replace();
|
||||
test_interp_barrier();
|
||||
test_copy();
|
||||
}
|
||||
|
2
ThirdParty/Ert/devel/libecl/tests/ecl_rft.c
vendored
2
ThirdParty/Ert/devel/libecl/tests/ecl_rft.c
vendored
@@ -34,7 +34,7 @@ void test_rft_read_write(const char * rft_file){
|
||||
ecl_rft_node_type ** nodes =(ecl_rft_node_type **) malloc(sizeof(ecl_rft_node_type *) * 3);
|
||||
int size = ecl_rft_file_get_size(rft);
|
||||
for(int i =0;i<size;i++){
|
||||
const ecl_rft_node_type * rft_node = ecl_rft_file_iget_node(rft, i);
|
||||
ecl_rft_node_type * rft_node = ecl_rft_file_iget_node(rft, i);
|
||||
nodes[i] =rft_node;
|
||||
}
|
||||
ecl_rft_node_type * old_node = ecl_rft_file_iget_node(rft, 0);
|
||||
|
32
ThirdParty/Ert/devel/libecl/tests/ecl_sum_test.c
vendored
32
ThirdParty/Ert/devel/libecl/tests/ecl_sum_test.c
vendored
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_sum_test.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.
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_sum_test.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.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
@@ -65,7 +65,7 @@ int main( int argc , char ** argv) {
|
||||
const char * case1 = argv[1];
|
||||
|
||||
ecl_sum_type * ecl_sum1 = ecl_sum_fread_alloc_case( case1 , ":");
|
||||
|
||||
|
||||
test_assert_true( ecl_sum_is_instance( ecl_sum1 ));
|
||||
test_time_range( ecl_sum1 );
|
||||
test_days( ecl_sum1 );
|
||||
|
@@ -7,6 +7,12 @@ target_link_libraries( ecl_coarse_test ecl test_util )
|
||||
add_test( ecl_coarse_test ${EXECUTABLE_OUTPUT_PATH}/ecl_coarse_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/LGCcase/LGC_TESTCASE2 )
|
||||
|
||||
|
||||
add_executable( ecl_grid_layer_contains ecl_grid_layer_contains.c )
|
||||
target_link_libraries( ecl_grid_layer_contains ecl test_util )
|
||||
add_test( ecl_grid_layer_contains1 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_layer_contains ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID )
|
||||
add_test( ecl_grid_layer_contains2 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_layer_contains ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Mariner/MARINER.EGRID )
|
||||
|
||||
|
||||
add_executable( ecl_restart_test ecl_restart_test.c )
|
||||
target_link_libraries( ecl_restart_test ecl test_util )
|
||||
add_test( ecl_restart_test ${EXECUTABLE_OUTPUT_PATH}/ecl_restart_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.UNRST )
|
||||
@@ -363,3 +369,5 @@ set_property( TEST ecl_grid_copy_statoil2 PROPERTY LABELS StatoilData )
|
||||
set_property( TEST ecl_grid_copy_statoil3 PROPERTY LABELS StatoilData )
|
||||
set_property( TEST ecl_grid_copy_statoil4 PROPERTY LABELS StatoilData )
|
||||
set_property( TEST ecl_layer_statoil PROPERTY LABELS StatoilData )
|
||||
set_property( TEST ecl_grid_layer_contains1 PROPERTY LABELS StatoilData )
|
||||
set_property( TEST ecl_grid_layer_contains2 PROPERTY LABELS StatoilData )
|
@@ -49,7 +49,7 @@ extern "C" {
|
||||
int well_nr);
|
||||
|
||||
bool well_state_add_MSW( well_state_type * well_state ,
|
||||
const ecl_file_type * rst_file ,
|
||||
ecl_file_type * rst_file ,
|
||||
int well_nr,
|
||||
bool load_segment_information);
|
||||
|
||||
|
@@ -371,7 +371,7 @@ void well_state_add_connections( well_state_type * well_state ,
|
||||
|
||||
|
||||
bool well_state_add_MSW( well_state_type * well_state ,
|
||||
const ecl_file_type * rst_file ,
|
||||
ecl_file_type * rst_file ,
|
||||
int well_nr,
|
||||
bool load_segment_information) {
|
||||
|
||||
|
5
ThirdParty/Ert/devel/libeclxx/CMakeLists.txt
vendored
Normal file
5
ThirdParty/Ert/devel/libeclxx/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
add_subdirectory( src )
|
||||
|
||||
if (BUILD_TESTS)
|
||||
add_subdirectory( tests )
|
||||
endif()
|
97
ThirdParty/Ert/devel/libeclxx/include/ert/ecl/EclKW.hpp
vendored
Normal file
97
ThirdParty/Ert/devel/libeclxx/include/ert/ecl/EclKW.hpp
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
Copyright 2015 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef OPM_ERT_ECL_KW
|
||||
#define OPM_ERT_ECL_KW
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/FortIO.hpp>
|
||||
|
||||
|
||||
|
||||
namespace ERT {
|
||||
template <typename T>
|
||||
class EclKW
|
||||
{
|
||||
public:
|
||||
EclKW(const std::string& kw, int size_);
|
||||
EclKW() { ; }
|
||||
|
||||
static EclKW load(FortIO& fortio);
|
||||
|
||||
size_t size() const {
|
||||
return static_cast<size_t>( ecl_kw_get_size( m_kw.get() ));
|
||||
}
|
||||
|
||||
T& operator[](size_t index) {
|
||||
return *( static_cast<T *>( ecl_kw_iget_ptr( m_kw.get() , index) ));
|
||||
}
|
||||
|
||||
|
||||
void fwrite(FortIO& fortio) const {
|
||||
ecl_kw_fwrite( m_kw.get() , fortio.getPointer() );
|
||||
}
|
||||
|
||||
|
||||
void assignVector(const std::vector<T>& data) {
|
||||
if (data.size() == size())
|
||||
ecl_kw_set_memcpy_data( m_kw.get() , data.data() );
|
||||
else
|
||||
throw std::invalid_argument("Size error");
|
||||
}
|
||||
|
||||
ecl_kw_type * getPointer() const {
|
||||
return m_kw.get();
|
||||
}
|
||||
|
||||
private:
|
||||
EclKW(ecl_kw_type * c_ptr) {
|
||||
reset(c_ptr);
|
||||
}
|
||||
|
||||
void reset(ecl_kw_type * c_ptr) {
|
||||
m_kw.reset( c_ptr , ecl_kw_free);
|
||||
}
|
||||
|
||||
|
||||
static EclKW checkedLoad(FortIO& fortio, ecl_type_enum expectedType) {
|
||||
ecl_kw_type * c_ptr = ecl_kw_fread_alloc( fortio.getPointer() );
|
||||
if (c_ptr) {
|
||||
if (ecl_kw_get_type( c_ptr ) == expectedType)
|
||||
return EclKW( c_ptr );
|
||||
else
|
||||
throw std::invalid_argument("Type error");
|
||||
} else
|
||||
throw std::invalid_argument("fread kw failed - EOF?");
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<ecl_kw_type> m_kw;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
48
ThirdParty/Ert/devel/libeclxx/include/ert/ecl/FortIO.hpp
vendored
Normal file
48
ThirdParty/Ert/devel/libeclxx/include/ert/ecl/FortIO.hpp
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright 2015 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef OPM_ERT_FORTIO_KW
|
||||
#define OPM_ERT_FORTIO_KW
|
||||
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include <ert/ecl/fortio.h>
|
||||
#include <ert/ecl/ecl_endian_flip.h>
|
||||
|
||||
|
||||
|
||||
|
||||
namespace ERT {
|
||||
class FortIO
|
||||
{
|
||||
public:
|
||||
FortIO(const std::string& filename , std::ios_base::openmode mode , bool fmt_file = false , bool endian_flip_header = ECL_ENDIAN_FLIP);
|
||||
fortio_type * getPointer() const;
|
||||
void close();
|
||||
void reset() const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<fortio_type> m_fortio;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
23
ThirdParty/Ert/devel/libeclxx/src/CMakeLists.txt
vendored
Normal file
23
ThirdParty/Ert/devel/libeclxx/src/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
set( source_files
|
||||
EclKW.cpp
|
||||
FortIO.cpp )
|
||||
|
||||
set( header_files
|
||||
EclKW.hpp
|
||||
FortIO.hpp )
|
||||
|
||||
|
||||
add_library( eclxx ${LIBRARY_TYPE} ${source_files} )
|
||||
set_target_properties( eclxx PROPERTIES VERSION 1.0 SOVERSION 1.0 )
|
||||
if (USE_RUNPATH)
|
||||
add_runpath( eclxx )
|
||||
endif()
|
||||
target_link_libraries( eclxx ecl )
|
||||
|
||||
|
||||
if (INSTALL_ERT)
|
||||
install(TARGETS eclxx DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
foreach(header ${header_files})
|
||||
install(FILES ../include/ert/ecl/${header} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ert/ecl)
|
||||
endforeach()
|
||||
endif()
|
39
ThirdParty/Ert/devel/libeclxx/src/EclKW.cpp
vendored
Normal file
39
ThirdParty/Ert/devel/libeclxx/src/EclKW.cpp
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
#include <ert/ecl/EclKW.hpp>
|
||||
|
||||
|
||||
namespace ERT {
|
||||
template <>
|
||||
EclKW<int>::EclKW(const std::string& kw, int size_) {
|
||||
ecl_kw_type * c_ptr = ecl_kw_alloc( kw.c_str() , size_ , ECL_INT_TYPE );
|
||||
reset( c_ptr );
|
||||
}
|
||||
|
||||
template <>
|
||||
EclKW<float>::EclKW(const std::string& kw, int size_) {
|
||||
ecl_kw_type * c_ptr = ecl_kw_alloc( kw.c_str() , size_ , ECL_FLOAT_TYPE );
|
||||
reset( c_ptr );
|
||||
}
|
||||
|
||||
template <>
|
||||
EclKW<double>::EclKW(const std::string& kw, int size_) {
|
||||
ecl_kw_type * c_ptr = ecl_kw_alloc( kw.c_str() , size_ , ECL_DOUBLE_TYPE );
|
||||
reset( c_ptr );
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <>
|
||||
EclKW<double> EclKW<double>::load(FortIO& fortio) {
|
||||
return checkedLoad(fortio , ECL_DOUBLE_TYPE);
|
||||
}
|
||||
|
||||
template <>
|
||||
EclKW<int> EclKW<int>::load(FortIO& fortio) {
|
||||
return checkedLoad(fortio , ECL_INT_TYPE);
|
||||
}
|
||||
|
||||
template <>
|
||||
EclKW<float> EclKW<float>::load(FortIO& fortio) {
|
||||
return checkedLoad(fortio , ECL_FLOAT_TYPE);
|
||||
}
|
||||
}
|
57
ThirdParty/Ert/devel/libeclxx/src/FortIO.cpp
vendored
Normal file
57
ThirdParty/Ert/devel/libeclxx/src/FortIO.cpp
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
Copyright 2015 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ert/ecl/fortio.h>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/ecl/FortIO.hpp>
|
||||
|
||||
namespace ERT {
|
||||
|
||||
FortIO::FortIO(const std::string& filename , std::ios_base::openmode mode , bool fmt_file , bool endian_flip_header) {
|
||||
if (mode == std::ios_base::in) {
|
||||
if (util_file_exists( filename.c_str() )) {
|
||||
fortio_type * c_ptr = fortio_open_reader( filename.c_str() , fmt_file , endian_flip_header);
|
||||
m_fortio.reset( c_ptr , fortio_fclose );
|
||||
} else
|
||||
throw std::invalid_argument("File " + filename + " does not exist");
|
||||
} else {
|
||||
fortio_type * c_ptr = fortio_open_writer( filename.c_str() , fmt_file , endian_flip_header);
|
||||
m_fortio.reset( c_ptr , fortio_fclose );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FortIO::close() {
|
||||
if (m_fortio)
|
||||
m_fortio.reset( );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
fortio_type * FortIO::getPointer() const {
|
||||
return m_fortio.get();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
7
ThirdParty/Ert/devel/libeclxx/tests/CMakeLists.txt
vendored
Normal file
7
ThirdParty/Ert/devel/libeclxx/tests/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
add_executable(eclxx_kw eclxx_kw.cpp)
|
||||
target_link_libraries(eclxx_kw eclxx test_util util)
|
||||
add_test(eclxx_kw ${EXECUTABLE_OUTPUT_PATH}/eclxx_kw)
|
||||
|
||||
add_executable(eclxx_fortio eclxx_fortio.cpp)
|
||||
target_link_libraries(eclxx_fortio eclxx test_util util)
|
||||
add_test(eclxx_fortio ${EXECUTABLE_OUTPUT_PATH}/eclxx_fortio)
|
96
ThirdParty/Ert/devel/libeclxx/tests/eclxx_fortio.cpp
vendored
Normal file
96
ThirdParty/Ert/devel/libeclxx/tests/eclxx_fortio.cpp
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
Copyright 2015 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <fstream>
|
||||
|
||||
|
||||
#include <ert/util/test_work_area.h>
|
||||
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/ecl/EclKW.hpp>
|
||||
#include <ert/ecl/FortIO.hpp>
|
||||
|
||||
|
||||
|
||||
void test_fortio() {
|
||||
test_work_area_type * work_area = test_work_area_alloc("fortio");
|
||||
|
||||
ERT::FortIO fortio("new_file" , std::fstream::out );
|
||||
{
|
||||
std::vector<int> data;
|
||||
for (size_t i=0; i < 1000; i++)
|
||||
data.push_back(i);
|
||||
|
||||
fortio_fwrite_record( fortio.getPointer() , reinterpret_cast<char *>(data.data()) , 1000 * 4 );
|
||||
}
|
||||
fortio.close();
|
||||
|
||||
fortio = ERT::FortIO("new_file" , std::fstream::in );
|
||||
{
|
||||
std::vector<int> data;
|
||||
for (size_t i=0; i < 1000; i++)
|
||||
data.push_back(99);
|
||||
|
||||
test_assert_true( fortio_fread_buffer( fortio.getPointer() , reinterpret_cast<char *>(data.data()) , 1000 * 4 ) );
|
||||
for (size_t i =0; i < 1000; i++)
|
||||
test_assert_size_t_equal(data[i], i);
|
||||
|
||||
}
|
||||
fortio.close();
|
||||
test_work_area_free( work_area );
|
||||
|
||||
test_assert_throw( ERT::FortIO fortio("file/does/not/exists" , std::fstream::in) , std::invalid_argument );
|
||||
}
|
||||
|
||||
|
||||
void test_fortio_kw() {
|
||||
test_work_area_type * work_area = test_work_area_alloc("fortio_kw");
|
||||
ERT::EclKW<int> kw("XYZ" , 1000);
|
||||
for (size_t i =0 ; i < kw.size(); i++)
|
||||
kw[i] = i;
|
||||
|
||||
{
|
||||
ERT::FortIO fortio("new_file" , std::fstream::out );
|
||||
kw.fwrite( fortio );
|
||||
fortio.close();
|
||||
}
|
||||
|
||||
{
|
||||
ERT::FortIO fortio("new_file" , std::fstream::in );
|
||||
ERT::EclKW<int> kw2 = ERT::EclKW<int>::load( fortio );
|
||||
fortio.close( );
|
||||
for (size_t i =0 ; i < kw.size(); i++)
|
||||
test_assert_int_equal( kw[i] , kw2[i]);
|
||||
|
||||
|
||||
fortio = ERT::FortIO("new_file" , std::fstream::in );
|
||||
test_assert_throw( ERT::EclKW<float>::load(fortio) , std::invalid_argument );
|
||||
fortio.close();
|
||||
}
|
||||
|
||||
test_work_area_free( work_area );
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc , char ** argv) {
|
||||
test_fortio();
|
||||
test_fortio_kw();
|
||||
}
|
47
ThirdParty/Ert/devel/libeclxx/tests/eclxx_kw.cpp
vendored
Normal file
47
ThirdParty/Ert/devel/libeclxx/tests/eclxx_kw.cpp
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
Copyright 2015 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <fstream>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_work_area.h>
|
||||
#include <ert/ecl/EclKW.hpp>
|
||||
#include <ert/ecl/FortIO.hpp>
|
||||
|
||||
|
||||
void test_kw() {
|
||||
ERT::EclKW<int> kw("XYZ" , 1000);
|
||||
test_assert_size_t_equal( kw.size() , 1000 );
|
||||
|
||||
kw[0] = 1;
|
||||
kw[10] = 77;
|
||||
|
||||
test_assert_int_equal( kw[0] , 1 );
|
||||
test_assert_int_equal( kw[10] , 77 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
test_kw();
|
||||
}
|
@@ -53,7 +53,6 @@
|
||||
#include <ert/enkf/plot_config.h>
|
||||
#include <ert/enkf/member_config.h>
|
||||
#include <ert/enkf/enkf_analysis.h>
|
||||
#include <ert/enkf/obs_tstep_list.h>
|
||||
#include <ert/enkf/pca_plot_data.h>
|
||||
|
||||
#include <enkf_tui_util.h>
|
||||
|
@@ -110,6 +110,11 @@ bool analysis_config_get_stop_long_running( const analysis_con
|
||||
void analysis_config_set_max_runtime( analysis_config_type * config, int max_runtime );
|
||||
int analysis_config_get_max_runtime( const analysis_config_type * config );
|
||||
const char * analysis_config_get_active_module_name( const analysis_config_type * config );
|
||||
bool analysis_config_get_std_scale_correlated_obs( const analysis_config_type * config);
|
||||
void analysis_config_set_std_scale_correlated_obs( analysis_config_type * config, bool std_scale_correlated_obs);
|
||||
|
||||
double analysis_config_get_global_std_scaling(const analysis_config_type * config);
|
||||
void analysis_config_set_global_std_scaling(analysis_config_type * config, double global_std_scaling);
|
||||
|
||||
UTIL_IS_INSTANCE_HEADER( analysis_config );
|
||||
|
||||
|
@@ -77,9 +77,8 @@ double block_obs_iget_value(const block_obs_type * block_obs, int index );
|
||||
double block_obs_iget_std(const block_obs_type * block_obs, int index );
|
||||
void block_obs_iget_ijk(const block_obs_type * block_obs , int block_nr , int * i , int * j , int * k);
|
||||
double block_obs_iget_data( const block_obs_type * block_obs, const void * state , int iobs , node_id_type node_id );
|
||||
|
||||
void block_obs_scale_std(block_obs_type * block_obs, double scale_factor);
|
||||
void block_obs_scale_std__(void * block_obs, double scale_factor);
|
||||
double block_obs_iget_std_scaling(const block_obs_type * block_obs, int index );
|
||||
void block_obs_update_std_scale(block_obs_type * block_obs, double scale_factor, const active_list_type * active_list);
|
||||
void block_obs_append_field_obs( block_obs_type * block_obs , int i , int j , int k , double value , double std);
|
||||
void block_obs_append_summary_obs( block_obs_type * block_obs , int i , int j , int k , const char * sum_key , double value , double std);
|
||||
|
||||
@@ -89,6 +88,7 @@ UTIL_IS_INSTANCE_HEADER(block_obs);
|
||||
VOID_MEASURE_HEADER(block_obs);
|
||||
VOID_USER_GET_OBS_HEADER(block_obs);
|
||||
VOID_CHI2_HEADER(block_obs);
|
||||
VOID_UPDATE_STD_SCALE_HEADER(block_obs);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'config_keys.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.
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'config_keys.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.
|
||||
*/
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ extern "C" {
|
||||
|
||||
/* These keys are used as options in KEY:VALUE statements */
|
||||
#define BASE_SURFACE_KEY "BASE_SURFACE"
|
||||
#define DEFINE_KEY "DEFINE"
|
||||
#define DYNAMIC_KEY "DYNAMIC"
|
||||
#define DEFINE_KEY "DEFINE"
|
||||
#define DYNAMIC_KEY "DYNAMIC"
|
||||
#define ECL_FILE_KEY "ECL_FILE"
|
||||
#define FORWARD_INIT_KEY "FORWARD_INIT"
|
||||
#define GENERAL_KEY "GENERAL"
|
||||
@@ -43,7 +43,7 @@ extern "C" {
|
||||
#define OUTPUT_FORMAT_KEY "OUTPUT_FORMAT"
|
||||
#define OUTPUT_TRANSFORM_KEY "OUTPUT_TRANSFORM"
|
||||
#define PARAMETER_KEY "PARAMETER"
|
||||
#define REPORT_STEPS_KEY "REPORT_STEPS"
|
||||
#define REPORT_STEPS_KEY "REPORT_STEPS"
|
||||
#define RESULT_FILE_KEY "RESULT_FILE"
|
||||
#define TEMPLATE_KEY "TEMPLATE"
|
||||
|
||||
@@ -57,31 +57,31 @@ extern "C" {
|
||||
#define CONTAINER_KEY "CONTAINER"
|
||||
#define CUSTOM_KW_KEY "CUSTOM_KW"
|
||||
#define DATA_FILE_KEY "DATA_FILE"
|
||||
#define DATA_KW_KEY "DATA_KW"
|
||||
#define DATA_KW_KEY "DATA_KW"
|
||||
#define DBASE_TYPE_KEY "DBASE_TYPE"
|
||||
#define DBASE_TYPE_KEY "DBASE_TYPE"
|
||||
#define DELETE_RUNPATH_KEY "DELETE_RUNPATH"
|
||||
#define DELETE_RUNPATH_KEY "DELETE_RUNPATH"
|
||||
#define ECLBASE_KEY "ECLBASE"
|
||||
#define END_DATE_KEY "END_DATE"
|
||||
#define ENKF_BOOTSTRAP_KEY "ENKF_BOOTSTRAP"
|
||||
#define ENKF_PEN_PRESS_KEY "ENKF_PEN_PRESS"
|
||||
#define ENKF_ALPHA_KEY "ENKF_ALPHA"
|
||||
#define ENKF_CROSS_VALIDATION_KEY "ENKF_CROSS_VALIDATION"
|
||||
#define ENKF_CV_FOLDS_KEY "ENKF_CV_FOLDS"
|
||||
#define ENKF_CV_FOLDS_KEY "ENKF_CV_FOLDS"
|
||||
#define ENKF_FORCE_NCOMP_KEY "ENKF_FORCE_NCOMP"
|
||||
#define ENKF_NCOMP_KEY "ENKF_NCOMP"
|
||||
#define ENKF_SCALING_KEY "ENKF_SCALING"
|
||||
#define ENKF_KERNEL_REG_KEY "ENKF_KERNEL_REGRESSION"
|
||||
#define ENKF_KERNEL_FUNC_KEY "ENKF_KERNEL_FUNCTION"
|
||||
#define ENKF_KERNEL_PARAM_KEY "ENKF_KERNEL_PARAM"
|
||||
#define ENKF_LOCAL_CV_KEY "ENKF_LOCAL_CV"
|
||||
#define ENKF_NCOMP_KEY "ENKF_NCOMP"
|
||||
#define ENKF_SCALING_KEY "ENKF_SCALING"
|
||||
#define ENKF_KERNEL_REG_KEY "ENKF_KERNEL_REGRESSION"
|
||||
#define ENKF_KERNEL_FUNC_KEY "ENKF_KERNEL_FUNCTION"
|
||||
#define ENKF_KERNEL_PARAM_KEY "ENKF_KERNEL_PARAM"
|
||||
#define ENKF_LOCAL_CV_KEY "ENKF_LOCAL_CV"
|
||||
#define ENKF_MERGE_OBSERVATIONS_KEY "ENKF_MERGE_OBSERVATIONS"
|
||||
#define ENKF_MODE_KEY "ENKF_MODE"
|
||||
#define ENKF_RERUN_KEY "ENKF_RERUN"
|
||||
#define ENKF_SCHED_FILE_KEY "ENKF_SCHED_FILE"
|
||||
#define ENKF_TRUNCATION_KEY "ENKF_TRUNCATION"
|
||||
#define ENSPATH_KEY "ENSPATH"
|
||||
#define ITER_CASE_KEY "ITER_CASE"
|
||||
#define ENSPATH_KEY "ENSPATH"
|
||||
#define ITER_CASE_KEY "ITER_CASE"
|
||||
#define ITER_COUNT_KEY "ITER_COUNT"
|
||||
#define ITER_RETRY_COUNT_KEY "ITER_RETRY_COUNT"
|
||||
#define FIELD_KEY "FIELD"
|
||||
@@ -90,21 +90,21 @@ extern "C" {
|
||||
#define GEN_KW_KEY "GEN_KW"
|
||||
#define GEN_KW_TAG_FORMAT_KEY "GEN_KW_TAG_FORMAT"
|
||||
#define GEN_KW_EXPORT_FILE_KEY "GEN_KW_EXPORT_FILE"
|
||||
#define GEN_PARAM_KEY "GEN_PARAM"
|
||||
#define GEN_PARAM_KEY "GEN_PARAM"
|
||||
#define GRID_KEY "GRID"
|
||||
#define HISTORY_SOURCE_KEY "HISTORY_SOURCE"
|
||||
#define HOSY_TYPE_KEY "HOST_TYPE"
|
||||
#define IGNORE_SCHEDULE_KEY "IGNORE_SCHEDULE"
|
||||
#define IGNORE_SCHEDULE_KEY "IGNORE_SCHEDULE"
|
||||
#define IMAGE_TYPE_KEY "IMAGE_TYPE"
|
||||
#define IMAGE_VIEWER_KEY "IMAGE_VIEWER"
|
||||
#define IMAGE_VIEWER_KEY "IMAGE_VIEWER"
|
||||
#define INIT_SECTION_KEY "INIT_SECTION"
|
||||
#define INSTALL_JOB_KEY "INSTALL_JOB"
|
||||
#define INSTALL_JOB_DIRECTORY_KEY "INSTALL_JOB_DIRECTORY"
|
||||
#define JOB_SCRIPT_KEY "JOB_SCRIPT"
|
||||
#define JOBNAME_KEY "JOBNAME"
|
||||
#define KEEP_RUNPATH_KEY "KEEP_RUNPATH"
|
||||
#define KEEP_RUNPATH_KEY "KEEP_RUNPATH"
|
||||
#define LICENSE_PATH_KEY "LICENSE_PATH"
|
||||
#define LOAD_SEED_KEY "LOAD_SEED"
|
||||
#define LOAD_SEED_KEY "LOAD_SEED"
|
||||
#define LOCAL_CONFIG_KEY "LOCAL_CONFIG"
|
||||
#define LOG_FILE_KEY "LOG_FILE"
|
||||
#define LOG_LEVEL_KEY "LOG_LEVEL"
|
||||
@@ -112,33 +112,33 @@ extern "C" {
|
||||
#define LSF_RESOURCES_KEY "LSF_RESOURCES"
|
||||
#define LSF_SERVER_KEY "LSF_SERVER"
|
||||
#define TORQUE_QUEUE_KEY "TORQUE_QUEUE"
|
||||
#define MAX_RESAMPLE_KEY "MAX_RESAMPLE"
|
||||
#define MAX_RESAMPLE_KEY "MAX_RESAMPLE"
|
||||
#define MAX_RUNNING_LOCAL_KEY "MAX_RUNNING_LOCAL"
|
||||
#define MAX_RUNNING_LSF_KEY "MAX_RUNNING_LSF"
|
||||
#define MAX_RUNNING_RSH_KEY "MAX_RUNNING_RSH"
|
||||
#define MAX_SUBMIT_KEY "MAX_SUBMIT"
|
||||
#define NUM_REALIZATIONS_KEY "NUM_REALIZATIONS"
|
||||
#define MIN_REALIZATIONS_KEY "MIN_REALIZATIONS"
|
||||
#define MAX_SUBMIT_KEY "MAX_SUBMIT"
|
||||
#define NUM_REALIZATIONS_KEY "NUM_REALIZATIONS"
|
||||
#define MIN_REALIZATIONS_KEY "MIN_REALIZATIONS"
|
||||
#define OBS_CONFIG_KEY "OBS_CONFIG"
|
||||
#define OBS_CONFIG_KEY "OBS_CONFIG"
|
||||
#define PLOT_DRIVER_KEY "PLOT_DRIVER"
|
||||
#define PLOT_ERRORBAR_MAX_KEY "PLOT_ERRORBAR_MAX"
|
||||
#define PLOT_ERRORBAR_MAX_KEY "PLOT_ERRORBAR_MAX"
|
||||
#define PLOT_ERRORBAR_KEY "PLOT_ERRORBAR"
|
||||
#define PLOT_HEIGHT_KEY "PLOT_HEIGHT"
|
||||
#define PLOT_PATH_KEY "PLOT_PATH"
|
||||
#define PLOT_HEIGHT_KEY "PLOT_HEIGHT"
|
||||
#define PLOT_PATH_KEY "PLOT_PATH"
|
||||
#define PLOT_REFCASE_KEY "PLOT_REFCASE"
|
||||
#define PLOT_REFCASE_LIST_KEY "PLOT_REFCASE_LIST"
|
||||
#define PLOT_WIDTH_KEY "PLOT_WIDTH"
|
||||
#define PLOT_WIDTH_KEY "PLOT_WIDTH"
|
||||
#define PRE_CLEAR_RUNPATH_KEY "PRE_CLEAR_RUNPATH"
|
||||
#define QUEUE_SYSTEM_KEY "QUEUE_SYSTEM"
|
||||
#define QUEUE_OPTION_KEY "QUEUE_OPTION"
|
||||
#define QC_PATH_KEY "QC_PATH"
|
||||
#define QUEUE_OPTION_KEY "QUEUE_OPTION"
|
||||
#define QC_PATH_KEY "QC_PATH"
|
||||
#define QC_WORKFLOW_KEY "QC_WORKFLOW"
|
||||
#define REFCASE_KEY "REFCASE"
|
||||
#define REFCASE_LIST_KEY "REFCASE_LIST"
|
||||
#define REPORT_CONTEXT_KEY "REPORT_CONTEXT"
|
||||
#define REPORT_SEARCH_PATH_KEY "REPORT_SEARCH_PATH"
|
||||
#define REPORT_LARGE_KEY "REPORT_LARGE"
|
||||
#define REPORT_LARGE_KEY "REPORT_LARGE"
|
||||
#define REPORT_LIST_KEY "REPORT_LIST"
|
||||
#define REPORT_PATH_KEY "REPORT_PATH"
|
||||
#define REPORT_WELL_LIST_KEY "REPORT_WELL_LIST"
|
||||
@@ -147,7 +147,7 @@ extern "C" {
|
||||
#define RERUN_START_KEY "RERUN_START"
|
||||
#define RSH_COMMAND_KEY "RSH_COMMAND"
|
||||
#define RSH_HOST_KEY "RSH_HOST"
|
||||
#define RUNPATH_FILE_KEY "RUNPATH_FILE"
|
||||
#define RUNPATH_FILE_KEY "RUNPATH_FILE"
|
||||
#define RUNPATH_KEY "RUNPATH"
|
||||
#define ITER_RUNPATH_KEY "ITER_RUNPATH"
|
||||
#define RERUN_PATH_KEY "RERUN_PATH"
|
||||
@@ -163,21 +163,22 @@ extern "C" {
|
||||
#define SETENV_KEY "SETENV"
|
||||
#define STATIC_KW_KEY "ADD_STATIC_KW"
|
||||
#define STD_CUTOFF_KEY "STD_CUTOFF"
|
||||
#define SUMMARY_KEY "SUMMARY"
|
||||
#define SUMMARY_KEY "SUMMARY"
|
||||
#define SURFACE_KEY "SURFACE"
|
||||
#define UPDATE_LOG_PATH_KEY "UPDATE_LOG_PATH"
|
||||
#define UPDATE_PATH_KEY "UPDATE_PATH"
|
||||
#define UPDATE_RESULTS_KEY "UPDATE_RESULTS"
|
||||
#define SINGLE_NODE_UPDATE_KEY "SINGLE_NODE_UPDATE"
|
||||
#define STORE_SEED_KEY "STORE_SEED"
|
||||
#define UMASK_KEY "UMASK"
|
||||
#define UMASK_KEY "UMASK"
|
||||
#define WORKFLOW_JOB_DIRECTORY_KEY "WORKFLOW_JOB_DIRECTORY"
|
||||
#define LOAD_WORKFLOW_KEY "LOAD_WORKFLOW"
|
||||
#define LOAD_WORKFLOW_KEY "LOAD_WORKFLOW"
|
||||
#define LOAD_WORKFLOW_JOB_KEY "LOAD_WORKFLOW_JOB"
|
||||
#define STOP_LONG_RUNNING_KEY "STOP_LONG_RUNNING"
|
||||
#define MAX_RUNTIME_KEY "MAX_RUNTIME"
|
||||
#define TIME_MAP_KEY "TIME_MAP"
|
||||
|
||||
#define EXT_JOB_SEARCH_PATH_KEY "EXT_JOB_SEARCH_PATH"
|
||||
#define STD_SCALE_CORRELATED_OBS_KEY "STD_SCALE_CORRELATED_OBS"
|
||||
|
||||
#define CONFIG_BOOL_STRING( var ) (var) ? "TRUE" : "FALSE"
|
||||
|
||||
|
@@ -15,7 +15,7 @@ extern "C" {
|
||||
custom_kw_config_set_type * custom_kw_config_set_alloc();
|
||||
custom_kw_config_set_type * custom_kw_config_set_alloc_from_file(const char * filename);
|
||||
void custom_kw_config_set_free(custom_kw_config_set_type * set);
|
||||
void custom_kw_config_set_add_config(custom_kw_config_set_type * set, custom_kw_config_type * config);
|
||||
void custom_kw_config_set_add_config(custom_kw_config_set_type * set, const custom_kw_config_type * config);
|
||||
void custom_kw_config_set_update_config(custom_kw_config_set_type * set, custom_kw_config_type * config);
|
||||
void custom_kw_config_set_reset(custom_kw_config_set_type * set);
|
||||
stringlist_type * custom_kw_config_set_get_keys_alloc(custom_kw_config_set_type * set);
|
||||
|
@@ -291,6 +291,15 @@ void obs_prefix ## _measure__(const void * void_obs , const void * state , node
|
||||
|
||||
#define VOID_MEASURE_HEADER(obs_prefix) void obs_prefix ## _measure__(const void * , const void * , node_id_type , meas_data_type * , const active_list_type *)
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
#define VOID_UPDATE_STD_SCALE(prefix)\
|
||||
void prefix ## _update_std_scale__( void * void_obs , double std_multiplier , const active_list_type * active_list) { \
|
||||
prefix ## _type * obs = prefix ## _safe_cast( void_obs ); \
|
||||
prefix ## _update_std_scale( obs , std_multiplier , active_list ); \
|
||||
}
|
||||
|
||||
#define VOID_UPDATE_STD_SCALE_HEADER(prefix) void prefix ## _update_std_scale__(void * void_obs , double std_multiplier , const active_list_type * active_list);
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'enkf_main.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.
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'enkf_main.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 __ENKF_MAIN_H__
|
||||
@@ -62,9 +62,9 @@ extern "C" {
|
||||
#include <ert/enkf/pca_plot_data.h>
|
||||
#include <ert/enkf/field_config.h>
|
||||
#include <ert/enkf/ert_run_context.h>
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
|
||||
typedef struct enkf_main_struct enkf_main_type;
|
||||
ui_return_type * enkf_main_set_eclbase( enkf_main_type * enkf_main , const char * eclbase_fmt);
|
||||
ui_return_type * enkf_main_set_data_file( enkf_main_type * enkf_main , const char * data_file );
|
||||
@@ -88,7 +88,7 @@ extern "C" {
|
||||
void enkf_main_del_unused_static(enkf_main_type * , int );
|
||||
const char * enkf_main_get_data_file(const enkf_main_type * );
|
||||
const char ** enkf_main_get_well_list_ref(const enkf_main_type * , int *);
|
||||
|
||||
|
||||
|
||||
bool enkf_main_get_endian_swap(const enkf_main_type * );
|
||||
bool enkf_main_get_fmt_file(const enkf_main_type * );
|
||||
@@ -114,12 +114,12 @@ extern "C" {
|
||||
bool enkf_main_run_simple_step(enkf_main_type * enkf_main , bool_vector_type * iactive , init_mode_type init_mode, int iter);
|
||||
|
||||
void enkf_main_run_exp(enkf_main_type * enkf_main ,
|
||||
bool_vector_type * iactive ,
|
||||
bool_vector_type * iactive ,
|
||||
bool simulate);
|
||||
|
||||
|
||||
|
||||
void enkf_main_run_assimilation(enkf_main_type * enkf_main ,
|
||||
bool_vector_type * iactive ,
|
||||
bool_vector_type * iactive ,
|
||||
int init_step_parameters ,
|
||||
int start_report ,
|
||||
state_enum start_state);
|
||||
@@ -132,16 +132,16 @@ extern "C" {
|
||||
void enkf_main_interactive_set_runpath__(void * );
|
||||
enkf_main_type * enkf_main_bootstrap(const char * model_config, bool strict, bool verbose);
|
||||
void enkf_main_create_new_config( const char * config_file , const char * storage_path , const char * case_name , const char * dbase_type , int num_realizations);
|
||||
|
||||
|
||||
enkf_node_type ** enkf_main_get_node_ensemble(const enkf_main_type * enkf_main , const char * key , int report_step , state_enum load_state);
|
||||
void enkf_main_node_mean( const enkf_node_type ** ensemble , int ens_size , enkf_node_type * mean );
|
||||
void enkf_main_node_std( const enkf_node_type ** ensemble , int ens_size , const enkf_node_type * mean , enkf_node_type * std);
|
||||
|
||||
|
||||
ert_impl_type enkf_main_impl_type(const enkf_main_type *, const char * );
|
||||
enkf_state_type * enkf_main_iget_state(const enkf_main_type * , int );
|
||||
enkf_state_type ** enkf_main_get_ensemble( enkf_main_type * enkf_main);
|
||||
const enkf_state_type ** enkf_main_get_ensemble_const( const enkf_main_type * enkf_main);
|
||||
|
||||
|
||||
const enkf_config_node_type * enkf_main_get_config_node(const enkf_main_type * , const char *);
|
||||
const sched_file_type * enkf_main_get_sched_file(const enkf_main_type *);
|
||||
ranking_table_type * enkf_main_get_ranking_table( const enkf_main_type * enkf_main );
|
||||
@@ -154,8 +154,7 @@ extern "C" {
|
||||
model_config_type * enkf_main_get_model_config( const enkf_main_type * );
|
||||
local_config_type * enkf_main_get_local_config( const enkf_main_type * enkf_main );
|
||||
plot_config_type * enkf_main_get_plot_config( const enkf_main_type * enkf_main );
|
||||
void enkf_main_load_obs( enkf_main_type * enkf_main , const char * obs_config_file );
|
||||
void enkf_main_reload_obs( enkf_main_type * enkf_main);
|
||||
void enkf_main_load_obs( enkf_main_type * enkf_main , const char * obs_config_file , bool clear_existing);
|
||||
enkf_obs_type * enkf_main_get_obs(const enkf_main_type * );
|
||||
bool enkf_main_have_obs( const enkf_main_type * enkf_main );
|
||||
analysis_config_type * enkf_main_get_analysis_config(const enkf_main_type * );
|
||||
@@ -165,28 +164,28 @@ extern "C" {
|
||||
const char * enkf_main_get_image_viewer(const enkf_main_type * );
|
||||
const char * enkf_main_get_plot_driver(const enkf_main_type * enkf_main );
|
||||
const char * enkf_main_get_image_type(const enkf_main_type * enkf_main);
|
||||
|
||||
|
||||
|
||||
|
||||
pca_plot_data_type * enkf_main_alloc_pca_plot_data( const enkf_main_type * enkf_main ,
|
||||
local_obsdata_type * obs_data,
|
||||
|
||||
|
||||
|
||||
pca_plot_data_type * enkf_main_alloc_pca_plot_data( const enkf_main_type * enkf_main ,
|
||||
local_obsdata_type * obs_data,
|
||||
double truncation_or_ncomp);
|
||||
|
||||
|
||||
|
||||
void enkf_main_list_users( set_type * users , const char * executable );
|
||||
const ext_joblist_type * enkf_main_get_installed_jobs( const enkf_main_type * enkf_main );
|
||||
|
||||
|
||||
subst_list_type * enkf_main_get_data_kw( const enkf_main_type * enkf_main );
|
||||
void enkf_main_clear_data_kw( enkf_main_type * enkf_main );
|
||||
site_config_type * enkf_main_get_site_config( const enkf_main_type * enkf_main );
|
||||
void enkf_main_resize_ensemble( enkf_main_type * enkf_main , int new_ens_size );
|
||||
void enkf_main_get_observations( const enkf_main_type * enkf_main, const char * user_key , int obs_count , time_t * obs_time , double * y , double * std);
|
||||
int enkf_main_get_observation_count( const enkf_main_type * enkf_main, const char * user_key );
|
||||
|
||||
|
||||
keep_runpath_type enkf_main_iget_keep_runpath( const enkf_main_type * enkf_main , int iens );
|
||||
void enkf_main_iset_keep_runpath( enkf_main_type * enkf_main , int iens , keep_runpath_type keep_runpath);
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
void enkf_main_install_SIGNALS(void);
|
||||
const char * enkf_main_get_SVN_VERSION( void );
|
||||
@@ -199,45 +198,45 @@ pca_plot_data_type * enkf_main_alloc_pca_plot_data( const enkf_main_type * enkf_
|
||||
qc_module_type * enkf_main_get_qc_module( const enkf_main_type * enkf_main );
|
||||
bool enkf_main_has_QC_workflow( const enkf_main_type * enkf_main );
|
||||
|
||||
void enkf_main_get_PC( const matrix_type * S,
|
||||
void enkf_main_get_PC( const matrix_type * S,
|
||||
const matrix_type * dObs,
|
||||
double truncation ,
|
||||
int ncomp ,
|
||||
matrix_type * PC ,
|
||||
double truncation ,
|
||||
int ncomp ,
|
||||
matrix_type * PC ,
|
||||
matrix_type * PC_obs,
|
||||
double_vector_type * singular_values);
|
||||
|
||||
|
||||
void enkf_main_init_PC( const enkf_main_type * enkf_main ,
|
||||
const local_obsdata_type * obsdata ,
|
||||
double truncation_or_ncomp ,
|
||||
matrix_type * PC ,
|
||||
|
||||
void enkf_main_init_PC( const enkf_main_type * enkf_main ,
|
||||
const local_obsdata_type * obsdata ,
|
||||
double truncation_or_ncomp ,
|
||||
matrix_type * PC ,
|
||||
matrix_type * PC_obs ,
|
||||
double_vector_type * singular_values);
|
||||
|
||||
|
||||
void enkf_main_fprintf_PC(const char * filename ,
|
||||
matrix_type * PC ,
|
||||
|
||||
void enkf_main_fprintf_PC(const char * filename ,
|
||||
matrix_type * PC ,
|
||||
matrix_type * PC_obs);
|
||||
|
||||
|
||||
|
||||
|
||||
void enkf_main_set_verbose( enkf_main_type * enkf_main , bool verbose);
|
||||
bool enkf_main_get_verbose( const enkf_main_type * enkf_main );
|
||||
|
||||
ert_workflow_list_type * enkf_main_get_workflow_list( enkf_main_type * enkf_main );
|
||||
void enkf_main_run_workflows( enkf_main_type * enkf_main , const stringlist_type * workflows);
|
||||
bool enkf_main_run_workflow( enkf_main_type * enkf_main , const char * workflow);
|
||||
|
||||
|
||||
enkf_main_type * enkf_main_alloc_empty( );
|
||||
|
||||
rng_config_type * enkf_main_get_rng_config( const enkf_main_type * enkf_main );
|
||||
void enkf_main_rng_init( enkf_main_type * enkf_main);
|
||||
|
||||
|
||||
|
||||
char * enkf_main_alloc_abs_path_to_init_file(const enkf_main_type * enkf_main, const enkf_config_node_type * enkf_config_node);
|
||||
|
||||
bool enkf_main_export_field(const enkf_main_type * enkf_main,
|
||||
const char * kw,
|
||||
const char * kw,
|
||||
const char * path,
|
||||
bool_vector_type * iactive,
|
||||
field_file_format_type file_type,
|
||||
@@ -253,7 +252,7 @@ pca_plot_data_type * enkf_main_alloc_pca_plot_data( const enkf_main_type * enkf_
|
||||
state_enum state,
|
||||
enkf_fs_type * fs);
|
||||
|
||||
|
||||
|
||||
void enkf_main_load_from_forward_model_with_fs(enkf_main_type * enkf_main, int iter , const bool_vector_type * iactive, stringlist_type ** realizations_msg_list, enkf_fs_type * fs);
|
||||
void enkf_main_load_from_forward_model(enkf_main_type * enkf_main, int iter , const bool_vector_type * iactive, stringlist_type ** realizations_msg_list);
|
||||
void enkf_main_load_from_forward_model_from_gui(enkf_main_type * enkf_main, int iter , bool_vector_type * iactive, enkf_fs_type * fs);
|
||||
@@ -350,13 +349,13 @@ pca_plot_data_type * enkf_main_alloc_pca_plot_data( const enkf_main_type * enkf_
|
||||
|
||||
ert_run_context_type * enkf_main_alloc_ert_run_context_ENSEMBLE_EXPERIMENT(const enkf_main_type * enkf_main , enkf_fs_type * fs , const bool_vector_type * iactive , init_mode_type init_mode , int iter);
|
||||
ert_run_context_type * enkf_main_alloc_ert_run_context_INIT_ONLY(const enkf_main_type * enkf_main , enkf_fs_type * fs , const bool_vector_type * iactive , init_mode_type init_mode , int iter);
|
||||
ert_run_context_type * enkf_main_alloc_ert_run_context_ENKF_ASSIMILATION( const enkf_main_type * enkf_main ,
|
||||
enkf_fs_type * fs ,
|
||||
ert_run_context_type * enkf_main_alloc_ert_run_context_ENKF_ASSIMILATION( const enkf_main_type * enkf_main ,
|
||||
enkf_fs_type * fs ,
|
||||
const bool_vector_type * iactive ,
|
||||
init_mode_type init_mode ,
|
||||
init_mode_type init_mode ,
|
||||
state_enum init_state_parameter ,
|
||||
state_enum init_state_dynamic ,
|
||||
int step1 ,
|
||||
int step1 ,
|
||||
int step2 ,
|
||||
int iter);
|
||||
|
||||
|
@@ -37,48 +37,28 @@ extern "C" {
|
||||
#include <ert/enkf/obs_data.h>
|
||||
#include <ert/enkf/time_map.h>
|
||||
#include <ert/enkf/obs_vector.h>
|
||||
#include <ert/enkf/local_obsset.h>
|
||||
#include <ert/enkf/enkf_types.h>
|
||||
#include <ert/enkf/local_obsdata_node.h>
|
||||
#include <ert/enkf/local_obsdata.h>
|
||||
|
||||
bool enkf_obs_have_obs( const enkf_obs_type * enkf_obs );
|
||||
const char * enkf_obs_get_config_file( const enkf_obs_type * enkf_obs);
|
||||
enkf_obs_type * enkf_obs_alloc( );
|
||||
enkf_obs_type * enkf_obs_alloc( const history_type * history ,
|
||||
time_map_type * external_time_map ,
|
||||
const ecl_grid_type * grid ,
|
||||
const ecl_sum_type * refcase,
|
||||
ensemble_config_type * ensemble_config );
|
||||
|
||||
void enkf_obs_free( enkf_obs_type * enkf_obs);
|
||||
|
||||
obs_vector_type * enkf_obs_iget_vector(const enkf_obs_type * obs, int index);
|
||||
obs_vector_type * enkf_obs_get_vector(const enkf_obs_type * , const char * );
|
||||
void enkf_obs_add_obs_vector(enkf_obs_type * enkf_obs, const char * key, const obs_vector_type * vector);
|
||||
void enkf_obs_add_obs_vector(enkf_obs_type * enkf_obs,
|
||||
const obs_vector_type * vector);
|
||||
|
||||
void enkf_obs_load(enkf_obs_type * enkf_obs,
|
||||
const history_type * history ,
|
||||
time_map_type * external_time_map,
|
||||
bool enkf_obs_load(enkf_obs_type * enkf_obs,
|
||||
const char * config_file,
|
||||
const ecl_grid_type * grid ,
|
||||
const ecl_sum_type * refcase ,
|
||||
double std_cutoff ,
|
||||
ensemble_config_type * ensemble_config);
|
||||
|
||||
void enkf_obs_reload( enkf_obs_type * enkf_obs ,
|
||||
const history_type * history ,
|
||||
time_map_type * external_time_map,
|
||||
const ecl_grid_type * grid ,
|
||||
const ecl_sum_type * refcase ,
|
||||
double std_cutoff ,
|
||||
ensemble_config_type * ensemble_config );
|
||||
|
||||
void enkf_obs_get_obs_and_measure(
|
||||
const enkf_obs_type * enkf_obs,
|
||||
enkf_fs_type * fs,
|
||||
const int_vector_type * step_list ,
|
||||
state_enum state,
|
||||
const int_vector_type * ens_active_list,
|
||||
meas_data_type * meas_data,
|
||||
obs_data_type * obs_data,
|
||||
const local_obsset_type * obsset);
|
||||
|
||||
double std_cutoff);
|
||||
void enkf_obs_clear( enkf_obs_type * enkf_obs );
|
||||
|
||||
void enkf_obs_get_obs_and_measure_node( const enkf_obs_type * enkf_obs,
|
||||
enkf_fs_type * fs,
|
||||
@@ -110,10 +90,11 @@ extern "C" {
|
||||
stringlist_type * enkf_obs_alloc_keylist(enkf_obs_type * enkf_obs );
|
||||
stringlist_type * enkf_obs_alloc_matching_keylist(const enkf_obs_type * enkf_obs , const char * input_string);
|
||||
time_t enkf_obs_iget_obs_time(const enkf_obs_type * enkf_obs , int report_step);
|
||||
void enkf_obs_fprintf_config( const enkf_obs_type * enkf_obs , FILE * stream);
|
||||
void enkf_obs_scale_std(enkf_obs_type * enkf_obs, double scale_factor);
|
||||
local_obsdata_type * enkf_obs_alloc_all_active_local_obs( const enkf_obs_type * enkf_obs , const char * key , bool add_active_steps);
|
||||
void enkf_obs_local_scale_std( const enkf_obs_type * enkf_obs , const local_obsdata_type * local_obsdata, double scale_factor);
|
||||
void enkf_obs_add_local_nodes_with_data(const enkf_obs_type * enkf_obs , local_obsdata_type * local_obs , enkf_fs_type *fs , const bool_vector_type * ens_mask);
|
||||
double enkf_obs_scale_correlated_std(const enkf_obs_type * enkf_obs , enkf_fs_type * fs , const int_vector_type * ens_active_list , const local_obsdata_type * local_obsdata);
|
||||
local_obsdata_type * enkf_obs_alloc_all_active_local_obs( const enkf_obs_type * enkf_obs , const char * key);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -85,6 +85,7 @@ typedef struct ensemble_config_struct ensemble_config_type;
|
||||
const summary_key_matcher_type * ensemble_config_get_summary_key_matcher(const ensemble_config_type * ensemble_config);
|
||||
|
||||
enkf_config_node_type * ensemble_config_add_STATIC_node(ensemble_config_type * , const char * );
|
||||
int ensemble_config_get_size(const ensemble_config_type * ensemble_config );
|
||||
|
||||
|
||||
UTIL_IS_INSTANCE_HEADER( ensemble_config );
|
||||
|
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ert_test_context.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.
|
||||
|
||||
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 ERT_TEST_CONTEXT_H
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include <ert/enkf/enkf_main.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -46,7 +46,7 @@ const char * ert_test_context_get_cwd( const ert_test_context_type *
|
||||
|
||||
UTIL_IS_INSTANCE_HEADER( ert_test_context );
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -23,18 +23,26 @@
|
||||
#include <ert/enkf/enkf_macros.h>
|
||||
#include <ert/enkf/gen_data_config.h>
|
||||
#include <ert/enkf/obs_data.h>
|
||||
#include <ert/enkf/active_list.h>
|
||||
|
||||
typedef struct gen_obs_struct gen_obs_type;
|
||||
|
||||
gen_obs_type * gen_obs_alloc(gen_data_config_type * config , const char * obs_key , const char * , double , double , const char * , const char * , const char * );
|
||||
void gen_obs_user_get_with_data_index(const gen_obs_type * gen_obs , const char * index_key , double * value , double * std , bool * valid);
|
||||
|
||||
void gen_obs_scale_std(gen_obs_type * gen_obs, double std_multiplier );
|
||||
void gen_obs_scale_std__(void * gen_obs, double std_multiplier );
|
||||
void gen_obs_update_std_scale(gen_obs_type * gen_obs, double std_multiplier , const active_list_type * active_list);
|
||||
int gen_obs_get_size(const gen_obs_type * gen_obs);
|
||||
double gen_obs_iget_std(const gen_obs_type * gen_obs, int index);
|
||||
double gen_obs_iget_data(const gen_obs_type * gen_obs, int index);
|
||||
double gen_obs_iget_value(const gen_obs_type * gen_obs, int index);
|
||||
double gen_obs_iget_std_scaling(const gen_obs_type * gen_obs, int index);
|
||||
int gen_obs_get_obs_index(const gen_obs_type * gen_obs, int index);
|
||||
void gen_obs_load_observation(gen_obs_type * gen_obs, const char * obs_file);
|
||||
void gen_obs_set_scalar( gen_obs_type * gen_obs , double scalar_value , double scalar_std);
|
||||
void gen_obs_attach_data_index( gen_obs_type * gen_obs , const int_vector_type * data_index );
|
||||
void gen_obs_load_data_index( gen_obs_type * obs , const char * data_index_file);
|
||||
void gen_obs_parse_data_index( gen_obs_type * obs , const char * data_index_string);
|
||||
|
||||
|
||||
|
||||
|
||||
VOID_CHI2_HEADER(gen_obs);
|
||||
@@ -43,5 +51,6 @@ VOID_FREE_HEADER(gen_obs);
|
||||
VOID_GET_OBS_HEADER(gen_obs);
|
||||
VOID_MEASURE_HEADER(gen_obs);
|
||||
VOID_USER_GET_OBS_HEADER(gen_obs);
|
||||
VOID_UPDATE_STD_SCALE_HEADER(gen_obs);
|
||||
|
||||
#endif
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'local_config.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.
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'local_config.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 __LOCAL_CONFIG_H__
|
||||
@@ -40,13 +40,13 @@ typedef enum {
|
||||
ATTACH_MINISTEP = 3, /* UPDATESTEP_NAME , MINISTEP_NAME -> local_updatestep_add_ministep(); */
|
||||
CREATE_DATASET = 4, /* NAME */
|
||||
ATTACH_DATASET = 5, /* DATASET_NAME MINISETP_NAME */
|
||||
CREATE_OBSSET = 6, /* NAME */
|
||||
CREATE_OBSSET = 6, /* NAME */
|
||||
ADD_DATA = 7, /* DATA_KEY -> local_ministep_add_node(); */
|
||||
ADD_OBS = 8, /* OBS_KEY -> local_ministep_add_obs(); */
|
||||
ACTIVE_LIST_ADD_OBS_INDEX = 9, /* OBS_KEY , ACTIVE_INDEX */
|
||||
ACTIVE_LIST_ADD_DATA_INDEX = 10, /* DATA_KEY , ACTIVE_INDEX */
|
||||
ACTIVE_LIST_ADD_MANY_OBS_INDEX = 11, /* OBS_KEY , NUM_INDEX , INDEX1, INDEX2, INDEX3,... */
|
||||
ACTIVE_LIST_ADD_MANY_DATA_INDEX = 12, /* DATA_KEY , NUM_INDEX , INDEX1 , INDEX2 , INDEX3 ,... */
|
||||
ACTIVE_LIST_ADD_MANY_DATA_INDEX = 12, /* DATA_KEY , NUM_INDEX , INDEX1 , INDEX2 , INDEX3 ,... */
|
||||
INSTALL_UPDATESTEP = 13, /* UPDATESTEP_NAME , STEP1 , STEP2 local_config_set_updatestep() */
|
||||
INSTALL_DEFAULT_UPDATESTEP = 14, /* UPDATETSTEP_NAME local_config_set_default_updatestep() */
|
||||
DEL_DATA = 16, /* DATASET KEY*/
|
||||
@@ -58,15 +58,15 @@ typedef enum {
|
||||
COPY_OBSSET = 22, /* SRC_NAME TARGET_NAME */
|
||||
/*****************************************************************/
|
||||
CREATE_ECLREGION = 100, /* Name of region TRUE|FALSE*/
|
||||
LOAD_FILE = 101, /* Key, filename */
|
||||
LOAD_FILE = 101, /* Key, filename */
|
||||
ECLREGION_SELECT_ALL = 102, /* Region TRUE|FALSE */
|
||||
ECLREGION_SELECT_VALUE_EQUAL = 103, /* Region FILE_key:kw(:nr) VALUE TRUE|FALSE */
|
||||
ECLREGION_SELECT_VALUE_LESS = 104, /* Region FILE_key:kw(:nr) VALUE TRUE|FALSE */
|
||||
ECLREGION_SELECT_VALUE_MORE = 105, /* Region FILE_key:kw(:nr) VALUE TRUE|FALSE */
|
||||
ECLREGION_SELECT_VALUE_LESS = 104, /* Region FILE_key:kw(:nr) VALUE TRUE|FALSE */
|
||||
ECLREGION_SELECT_VALUE_MORE = 105, /* Region FILE_key:kw(:nr) VALUE TRUE|FALSE */
|
||||
ECLREGION_SELECT_BOX = 106, /* Region i1 i2 j1 j2 k1 k2 TRUE|FALSE */
|
||||
ECLREGION_SELECT_SLICE = 107, /* Region dir n1 n2 TRUE|FALSE */
|
||||
ECLREGION_SELECT_PLANE = 108, /* Region nx ny nz px py pz sign TRUE|FALSE */
|
||||
ECLREGION_SELECT_IN_POLYGON = 109, /* Region num_points p1x p12 p2x p2y p3x p3y ... pnx pny TRUE|FALSE */
|
||||
ECLREGION_SELECT_IN_POLYGON = 109, /* Region num_points p1x p12 p2x p2y p3x p3y ... pnx pny TRUE|FALSE */
|
||||
/*****************************************************************/
|
||||
CREATE_POLYGON = 200,/* NAME NUM_POINTS x1 y1 x2 y2 x3 y3 ... xn yn */
|
||||
LOAD_POLYGON = 201,/* NAME FILENAME */
|
||||
@@ -75,8 +75,8 @@ typedef enum {
|
||||
CREATE_SURFACE_REGION = 301,
|
||||
SURFACE_REGION_SELECT_IN_POLYGON = 302,
|
||||
SURFACE_REGION_SELECT_LINE = 303,
|
||||
ADD_DATA_SURFACE = 304
|
||||
} local_config_instruction_type;
|
||||
ADD_DATA_SURFACE = 304
|
||||
} local_config_instruction_type;
|
||||
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ typedef enum {
|
||||
#define ATTACH_DATASET_STRING "ATTACH_DATASET"
|
||||
#define CREATE_OBSSET_STRING "CREATE_OBSSET"
|
||||
#define ADD_DATA_STRING "ADD_DATA"
|
||||
#define ADD_OBS_STRING "ADD_OBS"
|
||||
#define ADD_OBS_STRING "ADD_OBS"
|
||||
#define ACTIVE_LIST_ADD_OBS_INDEX_STRING "ACTIVE_LIST_ADD_OBS_INDEX"
|
||||
#define ACTIVE_LIST_ADD_DATA_INDEX_STRING "ACTIVE_LIST_ADD_DATA_INDEX"
|
||||
#define ACTIVE_LIST_ADD_MANY_OBS_INDEX_STRING "ACTIVE_LIST_ADD_MANY_OBS_INDEX"
|
||||
@@ -104,18 +104,18 @@ typedef enum {
|
||||
#define COPY_OBSSET_STRING "COPY_OBSSET"
|
||||
#define CREATE_ECLREGION_STRING "CREATE_ECLREGION"
|
||||
#define LOAD_FILE_STRING "LOAD_FILE"
|
||||
#define ECLREGION_SELECT_ALL_STRING "ECLREGION_SELECT_ALL"
|
||||
#define ECLREGION_SELECT_ALL_STRING "ECLREGION_SELECT_ALL"
|
||||
#define ECLREGION_SELECT_VALUE_EQUAL_STRING "ECLREGION_SELECT_VALUE_EQUAL"
|
||||
#define ECLREGION_SELECT_VALUE_LESS_STRING "ECLREGION_SELECT_VALUE_LESS"
|
||||
#define ECLREGION_SELECT_VALUE_MORE_STRING "ECLREGION_SELECT_VALUE_MORE"
|
||||
#define ECLREGION_SELECT_BOX_STRING "ECLREGION_SELECT_BOX"
|
||||
#define ECLREGION_SELECT_SLICE_STRING "ECLREGION_SELECT_SLICE"
|
||||
#define ECLREGION_SELECT_BOX_STRING "ECLREGION_SELECT_BOX"
|
||||
#define ECLREGION_SELECT_SLICE_STRING "ECLREGION_SELECT_SLICE"
|
||||
#define ECLREGION_SELECT_PLANE_STRING "ECLREGION_SELECT_PLANE"
|
||||
#define ECLREGION_SELECT_IN_POLYGON_STRING "ECLREGION_SELECT_IN_POLYGON"
|
||||
#define CREATE_POLYGON_STRING "CREATE_POLYGON"
|
||||
#define LOAD_POLYGON_STRING "LOAD_POLYGON"
|
||||
#define LOAD_SURFACE_STRING "LOAD_SURFACE"
|
||||
#define CREATE_SURFACE_REGION_STRING "CREATE_SURFACE_REGION"
|
||||
#define LOAD_SURFACE_STRING "LOAD_SURFACE"
|
||||
#define CREATE_SURFACE_REGION_STRING "CREATE_SURFACE_REGION"
|
||||
#define SURFACE_REGION_SELECT_IN_POLYGON_STRING "SURFACE_REGION_SELECT_IN_POLYGON"
|
||||
#define SURFACE_REGION_SELECT_LINE_STRING "SURFACE_REGION_SELECT_LINE"
|
||||
#define ADD_DATA_SURFACE_STRING "ADD_DATA_SURFACE"
|
||||
@@ -133,7 +133,7 @@ const local_updatestep_type * local_config_iget_updatestep( const local_config_t
|
||||
local_updatestep_type * local_config_get_updatestep( const local_config_type * local_config , const char * key);
|
||||
local_ministep_type * local_config_get_ministep( const local_config_type * local_config , const char * key);
|
||||
void local_config_set_updatestep(local_config_type * local_config, int step1 , int step2 , const char * key);
|
||||
void local_config_reload( local_config_type * local_config , const ecl_grid_type * ecl_grid , const ensemble_config_type * ensemble_config , const enkf_obs_type * enkf_obs ,
|
||||
void local_config_reload( local_config_type * local_config , const ecl_grid_type * ecl_grid , const ensemble_config_type * ensemble_config , const enkf_obs_type * enkf_obs ,
|
||||
const char * all_active_config_file);
|
||||
const char * local_config_get_cmd_string( local_config_instruction_type cmd );
|
||||
|
||||
|
@@ -38,7 +38,10 @@ void local_dataset_fprintf( const local_dataset_type * dataset ,
|
||||
active_list_type * local_dataset_get_node_active_list(const local_dataset_type * dataset , const char * node_key );
|
||||
stringlist_type * local_dataset_alloc_keys( const local_dataset_type * dataset );
|
||||
int local_dataset_get_size( const local_dataset_type * dataset );
|
||||
void local_dataset_del_node( local_dataset_type * dataset , const char * node_key);
|
||||
void local_dataset_clear( local_dataset_type * dataset);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'local_ministep.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.
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'local_ministep.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 __LOCAL_MINISTEP_H__
|
||||
@@ -28,12 +28,11 @@ extern "C" {
|
||||
|
||||
#include <ert/enkf/active_list.h>
|
||||
#include <ert/enkf/local_dataset.h>
|
||||
#include <ert/enkf/local_obsset.h>
|
||||
|
||||
#include <ert/enkf/local_obsdata.h>
|
||||
|
||||
typedef struct local_ministep_struct local_ministep_type;
|
||||
|
||||
local_ministep_type * local_ministep_alloc(const char * name , local_obsset_type * observations);
|
||||
local_ministep_type * local_ministep_alloc(const char * name , local_obsdata_type * observations);
|
||||
void local_ministep_free(local_ministep_type * ministep);
|
||||
void local_ministep_free__(void * arg);
|
||||
void local_ministep_add_obs(local_ministep_type * ministep, const char * obs_key);
|
||||
@@ -47,7 +46,7 @@ void local_ministep_clear_nodes( local_ministep_type * ministep
|
||||
void local_ministep_clear_observations( local_ministep_type * ministep);
|
||||
void local_ministep_fprintf( const local_ministep_type * ministep , FILE * stream );
|
||||
void local_ministep_add_dataset( local_ministep_type * ministep , const local_dataset_type * dataset);
|
||||
local_obsset_type * local_ministep_get_obsset(const local_ministep_type * ministep);
|
||||
local_obsdata_type * local_ministep_get_obsdata(const local_ministep_type * ministep);
|
||||
local_dataset_type * local_ministep_get_dataset( const local_ministep_type * ministep, const char * dataset_name);
|
||||
|
||||
UTIL_SAFE_CAST_HEADER(local_ministep);
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'local_obsdata.h'
|
||||
|
||||
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.
|
||||
|
||||
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 __LOCAL_OBSDATA_H__
|
||||
#define __LOCAL_OBSDATA_H__
|
||||
@@ -29,14 +29,20 @@ extern "C" {
|
||||
|
||||
typedef struct local_obsdata_struct local_obsdata_type;
|
||||
|
||||
void local_obsdata_free__( void * arg);
|
||||
bool local_obsdata_has_node( const local_obsdata_type * data , const char * key);
|
||||
local_obsdata_type * local_obsdata_alloc_copy( const local_obsdata_type * src, const char * target_key);
|
||||
local_obsdata_type * local_obsdata_alloc( const char * name );
|
||||
void local_obsdata_free( local_obsdata_type * data );
|
||||
int local_obsdata_get_size( const local_obsdata_type * data );
|
||||
bool local_obsdata_add_node( local_obsdata_type * data , local_obsdata_node_type * node );
|
||||
const local_obsdata_node_type * local_obsdata_iget( const local_obsdata_type * data , int index);
|
||||
local_obsdata_node_type * local_obsdata_iget( const local_obsdata_type * data , int index);
|
||||
local_obsdata_type * local_obsdata_alloc_wrapper( local_obsdata_node_type * node );
|
||||
const char * local_obsdata_get_name( const local_obsdata_type * data);
|
||||
local_obsdata_node_type * local_obsdata_get( const local_obsdata_type * data , const char * key);
|
||||
void local_obsdata_clear( local_obsdata_type * data );
|
||||
void local_obsdata_del_node( local_obsdata_type * data , const char * key);
|
||||
void local_obsdata_reset_tstep_list( local_obsdata_type * data , const int_vector_type * step_list);
|
||||
|
||||
UTIL_IS_INSTANCE_HEADER( local_obsdata );
|
||||
|
||||
|
@@ -23,26 +23,29 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
|
||||
#include <ert/enkf/obs_tstep_list.h>
|
||||
#include <ert/enkf/active_list.h>
|
||||
#include <ert/enkf/obs_vector.h>
|
||||
|
||||
|
||||
typedef struct local_obsdata_node_struct local_obsdata_node_type;
|
||||
|
||||
local_obsdata_node_type * local_obsdata_node_alloc( const char * obs_key );
|
||||
local_obsdata_node_type * local_obsdata_node_alloc_copy( const local_obsdata_node_type * src);
|
||||
const char * local_obsdata_node_get_key( const local_obsdata_node_type * node );
|
||||
void local_obsdata_node_free( local_obsdata_node_type * node );
|
||||
void local_obsdata_node_free__( void * arg );
|
||||
active_list_type * local_obsdata_node_get_active_list( const local_obsdata_node_type * node );
|
||||
const obs_tstep_list_type * local_obsdata_node_get_tstep_list( const local_obsdata_node_type * node);
|
||||
void local_obsdata_node_copy_active_list( local_obsdata_node_type * node , const active_list_type * active_list);
|
||||
void local_obsdata_node_add_tstep( local_obsdata_node_type * node, int tstep);
|
||||
void local_obsdata_node_add_range( local_obsdata_node_type * node, int step1, int step2);
|
||||
void local_obsdata_node_add_active_tstep( local_obsdata_node_type * node, const obs_vector_type * obs_vector);
|
||||
const int_vector_type * local_obsdata_node_get_tstep_list( const local_obsdata_node_type * node);
|
||||
bool local_obsdata_node_all_timestep_active( const local_obsdata_node_type * node);
|
||||
bool local_obsdata_node_has_tstep( const local_obsdata_node_type * node , int tstep);
|
||||
void local_obsdata_node_reset_tstep_list( local_obsdata_node_type * node , const int_vector_type * step_list);
|
||||
|
||||
UTIL_IS_INSTANCE_HEADER( local_obsdata_node );
|
||||
UTIL_IS_INSTANCE_HEADER( local_obsdata_node );
|
||||
UTIL_SAFE_CAST_HEADER( local_obsdata_node );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'local_obsset.h'
|
||||
|
||||
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 __LOCAL_OBSSET_H__
|
||||
#define __LOCAL_OBSSET_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ert/enkf/active_list.h>
|
||||
|
||||
typedef struct local_obsset_struct local_obsset_type;
|
||||
|
||||
local_obsset_type * local_obsset_alloc( const char * name );
|
||||
local_obsset_type * local_obsset_alloc_copy( local_obsset_type * src_dataset , const char * copy_name );
|
||||
void local_obsset_free( local_obsset_type * obsset );
|
||||
void local_obsset_free__( void * arg );
|
||||
void local_obsset_add_obs(local_obsset_type * obsset, const char * obs_key);
|
||||
void local_obsset_del_obs( local_obsset_type * obsset , const char * obs_key);
|
||||
const char * local_obsset_get_name( const local_obsset_type * obsset );
|
||||
void local_obsset_fprintf(local_obsset_type * obsset , FILE * stream);
|
||||
active_list_type * local_obsset_get_obs_active_list( const local_obsset_type * obsset , const char * obs_key );
|
||||
hash_iter_type * local_obsset_alloc_obs_iter( const local_obsset_type * obsset );
|
||||
void local_obsset_clear( local_obsset_type * obsset );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'local_updatestep.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.
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'local_updatestep.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 __LOCAL_UPDATESTEP_H__
|
||||
@@ -24,6 +24,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include <ert/enkf/local_ministep.h>
|
||||
#include <ert/enkf/local_obsdata.h>
|
||||
|
||||
typedef struct local_updatestep_struct local_updatestep_type;
|
||||
|
||||
@@ -31,7 +32,7 @@ local_updatestep_type * local_updatestep_alloc( const char * name );
|
||||
void local_updatestep_free__(void * arg);
|
||||
void local_updatestep_add_ministep( local_updatestep_type * updatestep , local_ministep_type * ministep);
|
||||
local_ministep_type * local_updatestep_iget_ministep( const local_updatestep_type * updatestep , int index);
|
||||
local_obsset_type * local_updatestep_iget_obsset( const local_updatestep_type * updatestep , int index);
|
||||
local_obsdata_type * local_updatestep_iget_obsdata( const local_updatestep_type * updatestep , int index);
|
||||
int local_updatestep_get_num_ministep( const local_updatestep_type * updatestep );
|
||||
local_updatestep_type * local_updatestep_alloc_copy( const local_updatestep_type * src , const char * name );
|
||||
void local_updatestep_fprintf( const local_updatestep_type * updatestep , FILE * stream);
|
||||
|
@@ -54,7 +54,7 @@ const obs_block_type * obs_data_iget_block_const( const obs_data_type * obs_
|
||||
obs_block_type * obs_data_get_block( obs_data_type * obs_data , const char * obs_key );
|
||||
obs_block_type * obs_data_add_block( obs_data_type * obs_data , const char * obs_key , int obs_size , matrix_type * error_covar , bool error_covar_owner);
|
||||
|
||||
obs_data_type * obs_data_alloc();
|
||||
obs_data_type * obs_data_alloc(double global_std_scaling);
|
||||
void obs_data_free(obs_data_type *);
|
||||
void obs_data_reset(obs_data_type * obs_data);
|
||||
matrix_type * obs_data_allocD(const obs_data_type * obs_data , const matrix_type * E , const matrix_type * S);
|
||||
|
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'obs_tstep_list.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 __OBS_TSTEP_LIST_H__
|
||||
#define __OBS_TSTEP_LIST_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/type_macros.h>
|
||||
|
||||
typedef struct obs_tstep_list_struct obs_tstep_list_type;
|
||||
|
||||
obs_tstep_list_type * obs_tstep_list_alloc();
|
||||
void obs_tstep_list_free( obs_tstep_list_type * list );
|
||||
bool obs_tstep_list_all_active( const obs_tstep_list_type * list );
|
||||
int obs_tstep_list_get_size( const obs_tstep_list_type * list );
|
||||
void obs_tstep_list_add_tstep( obs_tstep_list_type * list , int tstep);
|
||||
void obs_tstep_list_add_range( obs_tstep_list_type * list , int step1 , int step2);
|
||||
bool obs_tstep_list_contains( const obs_tstep_list_type * list , int tstep);
|
||||
int obs_tstep_list_iget( const obs_tstep_list_type * list , int index);
|
||||
int obs_tstep_list_get_last( const obs_tstep_list_type * list );
|
||||
|
||||
UTIL_IS_INSTANCE_HEADER( obs_tstep_list );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user