How to use the ecl.ecl.EclPrototype function in ecl

To help you get started, we’ve selected a few ecl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OPM / ResInsight / ThirdParty / Ert / python / python / ecl / ecl / ecl_subsidence.py View on Github external
Holding ECLIPSE results for calculating subsidence changes.

    The EclSubsidence class is a collection class holding the results from
    ECLIPSE forward modelling of subsidence surveys. Observe that the
    class is focused on the ECLIPSE side of things, and does not have
    any notion of observed values or measurement locations; that
    should be handled by the scope using the EclSubsidence class.

    Typical use of the EclSubsidence class involves the following steps:

      1. Create the EclSubsidence instance.
      2. Add surveys with the add_survey_XXXX() methods.
      3. Evalute the subsidence response with the eval() method.
    """
    TYPE_NAME = "ecl_subsidence"
    _alloc               = EclPrototype("void* ecl_subsidence_alloc( ecl_grid , ecl_file )" , bind = False)
    _free                = EclPrototype("void ecl_subsidence_free( ecl_subsidence )")
    _add_survey_PRESSURE = EclPrototype("void*  ecl_subsidence_add_survey_PRESSURE( ecl_subsidence , char* , ecl_file_view )")
    _eval                = EclPrototype("double ecl_subsidence_eval( ecl_subsidence , char* , char* , ecl_region , double , double , double, double, double)")
    _eval_geertsma       = EclPrototype("double ecl_subsidence_eval_geertsma( ecl_subsidence , char* , char* , ecl_region , double , double , double, double, double, double)")
    _has_survey          = EclPrototype("bool  ecl_subsidence_has_survey( ecl_subsidence , char*)")

    def __init__( self, grid, init_file ):
        """
        Creates a new EclSubsidence instance.

        The input arguments @grid and @init_file should be instances
        of EclGrid and EclFile respectively.
        """
        self.init_file = init_file   # Inhibit premature garbage collection of init_file
        c_ptr = self._alloc( grid , init_file )
        super( EclSubsidence , self ).__init__( c_ptr )
github OPM / ResInsight / ThirdParty / Ert / python / python / ecl / ecl / ecl_grav.py View on Github external
class is focused on the ECLIPSE side of things, and does not have
    any notion of observed values or measurement locations; that
    should be handled by the scope using the EclGrav class.

    Typical use of the EclGrav class involves the following steps:

      1. Create the EclGrav instance.
      2. Add surveys with the add_survey_XXXX() methods.
      3. Evalute the gravitational response with the eval() method.
    """
    TYPE_NAME = "ecl_grav"
    _grav_alloc = EclPrototype("void* ecl_grav_alloc(ecl_grid, ecl_file)", bind=False)
    _free = EclPrototype("void ecl_grav_free(ecl_grav)")
    _add_survey_RPORV = EclPrototype("void*  ecl_grav_add_survey_RPORV(ecl_grav, char*, ecl_file_view)")
    _add_survey_PORMOD = EclPrototype("void*  ecl_grav_add_survey_PORMOD(ecl_grav, char*, ecl_file_view)")
    _add_survey_FIP = EclPrototype("void*  ecl_grav_add_survey_FIP(ecl_grav, char*, ecl_file_view)")
    _add_survey_RFIP = EclPrototype("void*  ecl_grav_add_survey_RFIP(ecl_grav, char*, ecl_file_view)")
    _new_std_density = EclPrototype("void ecl_grav_new_std_density(ecl_grav, int, double)")
    _add_std_density = EclPrototype("void ecl_grav_add_std_density(ecl_grav, int, int, double)")
    _eval = EclPrototype("double ecl_grav_eval(ecl_grav, char*, char*, ecl_region, double, double, double, int)")



    def __init__(self, grid, init_file):
        """
        Creates a new EclGrav instance.

        The input arguments @grid and @init_file should be instances
        of EclGrid and EclFile respectively.
        """
        self.init_file = init_file   # Inhibit premature garbage collection of init_file
