예제 #1
0
#  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 ctypes
from ert.cwrap import create_enum, CClass, CWrapper, CWrapperNameSpace

from ert.job_queue import JOB_QUEUE_LIB, Job

QueueDriverEnum = create_enum(JOB_QUEUE_LIB, "queue_driver_type_enum_iget",
                              "QueueDriverEnum")


class Driver(CClass):
    def __init__(self, driver_type, max_running=1, options=None):
        """
        Creates a new driver instance
        """
        c_ptr = cfunc.alloc_driver(driver_type)
        self.init_cobj(c_ptr, cfunc.free_driver)
        if options:
            for (key, value) in options:
                self.set_option(key, value)
        self.set_max_running(max_running)

    def set_option(self, option, value):
예제 #2
0
파일: ecl_util.py 프로젝트: jonerduarte/ert
EclFileEnum.addEnum("ECL_RESTART_FILE", 1)
EclFileEnum.addEnum("ECL_UNIFIED_RESTART_FILE", 2)
EclFileEnum.addEnum("ECL_SUMMARY_FILE", 4)
EclFileEnum.addEnum("ECL_UNIFIED_SUMMARY_FILE", 8)
EclFileEnum.addEnum("ECL_SUMMARY_HEADER_FILE", 16)
EclFileEnum.addEnum("ECL_GRID_FILE", 32)
EclFileEnum.addEnum("ECL_EGRID_FILE", 64)
EclFileEnum.addEnum("ECL_INIT_FILE", 128)
EclFileEnum.addEnum("ECL_RFT_FILE", 256)
EclFileEnum.addEnum("ECL_DATA_FILE", 512)

EclFileEnum.registerEnum(ECL_LIB, "ecl_file_enum")


# ecl_phase_enum from ecl_util.h
EclPhaseEnum = create_enum(ECL_LIB, "ecl_util_phase_enum_iget", "ecl_phase_enum")

# ecl_type_enum defintion from ecl_util.h
EclTypeEnum = create_enum(ECL_LIB, "ecl_util_type_enum_iget", "ecl_type_enum")

# ecl_file_flag_type defintion from ecl_file.h
EclFileFlagEnum = create_enum(ECL_LIB, "ecl_util_file_flags_enum_iget", "ecl_file_flag_enum")


cwrapper = CWrapper(ECL_LIB)
cfunc = CWrapperNameSpace("ecl_util")

cfunc.get_num_cpu = cwrapper.prototype("int ecl_util_get_num_cpu( char* )")
cfunc.get_file_type = cwrapper.prototype("ecl_file_enum ecl_util_get_file_type( char* , bool* , int*)")
cfunc.get_type_name = cwrapper.prototype("char* ecl_util_get_type_name( int )")
cfunc.get_start_date = cwrapper.prototype("time_t ecl_util_get_start_date( char* )")
예제 #3
0
파일: driver.py 프로젝트: akva2/ert
#   
#  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 ctypes
from ert.cwrap import create_enum, CClass, CWrapper, CWrapperNameSpace

from ert.job_queue import JOB_QUEUE_LIB, Job


QueueDriverEnum = create_enum(JOB_QUEUE_LIB, "queue_driver_type_enum_iget", "QueueDriverEnum")


class Driver(CClass):
    def __init__( self, driver_type, max_running=1, options=None):
        """
        Creates a new driver instance
        """
        c_ptr = cfunc.alloc_driver(driver_type)
        self.init_cobj(c_ptr, cfunc.free_driver)
        if options:
            for (key, value) in options:
                self.set_option(key, value)
        self.set_max_running(max_running)

예제 #4
0
Constants from the header ecl_util.h - some stateless functions.

This module does not contain any class definitions; it mostly consists
of enum definitions/values from ecl_util.h; the enum values are
extracted from the shared library using the
ert.cwrap.cenum.create_enum() function in a semi-automagic manner.

In addition to the enum definitions there are a few stateless
functions from ecl_util.c which are not bound to any class type.
"""
from ert.cwrap import create_enum, CWrapper, CWrapperNameSpace

from ert.ecl import ECL_LIB

# ecl_file_enum from ecl_util.h
EclFileEnum = create_enum(ECL_LIB, "ecl_util_file_enum_iget", "ecl_file_enum")

# ecl_phase_enum from ecl_util.h
EclPhaseEnum = create_enum(ECL_LIB, "ecl_util_phase_enum_iget",
                           "ecl_phase_enum")

# ecl_type_enum defintion from ecl_util.h
EclTypeEnum = create_enum(ECL_LIB, "ecl_util_type_enum_iget", "ecl_type_enum")

# ecl_file_flag_type defintion from ecl_file.h
EclFileFlagEnum = create_enum(ECL_LIB, "ecl_util_file_flags_enum_iget",
                              "ecl_file_flag_enum")

cwrapper = CWrapper(ECL_LIB)
cfunc = CWrapperNameSpace("ecl_util")