mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Updated ERT from https://github.com/Ensembles/ert/commits/master to version
4a78d88f1dc7bbc86f173c5adb825bbca29fa116 p4#: 21120
This commit is contained in:
@@ -1,58 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo
|
||||
echo "A configuration file must be specified, or if you want to create a new"
|
||||
echo "configuration: enter the path to the new (non-existing) configuration file."
|
||||
echo " ertgui.sh ert_configuration_file"
|
||||
echo
|
||||
echo "Options (for debugging):"
|
||||
echo " gert debug ert_configuration_file"
|
||||
echo " gert strace ert_configuration_file"
|
||||
echo " gert local .... will use the Python code in your working copy"
|
||||
echo
|
||||
exit
|
||||
fi
|
||||
|
||||
#
|
||||
# setup the SDP environment
|
||||
#
|
||||
export ERT_SITE_CONFIG=/project/res/etc/ERT/site-config
|
||||
export QT_EXPERIMENTAL=1
|
||||
export PYTHON_EXPERIMENTAL=1
|
||||
source /project/res/SDP_bashrc > /dev/null
|
||||
set PYTHON=2.4 ; source /prog/sdpsoft/environment.sh > /dev/null
|
||||
BASEDIR=$(dirname $0)
|
||||
export PYTHONPATH=~/ert/ert/devel/python/python:$BASEDIR/../lib:$PYTHONPATH
|
||||
export GERT_SHARE_PATH=$BASEDIR/../share
|
||||
export LD_LIBRARY_PATH=~/ert/ert/build/lib64:$LD_LIBRARY_PATH
|
||||
ert_gui_dir=$BASEDIR/../lib/ert_gui/
|
||||
|
||||
export ERT_LD_PATH=$SDP_BINDIST/lib/python/lib
|
||||
|
||||
ORIGINAL_DIRECTORY=$PWD
|
||||
|
||||
if [ "$1" = "local" ]
|
||||
then
|
||||
# The user has given "local" as the first argument, meaning that we should
|
||||
# run based on Python code in the users current working directory, and not
|
||||
# the centraly installed code.
|
||||
BASEDIR=$(dirname $0)
|
||||
export ert_gui_dir=$BASEDIR/../
|
||||
shift
|
||||
else
|
||||
export ert_gui_dir=$SDP_BINDIST/lib/python/gert
|
||||
fi
|
||||
echo "Loading python GUI code from.......:" $ert_gui_dir
|
||||
echo "-----------------------------------------------------------------"
|
||||
|
||||
|
||||
if [ "$1" = "debug" ]
|
||||
then
|
||||
export CONFIG_FILE="$2"
|
||||
gdb python --command=$ert_gui_dir/bin/gdbcommands
|
||||
elif [ "$1" = "strace" ]
|
||||
then
|
||||
strace -e trace=file python $ert_gui_dir/code/main.py "$2"
|
||||
else
|
||||
python $ert_gui_dir/code/main.py "$1"
|
||||
fi
|
||||
python $ert_gui_dir/gert_main.py "$1"
|
||||
|
||||
cd "$ORIGINAL_DIRECTORY"
|
||||
|
||||
@@ -1,289 +0,0 @@
|
||||
# Copyright (C) 2011 Statoil ASA, Norway.
|
||||
#
|
||||
# The file 'enums.py' 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.
|
||||
|
||||
|
||||
|
||||
class enumtype(type):
|
||||
def __call__(cls, *args, **kwargs):
|
||||
newtype = super(enumtype, cls).__call__(*args, **kwargs)
|
||||
newtype.__getitem__ = classmethod(enumtype.__getitem__)
|
||||
return newtype
|
||||
|
||||
def __getitem__(cls, item):
|
||||
"""All enums can be accessed with the subscript operator, using the name or value as key"""
|
||||
v = cls.resolveValue(item)
|
||||
if v is None:
|
||||
return cls.resolveName(item)
|
||||
else:
|
||||
return v
|
||||
|
||||
# if isinstance(item, long) or isinstance(item, int):
|
||||
# return cls.resolveValue(item)
|
||||
# else:
|
||||
# return cls.resolveName(item)
|
||||
|
||||
class enum:
|
||||
"""
|
||||
A base class for enums.
|
||||
All enums support the subscript operator as a class method. The value or the name can be used as key/index.
|
||||
The subscript operator uses the resolveName and resolveValue functions as basis.
|
||||
"""
|
||||
__metaclass__ = enumtype
|
||||
|
||||
_enums = {} #This contains all sub classed enums! {class : [list of enums], ...}
|
||||
def __init__(self, name, value):
|
||||
self.name = name
|
||||
self.__value = value
|
||||
|
||||
if not enum._enums.has_key(self.__class__):
|
||||
enum._enums[self.__class__] = []
|
||||
|
||||
enum._enums[self.__class__].append(self)
|
||||
|
||||
def value(self):
|
||||
return self.__value
|
||||
|
||||
@classmethod
|
||||
def values(cls):
|
||||
"""Returns a list of the created enums for a class."""
|
||||
return enum._enums[cls]
|
||||
|
||||
@classmethod
|
||||
def resolveName(cls, name):
|
||||
"""Finds an enum based on name. Ignores the case of the name. Returns None if not found."""
|
||||
for e in enum._enums[cls]:
|
||||
if e.name.lower() == name.lower():
|
||||
return e
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
def resolveValue(cls, value):
|
||||
"""
|
||||
Returns the enum with the specified value.
|
||||
If several enums have the same value the first will be returned
|
||||
"""
|
||||
for e in enum._enums[cls]:
|
||||
if e.__value == value:
|
||||
return e
|
||||
return None
|
||||
|
||||
def __add__(self, other):
|
||||
"""Two enums can be added together returning the sum of the value fields as a new enum or an existing one."""
|
||||
if isinstance(other, self.__class__):
|
||||
sum = self.__value + other.__value
|
||||
existing_enum = self.__class__.resolveValue(sum)
|
||||
if not existing_enum is None:
|
||||
return existing_enum
|
||||
else:
|
||||
return self.__class__(self.name + " + " + other.name, sum)
|
||||
else:
|
||||
raise NotImplemented
|
||||
|
||||
|
||||
def __and__(self, other):
|
||||
"""Bitwise and of two enums or an enum and a long or int. Returns the and'ed value."""
|
||||
if isinstance(other, self.__class__):
|
||||
return self.__value & other.__value
|
||||
elif isinstance(other, long) or isinstance(other, int):
|
||||
return self.__value & other
|
||||
else:
|
||||
raise NotImplemented
|
||||
|
||||
def __rand__(self, other):
|
||||
return self.__and__(other)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
def __eq__(self, other):
|
||||
if other is None:
|
||||
return False
|
||||
|
||||
if isinstance(other, long) or isinstance(other, int):
|
||||
return self.__value == other
|
||||
else:
|
||||
return self.__value == other.__value
|
||||
|
||||
def __hash__(self):
|
||||
return hash("%s : %i" % (self.name, self.__value))
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# enum implementations
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
class ert_state_enum(enum):
|
||||
"""Defined in enkf_types.h"""
|
||||
FORECAST=None
|
||||
ANALYZED=None
|
||||
BOTH=None
|
||||
|
||||
INITIALIZATION_STATES = None
|
||||
|
||||
#ert_state_enum.UNDEFINED = ert_state_enum("Undefined", 0)
|
||||
#ert_state_enum.SERIALIZED = ert_state_enum("Serialized", 1)
|
||||
ert_state_enum.FORECAST = ert_state_enum("Forecast", 2)
|
||||
ert_state_enum.ANALYZED = ert_state_enum("Analyzed", 4)
|
||||
ert_state_enum.BOTH = ert_state_enum("Both", 6)
|
||||
|
||||
ert_state_enum.INITIALIZATION_STATES = [ert_state_enum.ANALYZED, ert_state_enum.FORECAST]
|
||||
|
||||
|
||||
class enkf_impl_type(enum):
|
||||
"""Defined in enkf_types.h"""
|
||||
#INVALID = 0
|
||||
#IMPL_TYPE_OFFSET = 100
|
||||
#STATIC = 100
|
||||
FIELD = None
|
||||
GEN_KW = None
|
||||
SUMMARY = None
|
||||
GEN_DATA = None
|
||||
#MAX_IMPL_TYPE = 113 #! not good to have several with same value, resolveValue fails!!!
|
||||
|
||||
enkf_impl_type.FIELD = enkf_impl_type("Field", 104)
|
||||
enkf_impl_type.GEN_KW = enkf_impl_type("Keyword", 107)
|
||||
enkf_impl_type.SUMMARY = enkf_impl_type("Summary", 110)
|
||||
enkf_impl_type.GEN_DATA = enkf_impl_type("Data", 113)
|
||||
|
||||
|
||||
class ert_job_status_type(enum):
|
||||
"""These "enum" values are all copies from the header file "basic_queue_driver.h"."""
|
||||
# Observe that the status strings are available from the function: libjob_queue.job_queue_status_name( status_code )
|
||||
NOT_ACTIVE = None
|
||||
LOADING = None
|
||||
WAITING = None
|
||||
SUBMITTED = None
|
||||
PENDING = None
|
||||
RUNNING = None
|
||||
DONE = None
|
||||
EXIT = None
|
||||
RUN_OK = None
|
||||
RUN_FAIL = None
|
||||
ALL_OK = None
|
||||
ALL_FAIL = None
|
||||
USER_KILLED = None
|
||||
USER_EXIT = None
|
||||
|
||||
ert_job_status_type.NOT_ACTIVE = ert_job_status_type("JOB_QUEUE_NOT_ACTIVE", 1)
|
||||
ert_job_status_type.LOADING = ert_job_status_type("JOB_QUEUE_LOADING", 2)
|
||||
ert_job_status_type.WAITING = ert_job_status_type("JOB_QUEUE_WAITING", 4)
|
||||
ert_job_status_type.SUBMITTED = ert_job_status_type("JOB_QUEUE_SUBMITTED", 8)
|
||||
ert_job_status_type.PENDING = ert_job_status_type("JOB_QUEUE_PENDING", 16)
|
||||
ert_job_status_type.RUNNING = ert_job_status_type("JOB_QUEUE_RUNNING", 32)
|
||||
ert_job_status_type.DONE = ert_job_status_type("JOB_QUEUE_DONE", 64)
|
||||
ert_job_status_type.EXIT = ert_job_status_type("JOB_QUEUE_EXIT", 128)
|
||||
ert_job_status_type.RUN_OK = ert_job_status_type("JOB_QUEUE_RUN_OK", 256)
|
||||
ert_job_status_type.RUN_FAIL = ert_job_status_type("JOB_QUEUE_RUN_FAIL", 512)
|
||||
ert_job_status_type.ALL_OK = ert_job_status_type("JOB_QUEUE_ALL_OK", 1024)
|
||||
ert_job_status_type.ALL_FAIL = ert_job_status_type("JOB_QUEUE_ALL_FAIL", 2048)
|
||||
ert_job_status_type.USER_KILLED = ert_job_status_type("JOB_QUEUE_USER_KILLED", 4096)
|
||||
ert_job_status_type.USER_EXIT = ert_job_status_type("JOB_QUEUE_USER_EXIT", 8192)
|
||||
|
||||
|
||||
class gen_data_file_format(enum):
|
||||
#defined in gen_data_config.h
|
||||
GEN_DATA_UNDEFINED = None
|
||||
ASCII = None
|
||||
ASCII_TEMPLATE = None
|
||||
BINARY_DOUBLE = None
|
||||
BINARY_FLOAT = None
|
||||
|
||||
INPUT_TYPES = None
|
||||
OUTPUT_TYPES = None
|
||||
|
||||
gen_data_file_format.GEN_DATA_UNDEFINED = gen_data_file_format("", 0)
|
||||
gen_data_file_format.ASCII = gen_data_file_format("ASCII", 1)
|
||||
gen_data_file_format.ASCII_TEMPLATE = gen_data_file_format("ASCII_TEMPLATE", 2)
|
||||
gen_data_file_format.BINARY_DOUBLE = gen_data_file_format("BINARY_DOUBLE", 3)
|
||||
gen_data_file_format.BINARY_FLOAT = gen_data_file_format("BINARY_FLOAT", 4)
|
||||
|
||||
gen_data_file_format.INPUT_TYPES = [gen_data_file_format.GEN_DATA_UNDEFINED,
|
||||
gen_data_file_format.ASCII,
|
||||
gen_data_file_format.BINARY_FLOAT,
|
||||
gen_data_file_format.BINARY_DOUBLE]
|
||||
|
||||
gen_data_file_format.OUTPUT_TYPES = [gen_data_file_format.GEN_DATA_UNDEFINED,
|
||||
gen_data_file_format.ASCII,
|
||||
gen_data_file_format.ASCII_TEMPLATE,
|
||||
gen_data_file_format.BINARY_FLOAT,
|
||||
gen_data_file_format.BINARY_DOUBLE]
|
||||
|
||||
|
||||
class field_type(enum):
|
||||
ECLIPSE_RESTART = None
|
||||
ECLIPSE_PARAMETER = None
|
||||
GENERAL = None
|
||||
|
||||
field_type.ECLIPSE_RESTART = field_type("Dynamic", 1)
|
||||
field_type.ECLIPSE_PARAMETER = field_type("Parameter", 2)
|
||||
field_type.GENERAL = field_type("General", 3)
|
||||
|
||||
|
||||
class truncation_type(enum):
|
||||
TRUNCATE_NONE = None
|
||||
TRUNCATE_MIN = None
|
||||
TRUNCATE_MAX = None
|
||||
|
||||
@staticmethod
|
||||
def resolveTruncationType(minimum, maximum):
|
||||
if minimum == "" and maximum == "":
|
||||
return truncation_type.TRUNCATE_NONE
|
||||
elif not minimum == "" and not maximum == "":
|
||||
return truncation_type.TRUNCATE_MIN + truncation_type.TRUNCATE_MAX
|
||||
elif not minimum == "":
|
||||
return truncation_type.TRUNCATE_MIN
|
||||
elif not maximum == "":
|
||||
return truncation_type.TRUNCATE_MAX
|
||||
else:
|
||||
raise AssertionError("This should not happen! o_O")
|
||||
|
||||
|
||||
truncation_type.TRUNCATE_NONE = truncation_type("TRUNCATE_NONE", 0)
|
||||
truncation_type.TRUNCATE_MIN = truncation_type("TRUNCATE_MIN", 1)
|
||||
truncation_type.TRUNCATE_MAX = truncation_type("TRUNCATE_MAX", 2)
|
||||
|
||||
#print enum._enums
|
||||
|
||||
class keep_runpath_type(enum):
|
||||
DEFAULT_KEEP = None
|
||||
EXPLICIT_DELETE = None
|
||||
EXPLICIT_KEEP = None
|
||||
|
||||
keep_runpath_type.DEFAULT_KEEP = keep_runpath_type("DEFAULT_KEEP", 0)
|
||||
keep_runpath_type.EXPLICIT_DELETE = keep_runpath_type("EXPLICIT_DELETE", 1)
|
||||
keep_runpath_type.EXPLICIT_KEEP = keep_runpath_type("EXPLICIT_KEEP", 2)
|
||||
|
||||
class history_source_type(enum):
|
||||
SCHEDULE = None
|
||||
REFCASE_SIMULATED = None
|
||||
REFCASE_HISTORY = None
|
||||
|
||||
history_source_type.SCHEDULE = history_source_type("SCHEDULE", 0)
|
||||
history_source_type.REFCASE_SIMULATED = history_source_type("REFCASE_SIMULATED", 1)
|
||||
history_source_type.REFCASE_HISTORY = history_source_type("REFCASE_HISTORY", 2)
|
||||
|
||||
|
||||
class obs_impl_type(enum):
|
||||
GEN_OBS = None
|
||||
SUMMARY_OBS = None
|
||||
FIELD_OBS = None
|
||||
|
||||
obs_impl_type.GEN_OBS = obs_impl_type("GEN_OBS", 1)
|
||||
obs_impl_type.SUMMARY_OBS = obs_impl_type("SUMMARY_OBS", 2)
|
||||
obs_impl_type.FIELD_OBS = obs_impl_type("FIELD_OBS", 3)
|
||||
@@ -1,139 +0,0 @@
|
||||
# Copyright (C) 2011 Statoil ASA, Norway.
|
||||
#
|
||||
# The file 'erttypes.py' 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.
|
||||
|
||||
|
||||
import datetime
|
||||
import time
|
||||
import ctypes
|
||||
#from ert.util.tvector import DoubleVector
|
||||
|
||||
|
||||
class time_t(ctypes.c_long):
|
||||
"""A convenience class for working with time_t objects."""
|
||||
|
||||
def time(self):
|
||||
"""Return this time_t as a time.localtime() object"""
|
||||
return time.localtime(self.value)
|
||||
|
||||
def datetime(self):
|
||||
"""Return this time_t as a datetime.date([year, month, day])"""
|
||||
return datetime.date(*self.time()[0:3])
|
||||
|
||||
def __str__(self):
|
||||
return "%d %s" % (self.value, str(self.datetime()))
|
||||
|
||||
def __ge__(self, other):
|
||||
return self.value >= other.value
|
||||
|
||||
def __lt__(self, other):
|
||||
return not self >= other
|
||||
|
||||
|
||||
class VectorIterator:
|
||||
"""A simple iterator"""
|
||||
def __init__(self, data, size):
|
||||
self.index = 0
|
||||
self.data = data
|
||||
self.size = size
|
||||
|
||||
def next(self):
|
||||
if self.index == self.size:
|
||||
raise StopIteration
|
||||
result = self.data[self.index]
|
||||
self.index += 1
|
||||
return result
|
||||
|
||||
|
||||
class time_vector(ctypes.c_long):
|
||||
"""Represents a vector of time_t objects"""
|
||||
initialized = False
|
||||
lib = None
|
||||
|
||||
def __getitem__(self, item):
|
||||
"""Indexing support"""
|
||||
return self.__class__.lib.time_t_vector_iget(self, item)
|
||||
|
||||
def __iter__(self):
|
||||
"""Iterator support"""
|
||||
return VectorIterator(self, self.size())
|
||||
|
||||
def __del__(self):
|
||||
"""Garbage collection"""
|
||||
self._free()
|
||||
|
||||
def size(self):
|
||||
"""The size of this vector"""
|
||||
return self.__class__.lib.time_t_vector_size(self)
|
||||
|
||||
def _free(self):
|
||||
self.__class__.lib.time_t_vector_free(self)
|
||||
|
||||
def getPointer(self):
|
||||
"""Returns the internal pointer for this instance."""
|
||||
return self.__class__.lib.time_t_vector_get_ptr(self)
|
||||
|
||||
@classmethod
|
||||
def initialize(cls, ert):
|
||||
if not cls.initialized:
|
||||
cls.lib = ert.util
|
||||
ert.registerType("time_vector", time_vector)
|
||||
ert.prototype("int time_t_vector_size(time_vector)", lib=ert.util)
|
||||
ert.prototype("time_t time_t_vector_iget(time_vector, int)", lib=ert.util)
|
||||
ert.prototype("long time_t_vector_get_ptr(time_vector)", lib=ert.util)
|
||||
ert.prototype("void time_t_vector_free(time_vector)", lib=ert.util)
|
||||
|
||||
cls.initialized = True
|
||||
|
||||
|
||||
class double_vector(ctypes.c_long):
|
||||
"""Represents a vector of double objects"""
|
||||
initialized = False
|
||||
lib = None
|
||||
|
||||
def __getitem__(self, item):
|
||||
"""Indexing support"""
|
||||
return self.__class__.lib.double_vector_iget(self, item)
|
||||
|
||||
def __iter__(self):
|
||||
"""Iterator support"""
|
||||
return VectorIterator(self, self.size())
|
||||
|
||||
def __del__(self):
|
||||
"""Garbage collection"""
|
||||
self._free()
|
||||
|
||||
def size(self):
|
||||
"""The size of this vector"""
|
||||
return self.__class__.lib.double_vector_size(self)
|
||||
|
||||
def _free(self):
|
||||
self.__class__.lib.double_vector_free(self)
|
||||
|
||||
def getPointer(self):
|
||||
"""Returns the internal pointer for this instance."""
|
||||
return self.__class__.lib.double_vector_get_ptr(self)
|
||||
|
||||
@classmethod
|
||||
def initialize(cls, ert):
|
||||
if not cls.initialized:
|
||||
cls.lib = ert.util
|
||||
ert.registerType("double_vector", double_vector)
|
||||
ert.prototype("int double_vector_size(double_vector)", lib=ert.util)
|
||||
ert.prototype("double double_vector_iget(double_vector, int)", lib=ert.util)
|
||||
ert.prototype("long double_vector_get_ptr(double_vector)", lib=ert.util)
|
||||
ert.prototype("void double_vector_free(double_vector)", lib=ert.util)
|
||||
|
||||
cls.initialized = True
|
||||
@@ -1,325 +0,0 @@
|
||||
# Copyright (C) 2011 Statoil ASA, Norway.
|
||||
#
|
||||
# The file 'ertwrapper.py' 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.
|
||||
|
||||
|
||||
|
||||
from ctypes import *
|
||||
import ctypes.util
|
||||
import atexit
|
||||
import re
|
||||
import sys
|
||||
import os
|
||||
import erttypes
|
||||
|
||||
|
||||
def RH_version():
|
||||
RH = open('/etc/redhat-release' , 'r').read().split()[6]
|
||||
return float( RH )
|
||||
|
||||
|
||||
|
||||
class ErtWrapper:
|
||||
"""Wraps the functionality of ERT using ctypes"""
|
||||
|
||||
def __init__( self ):
|
||||
self.__loadLibraries( )
|
||||
|
||||
self.pattern = re.compile("(?P<return>[a-zA-Z][a-zA-Z0-9_*]*) +(?P<function>[a-zA-Z]\w*) *[(](?P<arguments>[a-zA-Z0-9_*, ]*)[)]")
|
||||
self.__registerDefaultTypes()
|
||||
|
||||
|
||||
def bootstrap(self, enkf_config , site_config , strict = True):
|
||||
self.prototype("long enkf_main_bootstrap(char*, char*, bool)")
|
||||
self.main = self.enkf.enkf_main_bootstrap(site_config, enkf_config, strict)
|
||||
print "\nBootstrap complete!"
|
||||
|
||||
|
||||
self.plot_config = self.__getErtPointer("enkf_main_get_plot_config")
|
||||
self.analysis_config = self.__getErtPointer("enkf_main_get_analysis_config")
|
||||
self.ecl_config = self.__getErtPointer("enkf_main_get_ecl_config")
|
||||
self.site_config = self.__getErtPointer("enkf_main_get_site_config")
|
||||
self.ensemble_config = self.__getErtPointer("enkf_main_get_ensemble_config")
|
||||
self.model_config = self.__getErtPointer("enkf_main_get_model_config")
|
||||
self.logh = self.__getErtPointer("enkf_main_get_logh")
|
||||
|
||||
self.initializeTypes()
|
||||
|
||||
atexit.register(self.cleanup)
|
||||
|
||||
|
||||
def __loadLibrary(self, name):
|
||||
lib = "%s.so" % name
|
||||
try:
|
||||
lib_handle = CDLL( lib, RTLD_GLOBAL )
|
||||
return lib_handle
|
||||
except:
|
||||
raise AssertionError("Can not find library: %s" % (name))
|
||||
|
||||
|
||||
|
||||
def __loadLibraries(self ):
|
||||
"""Load libraries that are required by ERT and ERT itself"""
|
||||
CDLL("libblas.so" , RTLD_GLOBAL)
|
||||
CDLL("liblapack.so" , RTLD_GLOBAL)
|
||||
CDLL("libz.so" , RTLD_GLOBAL)
|
||||
CDLL("libnsl.so" , RTLD_GLOBAL)
|
||||
|
||||
LSF_HOME = os.getenv("LSF_HOME")
|
||||
if LSF_HOME:
|
||||
CDLL("%s/lib/liblsf.so" % LSF_HOME , RTLD_GLOBAL)
|
||||
CDLL("%s/lib/libbat.so" % LSF_HOME , RTLD_GLOBAL)
|
||||
else:
|
||||
sys.exit("Need a value for environment variable LSF_HOME")
|
||||
|
||||
self.util = self.__loadLibrary( "libutil" )
|
||||
self.__loadLibrary( "libgeometry" )
|
||||
self.ecl = self.__loadLibrary( "libecl" )
|
||||
self.__loadLibrary( "libsched" )
|
||||
self.__loadLibrary( "librms" )
|
||||
self.__loadLibrary( "libconfig" )
|
||||
self.__loadLibrary( "libanalysis" )
|
||||
self.job_queue = self.__loadLibrary( "libjob_queue" )
|
||||
self.enkf = self.__loadLibrary( "libenkf" )
|
||||
|
||||
self.enkf.enkf_main_install_SIGNALS()
|
||||
self.enkf.enkf_main_init_debug("/prog/sdpsoft/python2.4/bin/python")
|
||||
|
||||
|
||||
def __registerDefaultTypes(self):
|
||||
"""Registers the default available types for prototyping."""
|
||||
self.registered_types = {}
|
||||
self.registerType("void", None)
|
||||
self.registerType("int", ctypes.c_int)
|
||||
self.registerType("int*", ctypes.POINTER(ctypes.c_int))
|
||||
self.registerType("bool", ctypes.c_int)
|
||||
self.registerType("bool*", ctypes.POINTER(ctypes.c_int))
|
||||
self.registerType("long", ctypes.c_long)
|
||||
self.registerType("long*", ctypes.POINTER(ctypes.c_long))
|
||||
self.registerType("char", ctypes.c_char)
|
||||
self.registerType("char*", ctypes.c_char_p)
|
||||
self.registerType("float", ctypes.c_float)
|
||||
self.registerType("float*", ctypes.POINTER(ctypes.c_float))
|
||||
self.registerType("double", ctypes.c_double)
|
||||
self.registerType("double*", ctypes.POINTER(ctypes.c_double))
|
||||
|
||||
def registerType(self, type, value):
|
||||
"""Register a type against a legal ctypes type"""
|
||||
self.registered_types[type] = value
|
||||
|
||||
def __parseType(self, type):
|
||||
"""Convert a prototype definition type from string to a ctypes legal type."""
|
||||
type = type.strip()
|
||||
|
||||
if self.registered_types.has_key(type):
|
||||
return self.registered_types[type]
|
||||
else:
|
||||
return getattr(ctypes, type)
|
||||
|
||||
def prototype(self, prototype, lib=None):
|
||||
"""
|
||||
Defines the return type and arguments for a C-function
|
||||
|
||||
prototype expects a string formatted like this:
|
||||
|
||||
"type functionName(type, ... ,type)"
|
||||
|
||||
where type is a type available to ctypes
|
||||
Some type are automatically converted:
|
||||
int -> c_int
|
||||
long -> c_long
|
||||
char -> c_char_p
|
||||
bool -> c_int
|
||||
void -> None
|
||||
double -> c_double
|
||||
float -> c_float
|
||||
|
||||
There are also pointer versions of these:
|
||||
long* -> POINTER(c_long)
|
||||
bool* -> POINTER(c_int)
|
||||
double* -> POINTER(c_double)
|
||||
char* -> c_char_p
|
||||
...
|
||||
|
||||
if lib is None lib defaults to the enkf library
|
||||
"""
|
||||
if lib is None:
|
||||
lib = self.enkf
|
||||
|
||||
match = re.match(self.pattern, prototype)
|
||||
if not match:
|
||||
sys.stderr.write("Illegal prototype definition: %s\n" % (prototype))
|
||||
return None
|
||||
else:
|
||||
restype = match.groupdict()["return"]
|
||||
functioname = match.groupdict()["function"]
|
||||
arguments = match.groupdict()["arguments"].split(",")
|
||||
|
||||
func = getattr(lib , functioname)
|
||||
func.restype = self.__parseType(restype)
|
||||
|
||||
if len(arguments) == 1 and arguments[0].strip() == "":
|
||||
func.argtypes = []
|
||||
else:
|
||||
argtypes = [self.__parseType(arg) for arg in arguments]
|
||||
if len(argtypes) == 1 and argtypes[0] is None:
|
||||
argtypes = []
|
||||
func.argtypes = argtypes
|
||||
|
||||
#print func, func.restype, func.argtyp
|
||||
return func
|
||||
|
||||
def initializeTypes(self):
|
||||
self.prototype("char* stringlist_iget(long, int)", lib=self.util)
|
||||
self.prototype("long stringlist_alloc_new()", lib=self.util)
|
||||
self.prototype("void stringlist_append_copy(long, char*)", lib=self.util)
|
||||
self.prototype("int stringlist_get_size(long)", lib=self.util)
|
||||
self.prototype("void stringlist_free(long)", lib=self.util)
|
||||
|
||||
self.prototype("long hash_iter_alloc(long)", lib=self.util)
|
||||
self.prototype("char* hash_iter_get_next_key(long)", lib=self.util)
|
||||
self.prototype("char* hash_get(long, char*)", lib=self.util)
|
||||
self.prototype("int hash_get_int(long, char*)", lib=self.util)
|
||||
self.prototype("void hash_iter_free(long)", lib=self.util)
|
||||
self.prototype("bool hash_iter_is_complete(long)", lib=self.util)
|
||||
|
||||
self.prototype("int subst_list_get_size(long)", lib=self.util)
|
||||
self.prototype("char* subst_list_iget_key(long, int)", lib=self.util)
|
||||
self.prototype("char* subst_list_iget_value(long, int)", lib=self.util)
|
||||
|
||||
self.prototype("long bool_vector_alloc(int, bool)", lib=self.util)
|
||||
self.prototype("void bool_vector_iset(long, int, bool)", lib=self.util)
|
||||
self.prototype("long bool_vector_get_ptr(long)", lib=self.util)
|
||||
self.prototype("void bool_vector_free(long)", lib=self.util)
|
||||
|
||||
self.prototype("void enkf_main_free(long)")
|
||||
self.prototype("void enkf_main_fprintf_config(long)")
|
||||
self.prototype("void enkf_main_create_new_config(long , char*, char* , char* , int)")
|
||||
|
||||
|
||||
self.registerType("time_t", erttypes.time_t)
|
||||
erttypes.time_vector.initialize(self)
|
||||
erttypes.double_vector.initialize(self)
|
||||
|
||||
|
||||
def getStringList(self, stringlist_pointer, free_after_use=False):
|
||||
"""Retrieve a list of strings"""
|
||||
result = []
|
||||
|
||||
if stringlist_pointer == 0:
|
||||
return result
|
||||
|
||||
number_of_strings = self.util.stringlist_get_size(stringlist_pointer)
|
||||
|
||||
for index in range(number_of_strings):
|
||||
result.append(self.util.stringlist_iget(stringlist_pointer, index))
|
||||
|
||||
if free_after_use:
|
||||
self.freeStringList(stringlist_pointer)
|
||||
|
||||
return result
|
||||
|
||||
def createStringList(self, list):
|
||||
"""Creates a new string list from the specified list. Remember to free the list after use."""
|
||||
sl = self.util.stringlist_alloc_new()
|
||||
|
||||
for item in list:
|
||||
self.util.stringlist_append_copy(sl , item)
|
||||
|
||||
return sl
|
||||
|
||||
|
||||
def freeStringList(self, stringlistpointer):
|
||||
"""Must be used if the stringlist was allocated on the python side"""
|
||||
self.util.stringlist_free(stringlistpointer)
|
||||
|
||||
|
||||
def getHash(self, hashpointer, intValue = False, return_type="char*"):
|
||||
"""Retrieves a hash as a list of 2 element lists"""
|
||||
if hashpointer == 0:
|
||||
return []
|
||||
|
||||
hash_iterator = self.util.hash_iter_alloc(hashpointer)
|
||||
self.prototype("%s hash_get(long)" % (return_type), lib = self.util)
|
||||
|
||||
result = []
|
||||
while not self.util.hash_iter_is_complete(hash_iterator):
|
||||
key = self.util.hash_iter_get_next_key(hash_iterator)
|
||||
|
||||
if not intValue:
|
||||
value = self.util.hash_get(hashpointer, key)
|
||||
else:
|
||||
value = self.util.hash_get_int(hashpointer, key)
|
||||
#print "%s -> %d" % (key , value)
|
||||
|
||||
result.append([key, str(value)])
|
||||
|
||||
self.util.hash_iter_free(hash_iterator)
|
||||
#print result
|
||||
return result
|
||||
|
||||
def getSubstitutionList(self, substlistpointer):
|
||||
"""Retrieves a substitution list as a list of 2 element lists"""
|
||||
size = self.util.subst_list_get_size(substlistpointer)
|
||||
|
||||
result = []
|
||||
for index in range(size):
|
||||
key = self.util.subst_list_iget_key(substlistpointer, index)
|
||||
value = self.util.subst_list_iget_value(substlistpointer, index)
|
||||
result.append([key, value])
|
||||
|
||||
return result
|
||||
|
||||
def __getErtPointer(self, function):
|
||||
"""Returns a pointer from ERT as a c_long (64-bit support)"""
|
||||
func = getattr( self.enkf, function )
|
||||
func.restype = c_long # Should be c_size_t - if that exists.
|
||||
return func( self.main )
|
||||
|
||||
|
||||
def createBoolVector(self, size, list):
|
||||
"""Allocates a bool vector"""
|
||||
mask = self.util.bool_vector_alloc(size , False)
|
||||
|
||||
for index in list:
|
||||
self.util.bool_vector_iset(mask, index, True)
|
||||
|
||||
return mask
|
||||
|
||||
def getBoolVectorPtr(self, mask):
|
||||
"""Returns the pointer to a bool vector"""
|
||||
return self.util.bool_vector_get_ptr(mask)
|
||||
|
||||
def freeBoolVector(self, mask):
|
||||
"""Frees an allocated bool vector"""
|
||||
self.util.bool_vector_free(mask)
|
||||
|
||||
def cleanup(self):
|
||||
"""Called at atexit to clean up before shutdown"""
|
||||
print "Calling enkf_main_free()"
|
||||
self.enkf.enkf_main_free(self.main)
|
||||
|
||||
def nonify(self, s):
|
||||
"""Convert an empty string to None."""
|
||||
return s or None
|
||||
|
||||
def save(self):
|
||||
"""Save the state of ert to a configuration file."""
|
||||
self.enkf.enkf_main_fprintf_config(self.main)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -114,6 +114,8 @@ from PyQt4 import QtGui, QtCore
|
||||
import sys
|
||||
import os
|
||||
|
||||
from ert.ert.ertwrapper import ErtWrapper
|
||||
|
||||
import ert_gui.widgets.util
|
||||
import ert_gui.widgets.help
|
||||
ert_gui.widgets.help.help_prefix = os.getenv("GERT_SHARE_PATH")+ "/help/"
|
||||
@@ -130,7 +132,6 @@ from ert_gui.pages.init.initpanel import InitPanel
|
||||
from ert_gui.pages.run.runpanel import RunPanel
|
||||
from ert_gui.pages.config.configpages import ConfigPages
|
||||
from ert_gui.pages.plot.plotpanel import PlotPanel
|
||||
from ert.ertwrapper import ErtWrapper
|
||||
from ert_gui.widgets.helpedwidget import ContentModel
|
||||
from ert_gui.widgets.util import resourceImage, resourceIcon
|
||||
|
||||
@@ -186,7 +187,7 @@ window.setSaveFunction(ert.save)
|
||||
splash.showMessage("Creating GUI...", color=QtCore.Qt.white)
|
||||
app.processEvents()
|
||||
|
||||
window.addPage("Configuration", resourceIcon("config"), ConfigPages(window))
|
||||
#window.addPage("Configuration", resourceIcon("config"), ConfigPages(window))
|
||||
window.addPage("Init", resourceIcon("db"), InitPanel(window))
|
||||
window.addPage("Run", resourceIcon("run"), RunPanel(window))
|
||||
window.addPage("Plots", resourceIcon("plot"), PlotPanel())
|
||||
|
||||
@@ -19,41 +19,30 @@
|
||||
# Analysis tab
|
||||
# ----------------------------------------------------------------------------------------------
|
||||
from ert_gui.widgets.checkbox import CheckBox
|
||||
import ert.ertwrapper as ertwrapper
|
||||
from ert_gui.widgets.spinnerwidgets import IntegerSpinner, DoubleSpinner, DoubleSpinner
|
||||
import ert_gui.widgets.tablewidgets
|
||||
from ert_gui.widgets.pathchooser import PathChooser
|
||||
from ert_gui.widgets.combochoice import ComboChoice
|
||||
from PyQt4 import QtGui
|
||||
import ert.enkf
|
||||
|
||||
def createAnalysisPage(configPanel, parent):
|
||||
configPanel.startPage("Analysis")
|
||||
|
||||
r = configPanel.addRow(CheckBox(parent, "ENKF rerun", "config/analysis/enkf_rerun", "Perform rerun"))
|
||||
r.initialize = lambda ert : [ert.prototype("int analysis_config_get_rerun(long)"),
|
||||
ert.prototype("void analysis_config_set_rerun(long, bool)")]
|
||||
r.getter = lambda ert : ert.enkf.analysis_config_get_rerun(ert.analysis_config)
|
||||
r.setter = lambda ert, value : ert.enkf.analysis_config_set_rerun(ert.analysis_config, value)
|
||||
|
||||
r = configPanel.addRow(IntegerSpinner(parent, "Rerun start", "config/analysis/rerun_start", 0, 100000))
|
||||
r.initialize = lambda ert : [ert.prototype("int analysis_config_get_rerun_start(long)"),
|
||||
ert.prototype("void analysis_config_set_rerun_start(long, int)")]
|
||||
r.getter = lambda ert : ert.enkf.analysis_config_get_rerun_start(ert.analysis_config)
|
||||
r.setter = lambda ert, value : ert.enkf.analysis_config_set_rerun_start(ert.analysis_config, value)
|
||||
|
||||
r = configPanel.addRow(PathChooser(parent, "ENKF schedule file", "config/analysis/enkf_sched_file"))
|
||||
r.initialize = lambda ert : [ert.prototype("char* model_config_get_enkf_sched_file(long)"),
|
||||
ert.prototype("long enkf_main_get_model_config(long)"),
|
||||
ert.prototype("void model_config_set_enkf_sched_file(long, char*)")]
|
||||
r.getter = lambda ert : ert.enkf.model_config_get_enkf_sched_file(ert.enkf.enkf_main_get_model_config(ert.main))
|
||||
r.setter = lambda ert, value : ert.enkf.model_config_set_enkf_sched_file(ert.enkf.enkf_main_get_model_config(ert.main), str(value))
|
||||
|
||||
r = configPanel.addRow(ert_gui.widgets.tablewidgets.KeywordList(parent, "Local config", "config/analysis/local_config"))
|
||||
r.newKeywordPopup = lambda list : QtGui.QFileDialog.getOpenFileName(r, "Select a path", "")
|
||||
r.initialize = lambda ert : [ert.prototype("long local_config_get_config_files(long)"),
|
||||
ert.prototype("long enkf_main_get_local_config(long)"),
|
||||
ert.prototype("void local_config_clear_config_files(long)"),
|
||||
ert.prototype("void local_config_add_config_file(long, char*)")]
|
||||
|
||||
def get_local_config_files(ert):
|
||||
local_config = ert.enkf.enkf_main_get_local_config(ert.main)
|
||||
@@ -72,8 +61,6 @@ def createAnalysisPage(configPanel, parent):
|
||||
r.setter = add_config_file
|
||||
|
||||
r = configPanel.addRow(PathChooser(parent, "Update log", "config/analysis/update_log"))
|
||||
r.initialize = lambda ert : [ert.prototype("char* analysis_config_get_log_path(long)"),
|
||||
ert.prototype("void analysis_config_set_log_path(long, char*)")]
|
||||
r.getter = lambda ert : ert.enkf.analysis_config_get_log_path(ert.analysis_config)
|
||||
r.setter = lambda ert, value : ert.enkf.analysis_config_set_log_path(ert.analysis_config, str(value))
|
||||
|
||||
@@ -81,14 +68,10 @@ def createAnalysisPage(configPanel, parent):
|
||||
configPanel.startGroup("EnKF")
|
||||
|
||||
r = configPanel.addRow(DoubleSpinner(parent, "Alpha", "config/analysis/enkf_alpha", 0, 100000, 2))
|
||||
r.initialize = lambda ert : [ert.prototype("double analysis_config_get_alpha(long)"),
|
||||
ert.prototype("void analysis_config_set_alpha(long, double)")]
|
||||
r.getter = lambda ert : ert.enkf.analysis_config_get_alpha(ert.analysis_config)
|
||||
r.setter = lambda ert, value : ert.enkf.analysis_config_set_alpha(ert.analysis_config, value)
|
||||
|
||||
r = configPanel.addRow(CheckBox(parent, "Merge Observations", "config/analysis/enkf_merge_observations", "Perform merge"))
|
||||
r.initialize = lambda ert : [ert.prototype("bool analysis_config_get_merge_observations(long)"),
|
||||
ert.prototype("void analysis_config_set_merge_observations(long, int)")]
|
||||
r.getter = lambda ert : ert.enkf.analysis_config_get_merge_observations(ert.analysis_config)
|
||||
r.setter = lambda ert, value : ert.enkf.analysis_config_set_merge_observations(ert.analysis_config, value)
|
||||
|
||||
@@ -96,15 +79,11 @@ def createAnalysisPage(configPanel, parent):
|
||||
enkf_mode_type = {"ENKF_STANDARD" : 10, "ENKF_SQRT" : 20}
|
||||
enkf_mode_type_inverted = {10 : "ENKF_STANDARD" , 20 : "ENKF_SQRT"}
|
||||
r = configPanel.addRow(ComboChoice(parent, enkf_mode_type.keys(), "Mode", "config/analysis/enkf_mode"))
|
||||
r.initialize = lambda ert : [ert.prototype("int analysis_config_get_enkf_mode(long)"),
|
||||
ert.prototype("void analysis_config_set_enkf_mode(long, int)")]
|
||||
r.getter = lambda ert : enkf_mode_type_inverted[ert.enkf.analysis_config_get_enkf_mode(ert.analysis_config)]
|
||||
r.setter = lambda ert, value : ert.enkf.analysis_config_set_enkf_mode(ert.analysis_config, enkf_mode_type[str(value)])
|
||||
|
||||
|
||||
r = configPanel.addRow(DoubleSpinner(parent, "Truncation", "config/analysis/enkf_truncation", 0, 1, 2))
|
||||
r.initialize = lambda ert : [ert.prototype("double analysis_config_get_truncation(long)"),
|
||||
ert.prototype("void analysis_config_set_truncation(long, double)")]
|
||||
r.getter = lambda ert : ert.enkf.analysis_config_get_truncation(ert.analysis_config)
|
||||
r.setter = lambda ert, value : ert.enkf.analysis_config_set_truncation(ert.analysis_config, value)
|
||||
|
||||
|
||||
@@ -20,60 +20,43 @@
|
||||
# ----------------------------------------------------------------------------------------------
|
||||
from ert_gui.widgets.pathchooser import PathChooser
|
||||
from ert_gui.widgets.tablewidgets import KeywordTable, KeywordList
|
||||
import ert.ertwrapper as ertwrapper
|
||||
from ert_gui.widgets.configpanel import ConfigPanel
|
||||
import ert.enkf
|
||||
|
||||
def createEclipsePage(configPanel, parent):
|
||||
configPanel.startPage("Eclipse")
|
||||
|
||||
r = configPanel.addRow(PathChooser(parent, "Eclipse Base", "config/eclipse/eclbase", path_format=True))
|
||||
r.initialize = lambda ert : [ert.prototype("char* ecl_config_get_eclbase(long)"),
|
||||
ert.prototype("void enkf_main_set_eclbase(long, char*)")]
|
||||
r.getter = lambda ert : ert.enkf.ecl_config_get_eclbase(ert.ecl_config)
|
||||
r.setter = lambda ert, value : ert.enkf.enkf_main_set_eclbase(ert.main , str(value))
|
||||
|
||||
r = configPanel.addRow(PathChooser(parent, "Data file", "config/eclipse/data_file", show_files=True))
|
||||
r.initialize = lambda ert : [ert.prototype("char* ecl_config_get_data_file(long)"),
|
||||
ert.prototype("void enkf_main_set_data_file(long, char*)")]
|
||||
r.getter = lambda ert : ert.enkf.ecl_config_get_data_file(ert.ecl_config)
|
||||
r.setter = lambda ert, value : ert.enkf.enkf_main_set_data_file(ert.main , str(value))
|
||||
|
||||
r = configPanel.addRow(PathChooser(parent, "Grid", "config/eclipse/grid", show_files=True))
|
||||
r.initialize = lambda ert : [ert.prototype("char* ecl_config_get_gridfile(long)"),
|
||||
ert.prototype("void ecl_config_set_grid(long, char*)")]
|
||||
r.getter = lambda ert : ert.enkf.ecl_config_get_gridfile(ert.ecl_config)
|
||||
r.setter = lambda ert, value : ert.enkf.ecl_config_set_grid(ert.ecl_config, str(value))
|
||||
|
||||
r = configPanel.addRow(PathChooser(parent, "Schedule file" , "config/eclipse/schedule_file" , show_files = True))
|
||||
r.initialize = lambda ert : [ert.prototype("char* ecl_config_get_schedule_file(long)"),
|
||||
ert.prototype("void ecl_config_set_schedule_file(long, char*)")]
|
||||
r.getter = lambda ert : ert.enkf.ecl_config_get_schedule_file(ert.ecl_config)
|
||||
r.setter = lambda ert, value : ert.enkf.ecl_config_set_schedule_file(ert.ecl_config, str(value))
|
||||
|
||||
|
||||
r = configPanel.addRow(PathChooser(parent, "Init section", "config/eclipse/init_section", show_files=True))
|
||||
r.initialize = lambda ert : [ert.prototype("char* ecl_config_get_init_section(long)"),
|
||||
ert.prototype("void ecl_config_set_init_section(long, char*)")]
|
||||
r.getter = lambda ert : ert.enkf.ecl_config_get_init_section(ert.ecl_config)
|
||||
r.setter = lambda ert, value : ert.enkf.ecl_config_set_init_section(ert.ecl_config, str(value))
|
||||
|
||||
|
||||
r = configPanel.addRow(PathChooser(parent, "Refcase", "config/eclipse/refcase", show_files=True))
|
||||
r.initialize = lambda ert : [ert.prototype("char* ecl_config_get_refcase_name(long)"),
|
||||
ert.prototype("void ecl_config_load_refcase(long, char*)")]
|
||||
r.getter = lambda ert : ert.enkf.ecl_config_get_refcase_name(ert.ecl_config)
|
||||
r.setter = lambda ert, value : ert.enkf.ecl_config_load_refcase(ert.ecl_config, str(value))
|
||||
|
||||
r = configPanel.addRow(PathChooser(parent, "Schedule prediction file", "config/eclipse/schedule_prediction_file", show_files=True))
|
||||
r.initialize = lambda ert : [ert.prototype("char* enkf_main_get_schedule_prediction_file(long)"),
|
||||
ert.prototype("void enkf_main_set_schedule_prediction_file(long, char*)")]
|
||||
r.getter = lambda ert : ert.enkf.enkf_main_get_schedule_prediction_file(ert.main)
|
||||
r.setter = lambda ert, value : ert.enkf.enkf_main_set_schedule_prediction_file(ert.main, ert.nonify( value ))
|
||||
|
||||
r = configPanel.addRow(KeywordTable(parent, "Data keywords", "config/eclipse/data_kw"))
|
||||
r.initialize = lambda ert : [ert.prototype("long enkf_main_get_data_kw(long)"),
|
||||
ert.prototype("void enkf_main_clear_data_kw(long)"),
|
||||
ert.prototype("void enkf_main_add_data_kw(long, char*, char*)")]
|
||||
r.getter = lambda ert : ert.getSubstitutionList(ert.enkf.enkf_main_get_data_kw(ert.main))
|
||||
|
||||
def add_data_kw(ert, listOfKeywords):
|
||||
@@ -93,9 +76,6 @@ def createEclipsePage(configPanel, parent):
|
||||
internalPanel.startPage("Static keywords")
|
||||
|
||||
r = internalPanel.addRow(KeywordList(parent, "", "config/eclipse/add_static_kw"))
|
||||
r.initialize = lambda ert : [ert.prototype("long ecl_config_get_static_kw_list(long)"),
|
||||
ert.prototype("void ecl_config_clear_static_kw(long)"),
|
||||
ert.prototype("void ecl_config_add_static_kw(long, char*)")]
|
||||
r.getter = lambda ert : ert.getStringList(ert.enkf.ecl_config_get_static_kw_list(ert.ecl_config))
|
||||
|
||||
def add_static_kw(ert, listOfKeywords):
|
||||
|
||||
@@ -20,19 +20,16 @@
|
||||
# ----------------------------------------------------------------------------------------------
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from ert_gui.widgets.spinnerwidgets import IntegerSpinner
|
||||
import ert.ertwrapper as ertwrapper
|
||||
from parameters.parameterpanel import ParameterPanel, enums
|
||||
from parameters.parametermodels import SummaryModel, DataModel, FieldModel, KeywordModel
|
||||
from ert.enums import field_type
|
||||
from ert.enums import truncation_type
|
||||
from ert.enums import gen_data_file_format
|
||||
from ert.ert.enums import field_type
|
||||
from ert.ert.enums import truncation_type
|
||||
from ert.ert.enums import gen_data_file_format
|
||||
|
||||
def createEnsemblePage(configPanel, parent):
|
||||
configPanel.startPage("Ensemble")
|
||||
|
||||
r = configPanel.addRow(IntegerSpinner(parent, "Number of realizations", "config/ensemble/num_realizations", 1, 10000))
|
||||
r.initialize = lambda ert : [ert.prototype("int enkf_main_get_ensemble_size(long)"),
|
||||
ert.prototype("void enkf_main_resize_ensemble(int)")]
|
||||
|
||||
r.getter = lambda ert : ert.enkf.enkf_main_get_ensemble_size(ert.main)
|
||||
r.setter = lambda ert, value : ert.enkf.enkf_main_resize_ensemble(ert.main, value)
|
||||
@@ -44,51 +41,6 @@ def createEnsemblePage(configPanel, parent):
|
||||
r = configPanel.addRow(ParameterPanel(parent, "", "")) # no help file necessary
|
||||
parent.connect(r, QtCore.SIGNAL("contentsChanged()"), lambda : r.modelEmit("ensembleUpdated()"))
|
||||
|
||||
def initialize(ert):
|
||||
ert.prototype("long ensemble_config_get_node(long, char*)")
|
||||
ert.prototype("long ensemble_config_alloc_keylist(long)")
|
||||
ert.prototype("long ensemble_config_add_summary(long, char*)")
|
||||
ert.prototype("long ensemble_config_add_gen_kw(long, char*)")
|
||||
ert.prototype("long ensemble_config_add_gen_data(long, char*)")
|
||||
ert.prototype("long ensemble_config_add_field(long, char*, long)")
|
||||
|
||||
ert.prototype("void enkf_main_del_node(long, char*)")
|
||||
ert.prototype("long ecl_config_get_grid(long)")
|
||||
|
||||
ert.prototype("long enkf_config_node_get_impl_type(long)")
|
||||
ert.prototype("long enkf_config_node_get_ref(long)")
|
||||
ert.prototype("bool enkf_config_node_is_valid(long)")
|
||||
ert.prototype("char* enkf_config_node_get_min_std_file(long)")
|
||||
ert.prototype("char* enkf_config_node_get_enkf_outfile(long)")
|
||||
ert.prototype("char* enkf_config_node_get_enkf_infile(long)")
|
||||
ert.prototype("void enkf_config_node_update_gen_kw(long, char*, char*, char*, char*, char*)")
|
||||
ert.prototype("void enkf_config_node_update_state_field(long, int, double, double)")
|
||||
ert.prototype("void enkf_config_node_update_parameter_field(long, char*, char*, char*, int, double, double, char*, char*)")
|
||||
ert.prototype("void enkf_config_node_update_general_field(long, char*, char*, char*, char*, int, double, double, char*, char*, char*)")
|
||||
ert.prototype("void enkf_config_node_update_gen_data(long, int, int, char*, char*, char*, char*, char*, char*)")
|
||||
|
||||
ert.prototype("char* gen_kw_config_get_template_file(long)")
|
||||
ert.prototype("char* gen_kw_config_get_init_file_fmt(long)")
|
||||
ert.prototype("char* gen_kw_config_get_parameter_file(long)")
|
||||
|
||||
ert.prototype("long gen_data_config_get_output_format(long)")
|
||||
ert.prototype("long gen_data_config_get_input_format(long)")
|
||||
ert.prototype("char* gen_data_config_get_template_file(long)")
|
||||
ert.prototype("char* gen_data_config_get_template_key(long)")
|
||||
ert.prototype("char* gen_data_config_get_init_file_fmt(long)")
|
||||
|
||||
ert.prototype("int field_config_get_type(long)")
|
||||
ert.prototype("int field_config_get_truncation_mode(long)")
|
||||
ert.prototype("double field_config_get_truncation_min(long)")
|
||||
ert.prototype("double field_config_get_truncation_max(long)")
|
||||
ert.prototype("char* field_config_get_init_transform_name(long)")
|
||||
ert.prototype("char* field_config_get_output_transform_name(long)")
|
||||
ert.prototype("char* field_config_get_init_file_fmt(long)")
|
||||
|
||||
|
||||
|
||||
r.initialize = initialize
|
||||
|
||||
def getEnsembleParameters(ert):
|
||||
keys = ert.getStringList(ert.enkf.ensemble_config_alloc_keylist(ert.ensemble_config), free_after_use=True)
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ from ert_gui.widgets.tablewidgets import KeywordTable
|
||||
from ert_gui.widgets.tablewidgets import KeywordList
|
||||
from ert_gui.widgets.stringbox import StringBox
|
||||
import os
|
||||
from ert.ertwrapper import c_char_p, c_int
|
||||
from ert_gui.widgets.spinnerwidgets import IntegerSpinner
|
||||
import ert_gui.widgets.util
|
||||
from ert_gui.widgets.helpedwidget import ContentModelProxy
|
||||
@@ -158,34 +157,6 @@ class JobConfigPanel(ConfigPanel):
|
||||
self.addRow(widget, label)
|
||||
|
||||
|
||||
def initialize(self, ert):
|
||||
if not self.initialized:
|
||||
ert.prototype("long site_config_get_installed_jobs(long)")
|
||||
ert.prototype("char* ext_job_get_stdin_file(long)",lib=ert.job_queue)
|
||||
ert.prototype("void ext_job_set_stdin_file(long, char*)", lib=ert.job_queue)
|
||||
ert.prototype("char* ext_job_get_stdout_file(long)", lib=ert.job_queue)
|
||||
ert.prototype("void ext_job_set_stdout_file(long, char*)", lib=ert.job_queue)
|
||||
ert.prototype("char* ext_job_get_stderr_file(long)", lib=ert.job_queue)
|
||||
ert.prototype("void ext_job_set_stderr_file(long, char*)", lib=ert.job_queue)
|
||||
ert.prototype("char* ext_job_get_target_file(long)", lib=ert.job_queue)
|
||||
ert.prototype("void ext_job_set_target_file(long, char*)", lib=ert.job_queue)
|
||||
ert.prototype("char* ext_job_get_executable(long)", lib=ert.job_queue)
|
||||
ert.prototype("void ext_job_set_executable(long, char*)", lib=ert.job_queue)
|
||||
ert.prototype("char* ext_job_get_private_args_as_string(long)", lib=ert.job_queue)
|
||||
ert.prototype("void ext_job_set_private_args_from_string(long, char*)", lib=ert.job_queue)
|
||||
ert.prototype("int ext_job_get_max_running(long)", lib=ert.job_queue)
|
||||
ert.prototype("void ext_job_set_max_running(long, int)", lib=ert.job_queue)
|
||||
ert.prototype("int ext_job_get_max_running_minutes(long)", lib=ert.job_queue)
|
||||
ert.prototype("void ext_job_set_max_running_minutes(long, int)", lib=ert.job_queue)
|
||||
ert.prototype("long ext_job_get_environment(long)", lib=ert.job_queue)
|
||||
ert.prototype("void ext_job_add_environment(long, char*, char*)", lib=ert.job_queue)
|
||||
ert.prototype("void ext_job_clear_environment(long)", lib=ert.job_queue)
|
||||
ert.prototype("void ext_job_save(long)", lib=ert.job_queue)
|
||||
ert.prototype("long ext_joblist_get_job(long, char*)", lib=ert.job_queue)
|
||||
|
||||
self.initialized = True
|
||||
|
||||
|
||||
def setJob(self, job):
|
||||
self.job = job
|
||||
|
||||
|
||||
@@ -20,15 +20,13 @@
|
||||
# ----------------------------------------------------------------------------------------------
|
||||
from ert_gui.widgets.combochoice import ComboChoice
|
||||
from ert_gui.widgets.pathchooser import PathChooser
|
||||
from ert.enums import history_source_type
|
||||
from ert.ert.enums import history_source_type
|
||||
from ert_gui.widgets.reloadbutton import ReloadButton
|
||||
|
||||
def createObservationsPage(configPanel, parent):
|
||||
configPanel.startPage("Observations")
|
||||
|
||||
r = configPanel.addRow(ComboChoice(parent, history_source_type.values(), "History source", "config/observations/history_source"))
|
||||
r.initialize = lambda ert : [ert.prototype("int model_config_get_history_source(long)"),
|
||||
ert.prototype("void model_config_set_history_source(long, int)")]
|
||||
|
||||
def get_history_source(ert):
|
||||
history_source = ert.enkf.model_config_get_history_source(ert.model_config)
|
||||
@@ -44,9 +42,6 @@ def createObservationsPage(configPanel, parent):
|
||||
|
||||
|
||||
r = configPanel.addRow(PathChooser(parent, "Observations config", "config/observations/obs_config", True))
|
||||
r.initialize = lambda ert : [ert.prototype("long enkf_main_get_obs(long)"),
|
||||
ert.prototype("char* enkf_obs_get_config_file(long)"),
|
||||
ert.prototype("void enkf_main_load_obs(long, char*)")]
|
||||
|
||||
def get_obs(ert):
|
||||
obs = ert.enkf.enkf_main_get_obs(ert.main)
|
||||
@@ -61,7 +56,6 @@ def createObservationsPage(configPanel, parent):
|
||||
|
||||
|
||||
r = configPanel.addRow(ReloadButton(parent, "Reload Observations", "config/observations/reload_observation", "Reload"))
|
||||
r.initialize = lambda ert : [ert.prototype("void enkf_main_reload_obs(long)")]
|
||||
r.getter = lambda ert : ert.enkf.enkf_main_reload_obs(ert.main)
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ from ert_gui.widgets.combochoice import ComboChoice
|
||||
from ert_gui.widgets.stringbox import DoubleBox
|
||||
from ert_gui.widgets.pathchooser import PathChooser
|
||||
from parametermodels import DataModel
|
||||
import ert.enums as enums
|
||||
import ert.ert.enums as enums
|
||||
import ert_gui.widgets.helpedwidget
|
||||
|
||||
class DataPanel(QtGui.QFrame):
|
||||
|
||||
@@ -20,7 +20,7 @@ from ert_gui.widgets.combochoice import ComboChoice
|
||||
from ert_gui.widgets.stringbox import DoubleBox
|
||||
from ert_gui.widgets.pathchooser import PathChooser
|
||||
from parametermodels import FieldModel
|
||||
from ert.enums import field_type
|
||||
from ert.ert.enums import field_type
|
||||
from ert_gui.widgets.helpedwidget import ContentModel
|
||||
|
||||
class FieldPanel(QtGui.QFrame):
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
# for more details.
|
||||
|
||||
|
||||
from ert.enums import enkf_impl_type, field_type
|
||||
from ert.ert.enums import enkf_impl_type, field_type
|
||||
from PyQt4.QtCore import QObject
|
||||
from PyQt4.Qt import SIGNAL
|
||||
|
||||
|
||||
@@ -22,50 +22,35 @@ from ert_gui.widgets.pathchooser import PathChooser
|
||||
from ert_gui.widgets.combochoice import ComboChoice
|
||||
from ert_gui.widgets.spinnerwidgets import IntegerSpinner
|
||||
|
||||
import ert.ertwrapper as ertwrapper
|
||||
|
||||
def createPlotPage(configPanel, parent):
|
||||
configPanel.startPage("Plot")
|
||||
|
||||
r = configPanel.addRow(PathChooser(parent, "Output path", "config/plot/path"))
|
||||
r.initialize = lambda ert : [ert.prototype("char* plot_config_get_path(long)"),
|
||||
ert.prototype("void plot_config_set_path(long, char*)")]
|
||||
r.getter = lambda ert : ert.enkf.plot_config_get_path(ert.plot_config)
|
||||
r.setter = lambda ert, value : ert.enkf.plot_config_set_path(ert.plot_config, str(value))
|
||||
|
||||
r = configPanel.addRow(ComboChoice(parent, ["PLPLOT", "TEXT"], "Driver", "config/plot/plot_driver"))
|
||||
r.initialize = lambda ert : [ert.prototype("char* plot_config_get_driver(long)"),
|
||||
ert.prototype("void plot_config_set_driver(long, char*)")]
|
||||
r.getter = lambda ert : ert.enkf.plot_config_get_driver(ert.plot_config)
|
||||
r.setter = lambda ert, value : ert.enkf.plot_config_set_driver(ert.plot_config, str(value))
|
||||
|
||||
r = configPanel.addRow(IntegerSpinner(parent, "Errorbar max", "config/plot/plot_errorbar_max", 1, 10000000))
|
||||
r.initialize = lambda ert : [ert.prototype("int plot_config_get_errorbar_max(long)"),
|
||||
ert.prototype("void plot_config_set_errorbar_max(long, int)")]
|
||||
r.getter = lambda ert : ert.enkf.plot_config_get_errorbar_max(ert.plot_config)
|
||||
r.setter = lambda ert, value : ert.enkf.plot_config_set_errorbar_max(ert.plot_config, value)
|
||||
|
||||
r = configPanel.addRow(IntegerSpinner(parent, "Width", "config/plot/width", 1, 10000))
|
||||
r.initialize = lambda ert : [ert.prototype("int plot_config_get_width(long)"),
|
||||
ert.prototype("void plot_config_set_width(long, int)")]
|
||||
r.getter = lambda ert : ert.enkf.plot_config_get_width(ert.plot_config)
|
||||
r.setter = lambda ert, value : ert.enkf.plot_config_set_width(ert.plot_config, value)
|
||||
|
||||
r = configPanel.addRow(IntegerSpinner(parent, "Height", "config/plot/plot_height", 1, 10000))
|
||||
r.initialize = lambda ert : [ert.prototype("int plot_config_get_height(long)"),
|
||||
ert.prototype("void plot_config_set_height(long, int)")]
|
||||
r.getter = lambda ert : ert.enkf.plot_config_get_height(ert.plot_config)
|
||||
r.setter = lambda ert, value : ert.enkf.plot_config_set_height(ert.plot_config, value)
|
||||
|
||||
r = configPanel.addRow(PathChooser(parent, "Image Viewer", "config/plot/image_viewer", True))
|
||||
r.initialize = lambda ert : [ert.prototype("char* plot_config_get_viewer(long)"),
|
||||
ert.prototype("void plot_config_set_viewer(long, char*)")]
|
||||
r.getter = lambda ert : ert.enkf.plot_config_get_viewer(ert.plot_config)
|
||||
r.setter = lambda ert, value : ert.enkf.plot_config_set_viewer(ert.plot_config, str(value))
|
||||
|
||||
r = configPanel.addRow(ComboChoice(parent, ["bmp", "jpg", "png", "tif"], "Image type", "config/plot/image_type"))
|
||||
r.initialize = lambda ert : [ert.prototype("char* plot_config_get_image_type(long)"),
|
||||
ert.prototype("void plot_config_set_image_type(long, char*)")]
|
||||
r.getter = lambda ert : ert.enkf.plot_config_get_image_type(ert.plot_config)
|
||||
r.setter = lambda ert, value : ert.enkf.plot_config_set_image_type(ert.plot_config, str(value))
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
# ----------------------------------------------------------------------------------------------
|
||||
from ert_gui.widgets.configpanel import ConfigPanel
|
||||
from ert_gui.widgets.combochoice import ComboChoice
|
||||
import ert.ertwrapper as ertwrapper
|
||||
from ert_gui.widgets.stringbox import StringBox
|
||||
from ert_gui.widgets.pathchooser import PathChooser
|
||||
from ert_gui.widgets.spinnerwidgets import IntegerSpinner
|
||||
@@ -30,8 +29,6 @@ def createQueueSystemPage(configPanel, parent):
|
||||
configPanel.startPage("Queue System")
|
||||
|
||||
r = configPanel.addRow(ComboChoice(parent, ["LSF", "RSH", "LOCAL"], "Queue system", "config/queue_system/queue_system"))
|
||||
r.initialize = lambda ert : [ert.prototype("char* site_config_get_queue_name(long)"),
|
||||
ert.prototype("void site_config_set_job_queue(long, char*)")]
|
||||
r.getter = lambda ert : ert.enkf.site_config_get_queue_name(ert.site_config)
|
||||
r.setter = lambda ert, value : ert.enkf.site_config_set_job_queue(ert.site_config, str(value))
|
||||
|
||||
@@ -40,20 +37,14 @@ def createQueueSystemPage(configPanel, parent):
|
||||
internalPanel.startPage("LSF")
|
||||
|
||||
r = internalPanel.addRow(StringBox(parent, "LSF Queue", "config/queue_system/lsf_queue"))
|
||||
r.initialize = lambda ert : [ert.prototype("char* site_config_get_lsf_queue(long)"),
|
||||
ert.prototype("void site_config_set_lsf_queue(long, char*)")]
|
||||
r.getter = lambda ert : ert.enkf.site_config_get_lsf_queue(ert.site_config)
|
||||
r.setter = lambda ert, value : ert.enkf.site_config_set_lsf_queue(ert.site_config, str(value))
|
||||
|
||||
r = internalPanel.addRow(IntegerSpinner(parent, "Max running", "config/queue_system/max_running_lsf", 1, 1000))
|
||||
r.initialize = lambda ert : [ert.prototype("int site_config_get_max_running_lsf(long)"),
|
||||
ert.prototype("void site_config_set_max_running_lsf(long, int)")]
|
||||
r.getter = lambda ert : ert.enkf.site_config_get_max_running_lsf(ert.site_config)
|
||||
r.setter = lambda ert, value : ert.enkf.site_config_set_max_running_lsf(ert.site_config, value)
|
||||
|
||||
r = internalPanel.addRow(StringBox(parent, "Resources", "config/queue_system/lsf_resources"))
|
||||
r.initialize = lambda ert : [ert.prototype("char* site_config_get_lsf_request(long)"),
|
||||
ert.prototype("void site_config_set_lsf_request(long, char*)")]
|
||||
r.getter = lambda ert : ert.enkf.site_config_get_lsf_request(ert.site_config)
|
||||
r.setter = lambda ert, value : ert.enkf.site_config_set_lsf_request(ert.site_config, str(value))
|
||||
|
||||
@@ -63,22 +54,15 @@ def createQueueSystemPage(configPanel, parent):
|
||||
internalPanel.startPage("RSH")
|
||||
|
||||
r = internalPanel.addRow(PathChooser(parent, "Command", "config/queue_system/rsh_command", show_files=True, must_exist=True, is_executable_file=True))
|
||||
r.initialize = lambda ert : [ert.prototype("char* site_config_get_rsh_command(long)"),
|
||||
ert.prototype("void site_config_set_rsh_command(long, char*)")]
|
||||
r.getter = lambda ert : ert.enkf.site_config_get_rsh_command(ert.site_config)
|
||||
r.setter = lambda ert, value : ert.enkf.site_config_set_rsh_command(ert.site_config, str(value))
|
||||
|
||||
r = internalPanel.addRow(IntegerSpinner(parent, "Max running", "config/queue_system/max_running_rsh", 1, 1000))
|
||||
r.initialize = lambda ert : [ert.prototype("int site_config_get_max_running_rsh(long)"),
|
||||
ert.prototype("void site_config_set_max_running_rsh(long, int)")]
|
||||
r.getter = lambda ert : ert.enkf.site_config_get_max_running_rsh(ert.site_config)
|
||||
r.setter = lambda ert, value : ert.enkf.site_config_set_max_running_rsh(ert.site_config, value)
|
||||
|
||||
|
||||
r = internalPanel.addRow(KeywordTable(parent, "Host List", "config/queue_system/rsh_host_list", "Host", "Number of jobs"))
|
||||
r.initialize = lambda ert : [ert.prototype("long site_config_get_rsh_host_list(long)"),
|
||||
ert.prototype("void site_config_clear_rsh_host_list(long)"),
|
||||
ert.prototype("void site_config_add_rsh_host(long, char*, int)")]
|
||||
r.getter = lambda ert : ert.getHash(ert.enkf.site_config_get_rsh_host_list(ert.site_config), True)
|
||||
|
||||
def add_rsh_host(ert, listOfKeywords):
|
||||
@@ -100,8 +84,6 @@ def createQueueSystemPage(configPanel, parent):
|
||||
internalPanel.startPage("LOCAL")
|
||||
|
||||
r = internalPanel.addRow(IntegerSpinner(parent, "Max running", "config/queue_system/max_running_local", 1, 1000))
|
||||
r.initialize = lambda ert : [ert.prototype("int site_config_get_max_running_local(long)"),
|
||||
ert.prototype("void site_config_set_max_running_local(long, int)")]
|
||||
r.getter = lambda ert : ert.enkf.site_config_get_max_running_local(ert.site_config)
|
||||
r.setter = lambda ert, value : ert.enkf.site_config_set_max_running_local(ert.site_config, value)
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
# ----------------------------------------------------------------------------------------------
|
||||
from PyQt4 import QtCore
|
||||
from ert_gui.widgets.spinnerwidgets import IntegerSpinner
|
||||
import ert.ertwrapper as ertwrapper
|
||||
from ert_gui.widgets.tablewidgets import KeywordTable
|
||||
from ert_gui.widgets.pathchooser import PathChooser
|
||||
from ert_gui.widgets.checkbox import CheckBox
|
||||
@@ -28,7 +27,7 @@ from ert_gui.widgets.configpanel import ConfigPanel
|
||||
from ert_gui.widgets.stringbox import StringBox
|
||||
from jobs.forwardmodelpanel import ForwardModelPanel
|
||||
from simulations.runpathpanel import RunpathMemberList, RunpathMemberPanel
|
||||
from ert.enums import keep_runpath_type
|
||||
from ert.ert.enums import keep_runpath_type
|
||||
from simulations.runtemplatepanel import RunTemplatePanel
|
||||
import ert_gui.widgets.helpedwidget
|
||||
import os
|
||||
@@ -38,29 +37,17 @@ def createSimulationsPage(configPanel, parent):
|
||||
|
||||
|
||||
r = configPanel.addRow(IntegerSpinner(parent, "Max submit", "config/simulation/max_submit", 1, 10000))
|
||||
r.initialize = lambda ert : [ert.prototype("int site_config_get_max_submit(long)"),
|
||||
ert.prototype("void site_config_set_max_submit(long, int)")]
|
||||
r.getter = lambda ert : ert.enkf.site_config_get_max_submit(ert.site_config)
|
||||
r.setter = lambda ert, value : ert.enkf.site_config_set_max_submit(ert.site_config, value)
|
||||
|
||||
r = configPanel.addRow(IntegerSpinner(parent, "Max resample", "config/simulation/max_resample", 1, 10000))
|
||||
r.initialize = lambda ert : [ert.prototype("int model_config_get_max_resample(long)"),
|
||||
ert.prototype("void model_config_set_max_resample(long, int)")]
|
||||
r.getter = lambda ert : ert.enkf.model_config_get_max_resample(ert.model_config)
|
||||
r.setter = lambda ert, value : ert.enkf.model_config_set_max_resample(ert.model_config, value)
|
||||
|
||||
|
||||
|
||||
r = configPanel.addRow(ForwardModelPanel(parent))
|
||||
r.initialize = lambda ert: [ert.prototype("long model_config_get_forward_model(long)"),
|
||||
ert.prototype("long site_config_get_installed_jobs(long)"),
|
||||
ert.prototype("long ext_joblist_alloc_list(long)", lib=ert.job_queue),
|
||||
ert.prototype("char* ext_job_get_private_args_as_string(long)", lib=ert.job_queue),
|
||||
ert.prototype("char* ext_job_get_help_text(long)", lib=ert.job_queue),
|
||||
ert.prototype("void forward_model_clear(long)", lib=ert.job_queue),
|
||||
ert.prototype("long forward_model_add_job(long, char*)", lib=ert.job_queue),
|
||||
ert.prototype("void ext_job_set_private_args_from_string(long, char*)", lib=ert.job_queue),
|
||||
ert.prototype("long forward_model_alloc_joblist(long)", lib=ert.job_queue),]
|
||||
|
||||
|
||||
def get_forward_model(ert):
|
||||
site_config = ert.site_config
|
||||
@@ -106,8 +93,7 @@ def createSimulationsPage(configPanel, parent):
|
||||
|
||||
|
||||
r = configPanel.addRow(PathChooser(parent, "Case table", "config/simulation/case_table"))
|
||||
r.initialize = lambda ert : [ert.prototype("char* model_config_get_case_table_file(long)"),
|
||||
ert.prototype("void enkf_main_set_case_table(long, char*)")]
|
||||
|
||||
|
||||
def get_case_table(ert):
|
||||
return ert.enkf.model_config_get_case_table_file(ert.model_config)
|
||||
@@ -120,8 +106,6 @@ def createSimulationsPage(configPanel, parent):
|
||||
|
||||
|
||||
r = configPanel.addRow(PathChooser(parent, "License path", "config/simulation/license_path"))
|
||||
r.initialize = lambda ert : [ert.prototype("char* site_config_get_license_root_path(long)"),
|
||||
ert.prototype("void site_config_set_license_root_path(long, char*)")]
|
||||
r.getter = lambda ert : ert.enkf.site_config_get_license_root_path(ert.site_config)
|
||||
|
||||
def ls(string):
|
||||
@@ -139,8 +123,6 @@ def createSimulationsPage(configPanel, parent):
|
||||
internalPanel.startPage("Runpath")
|
||||
|
||||
r = internalPanel.addRow(PathChooser(parent, "Runpath", "config/simulation/runpath", path_format=True))
|
||||
r.initialize = lambda ert : [ert.prototype("char* model_config_get_runpath_as_char(long)"),
|
||||
ert.prototype("void model_config_set_runpath_fmt(long, char*)")]
|
||||
|
||||
r.getter = lambda ert : ert.enkf.model_config_get_runpath_as_char(ert.model_config)
|
||||
r.setter = lambda ert, value : ert.enkf.model_config_set_runpath_fmt(ert.model_config, str(value))
|
||||
@@ -148,17 +130,12 @@ def createSimulationsPage(configPanel, parent):
|
||||
|
||||
|
||||
r = internalPanel.addRow(CheckBox(parent, "Pre clear", "config/simulation/pre_clear_runpath", "Perform pre clear"))
|
||||
r.initialize = lambda ert : [ert.prototype("bool enkf_main_get_pre_clear_runpath(long)"),
|
||||
ert.prototype("void enkf_main_set_pre_clear_runpath(long, bool)")]
|
||||
|
||||
r.getter = lambda ert : ert.enkf.enkf_main_get_pre_clear_runpath(ert.main)
|
||||
r.setter = lambda ert, value : ert.enkf.enkf_main_set_pre_clear_runpath(ert.main, value)
|
||||
|
||||
|
||||
r = internalPanel.addRow(RunpathMemberPanel(widgetLabel="Retain runpath", helpLabel="config/simulation/runpath_retain"))
|
||||
r.initialize = lambda ert : [ert.prototype("int enkf_main_get_ensemble_size(long)"),
|
||||
ert.prototype("int enkf_main_iget_keep_runpath(long, int)"),
|
||||
ert.prototype("void enkf_main_iset_keep_runpath(long, int, long)"),]
|
||||
def get_runpath_retain_state(ert):
|
||||
ensemble_size = ert.enkf.enkf_main_get_ensemble_size(ert.main)
|
||||
|
||||
@@ -183,23 +160,15 @@ def createSimulationsPage(configPanel, parent):
|
||||
internalPanel.startPage("Run Template")
|
||||
|
||||
r = internalPanel.addRow(RunTemplatePanel(parent))
|
||||
r.initialize = lambda ert : [ert.prototype("long enkf_main_get_templates(long)"),
|
||||
ert.prototype("long ert_templates_alloc_list(long)"),
|
||||
ert.prototype("long ert_templates_get_template(long, char*)"),
|
||||
ert.prototype("char* ert_template_get_template_file(long)"),
|
||||
ert.prototype("char* ert_template_get_target_file(long)"),
|
||||
ert.prototype("char* ert_template_get_args_as_string(long)"),
|
||||
ert.prototype("void ert_templates_clear(long)"),
|
||||
ert.prototype("void ert_templates_add_template(long, char*, char*, char*, char*)"),]
|
||||
|
||||
def get_run_templates(ert):
|
||||
templates = ert.enkf.enkf_main_get_templates(ert.main)
|
||||
template_list = ert.enkf.ert_templates_alloc_list(templates)
|
||||
template_list = ert.enkf.ert_template_alloc_list(templates)
|
||||
|
||||
template_names = ert.getStringList(template_list, free_after_use=True)
|
||||
result = []
|
||||
for name in template_names:
|
||||
template = ert.enkf.ert_templates_get_template(templates, name)
|
||||
template = ert.enkf.ert_template_get_template(templates, name)
|
||||
template_file = ert.enkf.ert_template_get_template_file(template)
|
||||
target_file = ert.enkf.ert_template_get_target_file(template)
|
||||
arguments = ert.enkf.ert_template_get_args_as_string(template)
|
||||
@@ -210,10 +179,10 @@ def createSimulationsPage(configPanel, parent):
|
||||
|
||||
def set_run_templates(ert, template_list):
|
||||
templates_pointer = ert.enkf.enkf_main_get_templates(ert.main)
|
||||
ert.enkf.ert_templates_clear(templates_pointer)
|
||||
ert.enkf.ert_template_clear(templates_pointer)
|
||||
|
||||
for template in template_list:
|
||||
ert.enkf.ert_templates_add_template(templates_pointer, template[0], template[1], template[2], template[3])
|
||||
ert.enkf.ert_template_add_template(templates_pointer, template[0], template[1], template[2], template[3])
|
||||
|
||||
r.setter = set_run_templates
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from ert.enums import keep_runpath_type
|
||||
from ert.ert.enums import keep_runpath_type
|
||||
from ert_gui.widgets.helpedwidget import HelpedWidget
|
||||
from ert_gui.pages.run.legend import Legend
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
from ert_gui.widgets.pathchooser import PathChooser
|
||||
from ert_gui.widgets.configpanel import ConfigPanel
|
||||
from ert_gui.widgets.tablewidgets import KeywordTable, KeywordList
|
||||
import ert.ertwrapper as ertwrapper
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from jobs.jobspanel import JobsPanel, Job
|
||||
import os
|
||||
@@ -35,15 +34,12 @@ def createSystemPage(configPanel, parent):
|
||||
# the site configuration file; this should only be a label - not
|
||||
# user editable.
|
||||
r = configPanel.addRow(ActiveLabel(None, "Site Config", "", "Not specified."))
|
||||
r.initialize = lambda ert: [ert.prototype("char* enkf_main_get_site_config_file(long)")]
|
||||
r.getter = lambda ert : ert.enkf.enkf_main_get_site_config_file(ert.main)
|
||||
r.modelConnect("casesUpdated()", r.fetchContent)
|
||||
|
||||
|
||||
|
||||
r = configPanel.addRow(PathChooser(parent, "Job script", "config/systemenv/job_script", True))
|
||||
r.initialize = lambda ert : [ert.prototype("char* site_config_get_job_script(long)"),
|
||||
ert.prototype("void site_config_set_job_script(long, char*)")]
|
||||
r.getter = lambda ert : ert.enkf.site_config_get_job_script(ert.site_config)
|
||||
r.setter = lambda ert, value : ert.enkf.site_config_set_job_script(ert.site_config, str(value))
|
||||
|
||||
@@ -51,9 +47,6 @@ def createSystemPage(configPanel, parent):
|
||||
internalPanel.startPage("setenv")
|
||||
|
||||
r = internalPanel.addRow(KeywordTable(parent, "", "config/systemenv/setenv"))
|
||||
r.initialize = lambda ert : [ert.prototype("long site_config_get_env_hash(long)"),
|
||||
ert.prototype("void site_config_clear_env(long)"),
|
||||
ert.prototype("void site_config_setenv(long, char*, char*)")]
|
||||
r.getter = lambda ert : ert.getHash(ert.enkf.site_config_get_env_hash(ert.site_config))
|
||||
|
||||
def setenv(ert, value):
|
||||
@@ -68,10 +61,6 @@ def createSystemPage(configPanel, parent):
|
||||
internalPanel.startPage("Update path")
|
||||
|
||||
r = internalPanel.addRow(KeywordTable(parent, "", "config/systemenv/update_path"))
|
||||
r.initialize = lambda ert : [ert.prototype("long site_config_get_path_variables(long)"),
|
||||
ert.prototype("long site_config_get_path_values(long)"),
|
||||
ert.prototype("void site_config_clear_pathvar(long)"),
|
||||
ert.prototype("void site_config_update_pathvar(long, char*, char*)")]
|
||||
def get_update_path(ert):
|
||||
paths = ert.getStringList(ert.enkf.site_config_get_path_variables(ert.site_config))
|
||||
values = ert.getStringList(ert.enkf.site_config_get_path_values(ert.site_config))
|
||||
@@ -94,18 +83,6 @@ def createSystemPage(configPanel, parent):
|
||||
internalPanel.startPage("Jobs")
|
||||
|
||||
r = internalPanel.addRow(JobsPanel(parent))
|
||||
r.initialize = lambda ert : [ert.prototype("long site_config_get_installed_jobs(long)"),
|
||||
ert.prototype("char* site_config_get_license_root_path(long)"),
|
||||
ert.prototype("int ext_job_is_private(long)", lib=ert.job_queue),
|
||||
ert.prototype("char* ext_job_get_config_file(long)", lib=ert.job_queue),
|
||||
ert.prototype("void ext_job_set_config_file(long, char*)", lib=ert.job_queue),
|
||||
ert.prototype("long ext_job_alloc(char*, char*, int)", lib=ert.job_queue),
|
||||
ert.prototype("long ext_job_fscanf_alloc(char*, char*, int, char*)", lib=ert.job_queue),
|
||||
ert.prototype("long ext_joblist_get_job(long, char*)", lib=ert.job_queue),
|
||||
ert.prototype("int ext_joblist_del_job(long, char*)", lib=ert.job_queue),
|
||||
ert.prototype("int ext_joblist_has_job(long, char*)", lib=ert.job_queue),
|
||||
ert.prototype("void ext_joblist_add_job(long, char*, long)", lib=ert.job_queue),
|
||||
ert.prototype("long ext_joblist_get_jobs(long)", lib=ert.job_queue)]
|
||||
def get_jobs(ert):
|
||||
jl = ert.enkf.site_config_get_installed_jobs(ert.site_config)
|
||||
h = ert.job_queue.ext_joblist_get_jobs(jl)
|
||||
@@ -169,14 +146,10 @@ def createSystemPage(configPanel, parent):
|
||||
configPanel.addRow(internalPanel)
|
||||
|
||||
r = configPanel.addRow(PathChooser(parent, "Log file", "config/systemenv/log_file", True))
|
||||
r.initialize = lambda ert : [ert.prototype("char* log_get_filename(long)", lib=ert.util),
|
||||
ert.prototype("void log_reset_filename(long, char*)", lib=ert.util)]
|
||||
r.getter = lambda ert : ert.util.log_get_filename(ert.logh)
|
||||
r.setter = lambda ert, value : ert.util.log_reset_filename(ert.logh, value)
|
||||
|
||||
r = configPanel.addRow(ert_gui.widgets.spinnerwidgets.IntegerSpinner(parent, "Log level", "config/systemenv/log_level", 0, 1000))
|
||||
r.initialize = lambda ert : [ert.prototype("int log_get_level(long)", lib=ert.util),
|
||||
ert.prototype("void log_set_level(long, int)", lib=ert.util)]
|
||||
r.getter = lambda ert : ert.util.log_get_level(ert.logh)
|
||||
r.setter = lambda ert, value : ert.util.log_set_level(ert.logh, value)
|
||||
|
||||
|
||||
@@ -16,10 +16,9 @@
|
||||
|
||||
|
||||
from ert_gui.widgets.helpedwidget import HelpedWidget
|
||||
from ert import ertwrapper
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from ert_gui.widgets.util import resourceIcon, ListCheckPanel, ValidatedTimestepCombo, getItemsFromList
|
||||
from ert.enums import ert_state_enum
|
||||
from ert.ert.enums import ert_state_enum
|
||||
|
||||
class ParametersAndMembers(HelpedWidget):
|
||||
|
||||
@@ -218,15 +217,6 @@ class ParametersAndMembers(HelpedWidget):
|
||||
|
||||
|
||||
def initialize(self, ert):
|
||||
ert.prototype("long ensemble_config_alloc_keylist_from_var_type(long, int)")
|
||||
ert.prototype("int enkf_main_initialize_from_scratch(long, long, int, int)")
|
||||
ert.prototype("int enkf_main_get_ensemble_size(long)")
|
||||
ert.prototype("long enkf_main_get_fs(long)")
|
||||
ert.prototype("char* enkf_fs_get_read_dir(long)")
|
||||
ert.prototype("long enkf_fs_alloc_dirlist(long)")
|
||||
ert.prototype("int enkf_main_get_history_length(long)")
|
||||
ert.prototype("void enkf_main_initialize_from_existing__(long, char*, int, int, long, char*, long)")
|
||||
ert.prototype("void enkf_main_copy_ensemble(long, char*, int, int, char*, int, int, long, char*, long)")
|
||||
self.initialized = True
|
||||
|
||||
|
||||
@@ -249,12 +239,12 @@ class ParametersAndMembers(HelpedWidget):
|
||||
members = ert.enkf.enkf_main_get_ensemble_size(ert.main)
|
||||
|
||||
fs = ert.enkf.enkf_main_get_fs(ert.main)
|
||||
currentCase = ert.enkf.enkf_fs_get_read_dir(fs)
|
||||
|
||||
caseList = ert.enkf.enkf_fs_alloc_dirlist(fs)
|
||||
list = ert.getStringList(caseList)
|
||||
ert.freeStringList(caseList)
|
||||
currentCase = "default" #ert.enkf.enkf_fs_get_read_dir(fs)
|
||||
|
||||
#caseList = ert.enkf.enkf_fs_alloc_dirlist(fs)
|
||||
#list = ert.getStringList(caseList)
|
||||
#ert.freeStringList(caseList)
|
||||
list = ["default"]
|
||||
historyLength = ert.enkf.enkf_main_get_history_length(ert.main)
|
||||
|
||||
return {"parameters" : parameters,
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from ert_gui.widgets.tablewidgets import KeywordList
|
||||
from ert_gui.widgets.validateddialog import ValidatedDialog
|
||||
import ert.ertwrapper as ertwrapper
|
||||
import ert.ert.ertwrapper as ertwrapper
|
||||
from ert_gui.widgets.combochoice import ComboChoice
|
||||
|
||||
|
||||
@@ -43,10 +43,10 @@ class InitPanel(QtGui.QFrame):
|
||||
|
||||
def get_case_list(ert):
|
||||
fs = ert.enkf.enkf_main_get_fs(ert.main)
|
||||
caseList = ert.enkf.enkf_fs_alloc_dirlist(fs)
|
||||
caseList = ["default"] #ert.enkf.enkf_fs_alloc_dirlist(fs)
|
||||
|
||||
list = ert.getStringList(caseList)
|
||||
ert.freeStringList(caseList)
|
||||
list = caseList #ert.getStringList(caseList)
|
||||
#ert.freeStringList(caseList)
|
||||
return list
|
||||
|
||||
self.get_case_list = get_case_list # convenience: used by several functions
|
||||
@@ -104,9 +104,6 @@ class InitPanel(QtGui.QFrame):
|
||||
|
||||
def initialize_cases(ert):
|
||||
ert.prototype("long enkf_main_get_fs(long)")
|
||||
ert.prototype("char* enkf_fs_get_read_dir(long)")
|
||||
ert.prototype("void enkf_fs_select_read_dir(long, char*)")
|
||||
ert.prototype("void enkf_fs_select_write_dir(long, char*, bool)")
|
||||
|
||||
self.currentCase.updateList(self.get_case_list(ert))
|
||||
|
||||
@@ -114,7 +111,8 @@ class InitPanel(QtGui.QFrame):
|
||||
|
||||
def get_current_case(ert):
|
||||
fs = ert.enkf.enkf_main_get_fs(ert.main)
|
||||
currentCase = ert.enkf.enkf_fs_get_read_dir(fs)
|
||||
tmp = self.get_case_list(ert)
|
||||
currentCase = tmp[0] #ert.enkf.enkf_fs_get_read_dir(fs)
|
||||
#print "The selected case is: " + currentCase
|
||||
return currentCase
|
||||
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
|
||||
from fetcher import PlotDataFetcherHandler
|
||||
from ert_gui.pages.config.parameters.parametermodels import FieldModel, SummaryModel, KeywordModel, DataModel
|
||||
import ert.ertwrapper as ertwrapper
|
||||
import ert.enums as enums
|
||||
import ert.ert.ertwrapper as ertwrapper
|
||||
import ert.ert.enums as enums
|
||||
from PyQt4.QtGui import QWidget, QFormLayout, QSpinBox, QComboBox
|
||||
from PyQt4.QtCore import SIGNAL
|
||||
from ert.erttypes import time_t
|
||||
from ert.ert.erttypes import time_t
|
||||
import numpy
|
||||
|
||||
class EnsembleFetcher(PlotDataFetcherHandler):
|
||||
@@ -45,8 +45,7 @@ class EnsembleFetcher(PlotDataFetcherHandler):
|
||||
self.connect(self.data_configuration, SIGNAL('configurationChanged()'), emitter)
|
||||
|
||||
def initialize(self, ert):
|
||||
ert.prototype("long ensemble_config_get_node(long, char*)")
|
||||
ert.prototype("bool ensemble_config_has_key(long, char*)")
|
||||
|
||||
|
||||
ert.prototype("long enkf_main_get_fs(long)")
|
||||
ert.prototype("int enkf_main_get_ensemble_size(long)")
|
||||
|
||||
@@ -15,15 +15,14 @@
|
||||
# for more details.
|
||||
|
||||
|
||||
from ert.erttypes import time_t
|
||||
from ert.ert.erttypes import time_t
|
||||
from ert_gui.widgets.helpedwidget import ContentModel
|
||||
from ert_gui.widgets.util import print_timing, resourceIcon
|
||||
from ert_gui.pages.config.parameters.parametermodels import DataModel, KeywordModel, FieldModel, SummaryModel
|
||||
from ert_gui.pages.config.parameters.parameterpanel import Parameter
|
||||
import ert.ertwrapper as ertwrapper
|
||||
import ert.enums as enums
|
||||
import ert.ert.enums as enums
|
||||
import sys
|
||||
from ert.enums import obs_impl_type
|
||||
from ert.ert.enums import obs_impl_type
|
||||
|
||||
from ensemblefetcher import EnsembleFetcher
|
||||
from rftfetcher import RFTFetcher
|
||||
@@ -232,8 +231,6 @@ class PlotContextDataFetcher(ContentModel):
|
||||
ContentModel.__init__(self)
|
||||
|
||||
def initialize(self, ert):
|
||||
ert.prototype("long ensemble_config_alloc_keylist(long)")
|
||||
ert.prototype("long ensemble_config_get_node(long, char*)")
|
||||
|
||||
ert.prototype("long enkf_config_node_get_impl_type(long)")
|
||||
ert.prototype("long enkf_config_node_get_ref(long)")
|
||||
@@ -299,11 +296,12 @@ class PlotContextDataFetcher(ContentModel):
|
||||
data.errorbar_max = ert.enkf.plot_config_get_errorbar_max(ert.plot_config)
|
||||
|
||||
fs = ert.enkf.enkf_main_get_fs(ert.main)
|
||||
current_case = ert.enkf.enkf_fs_get_read_dir(fs)
|
||||
current_case = "default" #ert.enkf.enkf_fs_get_read_dir(fs)
|
||||
|
||||
data.plot_config_path = ert.enkf.plot_config_get_path(ert.plot_config)
|
||||
data.plot_path = ert.enkf.plot_config_get_path(ert.plot_config) + "/" + current_case
|
||||
|
||||
#data.plot_path = ert.enkf.plot_config_get_path(ert.plot_config) + "/" + current_case
|
||||
data.plot_path = "PLOTXXX"
|
||||
|
||||
enkf_obs = ert.enkf.enkf_main_get_obs(ert.main)
|
||||
key_list = ert.enkf.enkf_obs_alloc_typed_keylist(enkf_obs, obs_impl_type.FIELD_OBS.value())
|
||||
field_obs = ert.getStringList(key_list, free_after_use=True)
|
||||
@@ -313,10 +311,11 @@ class PlotContextDataFetcher(ContentModel):
|
||||
data.parameters.append(p)
|
||||
|
||||
|
||||
case_list_pointer = ert.enkf.enkf_fs_alloc_dirlist(fs)
|
||||
case_list = ert.getStringList(case_list_pointer)
|
||||
#case_list_pointer = ert.enkf.enkf_fs_alloc_dirlist(fs)
|
||||
#case_list = ert.getStringList(case_list_pointer)
|
||||
case_list = ["default"]
|
||||
data.current_case = current_case
|
||||
ert.freeStringList(case_list_pointer)
|
||||
#ert.freeStringList(case_list_pointer)
|
||||
|
||||
for case in case_list:
|
||||
data.case_list.append(case)
|
||||
|
||||
@@ -20,7 +20,7 @@ import matplotlib.lines
|
||||
import matplotlib.text
|
||||
|
||||
import numpy
|
||||
import ert.erttypes as erttypes
|
||||
import ert.ert.erttypes as erttypes
|
||||
import plotsettings
|
||||
from plotrenderer import DefaultPlotRenderer
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ from plotsettingsxml import PlotSettingsLoader
|
||||
from plotsettings import PlotSettings
|
||||
from plotdata import PlotContextDataFetcher, PlotDataFetcher
|
||||
from ert_gui.pages.config.parameters.parametermodels import SummaryModel, KeywordModel
|
||||
import ert.enums as enums
|
||||
import ert.ert.enums as enums
|
||||
|
||||
class PlotGenerator(QFrame):
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from ert_gui.pages.config.parameters.parameterpanel import Parameter
|
||||
from ert_gui.pages.plot.plotview import PlotView
|
||||
import ert.ertwrapper as ertwrapper
|
||||
import ert_gui.pages.config.parameters.parameterpanel
|
||||
import ert_gui.widgets.helpedwidget
|
||||
from ert_gui.widgets.helpedwidget import ContentModel
|
||||
@@ -36,7 +35,7 @@ from plotconfig import PlotConfigPanel
|
||||
from PyQt4.QtGui import QTabWidget, QFormLayout, QFrame, QVBoxLayout, QHBoxLayout, QCheckBox, QPushButton, QToolButton, QMainWindow
|
||||
from PyQt4.QtGui import QCalendarWidget
|
||||
import plotsettings
|
||||
import ert.erttypes as erttypes
|
||||
import ert.ert.erttypes as erttypes
|
||||
|
||||
class PlotPanel(QtGui.QWidget):
|
||||
def __init__(self):
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
|
||||
from matplotlib.dates import AutoDateLocator, datetime, matplotlib
|
||||
import ert.erttypes as erttypes
|
||||
import ert.ert.erttypes as erttypes
|
||||
|
||||
class PlotRenderer:
|
||||
"""An abstract plotter that plots data"""
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
from plotconfig import PlotConfig
|
||||
import matplotlib
|
||||
from ert.erttypes import time_t
|
||||
from ert.ert.erttypes import time_t
|
||||
import datetime
|
||||
from PyQt4.QtCore import QObject, SIGNAL
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
|
||||
|
||||
import datetime
|
||||
import time
|
||||
from ert.erttypes import time_t
|
||||
from ert.ert.erttypes import time_t
|
||||
|
||||
from ert_gui.widgets.util import print_timing
|
||||
from plotdata import PlotData
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
|
||||
|
||||
from fetcher import PlotDataFetcherHandler
|
||||
import ert.ertwrapper as ertwrapper
|
||||
import ert.enums as enums
|
||||
import ert.ert.ertwrapper as ertwrapper
|
||||
import ert.ert.enums as enums
|
||||
import plotdata
|
||||
from ert.enums import ert_state_enum, obs_impl_type
|
||||
from ert.ert.enums import ert_state_enum, obs_impl_type
|
||||
import numpy
|
||||
|
||||
class RFTFetcher(PlotDataFetcherHandler):
|
||||
@@ -45,7 +45,6 @@ class RFTFetcher(PlotDataFetcherHandler):
|
||||
ert.prototype("int obs_vector_get_num_active(long)")
|
||||
ert.prototype("bool obs_vector_iget_active(long, int)")
|
||||
|
||||
ert.prototype("long ensemble_config_get_node(long, char*)")
|
||||
ert.prototype("long enkf_config_node_get_ref(long)")
|
||||
|
||||
ert.prototype("int* field_obs_get_i(long)")
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from ert import ertwrapper
|
||||
|
||||
from ert_gui.widgets.helpedwidget import HelpedWidget, ContentModel
|
||||
from ert_gui.widgets.util import resourceIcon, ListCheckPanel, ValidatedTimestepCombo, createSpace, getItemsFromList, frange
|
||||
|
||||
@@ -19,8 +19,7 @@ from __future__ import division
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from ert_gui.widgets.util import resourceIcon, resourceStateIcon, shortTime
|
||||
import time
|
||||
import ert.ertwrapper as ertwrapper
|
||||
from ert.enums import ert_job_status_type
|
||||
from ert.ert.enums import ert_job_status_type
|
||||
|
||||
|
||||
class SimulationList(QtGui.QListWidget):
|
||||
|
||||
@@ -22,9 +22,8 @@ from simulation import SimulationItemDelegate, SimulationList, SimulationItem, S
|
||||
|
||||
import threading
|
||||
import time
|
||||
import ert.ertwrapper as ertwrapper
|
||||
from ert_gui.widgets.util import getItemsFromList
|
||||
from ert.enums import ert_job_status_type
|
||||
from ert.ert.enums import ert_job_status_type
|
||||
from PyQt4.QtGui import QApplication
|
||||
|
||||
class SimulationsDialog(QtGui.QDialog):
|
||||
|
||||
@@ -20,7 +20,7 @@ import help
|
||||
import sys
|
||||
from util import resourceIcon, resourceImage
|
||||
import inspect
|
||||
import ert.enums as enums
|
||||
import ert.ert.enums as enums
|
||||
|
||||
def abstract():
|
||||
"""Abstract keyword that indicate an abstract function"""
|
||||
|
||||
@@ -4,7 +4,7 @@ include_directories( ${PLPLOT_HEADER} )
|
||||
set( SITE_CONFIG_FILE /project/res/etc/ERT/site-config CACHE FILEPATH "Path to global ERT Configuration file")
|
||||
|
||||
set( src_list main.c enkf_tui_main.c enkf_tui_fs.c enkf_tui_ranking.c enkf_tui_misc.c enkf_tui_table.c enkf_tui_plot.c enkf_tui_plot_rft.c enkf_tui_plot_util.c
|
||||
enkf_tui_run.c enkf_tui_util.c enkf_tui_init.c enkf_tui_export.c enkf_tui_analysis.c enkf_tui_QC.c enkf_tui_help.c enkf_tui_simple.c ert_tui_jobs.c)
|
||||
enkf_tui_run.c enkf_tui_util.c enkf_tui_init.c enkf_tui_export.c enkf_tui_analysis.c enkf_tui_QC.c enkf_tui_help.c enkf_tui_simple.c ert_tui_jobs.c enkf_tui_workflow.c)
|
||||
|
||||
#exec_program( svnversion ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE SVN_VERSION)
|
||||
#exec_program( date OUTPUT_VARIABLE COMPILE_TIME_STAMP)
|
||||
@@ -38,8 +38,11 @@ else()
|
||||
set (destination ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
endif()
|
||||
|
||||
install(TARGETS ert DESTINATION ${destination})
|
||||
if (INSTALL_GROUP)
|
||||
install(CODE "EXECUTE_PROCESS(COMMAND chgrp ${INSTALL_GROUP} ${destination}/ert)")
|
||||
install(CODE "EXECUTE_PROCESS(COMMAND chmod g+w ${destination}/ert)")
|
||||
|
||||
if (INSTALL_ERT)
|
||||
install(TARGETS ert DESTINATION ${destination})
|
||||
if (INSTALL_GROUP)
|
||||
install(CODE "EXECUTE_PROCESS(COMMAND chgrp ${INSTALL_GROUP} ${destination}/ert)")
|
||||
install(CODE "EXECUTE_PROCESS(COMMAND chmod g+w ${destination}/ert)")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
#include <ert_tui_const.h>
|
||||
#include <enkf_tui_plot_util.h>
|
||||
|
||||
|
||||
void enkf_tui_QC_plot_get_PC( enkf_main_type * enkf_main , int step1 , int step2 , state_enum state , const local_obsset_type * obsset ,
|
||||
double truncation , int ncomp ,
|
||||
matrix_type * PC , matrix_type * PC_obs) {
|
||||
@@ -109,6 +110,7 @@ void enkf_tui_QC_plot_get_PC( enkf_main_type * enkf_main , int step1 , int step2
|
||||
}
|
||||
|
||||
|
||||
|
||||
void enkf_tui_QC_plot_PC( void * arg ) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
|
||||
local_config_type * local_config = enkf_main_get_local_config( enkf_main );
|
||||
@@ -189,6 +191,14 @@ void enkf_tui_QC_plot_PC( void * arg ) {
|
||||
}
|
||||
|
||||
|
||||
void enkf_tui_QC_run_workflow( void * arg ) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
|
||||
qc_module_type * qc_module = enkf_main_get_qc_module( enkf_main );
|
||||
|
||||
qc_module_run_workflow( qc_module , enkf_main );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void enkf_tui_QC_menu(void * arg) {
|
||||
|
||||
@@ -201,7 +211,15 @@ void enkf_tui_QC_menu(void * arg) {
|
||||
|
||||
{
|
||||
menu_type * menu = menu_alloc("Quality check of prior" , "Back" , "bB");
|
||||
menu_add_item(menu , "Plot of prior principal components" , "pP" , enkf_tui_QC_plot_PC , enkf_main , NULL);
|
||||
menu_item_type * plot_PC_item = menu_add_item( menu , "Plot of prior principal components" , "pP" , enkf_tui_QC_plot_PC , enkf_main , NULL);
|
||||
menu_item_type * run_QC_workflow_item = menu_add_item( menu , "Run QC workflow" , "rR" , enkf_tui_QC_run_workflow , enkf_main , NULL);
|
||||
|
||||
if (!enkf_main_have_obs( enkf_main ))
|
||||
menu_item_disable( plot_PC_item );
|
||||
|
||||
if (!enkf_main_has_QC_workflow( enkf_main ))
|
||||
menu_item_disable( run_QC_workflow_item );
|
||||
|
||||
menu_run(menu);
|
||||
menu_free(menu);
|
||||
}
|
||||
|
||||
@@ -417,79 +417,6 @@ void enkf_tui_export_time(void * enkf_main) {
|
||||
}
|
||||
|
||||
|
||||
void enkf_tui_export_python_module(void * arg ) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
|
||||
const ensemble_config_type * ensemble_config = enkf_main_get_ensemble_config(enkf_main);
|
||||
const int ens_size = enkf_main_get_ensemble_size( enkf_main );
|
||||
enkf_fs_type * fs = enkf_main_get_fs(enkf_main);
|
||||
char ** kw_list;
|
||||
char * keyword_string;
|
||||
char * step_string;
|
||||
char * module_name;
|
||||
char * module_file;
|
||||
int * step_list;
|
||||
int num_step , num_kw;
|
||||
|
||||
util_printf_prompt("Keywords to export" , PROMPT_LEN , '=' , "=> ");
|
||||
keyword_string = util_alloc_stdin_line();
|
||||
util_printf_prompt("Timesteps to export" , PROMPT_LEN , '=' , "=> ");
|
||||
step_string = util_alloc_stdin_line();
|
||||
util_printf_prompt("Name of python module" , PROMPT_LEN , '=' , "=> ");
|
||||
module_name = util_alloc_stdin_line();
|
||||
module_file = util_alloc_sprintf("%s.py" , module_name );
|
||||
step_list = util_sscanf_alloc_active_list( step_string , &num_step );
|
||||
util_split_string( keyword_string , " " , &num_kw , &kw_list);
|
||||
{
|
||||
FILE * stream = util_fopen(module_file , "w");
|
||||
int ikw;
|
||||
fprintf(stream , "data = [");
|
||||
for (ikw = 0; ikw < num_kw; ikw++) {
|
||||
char * index_key;
|
||||
const enkf_config_node_type * config_node = ensemble_config_user_get_node( ensemble_config , kw_list[ikw] , &index_key);
|
||||
if (config_node == NULL)
|
||||
fprintf(stderr,"Warning: could not locate node: %s \n", kw_list[ikw]);
|
||||
else {
|
||||
enkf_node_type * node = enkf_node_alloc( config_node );
|
||||
node_id_type node_id;
|
||||
|
||||
node_id.state = FORECAST;
|
||||
for (int istep = 0; istep < num_step; istep++) {
|
||||
node_id.report_step = istep;
|
||||
int step = step_list[istep];
|
||||
fprintf(stream , "(\"%s\" , %d , [" , kw_list[ikw] , step);
|
||||
for (int iens = 0; iens < ens_size; iens++) {
|
||||
double value;
|
||||
node_id.iens = iens;
|
||||
enkf_node_user_get( node , fs , index_key , node_id , &value);
|
||||
|
||||
fprintf(stream , "%g " , value);
|
||||
if (iens < (ens_size -1 ))
|
||||
fprintf(stream , ",");
|
||||
else
|
||||
fprintf(stream , "]");
|
||||
|
||||
}
|
||||
if ((istep == (num_step - 1)) && (ikw == (num_kw - 1)))
|
||||
fprintf(stream , ")]");
|
||||
else
|
||||
fprintf(stream , "),\n");
|
||||
}
|
||||
free(index_key);
|
||||
enkf_node_free( node );
|
||||
}
|
||||
}
|
||||
fclose(stream);
|
||||
}
|
||||
|
||||
|
||||
util_free_stringlist( kw_list , num_kw );
|
||||
free(module_name);
|
||||
free(module_file);
|
||||
free( step_list );
|
||||
free( step_string );
|
||||
free( keyword_string );
|
||||
}
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
void enkf_tui_export_fieldP(void * arg) {
|
||||
@@ -773,8 +700,6 @@ void enkf_tui_export_menu(void * arg) {
|
||||
menu_add_separator(menu);
|
||||
menu_add_item(menu , "Export P( a =< x < b )" , "sS" , enkf_tui_export_fieldP , enkf_main , NULL);
|
||||
menu_add_separator(menu);
|
||||
menu_add_item(menu , "Export Python module of" , "yY" , enkf_tui_export_python_module , enkf_main , NULL);
|
||||
menu_add_separator(menu);
|
||||
menu_add_item(menu , "Export cell values to text file(s)" , "cC" , enkf_tui_export_cell , enkf_main , NULL);
|
||||
menu_add_item(menu , "Export line profile of a field to text file(s)" , "pP" , enkf_tui_export_profile , enkf_main , NULL);
|
||||
menu_add_item(menu , "Export time development in one cell to text file(s)" , "tT" , enkf_tui_export_time , enkf_main , NULL);
|
||||
|
||||
@@ -45,6 +45,7 @@ void enkf_tui_init(enkf_main_type * enkf_main, bool all_members , bool all_param
|
||||
const ensemble_config_type * ensemble_config = enkf_main_get_ensemble_config(enkf_main);
|
||||
int ens_size = enkf_main_get_ensemble_size( enkf_main );
|
||||
int iens1, iens2;
|
||||
bool force_init = true;
|
||||
bool iens_valid = false;
|
||||
|
||||
/* iens2 should be interpreted as __inclusive__ */
|
||||
@@ -89,7 +90,7 @@ void enkf_tui_init(enkf_main_type * enkf_main, bool all_members , bool all_param
|
||||
}
|
||||
|
||||
if (param_list != NULL) {
|
||||
enkf_main_initialize_from_scratch(enkf_main , param_list , iens1 , iens2);
|
||||
enkf_main_initialize_from_scratch(enkf_main , param_list , iens1 , iens2 , force_init);
|
||||
stringlist_free( param_list );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <enkf_tui_help.h>
|
||||
#include <enkf_tui_misc.h>
|
||||
#include <enkf_tui_simple.h>
|
||||
#include <enkf_tui_workflow.h>
|
||||
#include <enkf_main.h>
|
||||
#include <enkf_sched.h>
|
||||
|
||||
@@ -57,12 +58,13 @@ void enkf_tui_main_menu(enkf_main_type * enkf_main) {
|
||||
|
||||
menu_add_item(menu , "Manage cases" , "cC" , enkf_tui_fs_menu , enkf_main , NULL);
|
||||
menu_add_item(menu , "Run, restart or analyse experiment" , "rR" , enkf_tui_run_menu , enkf_main , NULL);
|
||||
menu_add_item(menu , "Prior quality check" , "uU" , enkf_tui_QC_menu , enkf_main , NULL);
|
||||
menu_add_item(menu , "Quality check" , "uU" , enkf_tui_QC_menu , enkf_main , NULL);
|
||||
menu_add_item(menu , "Plot results" , "pP" , enkf_tui_plot_menu , enkf_main , NULL);
|
||||
menu_add_item(menu , "Rank results" , "aA" , enkf_tui_ranking_menu , enkf_main , NULL);
|
||||
menu_add_item(menu , "Export data to other formats" , "eE" , enkf_tui_export_menu , enkf_main , NULL);
|
||||
menu_add_item(menu , "Table of results" , "tT" , enkf_tui_table_menu , enkf_main , NULL);
|
||||
menu_add_item(menu , "Miscellanous" , "mM" , enkf_tui_misc_menu , enkf_main , NULL);
|
||||
menu_add_item(menu , "Workflows" , "wW" , enkf_tui_workflow_menu , enkf_main , NULL);
|
||||
menu_add_item(menu , "Help" , "hH" , enkf_tui_help_menu_main , enkf_main , NULL);
|
||||
menu_add_item(menu , "Simple menu" , "sS" , enkf_tui_simple_menu , enkf_main , NULL);
|
||||
menu_run(menu);
|
||||
|
||||
@@ -15,13 +15,12 @@
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
#include <ert/util/menu.h>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/job_queue/ext_joblist.h>
|
||||
#include <ert/job_queue/ext_job.h>
|
||||
|
||||
#include <ert/util/menu.h>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/enkf/enkf_types.h>
|
||||
#include <ert/enkf/enkf_main.h>
|
||||
#include <ert/enkf/enkf_state.h>
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
#include <ert/enkf/enkf_plot_data.h>
|
||||
#include <ert/enkf/time_map.h>
|
||||
#include <ert/enkf/ert_report_list.h>
|
||||
#include <ert/enkf/ecl_refcase_list.h>
|
||||
|
||||
#include <ert_tui_const.h>
|
||||
#include <enkf_tui_util.h>
|
||||
@@ -74,6 +75,7 @@
|
||||
base_name: The filename of the current plot.
|
||||
*/
|
||||
|
||||
#define NUM_REFCASE_POINTS 75
|
||||
|
||||
|
||||
static void __plot_add_data(plot_type * plot , const char * label , int N , const double * x , const double *y) {
|
||||
@@ -122,14 +124,14 @@ void enkf_tui_plot_PC( enkf_main_type * enkf_main , const char * plot_name , con
|
||||
|
||||
|
||||
|
||||
static void enkf_tui_plot_ensemble__(enkf_main_type * enkf_main ,
|
||||
const enkf_config_node_type * config_node ,
|
||||
const char * user_key ,
|
||||
const char * key_index ,
|
||||
int step1 , int step2 ,
|
||||
bool prediction_mode ,
|
||||
int iens1 , int iens2 ,
|
||||
state_enum plot_state) {
|
||||
void enkf_tui_plot_ensemble__(enkf_main_type * enkf_main ,
|
||||
const enkf_config_node_type * config_node ,
|
||||
const char * user_key ,
|
||||
const char * key_index ,
|
||||
int step1 , int step2 ,
|
||||
bool prediction_mode ,
|
||||
int iens1 , int iens2 ,
|
||||
state_enum plot_state) {
|
||||
|
||||
enkf_fs_type * fs = enkf_main_get_fs(enkf_main);
|
||||
enkf_obs_type * enkf_obs = enkf_main_get_obs( enkf_main );
|
||||
@@ -137,10 +139,10 @@ static void enkf_tui_plot_ensemble__(enkf_main_type * enkf_main ,
|
||||
|
||||
bool plot_dates = true;
|
||||
const int errorbar_max_obsnr = plot_config_get_errorbar_max( plot_config );
|
||||
const char * data_file = plot_config_get_plot_refcase( plot_config );
|
||||
const bool plot_errorbars = plot_config_get_plot_errorbar( plot_config );
|
||||
const bool add_observations = true;
|
||||
const bool logy = plot_config_get_logy( plot_config );
|
||||
const bool plot_refcase = plot_config_get_plot_refcase( plot_config );
|
||||
bool show_plot = false;
|
||||
char * plot_file = enkf_tui_plot_alloc_plot_file( plot_config , enkf_main_get_current_fs( enkf_main ), user_key );
|
||||
time_map_type * time_map = enkf_fs_get_time_map( fs );
|
||||
@@ -149,8 +151,7 @@ static void enkf_tui_plot_ensemble__(enkf_main_type * enkf_main ,
|
||||
msg_type * msg;
|
||||
bool_vector_type * has_data = bool_vector_alloc( 0 , false );
|
||||
int iens , step;
|
||||
bool plot_refcase = true;
|
||||
|
||||
|
||||
/*
|
||||
{
|
||||
enkf_plot_data_type * plot_data = enkf_main_alloc_plot_data( enkf_main );
|
||||
@@ -164,10 +165,8 @@ static void enkf_tui_plot_ensemble__(enkf_main_type * enkf_main ,
|
||||
enkf_plot_data_free( plot_data );
|
||||
}
|
||||
*/
|
||||
|
||||
if ( strcmp( data_file , "" ) == 0)
|
||||
plot_refcase = false;
|
||||
|
||||
|
||||
if (plot_dates)
|
||||
plot = enkf_tui_plot_alloc(plot_config , "" , /* y akse */ "" ,user_key,plot_file);
|
||||
else
|
||||
@@ -423,46 +422,41 @@ static void enkf_tui_plot_ensemble__(enkf_main_type * enkf_main ,
|
||||
double_vector_free( obs_value );
|
||||
}
|
||||
}
|
||||
/*REFCASE PLOTTING*/
|
||||
|
||||
if(plot_refcase){
|
||||
if( util_file_exists( data_file )){
|
||||
double_vector_type * refcase_value = double_vector_alloc( 0 , 0 );
|
||||
double_vector_type * refcase_time = double_vector_alloc( 0 , 0 );
|
||||
plot_dataset_type * d = plot_alloc_new_dataset( plot ,"refcase" , PLOT_XY );
|
||||
plot_dataset_set_style( d , LINE );
|
||||
plot_dataset_set_line_color( d , RED);
|
||||
char *base;
|
||||
char *header_file;
|
||||
stringlist_type * summary_file_list = stringlist_alloc_new();
|
||||
char *path;
|
||||
ecl_sum_type *ecl_sum;
|
||||
util_alloc_file_components( data_file , &path , &base , NULL );
|
||||
ecl_util_alloc_summary_files( path , base , NULL , &header_file , summary_file_list);
|
||||
ecl_sum = ecl_sum_fread_alloc( header_file , summary_file_list , ":" );
|
||||
for ( int i = 0; i < double_vector_size(x); i++ ){
|
||||
time_t sim_time = ( time_t ) double_vector_iget( x , i );
|
||||
if( ecl_sum_has_general_var( ecl_sum , user_key ) && ecl_sum_check_sim_time( ecl_sum , sim_time)){
|
||||
double_vector_append( refcase_value , ecl_sum_get_general_var_from_sim_time( ecl_sum, sim_time , user_key));
|
||||
double_vector_append( refcase_time , sim_time );
|
||||
/*REFCASE PLOTTING*/
|
||||
|
||||
if (plot_refcase && time_map_get_size( time_map) ) {
|
||||
ecl_config_type * ecl_config = enkf_main_get_ecl_config( enkf_main );
|
||||
ecl_refcase_list_type * refcase_list = ecl_config_get_refcase_list( ecl_config );
|
||||
int num_refcase = ecl_refcase_list_get_size( refcase_list );
|
||||
|
||||
for( int iref=0; iref < num_refcase; iref++) {
|
||||
ecl_sum_type * refcase = ecl_refcase_list_iget_case( refcase_list , iref );
|
||||
if ( ecl_sum_has_general_var( refcase , user_key)) {
|
||||
char * refcase_label = util_alloc_sprintf("Refcase%d" , iref);
|
||||
plot_dataset_type * d = plot_alloc_new_dataset( plot , refcase_label , PLOT_XY );
|
||||
int color_nr = iref % (PLOT_NUM_COLORS - 1) + 1; // Color_nr == 0 is white; we skip that.
|
||||
|
||||
plot_dataset_set_style( d , LINE );
|
||||
plot_dataset_set_line_color( d , color_nr );
|
||||
plot_dataset_set_line_width(d , 2.0 );
|
||||
|
||||
for ( int i = 0; i < time_map_get_size( time_map ); i++ ){
|
||||
time_t sim_time = ( time_t ) time_map_iget( time_map , i );
|
||||
if (ecl_sum_check_sim_time( refcase , sim_time)) {
|
||||
double days = ecl_sum_time2days( refcase , sim_time );
|
||||
double value = ecl_sum_get_general_var_from_sim_time( refcase , sim_time , user_key);
|
||||
|
||||
if (plot_dates)
|
||||
plot_dataset_append_point_xy( d , sim_time , value);
|
||||
else
|
||||
plot_dataset_append_point_xy( d , days , value);
|
||||
}
|
||||
}
|
||||
|
||||
free( refcase_label );
|
||||
}
|
||||
|
||||
util_safe_free(header_file);
|
||||
util_safe_free(base);
|
||||
util_safe_free(path);
|
||||
ecl_sum_free(ecl_sum);
|
||||
|
||||
for (int i = 0; i < double_vector_size( refcase_time ); i++) {
|
||||
double days = double_vector_iget( refcase_time , i);
|
||||
double value = double_vector_iget( refcase_value , i);
|
||||
plot_dataset_append_point_xy( d , days , value);
|
||||
}
|
||||
double_vector_free( refcase_value );
|
||||
double_vector_free( refcase_time );
|
||||
}
|
||||
else
|
||||
printf("\nCannot find refcase data file: \n%s\n", data_file);
|
||||
}
|
||||
double_vector_free( x );
|
||||
|
||||
@@ -479,7 +473,6 @@ static void enkf_tui_plot_ensemble__(enkf_main_type * enkf_main ,
|
||||
printf( "No data to plot for:%s \n" , user_key);
|
||||
plot_free( plot );
|
||||
}
|
||||
|
||||
free( plot_file );
|
||||
bool_vector_free( has_data );
|
||||
}
|
||||
@@ -753,6 +746,7 @@ static void * enkf_tui_plot_ensemble_mt( void * void_arg ) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
void enkf_tui_plot_all_summary__( enkf_main_type * enkf_main , int iens1 , int iens2 , int step1 , int step2 , bool prediction_mode) {
|
||||
/*
|
||||
This code is prepared for multithreaded creation of plots;
|
||||
@@ -805,10 +799,9 @@ void enkf_tui_plot_all_summary__( enkf_main_type * enkf_main , int iens1 , int i
|
||||
|
||||
|
||||
|
||||
|
||||
void enkf_tui_plot_all_summary(void * arg) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
|
||||
const ensemble_config_type * ensemble_config = enkf_main_get_ensemble_config(enkf_main);
|
||||
const plot_config_type * plot_config = enkf_main_get_plot_config( enkf_main );
|
||||
int iens1 , iens2 , step1 , step2;
|
||||
bool prediction_mode;
|
||||
|
||||
@@ -822,12 +815,14 @@ void enkf_tui_plot_all_summary(void * arg) {
|
||||
if(step1 != -2)
|
||||
step2 = enkf_tui_util_scanf_int_with_default_return_to_menu( "Stop plotting at report step [Enter: default: everything] (M: return to menu)" , PROMPT_LEN , &prediction_mode);
|
||||
}
|
||||
|
||||
if (step1 != -2 && step2 != -2){
|
||||
enkf_tui_util_scanf_iens_range("Realizations members to plot(0 - %d) [default: all]" , enkf_main_get_ensemble_size( enkf_main ) , PROMPT_LEN , &iens1 , &iens2);
|
||||
enkf_tui_plot_all_summary__( enkf_main , iens1 , iens2 , step1 , step2 , prediction_mode);
|
||||
enkf_tui_plot_all_summary__( enkf_main , iens1 , iens2 , step1 , step2 , prediction_mode );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -29,4 +29,13 @@ void enkf_tui_plot_menu(void * );
|
||||
void enkf_tui_plot_PC( enkf_main_type * enkf_main , const char * plot_name , const matrix_type * PC , const matrix_type * PC_obs);
|
||||
void enkf_tui_plot_reports(void *);
|
||||
void enkf_tui_plot_all_summary__( enkf_main_type * enkf_main , int iens1 , int iens2 , int step1 , int step2 , bool prediction_mode);
|
||||
|
||||
void enkf_tui_plot_ensemble__(enkf_main_type * enkf_main ,
|
||||
const enkf_config_node_type * config_node ,
|
||||
const char * user_key ,
|
||||
const char * key_index ,
|
||||
int step1 , int step2 ,
|
||||
bool prediction_mode ,
|
||||
int iens1 , int iens2 ,
|
||||
state_enum plot_state);
|
||||
#endif
|
||||
|
||||
@@ -215,166 +215,173 @@ void enkf_tui_plot_RFTS__(enkf_main_type * enkf_main ,
|
||||
|
||||
|
||||
void enkf_tui_plot_RFT_simIn(enkf_main_type * enkf_main, path_fmt_type * runpathformat, const path_fmt_type * caseformat, char * wellname , time_t recording_time, bool isMD){
|
||||
const int ens_size = enkf_main_get_ensemble_size( enkf_main );
|
||||
const plot_config_type * plot_config = enkf_main_get_plot_config( enkf_main );
|
||||
const char * data_file = plot_config_get_plot_refcase( plot_config );
|
||||
bool plot_refcase = true;
|
||||
if ( strcmp( data_file , "" ) == 0)
|
||||
plot_refcase = false;
|
||||
/*
|
||||
Start by reading RFT measurment
|
||||
*/
|
||||
double_vector_type * UTM_x = double_vector_alloc( 0 , 0);
|
||||
double_vector_type * UTM_y = double_vector_alloc( 0 , 0);
|
||||
double_vector_type * MD = double_vector_alloc( 0 , 0);
|
||||
double_vector_type * TVD_z = double_vector_alloc( 0 , 0);
|
||||
double_vector_type * RFT_obs = double_vector_alloc( 0 , 0);
|
||||
int lines = enkf_tui_plot_read_rft_obs(enkf_main, wellname, UTM_x, UTM_y, MD, TVD_z, RFT_obs);
|
||||
/*
|
||||
Find ijk-list
|
||||
*/
|
||||
char * caseending = path_fmt_alloc_path(caseformat, false, 0); //Use the grid in ensmember 0
|
||||
char * casename = path_fmt_alloc_file(runpathformat , false, 0, caseending);
|
||||
ecl_grid_type * grid = ecl_grid_load_case( casename );
|
||||
int_vector_type * i_values = int_vector_alloc( lines , 0 );
|
||||
int_vector_type * j_values = int_vector_alloc( lines , 0 );
|
||||
int_vector_type * k_values = int_vector_alloc( lines , 0 );
|
||||
int_vector_type * active = int_vector_alloc( lines , 0 );
|
||||
for (int nobs =0; nobs<lines; nobs++){
|
||||
int start_index = 0;
|
||||
int i; int j; int k;
|
||||
int global_index = ecl_grid_get_global_index_from_xyz(grid,double_vector_iget(UTM_x,nobs) ,double_vector_iget(UTM_y,nobs) ,double_vector_iget(TVD_z,nobs) ,start_index);
|
||||
ecl_grid_get_ijk1(grid , global_index, &i, &j , &k);
|
||||
int is_active = ecl_grid_get_active_index1(grid , global_index);
|
||||
int_vector_iset(i_values, nobs, i);
|
||||
int_vector_iset(j_values, nobs, j);
|
||||
int_vector_iset(k_values, nobs, k);
|
||||
int_vector_iset(active , nobs, is_active);
|
||||
start_index = global_index;
|
||||
}
|
||||
ecl_grid_free(grid);
|
||||
|
||||
/*
|
||||
Find refcase rfts
|
||||
*/
|
||||
double_vector_type * RFT_refcase = double_vector_alloc( 0 , 0);
|
||||
bool_vector_type * refcase_has_data = bool_vector_alloc(0, false);
|
||||
const char * refcase_file_name = ecl_rft_file_alloc_case_filename(data_file);
|
||||
|
||||
if (refcase_file_name == NULL){
|
||||
if( plot_refcase )
|
||||
util_abort("%s: Cannot find eclipse RFT file",__func__ , refcase_file_name);
|
||||
|
||||
}
|
||||
ecl_rft_file_type * rft_refcase_file = ecl_rft_file_alloc( refcase_file_name );
|
||||
if (refcase_file_name == NULL){
|
||||
if( plot_refcase )
|
||||
util_abort("%s: Cannot find eclipse RFT file",__func__ , refcase_file_name);
|
||||
const int ens_size = enkf_main_get_ensemble_size( enkf_main );
|
||||
const plot_config_type * plot_config = enkf_main_get_plot_config( enkf_main );
|
||||
bool plot_refcase = plot_config_get_plot_refcase( plot_config );
|
||||
ecl_config_type * ecl_config = enkf_main_get_ecl_config(enkf_main);
|
||||
ecl_refcase_list_type * refcase_list = ecl_config_get_refcase_list( ecl_config );
|
||||
ecl_sum_type * refcase = ecl_refcase_list_get_default( refcase_list );
|
||||
if (refcase) {
|
||||
|
||||
}
|
||||
const ecl_rft_node_type * rft_refcase_node = ecl_rft_file_get_well_time_rft( rft_refcase_file , wellname , recording_time);
|
||||
if(rft_refcase_node == NULL){
|
||||
if( plot_refcase )
|
||||
printf("No RFT information exists for %s in refcase.\n", wellname);
|
||||
|
||||
for( int nobs = 0; nobs < lines; nobs++){
|
||||
double_vector_append(RFT_refcase, 0.0);
|
||||
bool_vector_append(refcase_has_data, false);
|
||||
/*
|
||||
Start by reading RFT measurment
|
||||
*/
|
||||
double_vector_type * UTM_x = double_vector_alloc( 0 , 0);
|
||||
double_vector_type * UTM_y = double_vector_alloc( 0 , 0);
|
||||
double_vector_type * MD = double_vector_alloc( 0 , 0);
|
||||
double_vector_type * TVD_z = double_vector_alloc( 0 , 0);
|
||||
double_vector_type * RFT_obs = double_vector_alloc( 0 , 0);
|
||||
int lines = enkf_tui_plot_read_rft_obs(enkf_main, wellname, UTM_x, UTM_y, MD, TVD_z, RFT_obs);
|
||||
/*
|
||||
Find ijk-list
|
||||
*/
|
||||
char * caseending = path_fmt_alloc_path(caseformat, false, 0); //Use the grid in ensmember 0
|
||||
char * casename = path_fmt_alloc_file(runpathformat , false, 0, caseending);
|
||||
ecl_grid_type * grid = ecl_grid_load_case( casename );
|
||||
int_vector_type * i_values = int_vector_alloc( lines , 0 );
|
||||
int_vector_type * j_values = int_vector_alloc( lines , 0 );
|
||||
int_vector_type * k_values = int_vector_alloc( lines , 0 );
|
||||
int_vector_type * active = int_vector_alloc( lines , 0 );
|
||||
for (int nobs =0; nobs<lines; nobs++){
|
||||
int start_index = 0;
|
||||
int i; int j; int k;
|
||||
int global_index = ecl_grid_get_global_index_from_xyz(grid,double_vector_iget(UTM_x,nobs) ,double_vector_iget(UTM_y,nobs) ,double_vector_iget(TVD_z,nobs) ,start_index);
|
||||
ecl_grid_get_ijk1(grid , global_index, &i, &j , &k);
|
||||
int is_active = ecl_grid_get_active_index1(grid , global_index);
|
||||
int_vector_iset(i_values, nobs, i);
|
||||
int_vector_iset(j_values, nobs, j);
|
||||
int_vector_iset(k_values, nobs, k);
|
||||
int_vector_iset(active , nobs, is_active);
|
||||
start_index = global_index;
|
||||
}
|
||||
}
|
||||
else{
|
||||
for( int nobs = 0; nobs < lines; nobs++){
|
||||
if( int_vector_iget(active,nobs) > -1){
|
||||
int cell_index = ecl_rft_node_lookup_ijk( rft_refcase_node , int_vector_iget(i_values,nobs), int_vector_iget(j_values,nobs),int_vector_iget(k_values,nobs) ); //lookup cell
|
||||
if(cell_index > -1){
|
||||
double pressure_value = ecl_rft_node_iget_pressure( rft_refcase_node , cell_index); // Pressure
|
||||
double_vector_append(RFT_refcase, pressure_value);
|
||||
bool_vector_append(refcase_has_data, true);
|
||||
}
|
||||
else{
|
||||
double_vector_append(RFT_refcase, 0.0);
|
||||
bool_vector_append(refcase_has_data, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ecl_grid_free(grid);
|
||||
|
||||
/*
|
||||
Find refcase rfts
|
||||
*/
|
||||
double_vector_type * RFT_refcase = double_vector_alloc( 0 , 0);
|
||||
bool_vector_type * refcase_has_data = bool_vector_alloc(0, false);
|
||||
const char * refcase_file_name = ecl_rft_file_alloc_case_filename( ecl_sum_get_case( refcase ));
|
||||
|
||||
if (refcase_file_name == NULL){
|
||||
if( plot_refcase )
|
||||
util_abort("%s: Cannot find eclipse RFT file",__func__ , refcase_file_name);
|
||||
|
||||
}
|
||||
ecl_rft_file_type * rft_refcase_file = ecl_rft_file_alloc( refcase_file_name );
|
||||
if (refcase_file_name == NULL){
|
||||
if( plot_refcase )
|
||||
util_abort("%s: Cannot find eclipse RFT file",__func__ , refcase_file_name);
|
||||
|
||||
}
|
||||
const ecl_rft_node_type * rft_refcase_node = ecl_rft_file_get_well_time_rft( rft_refcase_file , wellname , recording_time);
|
||||
if(rft_refcase_node == NULL){
|
||||
if( plot_refcase )
|
||||
printf("No RFT information exists for %s in refcase.\n", wellname);
|
||||
|
||||
for( int nobs = 0; nobs < lines; nobs++){
|
||||
double_vector_append(RFT_refcase, 0.0);
|
||||
bool_vector_append(refcase_has_data, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
ecl_rft_file_free(rft_refcase_file);
|
||||
/*
|
||||
Get the simulated RFTs
|
||||
*/
|
||||
vector_type * pressure_container = vector_alloc_new();
|
||||
vector_type * has_data_container = vector_alloc_new();
|
||||
char * caseending1 = path_fmt_alloc_path(caseformat, false, 0);
|
||||
char * casename1 = path_fmt_alloc_file(runpathformat , false, 0, caseending1);
|
||||
const char * case_file_name1 = ecl_rft_file_alloc_case_filename(casename1 );
|
||||
bool eclipse_rft_exists = false;
|
||||
if (case_file_name1 == NULL){
|
||||
util_abort("%s: Cannot find eclipse RFT file",__func__ , case_file_name1);
|
||||
}
|
||||
else{
|
||||
eclipse_rft_exists = true;
|
||||
for (int iens = 0; iens<ens_size; iens++){
|
||||
double_vector_type * simulated_pressures = double_vector_alloc(lines, 0.0);
|
||||
bool_vector_type * has_data = bool_vector_alloc(lines, true);
|
||||
char * caseending = path_fmt_alloc_path(caseformat, false, iens);
|
||||
char * casename = path_fmt_alloc_file(runpathformat , false, iens, caseending);
|
||||
const char * case_file_name = ecl_rft_file_alloc_case_filename(casename );
|
||||
ecl_rft_file_type * rftfile = ecl_rft_file_alloc( case_file_name );
|
||||
const ecl_rft_node_type * rftnode = ecl_rft_file_get_well_time_rft( rftfile , wellname , recording_time);
|
||||
if(rftnode == NULL){
|
||||
printf("No RFT information exists for %s:\n", wellname);
|
||||
}
|
||||
else{
|
||||
for( int nobs = 0; nobs < lines; nobs++){
|
||||
if( int_vector_iget(active,nobs) > -1){
|
||||
int cell_index = ecl_rft_node_lookup_ijk( rftnode , int_vector_iget(i_values,nobs), int_vector_iget(j_values,nobs),int_vector_iget(k_values,nobs) ); //lookup cell
|
||||
double pressure_value = ecl_rft_node_iget_pressure( rftnode , cell_index); // Pressure
|
||||
double_vector_iset(simulated_pressures,nobs , pressure_value);
|
||||
if(cell_index > -1)
|
||||
bool_vector_iset(has_data, nobs, true);
|
||||
else
|
||||
bool_vector_iset(has_data, nobs, false);
|
||||
else{
|
||||
for( int nobs = 0; nobs < lines; nobs++){
|
||||
if( int_vector_iget(active,nobs) > -1){
|
||||
int cell_index = ecl_rft_node_lookup_ijk( rft_refcase_node ,
|
||||
int_vector_iget(i_values,nobs) ,
|
||||
int_vector_iget(j_values,nobs) ,
|
||||
int_vector_iget(k_values,nobs) ); //lookup cell
|
||||
|
||||
if(cell_index > -1){
|
||||
double pressure_value = ecl_rft_node_iget_pressure( rft_refcase_node , cell_index); // Pressure
|
||||
double_vector_append(RFT_refcase, pressure_value);
|
||||
bool_vector_append(refcase_has_data, true);
|
||||
}
|
||||
else {
|
||||
double_vector_iset(simulated_pressures,nobs ,0.0);
|
||||
bool_vector_iset(has_data, nobs, false);
|
||||
else{
|
||||
double_vector_append(RFT_refcase, 0.0);
|
||||
bool_vector_append(refcase_has_data, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
double_vector_append(RFT_refcase, 0.0);
|
||||
bool_vector_append(refcase_has_data, false);
|
||||
}
|
||||
}
|
||||
ecl_rft_file_free(rftfile);
|
||||
vector_append_owned_ref( pressure_container , simulated_pressures , double_vector_free__ );
|
||||
vector_append_owned_ref( has_data_container , has_data , bool_vector_free__ );
|
||||
}
|
||||
ecl_rft_file_free(rft_refcase_file);
|
||||
/*
|
||||
Get the simulated RFTs
|
||||
*/
|
||||
vector_type * pressure_container = vector_alloc_new();
|
||||
vector_type * has_data_container = vector_alloc_new();
|
||||
char * caseending1 = path_fmt_alloc_path(caseformat, false, 0);
|
||||
char * casename1 = path_fmt_alloc_file(runpathformat , false, 0, caseending1);
|
||||
const char * case_file_name1 = ecl_rft_file_alloc_case_filename(casename1 );
|
||||
bool eclipse_rft_exists = false;
|
||||
if (case_file_name1 == NULL){
|
||||
util_abort("%s: Cannot find eclipse RFT file",__func__ , case_file_name1);
|
||||
}
|
||||
else{
|
||||
eclipse_rft_exists = true;
|
||||
for (int iens = 0; iens<ens_size; iens++){
|
||||
double_vector_type * simulated_pressures = double_vector_alloc(lines, 0.0);
|
||||
bool_vector_type * has_data = bool_vector_alloc(lines, true);
|
||||
char * caseending = path_fmt_alloc_path(caseformat, false, iens);
|
||||
char * casename = path_fmt_alloc_file(runpathformat , false, iens, caseending);
|
||||
const char * case_file_name = ecl_rft_file_alloc_case_filename(casename );
|
||||
ecl_rft_file_type * rftfile = ecl_rft_file_alloc( case_file_name );
|
||||
const ecl_rft_node_type * rftnode = ecl_rft_file_get_well_time_rft( rftfile , wellname , recording_time);
|
||||
if(rftnode == NULL){
|
||||
printf("No RFT information exists for %s:\n", wellname);
|
||||
}
|
||||
else{
|
||||
for( int nobs = 0; nobs < lines; nobs++){
|
||||
if( int_vector_iget(active,nobs) > -1){
|
||||
int cell_index = ecl_rft_node_lookup_ijk( rftnode , int_vector_iget(i_values,nobs), int_vector_iget(j_values,nobs),int_vector_iget(k_values,nobs) ); //lookup cell
|
||||
double pressure_value = ecl_rft_node_iget_pressure( rftnode , cell_index); // Pressure
|
||||
double_vector_iset(simulated_pressures,nobs , pressure_value);
|
||||
if(cell_index > -1)
|
||||
bool_vector_iset(has_data, nobs, true);
|
||||
else
|
||||
bool_vector_iset(has_data, nobs, false);
|
||||
}
|
||||
else {
|
||||
double_vector_iset(simulated_pressures,nobs ,0.0);
|
||||
bool_vector_iset(has_data, nobs, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
ecl_rft_file_free(rftfile);
|
||||
vector_append_owned_ref( pressure_container , simulated_pressures , double_vector_free__ );
|
||||
vector_append_owned_ref( has_data_container , has_data , bool_vector_free__ );
|
||||
}
|
||||
}
|
||||
/*
|
||||
Do the actual plotting
|
||||
*/
|
||||
if(isMD)
|
||||
enkf_tui_plot_RFTS__( enkf_main , wellname , MD, RFT_obs, RFT_refcase, refcase_has_data, pressure_container, active, eclipse_rft_exists, has_data_container, isMD);
|
||||
else
|
||||
enkf_tui_plot_RFTS__( enkf_main , wellname , TVD_z, RFT_obs, RFT_refcase, refcase_has_data, pressure_container, active, eclipse_rft_exists, has_data_container, isMD);
|
||||
double_vector_free( UTM_x );
|
||||
double_vector_free( UTM_y );
|
||||
double_vector_free( MD );
|
||||
double_vector_free( TVD_z );
|
||||
double_vector_free( RFT_obs );
|
||||
double_vector_free( RFT_refcase );
|
||||
bool_vector_free( refcase_has_data );
|
||||
vector_free( pressure_container );
|
||||
vector_free( has_data_container );
|
||||
free( caseending );
|
||||
free( caseending1 );
|
||||
free( casename );
|
||||
free( casename1 );
|
||||
int_vector_free( i_values );
|
||||
int_vector_free( j_values );
|
||||
int_vector_free( k_values );
|
||||
int_vector_free( active );
|
||||
}
|
||||
/*
|
||||
Do the actual plotting
|
||||
*/
|
||||
if(isMD)
|
||||
enkf_tui_plot_RFTS__( enkf_main , wellname , MD, RFT_obs, RFT_refcase, refcase_has_data, pressure_container, active, eclipse_rft_exists, has_data_container, isMD);
|
||||
else
|
||||
enkf_tui_plot_RFTS__( enkf_main , wellname , TVD_z, RFT_obs, RFT_refcase, refcase_has_data, pressure_container, active, eclipse_rft_exists, has_data_container, isMD);
|
||||
double_vector_free( UTM_x );
|
||||
double_vector_free( UTM_y );
|
||||
double_vector_free( MD );
|
||||
double_vector_free( TVD_z );
|
||||
double_vector_free( RFT_obs );
|
||||
double_vector_free( RFT_refcase );
|
||||
bool_vector_free( refcase_has_data );
|
||||
vector_free( pressure_container );
|
||||
vector_free( has_data_container );
|
||||
free( caseending );
|
||||
free( caseending1 );
|
||||
free( casename );
|
||||
free( casename1 );
|
||||
int_vector_free( i_values );
|
||||
int_vector_free( j_values );
|
||||
int_vector_free( k_values );
|
||||
int_vector_free( active );
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
int enkf_tui_plot_read_rft_config(const char * rft_config_file, stringlist_type * wellnames, time_t_vector_type * dates){
|
||||
|
||||
@@ -107,14 +107,13 @@ static void enkf_tui_ranking_create_data__( void * arg , bool sort_increasing) {
|
||||
ranking_table_type * ranking_table = enkf_main_get_ranking_table( enkf_main );
|
||||
enkf_fs_type * fs = enkf_main_get_fs( enkf_main );
|
||||
ensemble_config_type * ensemble_config = enkf_main_get_ensemble_config( enkf_main );
|
||||
//const int history_length = enkf_main_get_history_length( enkf_main );
|
||||
time_map_type * time_map = enkf_fs_get_time_map( fs );
|
||||
const int prompt_len = 60;
|
||||
const char * prompt1 = "Data key to use for ranking";
|
||||
const char * prompt2 = "Report step of data";
|
||||
const char * prompt2 = "Report step of data [Blank: last step]";
|
||||
const char * ranking_name = "Name of new ranking";
|
||||
const char * store_prompt = "Name of file to store ranking [Blank - no store]";
|
||||
|
||||
int step;
|
||||
state_enum state = FORECAST;
|
||||
char * user_key;
|
||||
|
||||
@@ -123,26 +122,32 @@ static void enkf_tui_ranking_create_data__( void * arg , bool sort_increasing) {
|
||||
if (user_key != NULL) {
|
||||
util_printf_prompt( prompt2 , prompt_len , '=' , "=> ");
|
||||
{
|
||||
char * step_char = util_alloc_stdin_line();
|
||||
if (step_char == NULL)
|
||||
step = 0;
|
||||
else {
|
||||
if (util_sscanf_int( step_char , &step )) {
|
||||
const enkf_config_node_type * config_node;
|
||||
char * key_index;
|
||||
config_node = ensemble_config_user_get_node( ensemble_config , user_key , &key_index);
|
||||
if (config_node) {
|
||||
util_printf_prompt(ranking_name , prompt_len , '=' , "=> ");
|
||||
char * ranking_key = util_alloc_stdin_line();
|
||||
if (ranking_key != NULL) {
|
||||
ranking_table_add_data_ranking( ranking_table , sort_increasing , ranking_key , user_key , key_index , fs , config_node, step , state );
|
||||
ranking_table_display_ranking( ranking_table , ranking_key );
|
||||
}
|
||||
util_safe_free( ranking_key );
|
||||
}
|
||||
int step = -1;
|
||||
{
|
||||
char * step_char = util_alloc_stdin_line();
|
||||
|
||||
if (step_char == NULL)
|
||||
step = time_map_get_last_step( time_map );
|
||||
else {
|
||||
util_sscanf_int( step_char , &step );
|
||||
free( step_char );
|
||||
}
|
||||
}
|
||||
|
||||
if (step >= 0) {
|
||||
const enkf_config_node_type * config_node;
|
||||
char * key_index;
|
||||
config_node = ensemble_config_user_get_node( ensemble_config , user_key , &key_index);
|
||||
if (config_node) {
|
||||
util_printf_prompt(ranking_name , prompt_len , '=' , "=> ");
|
||||
char * ranking_key = util_alloc_stdin_line();
|
||||
if (ranking_key != NULL) {
|
||||
ranking_table_add_data_ranking( ranking_table , sort_increasing , ranking_key , user_key , key_index , fs , config_node, step , state );
|
||||
ranking_table_display_ranking( ranking_table , ranking_key );
|
||||
}
|
||||
util_safe_free( ranking_key );
|
||||
}
|
||||
}
|
||||
util_safe_free( step_char );
|
||||
}
|
||||
}
|
||||
util_safe_free( user_key );
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <ert/util/thread_pool.h>
|
||||
#include <ert/util/arg_pack.h>
|
||||
#include <ert/util/bool_vector.h>
|
||||
#include <ert/util/string_util.h>
|
||||
|
||||
#include <ert/enkf/enkf_main.h>
|
||||
#include <ert/enkf/enkf_fs.h>
|
||||
@@ -34,6 +35,8 @@
|
||||
#include <ert/enkf/ensemble_config.h>
|
||||
#include <ert/enkf/enkf_analysis.h>
|
||||
#include <ert/enkf/ecl_config.h>
|
||||
#include <ert/enkf/analysis_config.h>
|
||||
#include <ert/enkf/analysis_iter_config.h>
|
||||
|
||||
#include <enkf_tui_util.h>
|
||||
#include <enkf_tui_fs.h>
|
||||
@@ -42,7 +45,7 @@
|
||||
#include <enkf_tui_help.h>
|
||||
|
||||
/*
|
||||
Set runpath runtime - disabled.
|
||||
Set runpath runtime - disabled.
|
||||
|
||||
static void enkf_tui_run_set_runpath(void * arg) {
|
||||
arg_pack_type * arg_pack = arg_pack_safe_cast( arg );
|
||||
@@ -112,6 +115,7 @@ void enkf_tui_run_smoother(void * arg) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
void enkf_tui_run_iterated_ES(void * enkf_main) {
|
||||
const int ens_size = enkf_main_get_ensemble_size( enkf_main );
|
||||
const int last_report = enkf_main_get_history_length( enkf_main );
|
||||
@@ -120,13 +124,14 @@ void enkf_tui_run_iterated_ES(void * enkf_main) {
|
||||
model_config_type * model_config = enkf_main_get_model_config( enkf_main );
|
||||
const ecl_config_type * ecl_config = enkf_main_get_ecl_config( enkf_main );
|
||||
const analysis_config_type * analysis_config = enkf_main_get_analysis_config( enkf_main );
|
||||
analysis_iter_config_type * iter_config = analysis_config_get_iter_config( analysis_config );
|
||||
analysis_module_type * module = analysis_config_get_active_module( analysis_config );
|
||||
int step1 = 0;
|
||||
int step2 ;
|
||||
int_vector_type * step_list = int_vector_alloc(0,0);
|
||||
bool_vector_type * iactive = bool_vector_alloc(0 , true);
|
||||
int iter = 0;
|
||||
int num_iter = 16;
|
||||
int num_iter = analysis_iter_config_get_num_iterations( iter_config );
|
||||
stringlist_type * node_list = ensemble_config_alloc_keylist_from_var_type( enkf_main_get_ensemble_config(enkf_main) , PARAMETER );
|
||||
|
||||
if (ecl_config_has_schedule( ecl_config ))
|
||||
@@ -141,24 +146,25 @@ void enkf_tui_run_iterated_ES(void * enkf_main) {
|
||||
bool_vector_iset( iactive , ens_size - 1 , true );
|
||||
|
||||
while (true) {
|
||||
/* {
|
||||
char * user = getenv("USER");
|
||||
char * runpath_fmt = util_alloc_sprintf("/scratch/ert/%s/iteratedES/%d/run%%d" , user , iter);
|
||||
model_config_set_runpath_fmt( model_config , runpath_fmt );
|
||||
free( runpath_fmt );
|
||||
}
|
||||
*/
|
||||
|
||||
char * target_fs_name = util_alloc_sprintf("smoother-%d" , iter);
|
||||
enkf_fs_type * target_fs = enkf_main_get_alt_fs(enkf_main , target_fs_name , false , true );
|
||||
enkf_main_run_exp(enkf_main , iactive , step1 , step1 , FORECAST);
|
||||
enkf_main_smoother_update(enkf_main , step_list , target_fs);
|
||||
{
|
||||
|
||||
|
||||
const char * runpath_fmt = analysis_iter_config_iget_runpath_fmt( iter_config , iter);
|
||||
if (runpath_fmt != NULL) {
|
||||
char * runpath_key = util_alloc_sprintf( "runpath-%d" , iter);
|
||||
model_config_add_runpath( model_config , runpath_key , runpath_fmt);
|
||||
model_config_select_runpath( model_config , runpath_key );
|
||||
free( runpath_key );
|
||||
}
|
||||
}
|
||||
|
||||
enkf_main_run_exp(enkf_main , iactive , true , step1 , step1 , FORECAST);
|
||||
{
|
||||
char * target_fs_name = analysis_iter_config_iget_case( iter_config , iter );
|
||||
enkf_fs_type * target_fs = enkf_main_get_alt_fs(enkf_main , target_fs_name , false , true );
|
||||
enkf_main_smoother_update(enkf_main , step_list , target_fs);
|
||||
|
||||
enkf_main_copy_ensemble( enkf_main ,
|
||||
enkf_main_get_current_fs( enkf_main ),
|
||||
step2 ,
|
||||
0 , // Smoother update will write on step 0
|
||||
ANALYZED ,
|
||||
target_fs,
|
||||
step1 ,
|
||||
@@ -167,15 +173,17 @@ void enkf_tui_run_iterated_ES(void * enkf_main) {
|
||||
NULL ,
|
||||
node_list );
|
||||
|
||||
enkf_main_select_fs(enkf_main , target_fs );
|
||||
|
||||
enkf_main_set_fs(enkf_main , target_fs , enkf_fs_get_case_name( target_fs ));
|
||||
free( target_fs_name );
|
||||
}
|
||||
|
||||
free( target_fs_name );
|
||||
iter= analysis_module_get_int(module, "ITER");
|
||||
//iter = analysis_module_get_int(module, "ITER");
|
||||
iter++;
|
||||
if (iter == num_iter)
|
||||
break;
|
||||
}
|
||||
int_vector_free( step_list );
|
||||
bool_vector_free( iactive );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -195,26 +203,27 @@ void enkf_tui_run_iterated_ES(void * enkf_main) {
|
||||
|
||||
|
||||
void enkf_tui_run_exp(void * enkf_main) {
|
||||
const int ens_size = enkf_main_get_ensemble_size( enkf_main );
|
||||
bool_vector_type * iactive = bool_vector_alloc(0,true);
|
||||
bool_vector_iset( iactive , ens_size - 1 , true );
|
||||
const int ens_size = enkf_main_get_ensemble_size( enkf_main );
|
||||
bool_vector_type * iactive = bool_vector_alloc(0,false);
|
||||
|
||||
state_enum init_state = ANALYZED;
|
||||
int start_report = 0;
|
||||
int init_step_parameters = 0;
|
||||
char * select_string;
|
||||
|
||||
{
|
||||
|
||||
char * prompt = util_alloc_sprintf("Which realizations to simulate (Ex: 1,3-5) <Enter for all> [M to return to menu] : " , ens_size);
|
||||
char * select_string;
|
||||
|
||||
util_printf_prompt(prompt , PROMPT_LEN , '=' , "=> ");
|
||||
select_string = util_alloc_stdin_line();
|
||||
if (select_string != NULL) {
|
||||
util_sscanf_active_range( select_string , ens_size - 1 , bool_vector_get_ptr( iactive) );
|
||||
free( select_string );
|
||||
}
|
||||
enkf_tui_util_sscanf_active_list( iactive , select_string , ens_size);
|
||||
|
||||
util_safe_free( select_string );
|
||||
free( prompt );
|
||||
}
|
||||
enkf_main_run_exp(enkf_main , iactive , init_step_parameters , start_report , init_state);
|
||||
if (bool_vector_count_equal(iactive , true))
|
||||
enkf_main_run_exp(enkf_main , iactive , true , init_step_parameters , start_report , init_state);
|
||||
|
||||
bool_vector_free(iactive);
|
||||
}
|
||||
@@ -223,10 +232,8 @@ void enkf_tui_run_exp(void * enkf_main) {
|
||||
|
||||
void enkf_tui_run_create_runpath__(void * __enkf_main) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast(__enkf_main);
|
||||
const int ens_size = enkf_main_get_ensemble_size( enkf_main );
|
||||
bool_vector_type * iactive = bool_vector_alloc(0,true);
|
||||
bool_vector_iset( iactive , ens_size - 1 , true );
|
||||
|
||||
const int ens_size = enkf_main_get_ensemble_size( enkf_main );
|
||||
bool_vector_type * iactive = bool_vector_alloc(0,false);
|
||||
|
||||
state_enum init_state = ANALYZED;
|
||||
int start_report = 0;
|
||||
@@ -234,14 +241,15 @@ void enkf_tui_run_create_runpath__(void * __enkf_main) {
|
||||
{
|
||||
char * prompt = util_alloc_sprintf("Which realizations to create[ensemble size:%d] : " , ens_size);
|
||||
char * select_string;
|
||||
|
||||
util_printf_prompt(prompt , PROMPT_LEN , '=' , "=> ");
|
||||
select_string = util_alloc_stdin_line();
|
||||
util_sscanf_active_range( select_string , ens_size - 1 , bool_vector_get_ptr( iactive) );
|
||||
enkf_tui_util_sscanf_active_list( iactive , select_string , ens_size );
|
||||
|
||||
util_safe_free( select_string );
|
||||
free( prompt );
|
||||
free( select_string );
|
||||
}
|
||||
|
||||
enkf_main_run_exp(enkf_main , iactive , init_step_parameters , start_report , init_state);
|
||||
enkf_main_run_exp(enkf_main , iactive , false , init_step_parameters , start_report , init_state);
|
||||
bool_vector_free(iactive);
|
||||
}
|
||||
|
||||
@@ -259,9 +267,9 @@ void enkf_tui_run_manual_load__( void * arg ) {
|
||||
const int last_report = -1;
|
||||
const int ens_size = enkf_main_get_ensemble_size( enkf_main );
|
||||
int step1,step2;
|
||||
bool * iactive = util_calloc(ens_size , sizeof * iactive );
|
||||
bool_vector_type * iactive = bool_vector_alloc( 0 , false );
|
||||
run_mode_type run_mode = ENSEMBLE_EXPERIMENT;
|
||||
|
||||
|
||||
enkf_main_init_run(enkf_main , run_mode); /* This is ugly */
|
||||
|
||||
step1 = 0;
|
||||
@@ -271,15 +279,16 @@ void enkf_tui_run_manual_load__( void * arg ) {
|
||||
char * select_string;
|
||||
util_printf_prompt(prompt , PROMPT_LEN , '=' , "=> ");
|
||||
select_string = util_alloc_stdin_line();
|
||||
util_sscanf_active_range( select_string , ens_size - 1 , iactive);
|
||||
|
||||
enkf_tui_util_sscanf_active_list( iactive , select_string , ens_size );
|
||||
util_safe_free( select_string );
|
||||
|
||||
free( prompt );
|
||||
free( select_string );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
if (bool_vector_count_equal( iactive , true )) {
|
||||
int iens;
|
||||
arg_pack_type ** arg_list = util_calloc( ens_size , sizeof * arg_list );
|
||||
thread_pool_type * tp = thread_pool_alloc( 4 , true ); /* num_cpu - HARD coded. */
|
||||
@@ -288,7 +297,7 @@ void enkf_tui_run_manual_load__( void * arg ) {
|
||||
arg_pack_type * arg_pack = arg_pack_alloc();
|
||||
arg_list[iens] = arg_pack;
|
||||
|
||||
if (iactive[iens]) {
|
||||
if (bool_vector_iget(iactive , iens)) {
|
||||
enkf_state_type * enkf_state = enkf_main_iget_state( enkf_main , iens );
|
||||
|
||||
arg_pack_append_ptr( arg_pack , enkf_state); /* 0: */
|
||||
@@ -299,15 +308,30 @@ void enkf_tui_run_manual_load__( void * arg ) {
|
||||
arg_pack_append_bool( arg_pack , true ); /* 5: Interactive */
|
||||
arg_pack_append_owned_ptr( arg_pack , stringlist_alloc_new() , stringlist_free__); /* 6: List of interactive mode messages. */
|
||||
thread_pool_add_job( tp , enkf_state_internalize_results_mt , arg_pack);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
thread_pool_join( tp );
|
||||
thread_pool_free( tp );
|
||||
printf("\n");
|
||||
|
||||
|
||||
{
|
||||
qc_module_type * qc_module = enkf_main_get_qc_module( enkf_main );
|
||||
runpath_list_type * runpath_list = qc_module_get_runpath_list( qc_module );
|
||||
|
||||
for (iens = 0; iens < ens_size; iens++) {
|
||||
if (bool_vector_iget(iactive , iens)) {
|
||||
const enkf_state_type * state = enkf_main_iget_state( enkf_main , iens );
|
||||
runpath_list_add( runpath_list , iens , enkf_state_get_run_path( state ) , enkf_state_get_eclbase( state ));
|
||||
}
|
||||
}
|
||||
|
||||
qc_module_export_runpath_list( qc_module );
|
||||
}
|
||||
|
||||
for (iens = 0; iens < ens_size; iens++) {
|
||||
if (iactive[iens]) {
|
||||
if (bool_vector_iget(iactive , iens)) {
|
||||
stringlist_type * msg_list = arg_pack_iget_ptr( arg_list[iens] , 6 );
|
||||
if (stringlist_get_size( msg_list ))
|
||||
enkf_tui_display_load_msg( iens , msg_list );
|
||||
@@ -319,18 +343,24 @@ void enkf_tui_run_manual_load__( void * arg ) {
|
||||
arg_pack_free( arg_list[iens]);
|
||||
free( arg_list );
|
||||
}
|
||||
free( iactive );
|
||||
bool_vector_free( iactive );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
void enkf_tui_run_menu(void * arg) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
|
||||
model_config_type * model_config = enkf_main_get_model_config( enkf_main );
|
||||
path_fmt_type * runpath_fmt = model_config_get_runpath_fmt( model_config );
|
||||
menu_type * menu;
|
||||
|
||||
{
|
||||
char * title = util_alloc_sprintf("Run menu [case:%s]" , enkf_main_get_current_fs( enkf_main ));
|
||||
char * title = util_alloc_sprintf("Run menu [case:%s Runpath:%s]" , enkf_main_get_current_fs( enkf_main ) , path_fmt_get_fmt ( runpath_fmt ));
|
||||
menu = menu_alloc(title , "Back" , "bB");
|
||||
free(title);
|
||||
}
|
||||
@@ -344,7 +374,7 @@ void enkf_tui_run_menu(void * arg) {
|
||||
menu_item_type * restart_enkf_item = menu_add_item(menu , "Restart EnKF run from arbitrary state" , "rR" , enkf_tui_run_restart__ , enkf_main , NULL);
|
||||
menu_item_type * ES_item = menu_add_item(menu , "Integrated smoother update" , "iI" , enkf_tui_run_smoother , enkf_main , NULL);
|
||||
menu_item_type * it_ES_item = menu_add_item(menu , "Iterated smoother [RML-EnKF]" , "tT" , enkf_tui_run_iterated_ES , enkf_main , NULL);
|
||||
|
||||
|
||||
if (!ecl_config_has_schedule( ecl_config )) {
|
||||
menu_item_disable( enkf_item );
|
||||
menu_item_disable( restart_enkf_item );
|
||||
@@ -357,7 +387,7 @@ void enkf_tui_run_menu(void * arg) {
|
||||
}
|
||||
menu_add_separator(menu);
|
||||
menu_add_item(menu , "Create runpath directories - NO simulation" , "cC" , enkf_tui_run_create_runpath__ , enkf_main , NULL );
|
||||
menu_add_item(menu , "Load results manually" , "lL" , enkf_tui_run_manual_load__ , enkf_main , NULL);
|
||||
menu_add_item(menu , "Load results manually" , "lL" , enkf_tui_run_manual_load__ , enkf_main , NULL);
|
||||
menu_add_separator(menu);
|
||||
{
|
||||
menu_item_type * analysis_item = menu_add_item(menu , "Analysis menu" , "aA" , enkf_tui_analysis_menu , enkf_main , NULL);
|
||||
|
||||
@@ -417,6 +417,23 @@ int enkf_tui_util_scanf_int_with_default_return_to_menu(const char * prompt , in
|
||||
return value;
|
||||
}
|
||||
|
||||
bool enkf_tui_util_sscanf_active_list( bool_vector_type * iactive , const char * select_string , int ens_size ) {
|
||||
if (select_string == NULL) {
|
||||
bool_vector_set_default( iactive , true );
|
||||
bool_vector_iset( iactive , ens_size - 1 , true );
|
||||
return true;
|
||||
} else {
|
||||
bool OK;
|
||||
OK = string_util_init_active_mask( select_string , iactive );
|
||||
|
||||
if (bool_vector_size( iactive ) < ens_size)
|
||||
bool_vector_iset( iactive , ens_size - 1 , false );
|
||||
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#ifndef __ENKF_TUI_UTIL_H__
|
||||
#define __ENKF_TUI_UTIL_H__
|
||||
|
||||
#include <ert/util/bool_vector.h>
|
||||
|
||||
#include <ert/enkf/enkf_types.h>
|
||||
#include <ert/enkf/field_config.h>
|
||||
@@ -41,4 +42,6 @@ char * enkf_tui_util_scanf_report_step_as_char(int , cons
|
||||
void enkf_tui_util_msg(const char * , ...);
|
||||
int enkf_tui_util_scanf_int_with_default(const char * prompt , int prompt_len , bool * default_used);
|
||||
int enkf_tui_util_scanf_int_with_default_return_to_menu(const char * prompt , int prompt_len , bool * default_used);
|
||||
|
||||
bool enkf_tui_util_sscanf_active_list( bool_vector_type * iactive , const char * select_string , int ens_size );
|
||||
#endif
|
||||
|
||||
115
ThirdParty/Ert/devel/libenkf/applications/ert_tui/enkf_tui_workflow.c
vendored
Normal file
115
ThirdParty/Ert/devel/libenkf/applications/ert_tui/enkf_tui_workflow.c
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
Copyright (C) 2012 Statoil ASA, Norway.
|
||||
|
||||
The file 'enkf_tui_workflow.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>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/menu.h>
|
||||
#include <ert/util/thread_pool.h>
|
||||
#include <ert/util/arg_pack.h>
|
||||
#include <ert/util/bool_vector.h>
|
||||
|
||||
#include <ert/config/config_error.h>
|
||||
|
||||
#include <ert/enkf/enkf_main.h>
|
||||
#include <ert/enkf/enkf_fs.h>
|
||||
#include <ert/enkf/enkf_sched.h>
|
||||
#include <ert/enkf/ensemble_config.h>
|
||||
#include <ert/enkf/enkf_analysis.h>
|
||||
#include <ert/enkf/ecl_config.h>
|
||||
|
||||
#include <enkf_tui_analysis.h>
|
||||
#include <ert_tui_const.h>
|
||||
#include <enkf_tui_help.h>
|
||||
#include <enkf_tui_util.h>
|
||||
#include <enkf_tui_fs.h>
|
||||
|
||||
|
||||
void enkf_tui_workflow_run( void * arg ) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
|
||||
{
|
||||
ert_workflow_list_type * workflow_list = enkf_main_get_workflow_list( enkf_main );
|
||||
util_printf_prompt("Name of workflow" , PROMPT_LEN , '=' , "=> ");
|
||||
{
|
||||
char * workflow_name = util_alloc_stdin_line();
|
||||
if (workflow_name != NULL) {
|
||||
if (ert_workflow_list_has_workflow( workflow_list , workflow_name )) {
|
||||
if (!ert_workflow_list_run_workflow( workflow_list , workflow_name , enkf_main )) {
|
||||
printf("Errors in workflow:%s \n", workflow_name );
|
||||
printf("-----------------------------------------------------------------\n");
|
||||
config_error_fprintf( ert_workflow_list_get_last_error( workflow_list ) , true , stdout);
|
||||
printf("-----------------------------------------------------------------\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
util_safe_free( workflow_name );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void enkf_tui_workflow_load( void * arg ) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void enkf_tui_workflow_list( void * arg ) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
|
||||
{
|
||||
ert_workflow_list_type * workflow_list = enkf_main_get_workflow_list( enkf_main );
|
||||
stringlist_type * name_list = ert_workflow_list_alloc_namelist( workflow_list );
|
||||
|
||||
printf("Available workflows: \n");
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < stringlist_get_size( name_list ); i++) {
|
||||
if ((i % 5) == 0)
|
||||
printf("\n ");
|
||||
else
|
||||
printf(" ");
|
||||
|
||||
printf( stringlist_iget( name_list , i ));
|
||||
}
|
||||
}
|
||||
stringlist_free( name_list );
|
||||
printf("\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void enkf_tui_workflow_menu(void * arg) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
|
||||
menu_type * menu = menu_alloc("Workflows" , "Back" , "bB");
|
||||
|
||||
menu_add_item(menu , "Run workflow" , "rR" , enkf_tui_workflow_run , enkf_main , NULL );
|
||||
menu_add_item(menu , "Load workflow" , "lL" , enkf_tui_workflow_load , enkf_main , NULL );
|
||||
menu_add_item(menu , "List available workflows" , "iI" , enkf_tui_workflow_list , enkf_main , NULL );
|
||||
|
||||
menu_add_item(menu , "Help" , "hH" , enkf_tui_help_menu_run , enkf_main , NULL);
|
||||
menu_run(menu);
|
||||
menu_free(menu);
|
||||
|
||||
}
|
||||
|
||||
24
ThirdParty/Ert/devel/libenkf/applications/ert_tui/enkf_tui_workflow.h
vendored
Normal file
24
ThirdParty/Ert/devel/libenkf/applications/ert_tui/enkf_tui_workflow.h
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
Copyright (C) 2012 Statoil ASA, Norway.
|
||||
|
||||
The file 'enkf_tui_workflow.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_TUI_WORKFLOW_H__
|
||||
#define __ENKF_TUI_WORKFLOW_H__
|
||||
|
||||
void enkf_tui_workflow_menu(void *);
|
||||
|
||||
#endif
|
||||
@@ -19,6 +19,9 @@
|
||||
#include <ert/util/stringlist.h>
|
||||
|
||||
#include <ert/enkf/enkf_main.h>
|
||||
#include <ert/enkf/enkf_fs.h>
|
||||
#include <ert/enkf/time_map.h>
|
||||
#include <ert/enkf/ensemble_config.h>
|
||||
|
||||
#include <enkf_tui_plot.h>
|
||||
|
||||
@@ -34,3 +37,26 @@ void enkf_tui_plot_all_summary_JOB(void * self , const stringlist_type * args )
|
||||
enkf_tui_plot_all_summary__( enkf_main , iens1 , iens2 , step1 , step2 , prediction_mode );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void enkf_tui_plot_JOB(void * self , const stringlist_type * args ) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( self );
|
||||
enkf_fs_type * enkf_fs = enkf_main_get_fs( enkf_main );
|
||||
time_map_type * time_map = enkf_fs_get_time_map( enkf_fs );
|
||||
ensemble_config_type * ensemble_config = enkf_main_get_ensemble_config( enkf_main );
|
||||
const int step2 = time_map_get_last_step( time_map );
|
||||
const int step1 = 0;
|
||||
int i;
|
||||
|
||||
for (i=0; i < stringlist_get_size( args ); i++) {
|
||||
const char * user_key = stringlist_iget( args , i );
|
||||
char * key_index;
|
||||
enkf_config_node_type * config_node = ensemble_config_user_get_node( ensemble_config , user_key , &key_index);
|
||||
if (config_node != NULL)
|
||||
enkf_tui_plot_ensemble__(enkf_main , config_node , user_key , key_index , step1 , step2 , false , 0 , enkf_main_get_ensemble_size( enkf_main ) , BOTH );
|
||||
|
||||
util_safe_free( key_index );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <ert/enkf/enkf_sched.h>
|
||||
#include <enkf_tui_main.h>
|
||||
|
||||
#define WORKFLOW_OPTION "-wf"
|
||||
|
||||
void text_splash() {
|
||||
const int usleep_time = 1000;
|
||||
@@ -51,22 +52,6 @@ void text_splash() {
|
||||
}
|
||||
|
||||
|
||||
void devel_warning() {
|
||||
#ifdef DEVEL_VERSION
|
||||
printf("\n");
|
||||
printf(" ***************************************************************\n");
|
||||
printf(" ** You have started a development version of ERT. If you are **\n");
|
||||
printf(" ** not an advanced user, it might be better to use a stable **\n");
|
||||
printf(" ** version which has been better tested. The stable version **\n");
|
||||
printf(" ** should be available with the command: **\n");
|
||||
printf(" ** **\n");
|
||||
printf(" ** bash%% ert config_file **\n");
|
||||
printf(" ** **\n");
|
||||
printf(" ***************************************************************\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
GIT_COMMIT and COMPILE_TIME_STAMP are env variables set by the
|
||||
makefile. Will exit if the config file does not exist.
|
||||
@@ -108,7 +93,7 @@ void enkf_usage() {
|
||||
|
||||
|
||||
|
||||
static void init_debug( const char * executable ) {
|
||||
static void init_debug( const char * argv0) {
|
||||
char * git_commit = util_alloc_sprintf("git commit...........: %s \n",GIT_COMMIT);
|
||||
char * compile_time = util_alloc_sprintf("Compile time.........: %s \n",COMPILE_TIME_STAMP);
|
||||
|
||||
@@ -119,39 +104,68 @@ static void init_debug( const char * executable ) {
|
||||
free(git_commit);
|
||||
free(compile_time);
|
||||
|
||||
if (executable != NULL)
|
||||
util_abort_set_executable( executable );
|
||||
util_abort_set_executable( argv0 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void parse_workflows(int argc , char ** argv , stringlist_type * workflows) {
|
||||
bool workflow_on = false;
|
||||
for (int iarg = 2; iarg < argc; iarg++) {
|
||||
stringlist_append_copy( workflows , argv[iarg]);
|
||||
|
||||
/*if (strcmp( argv[iarg] , WORKFLOW_OPTION) == 0)
|
||||
workflow_on = true;
|
||||
else {
|
||||
if (workflow_on)
|
||||
stringlist_append_copy( workflows , argv[iarg]);
|
||||
else
|
||||
fprintf(stderr,"**Warning - option:\'%s\' ignored\n",argv[iarg]);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int main (int argc , char ** argv) {
|
||||
devel_warning();
|
||||
text_splash();
|
||||
init_debug( NULL );
|
||||
init_debug( argv[0] );
|
||||
printf("\n");
|
||||
printf("Documentation : %s \n","http://ert.nr.no");
|
||||
printf("git commit : %s \n",GIT_COMMIT);
|
||||
printf("compile time : %s \n",COMPILE_TIME_STAMP);
|
||||
printf("site config : %s \n\n",SITE_CONFIG_FILE);
|
||||
printf("site config : %s \n",SITE_CONFIG_FILE);
|
||||
|
||||
enkf_main_install_SIGNALS(); /* Signals common to both tui and gui. */
|
||||
signal(SIGINT , util_abort_signal); /* Control C - tui only. */
|
||||
if (argc != 2) {
|
||||
if (argc < 2) {
|
||||
enkf_usage();
|
||||
exit(1);
|
||||
} else {
|
||||
const char * site_config_file = SITE_CONFIG_FILE; /* The variable SITE_CONFIG_FILE should be defined on compilation ... */
|
||||
const char * model_config_file = argv[1];
|
||||
stringlist_type * workflow_list = stringlist_alloc_new();
|
||||
|
||||
parse_workflows( argc , argv , workflow_list );
|
||||
if ( !(util_entry_readable(model_config_file) && util_is_file(model_config_file)) )
|
||||
util_exit("Can not read file %s - exiting \n", model_config_file);
|
||||
|
||||
{
|
||||
char * abs_config = util_alloc_realpath( model_config_file );
|
||||
printf("model config : %s \n\n", abs_config);
|
||||
}
|
||||
enkf_welcome( model_config_file );
|
||||
{
|
||||
enkf_main_type * enkf_main = enkf_main_bootstrap(site_config_file , model_config_file , true , true);
|
||||
enkf_main_run_workflows( enkf_main , workflow_list );
|
||||
enkf_tui_main_menu(enkf_main);
|
||||
enkf_main_free(enkf_main);
|
||||
}
|
||||
|
||||
|
||||
stringlist_free( workflow_list );
|
||||
util_abort_free_version_info(); /* No fucking leaks ... */
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -268,7 +268,11 @@ int main (int argc , char ** argv) {
|
||||
ecl_sum_type * refcase;
|
||||
{
|
||||
config_type * config = create_config();
|
||||
config_parse( config , model_config_file , "--" , "INCLUDE" , "DEFINE" , false , true );
|
||||
if (!config_parse( config , model_config_file , "--" , "INCLUDE" , "DEFINE" , CONFIG_UNRECOGNIZED_IGNORE , true )) {
|
||||
config_fprintf_erors( config , stderr );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
{
|
||||
char * path;
|
||||
util_alloc_file_components(model_config_file , &path , NULL , NULL);
|
||||
|
||||
Reference in New Issue
Block a user