github OPM / ResInsight / ThirdParty / Ert / python / python / ecl / ecl / ecl_type.py View on Github external
EclTypeEnum.addEnum("ECL_FLOAT_TYPE" , 1 )
EclTypeEnum.addEnum("ECL_DOUBLE_TYPE" , 2 )
EclTypeEnum.addEnum("ECL_INT_TYPE" , 3 )
EclTypeEnum.addEnum("ECL_BOOL_TYPE" , 4 )
EclTypeEnum.addEnum("ECL_MESS_TYPE" , 5 )
EclTypeEnum.addEnum("ECL_STRING_TYPE" , 7 )

#-----------------------------------------------------------------

class EclDataType(BaseCClass):

    TYPE_NAME = "ecl_data_type"

    _alloc            = EclPrototype("void* ecl_type_alloc_python(ecl_type_enum, size_t)", bind=False)
    _alloc_from_type  = EclPrototype("void* ecl_type_alloc_from_type_python(ecl_type_enum)", bind=False)
    _alloc_from_name  = EclPrototype("void* ecl_type_alloc_from_name_python(char*)", bind = False)
    _free             = EclPrototype("void ecl_type_free_python(ecl_data_type)")
    _get_type         = EclPrototype("ecl_type_enum ecl_type_get_type_python(ecl_data_type)")
    _get_element_size = EclPrototype("size_t ecl_type_get_sizeof_ctype_fortio_python(ecl_data_type)")
    _is_int           = EclPrototype("bool ecl_type_is_int_python(ecl_data_type)")
    _is_char          = EclPrototype("bool ecl_type_is_char_python(ecl_data_type)")
    _is_float         = EclPrototype("bool ecl_type_is_float_python(ecl_data_type)")
    _is_double        = EclPrototype("bool ecl_type_is_double_python(ecl_data_type)")
    _is_mess          = EclPrototype("bool ecl_type_is_mess_python(ecl_data_type)")
    _is_bool          = EclPrototype("bool ecl_type_is_bool_python(ecl_data_type)")
    _is_string        = EclPrototype("bool ecl_type_is_string_python(ecl_data_type)")
    _get_name         = EclPrototype("char* ecl_type_alloc_name_python(ecl_data_type)")
    _is_numeric       = EclPrototype("bool ecl_type_is_numeric_python(ecl_data_type)")
    _is_equal         = EclPrototype("bool ecl_type_is_equal_python(ecl_data_type, ecl_data_type)")

    def __init__(self, type_enum = None, element_size = None, type_name = None):
        self._assert_valid_arguments(type_enum, element_size, type_name)
github OPM / ResInsight / ThirdParty / Ert / python / python / ecl / ecl / ecl_type.py View on Github external
EclTypeEnum.addEnum("ECL_INT_TYPE" , 3 )
EclTypeEnum.addEnum("ECL_BOOL_TYPE" , 4 )
EclTypeEnum.addEnum("ECL_MESS_TYPE" , 5 )
EclTypeEnum.addEnum("ECL_STRING_TYPE" , 7 )

#-----------------------------------------------------------------

class EclDataType(BaseCClass):

    TYPE_NAME = "ecl_data_type"

    _alloc            = EclPrototype("void* ecl_type_alloc_python(ecl_type_enum, size_t)", bind=False)
    _alloc_from_type  = EclPrototype("void* ecl_type_alloc_from_type_python(ecl_type_enum)", bind=False)
    _alloc_from_name  = EclPrototype("void* ecl_type_alloc_from_name_python(char*)", bind = False)
    _free             = EclPrototype("void ecl_type_free_python(ecl_data_type)")
    _get_type         = EclPrototype("ecl_type_enum ecl_type_get_type_python(ecl_data_type)")
    _get_element_size = EclPrototype("size_t ecl_type_get_sizeof_ctype_fortio_python(ecl_data_type)")
    _is_int           = EclPrototype("bool ecl_type_is_int_python(ecl_data_type)")
    _is_char          = EclPrototype("bool ecl_type_is_char_python(ecl_data_type)")
    _is_float         = EclPrototype("bool ecl_type_is_float_python(ecl_data_type)")
    _is_double        = EclPrototype("bool ecl_type_is_double_python(ecl_data_type)")
    _is_mess          = EclPrototype("bool ecl_type_is_mess_python(ecl_data_type)")
    _is_bool          = EclPrototype("bool ecl_type_is_bool_python(ecl_data_type)")
    _is_string        = EclPrototype("bool ecl_type_is_string_python(ecl_data_type)")
    _get_name         = EclPrototype("char* ecl_type_alloc_name_python(ecl_data_type)")
    _is_numeric       = EclPrototype("bool ecl_type_is_numeric_python(ecl_data_type)")
    _is_equal         = EclPrototype("bool ecl_type_is_equal_python(ecl_data_type, ecl_data_type)")

    def __init__(self, type_enum = None, element_size = None, type_name = None):
        self._assert_valid_arguments(type_enum, element_size, type_name)

        if type_name:
github OPM / ResInsight / ThirdParty / Ert / python / python / ecl / ecl / ecl_rft.py View on Github external
In addition to the measurements specific for RFT and PLT each cell
    has coordinates, pressure and depth.
    """
    TYPE_NAME = "ecl_rft"
    _alloc            = EclPrototype("void* ecl_rft_node_alloc_new( char* , char* , time_t , double)" , bind = False)
    _free             = EclPrototype("void  ecl_rft_node_free( ecl_rft )")
    _get_type         = EclPrototype("int    ecl_rft_node_get_type( ecl_rft )")
    _get_well         = EclPrototype("char*  ecl_rft_node_get_well_name( ecl_rft )")
    _get_date         = EclPrototype("time_t ecl_rft_node_get_date( ecl_rft )")
    _get_size         = EclPrototype("int ecl_rft_node_get_size( ecl_rft )")
    _iget_cell        = EclPrototype("void* ecl_rft_node_iget_cell( ecl_rft )")
    _iget_cell_sorted = EclPrototype("void* ecl_rft_node_iget_cell_sorted( ecl_rft )")
    _sort_cells       = EclPrototype("void* ecl_rft_node_inplace_sort_cells( ecl_rft )")
    _iget_depth       = EclPrototype("double ecl_rft_node_iget_depth( ecl_rft )")
    _iget_pressure    = EclPrototype("double ecl_rft_node_iget_pressure(ecl_rft)")
    _iget_ijk         = EclPrototype("void ecl_rft_node_iget_ijk( ecl_rft , int , int*, int*, int*)")
    _iget_swat        = EclPrototype("double ecl_rft_node_iget_swat(ecl_rft)")
    _iget_sgas        = EclPrototype("double ecl_rft_node_iget_sgas(ecl_rft)")
    _iget_orat        = EclPrototype("double ecl_rft_node_iget_orat(ecl_rft)")
    _iget_wrat        = EclPrototype("double ecl_rft_node_iget_wrat(ecl_rft)")
    _iget_grat        = EclPrototype("double ecl_rft_node_iget_grat(ecl_rft)")
    _lookup_ijk       = EclPrototype("void* ecl_rft_node_lookup_ijk( ecl_rft , int , int , int)")
    _is_RFT           = EclPrototype("bool   ecl_rft_node_is_RFT( ecl_rft )")
    _is_PLT           = EclPrototype("bool   ecl_rft_node_is_PLT( ecl_rft )")
    _is_SEGMENT       = EclPrototype("bool   ecl_rft_node_is_SEGMENT( ecl_rft )")
    _is_MSW           = EclPrototype("bool   ecl_rft_node_is_MSW( ecl_rft )")


    def __init__(self , name , type_string , date , days):
        c_ptr = self._alloc( name , type_string , CTime( date ) , days )
        super(EclRFT , self).__init__( c_ptr )
github OPM / ResInsight / ThirdParty / Ert / python / python / ecl / ecl / ecl_type.py View on Github external
EclTypeEnum.addEnum("ECL_MESS_TYPE" , 5 )
EclTypeEnum.addEnum("ECL_STRING_TYPE" , 7 )

#-----------------------------------------------------------------

class EclDataType(BaseCClass):

    TYPE_NAME = "ecl_data_type"

    _alloc            = EclPrototype("void* ecl_type_alloc_python(ecl_type_enum, size_t)", bind=False)
    _alloc_from_type  = EclPrototype("void* ecl_type_alloc_from_type_python(ecl_type_enum)", bind=False)
    _alloc_from_name  = EclPrototype("void* ecl_type_alloc_from_name_python(char*)", bind = False)
    _free             = EclPrototype("void ecl_type_free_python(ecl_data_type)")
    _get_type         = EclPrototype("ecl_type_enum ecl_type_get_type_python(ecl_data_type)")
    _get_element_size = EclPrototype("size_t ecl_type_get_sizeof_ctype_fortio_python(ecl_data_type)")
    _is_int           = EclPrototype("bool ecl_type_is_int_python(ecl_data_type)")
    _is_char          = EclPrototype("bool ecl_type_is_char_python(ecl_data_type)")
    _is_float         = EclPrototype("bool ecl_type_is_float_python(ecl_data_type)")
    _is_double        = EclPrototype("bool ecl_type_is_double_python(ecl_data_type)")
    _is_mess          = EclPrototype("bool ecl_type_is_mess_python(ecl_data_type)")
    _is_bool          = EclPrototype("bool ecl_type_is_bool_python(ecl_data_type)")
    _is_string        = EclPrototype("bool ecl_type_is_string_python(ecl_data_type)")
    _get_name         = EclPrototype("char* ecl_type_alloc_name_python(ecl_data_type)")
    _is_numeric       = EclPrototype("bool ecl_type_is_numeric_python(ecl_data_type)")
    _is_equal         = EclPrototype("bool ecl_type_is_equal_python(ecl_data_type, ecl_data_type)")

    def __init__(self, type_enum = None, element_size = None, type_name = None):
        self._assert_valid_arguments(type_enum, element_size, type_name)

        if type_name:
            c_ptr = self._alloc_from_name(type_name)
        elif element_size is None:
github OPM / ResInsight / ThirdParty / Ert / python / python / ecl / ecl / faults / fault_block_layer.py View on Github external
from ecl.util import monkey_the_camel
from ecl.ecl import EclDataType, EclPrototype
from ecl.ecl.faults import Fault

class FaultBlockLayer(BaseCClass):
    TYPE_NAME = "fault_block_layer"
    _alloc                = EclPrototype("void*           fault_block_layer_alloc(ecl_grid,  int)", bind = False)
    _free                 = EclPrototype("void            fault_block_layer_free(fault_block_layer)")
    _size                 = EclPrototype("int             fault_block_layer_get_size(fault_block_layer)")
    _iget_block           = EclPrototype("fault_block_ref fault_block_layer_iget_block(fault_block_layer, int)")
    _add_block            = EclPrototype("fault_block_ref fault_block_layer_add_block(fault_block_layer, int)")
    _get_block            = EclPrototype("fault_block_ref fault_block_layer_get_block(fault_block_layer, int)")
    _del_block            = EclPrototype("void            fault_block_layer_del_block(fault_block_layer, int)")
    _has_block            = EclPrototype("bool            fault_block_layer_has_block(fault_block_layer, int)")
    _scan_keyword         = EclPrototype("bool            fault_block_layer_scan_kw(fault_block_layer, ecl_kw)")
    _load_keyword         = EclPrototype("bool            fault_block_layer_load_kw(fault_block_layer, ecl_kw)")
    _getK                 = EclPrototype("int             fault_block_layer_get_k(fault_block_layer)")
    _get_next_id          = EclPrototype("int             fault_block_layer_get_next_id(fault_block_layer)")
    _scan_layer           = EclPrototype("void            fault_block_layer_scan_layer(fault_block_layer, layer)")
    _insert_block_content = EclPrototype("void            fault_block_layer_insert_block_content(fault_block_layer, fault_block)")
    _export_kw            = EclPrototype("bool            fault_block_layer_export(fault_block_layer, ecl_kw)")
    _get_layer            = EclPrototype("layer_ref       fault_block_layer_get_layer(fault_block_layer)")


    def __init__(self, grid, k):
        c_ptr = self._alloc(grid, k)
        if c_ptr:
            super(FaultBlockLayer, self).__init__(c_ptr)
        else:
            raise ValueError("Invalid input - failed to create FaultBlockLayer")

        # The underlying C implementation uses lazy evaluation and
github OPM / ResInsight / ThirdParty / Ert / python / python / ecl / ecl / ecl_rft.py View on Github external
_iget_cell        = EclPrototype("void* ecl_rft_node_iget_cell( ecl_rft )")
    _iget_cell_sorted = EclPrototype("void* ecl_rft_node_iget_cell_sorted( ecl_rft )")
    _sort_cells       = EclPrototype("void* ecl_rft_node_inplace_sort_cells( ecl_rft )")
    _iget_depth       = EclPrototype("double ecl_rft_node_iget_depth( ecl_rft )")
    _iget_pressure    = EclPrototype("double ecl_rft_node_iget_pressure(ecl_rft)")
    _iget_ijk         = EclPrototype("void ecl_rft_node_iget_ijk( ecl_rft , int , int*, int*, int*)")
    _iget_swat        = EclPrototype("double ecl_rft_node_iget_swat(ecl_rft)")
    _iget_sgas        = EclPrototype("double ecl_rft_node_iget_sgas(ecl_rft)")
    _iget_orat        = EclPrototype("double ecl_rft_node_iget_orat(ecl_rft)")
    _iget_wrat        = EclPrototype("double ecl_rft_node_iget_wrat(ecl_rft)")
    _iget_grat        = EclPrototype("double ecl_rft_node_iget_grat(ecl_rft)")
    _lookup_ijk       = EclPrototype("void* ecl_rft_node_lookup_ijk( ecl_rft , int , int , int)")
    _is_RFT           = EclPrototype("bool   ecl_rft_node_is_RFT( ecl_rft )")
    _is_PLT           = EclPrototype("bool   ecl_rft_node_is_PLT( ecl_rft )")
    _is_SEGMENT       = EclPrototype("bool   ecl_rft_node_is_SEGMENT( ecl_rft )")
    _is_MSW           = EclPrototype("bool   ecl_rft_node_is_MSW( ecl_rft )")


    def __init__(self , name , type_string , date , days):
        c_ptr = self._alloc( name , type_string , CTime( date ) , days )
        super(EclRFT , self).__init__( c_ptr )


    def free(self):
        self._free( )

    def __repr__(self):
        rs = []
        rs.append('completed_cells = %d' % len(self))
        rs.append('date = %s' % self.getDate())
        if self.is_RFT():
            rs.append('RFT')
github OPM / ResInsight / ThirdParty / Ert / python / python / ecl / ecl / ecl_rft.py View on Github external
TYPE_NAME = "ecl_rft"
    _alloc            = EclPrototype("void* ecl_rft_node_alloc_new( char* , char* , time_t , double)" , bind = False)
    _free             = EclPrototype("void  ecl_rft_node_free( ecl_rft )")
    _get_type         = EclPrototype("int    ecl_rft_node_get_type( ecl_rft )")
    _get_well         = EclPrototype("char*  ecl_rft_node_get_well_name( ecl_rft )")
    _get_date         = EclPrototype("time_t ecl_rft_node_get_date( ecl_rft )")
    _get_size         = EclPrototype("int ecl_rft_node_get_size( ecl_rft )")
    _iget_cell        = EclPrototype("void* ecl_rft_node_iget_cell( ecl_rft )")
    _iget_cell_sorted = EclPrototype("void* ecl_rft_node_iget_cell_sorted( ecl_rft )")
    _sort_cells       = EclPrototype("void* ecl_rft_node_inplace_sort_cells( ecl_rft )")
    _iget_depth       = EclPrototype("double ecl_rft_node_iget_depth( ecl_rft )")
    _iget_pressure    = EclPrototype("double ecl_rft_node_iget_pressure(ecl_rft)")
    _iget_ijk         = EclPrototype("void ecl_rft_node_iget_ijk( ecl_rft , int , int*, int*, int*)")
    _iget_swat        = EclPrototype("double ecl_rft_node_iget_swat(ecl_rft)")
    _iget_sgas        = EclPrototype("double ecl_rft_node_iget_sgas(ecl_rft)")
    _iget_orat        = EclPrototype("double ecl_rft_node_iget_orat(ecl_rft)")
    _iget_wrat        = EclPrototype("double ecl_rft_node_iget_wrat(ecl_rft)")
    _iget_grat        = EclPrototype("double ecl_rft_node_iget_grat(ecl_rft)")
    _lookup_ijk       = EclPrototype("void* ecl_rft_node_lookup_ijk( ecl_rft , int , int , int)")
    _is_RFT           = EclPrototype("bool   ecl_rft_node_is_RFT( ecl_rft )")
    _is_PLT           = EclPrototype("bool   ecl_rft_node_is_PLT( ecl_rft )")
    _is_SEGMENT       = EclPrototype("bool   ecl_rft_node_is_SEGMENT( ecl_rft )")
    _is_MSW           = EclPrototype("bool   ecl_rft_node_is_MSW( ecl_rft )")


    def __init__(self , name , type_string , date , days):
        c_ptr = self._alloc( name , type_string , CTime( date ) , days )
        super(EclRFT , self).__init__( c_ptr )


    def free(self):
        self._free( )
github OPM / ResInsight / ThirdParty / Ert / python / python / ecl / ecl / faults / fault_block_layer.py View on Github external
TYPE_NAME = "fault_block_layer"
    _alloc                = EclPrototype("void*           fault_block_layer_alloc(ecl_grid,  int)", bind = False)
    _free                 = EclPrototype("void            fault_block_layer_free(fault_block_layer)")
    _size                 = EclPrototype("int             fault_block_layer_get_size(fault_block_layer)")
    _iget_block           = EclPrototype("fault_block_ref fault_block_layer_iget_block(fault_block_layer, int)")
    _add_block            = EclPrototype("fault_block_ref fault_block_layer_add_block(fault_block_layer, int)")
    _get_block            = EclPrototype("fault_block_ref fault_block_layer_get_block(fault_block_layer, int)")
    _del_block            = EclPrototype("void            fault_block_layer_del_block(fault_block_layer, int)")
    _has_block            = EclPrototype("bool            fault_block_layer_has_block(fault_block_layer, int)")
    _scan_keyword         = EclPrototype("bool            fault_block_layer_scan_kw(fault_block_layer, ecl_kw)")
    _load_keyword         = EclPrototype("bool            fault_block_layer_load_kw(fault_block_layer, ecl_kw)")
    _getK                 = EclPrototype("int             fault_block_layer_get_k(fault_block_layer)")
    _get_next_id          = EclPrototype("int             fault_block_layer_get_next_id(fault_block_layer)")
    _scan_layer           = EclPrototype("void            fault_block_layer_scan_layer(fault_block_layer, layer)")
    _insert_block_content = EclPrototype("void            fault_block_layer_insert_block_content(fault_block_layer, fault_block)")
    _export_kw            = EclPrototype("bool            fault_block_layer_export(fault_block_layer, ecl_kw)")
    _get_layer            = EclPrototype("layer_ref       fault_block_layer_get_layer(fault_block_layer)")


    def __init__(self, grid, k):
        c_ptr = self._alloc(grid, k)
        if c_ptr:
            super(FaultBlockLayer, self).__init__(c_ptr)
        else:
            raise ValueError("Invalid input - failed to create FaultBlockLayer")

        # The underlying C implementation uses lazy evaluation and
        # needs to hold on to the grid reference. We therefor take
        # references to it here, to protect against premature garbage
        # collection.
        self.grid_ref = grid