How to use the 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 equinor / libecl / python / ecl / summary / ecl_sum.py View on Github external
_check_sim_time                = EclPrototype("bool     ecl_sum_check_sim_time(ecl_sum, time_t)")
    _check_sim_days                = EclPrototype("bool     ecl_sum_check_sim_days(ecl_sum, double)")
    _sim_length                    = EclPrototype("double   ecl_sum_get_sim_length(ecl_sum)")
    _get_first_day                 = EclPrototype("double   ecl_sum_get_first_day(ecl_sum)")
    _get_data_start                = EclPrototype("time_t   ecl_sum_get_data_start(ecl_sum)")
    _get_unit                      = EclPrototype("char*    ecl_sum_get_unit(ecl_sum, char*)")
    _get_restart_case              = EclPrototype("ecl_sum_ref ecl_sum_get_restart_case(ecl_sum)")
    _get_restart_step              = EclPrototype("int      ecl_sum_get_restart_step(ecl_sum)")
    _get_simcase                   = EclPrototype("char*    ecl_sum_get_case(ecl_sum)")
    _get_unit_system               = EclPrototype("ecl_unit_enum ecl_sum_get_unit_system(ecl_sum)")
    _get_base                      = EclPrototype("char*    ecl_sum_get_base(ecl_sum)")
    _get_path                      = EclPrototype("char*    ecl_sum_get_path(ecl_sum)")
    _get_abs_path                  = EclPrototype("char*    ecl_sum_get_abs_path(ecl_sum)")
    _get_report_step_from_time     = EclPrototype("int      ecl_sum_get_report_step_from_time(ecl_sum, time_t)")
    _get_report_step_from_days     = EclPrototype("int      ecl_sum_get_report_step_from_days(ecl_sum, double)")
    _get_report_time               = EclPrototype("time_t   ecl_sum_get_report_time(ecl_sum, int)")
    _fwrite_sum                    = EclPrototype("void     ecl_sum_fwrite(ecl_sum)")
    _can_write                     = EclPrototype("bool     ecl_sum_can_write(ecl_sum)")
    _set_case                      = EclPrototype("void     ecl_sum_set_case(ecl_sum, char*)")
    _alloc_time_vector             = EclPrototype("time_t_vector_obj ecl_sum_alloc_time_vector(ecl_sum, bool)")
    _alloc_data_vector             = EclPrototype("double_vector_obj ecl_sum_alloc_data_vector(ecl_sum, int, bool)")
    _get_var_node                  = EclPrototype("smspec_node_ref ecl_sum_get_general_var_node(ecl_sum, char*)")
    _create_well_list              = EclPrototype("stringlist_obj ecl_sum_alloc_well_list(ecl_sum, char*)")
    _create_group_list             = EclPrototype("stringlist_obj ecl_sum_alloc_group_list(ecl_sum, char*)")
    _add_variable                  = EclPrototype("smspec_node_ref   ecl_sum_add_var(ecl_sum, char*, char*, int, char*, double)")
    _add_tstep                     = EclPrototype("ecl_sum_tstep_ref ecl_sum_add_tstep(ecl_sum, int, double)")
    _export_csv                    = EclPrototype("void ecl_sum_export_csv(ecl_sum, char*, stringlist, char*, char*)")
    _identify_var_type             = EclPrototype("ecl_sum_var_type ecl_sum_identify_var_type(char*)", bind = False)
    _is_rate                       = EclPrototype("bool smspec_node_identify_rate(char*)", bind = False)
    _is_total                      = EclPrototype("bool smspec_node_identify_total(char*, ecl_sum_var_type)", bind = False)
    _get_last_value                = EclPrototype("double ecl_sum_get_last_value_gen_key(ecl_sum, char*)")
    _get_first_value               = EclPrototype("double ecl_sum_get_first_value_gen_key(ecl_sum, char*)")
github equinor / libecl / python / ecl / util / util / stringlist.py View on Github external
from __future__ import absolute_import, division, print_function, unicode_literals
from six import string_types
from ecl import EclPrototype
from cwrap import BaseCClass


class StringList(BaseCClass):
    TYPE_NAME = "stringlist"

    _alloc      = EclPrototype("void* stringlist_alloc_new( )", bind = False)
    _free       = EclPrototype("void stringlist_free(stringlist )")
    _append     = EclPrototype("void stringlist_append_copy(stringlist , char* )")
    _iget       = EclPrototype("char* stringlist_iget(stringlist , int )")
    _front      = EclPrototype("char* stringlist_front( stringlist )")
    _back       = EclPrototype("char* stringlist_back( stringlist )")
    _iget_copy  = EclPrototype("char* stringlist_iget_copy(stringlist, int)")
    _iset       = EclPrototype("void  stringlist_iset_copy( stringlist , int , char* )")
    _get_size   = EclPrototype("int  stringlist_get_size( stringlist )")
    _contains   = EclPrototype("bool stringlist_contains(stringlist , char*)")
    _equal      = EclPrototype("bool stringlist_equal(stringlist , stringlist)")
    _sort       = EclPrototype("void stringlist_python_sort( stringlist , int)")
    _pop        = EclPrototype("char* stringlist_pop(stringlist)")
    _last       = EclPrototype("char* stringlist_get_last(stringlist)")
    _find_first = EclPrototype("int stringlist_find_first(stringlist, char*)")

    def __init__(self, initial=None):
        """
        Creates a new stringlist instance.

        Creates a new stringlist instance. The optional argument
        @initial should be an iterable of strings which will be the
        initial content of the StringList; the content will be copied
github OPM / ResInsight / ThirdParty / Ert / python / ecl / eclfile / ecl_kw.py View on Github external
and all the other datatypes like e.g. ecl_grid and ecl_sum are
    based on collections of ecl_kw instances, and interpreting the
    content of the ecl_kw keywords.

    Many of the special __xxx___() functions have been implemented, so
    that the EclKW class supports both numerical operations and also
    [] based lookup. Many of the methods accept an optional @mask
    argument; this should be a EclRegion instance which can be used to
    limit the operation to a part of the EclKW.
    """

    int_kw_set = set(["PVTNUM", "FIPNUM", "EQLNUM", "FLUXNUM", "MULTNUM", "ACTNUM", "SPECGRID", "REGIONS"])

    TYPE_NAME          = "ecl_kw"
    _alloc_new         = EclPrototype("void* ecl_kw_alloc_python(char*, int, ecl_data_type)", bind = False)
    _fread_alloc       = EclPrototype("ecl_kw_obj ecl_kw_fread_alloc(fortio)", bind = False)
    _load_grdecl       = EclPrototype("ecl_kw_obj ecl_kw_fscanf_alloc_grdecl_dynamic_python(FILE, char*, bool, ecl_data_type)", bind = False)
    _fseek_grdecl      = EclPrototype("bool     ecl_kw_grdecl_fseek_kw(char*, bool, FILE)", bind = False)

    _sub_copy          = EclPrototype("ecl_kw_obj ecl_kw_alloc_sub_copy(ecl_kw, char*, int, int)")
    _copyc             = EclPrototype("ecl_kw_obj ecl_kw_alloc_copy(ecl_kw)")
    _slice_copyc       = EclPrototype("ecl_kw_obj ecl_kw_alloc_slice_copy(ecl_kw, int, int, int)")
    _global_copy       = EclPrototype("ecl_kw_obj ecl_kw_alloc_global_copy(ecl_kw, ecl_kw)")
    _fprintf_grdecl    = EclPrototype("void     ecl_kw_fprintf_grdecl(ecl_kw, FILE)")
    _fprintf_data      = EclPrototype("void     ecl_kw_fprintf_data(ecl_kw, char*, FILE)")

    _get_size          = EclPrototype("int      ecl_kw_get_size(ecl_kw)")
    _get_fortio_size   = EclPrototype("size_t   ecl_kw_fortio_size(ecl_kw)")
    _get_type          = EclPrototype("ecl_type_enum ecl_kw_get_type(ecl_kw)")
    _iget_char_ptr     = EclPrototype("char*    ecl_kw_iget_char_ptr(ecl_kw, int)")
    _iset_char_ptr     = EclPrototype("void     ecl_kw_iset_char_ptr(ecl_kw, int, char*)")
    _iget_string_ptr   = EclPrototype("char*    ecl_kw_iget_string_ptr(ecl_kw, int)")
github equinor / libecl / python / ecl / eclfile / ecl_file_view.py View on Github external
#  WARRANTY; without even the implied warranty of MERCHANTABILITY or
#  FITNESS FOR A PARTICULAR PURPOSE.
#
#  See the GNU General Public License at 
#  for more details.

from __future__ import absolute_import, division, print_function, unicode_literals
from six import string_types
from cwrap import BaseCClass
from ecl.util.util import monkey_the_camel
from ecl.util.util import CTime
from ecl import EclPrototype

class EclFileView(BaseCClass):
    TYPE_NAME             = "ecl_file_view"
    _iget_kw              = EclPrototype("ecl_kw_ref    ecl_file_view_iget_kw( ecl_file_view , int)")
    _iget_named_kw        = EclPrototype("ecl_kw_ref    ecl_file_view_iget_named_kw( ecl_file_view , char* , int)")
    _get_unique_kw        = EclPrototype("char*         ecl_file_view_iget_distinct_kw( ecl_file_view, int )")
    _get_size             = EclPrototype("int           ecl_file_view_get_size( ecl_file_view )")
    _get_num_named_kw     = EclPrototype("int           ecl_file_view_get_num_named_kw( ecl_file_view , char* )")
    _get_unique_size      = EclPrototype("int           ecl_file_view_get_num_distinct_kw( ecl_file_view )")
    _create_block_view    = EclPrototype("ecl_file_view_ref ecl_file_view_add_blockview( ecl_file_view , char*, int )")
    _create_block_view2   = EclPrototype("ecl_file_view_ref ecl_file_view_add_blockview2( ecl_file_view , char*, char*, int )")
    _restart_view         = EclPrototype("ecl_file_view_ref ecl_file_view_add_restart_view( ecl_file_view , int, int, time_t, double )")


    def __init__(self):
        raise NotImplementedError("Can not instantiate directly")


    def __iget(self, index):
        return self._iget_kw(index).setParent(parent=self)
github equinor / libecl / python / ecl / util / util / stringlist.py View on Github external
TYPE_NAME = "stringlist"

    _alloc      = EclPrototype("void* stringlist_alloc_new( )", bind = False)
    _free       = EclPrototype("void stringlist_free(stringlist )")
    _append     = EclPrototype("void stringlist_append_copy(stringlist , char* )")
    _iget       = EclPrototype("char* stringlist_iget(stringlist , int )")
    _front      = EclPrototype("char* stringlist_front( stringlist )")
    _back       = EclPrototype("char* stringlist_back( stringlist )")
    _iget_copy  = EclPrototype("char* stringlist_iget_copy(stringlist, int)")
    _iset       = EclPrototype("void  stringlist_iset_copy( stringlist , int , char* )")
    _get_size   = EclPrototype("int  stringlist_get_size( stringlist )")
    _contains   = EclPrototype("bool stringlist_contains(stringlist , char*)")
    _equal      = EclPrototype("bool stringlist_equal(stringlist , stringlist)")
    _sort       = EclPrototype("void stringlist_python_sort( stringlist , int)")
    _pop        = EclPrototype("char* stringlist_pop(stringlist)")
    _last       = EclPrototype("char* stringlist_get_last(stringlist)")
    _find_first = EclPrototype("int stringlist_find_first(stringlist, char*)")

    def __init__(self, initial=None):
        """
        Creates a new stringlist instance.

        Creates a new stringlist instance. The optional argument
        @initial should be an iterable of strings which will be the
        initial content of the StringList; the content will be copied
        from the initial list:

            S = StringList( initial = ["My" , "name" , "is", "John" , "Doe"] )

        If an element in the @initial argument is not a string the
        TypeError exception will be raised.
github equinor / libecl / python / ecl / util / util / bool_vector.py View on Github external
_idel_block          = EclPrototype("void   bool_vector_idel_block( bool_vector , bool , bool )")
    _idel                = EclPrototype("void   bool_vector_idel( bool_vector , int )")
    _pop                 = EclPrototype("bool   bool_vector_pop( bool_vector )")
    _lshift              = EclPrototype("void   bool_vector_lshift( bool_vector , int )")
    _rshift              = EclPrototype("void   bool_vector_rshift( bool_vector , int )")
    _insert              = EclPrototype("void   bool_vector_insert( bool_vector , int , bool)")
    _fprintf             = EclPrototype("void   bool_vector_fprintf( bool_vector , FILE , char* , char*)")
    _sort                = EclPrototype("void   bool_vector_sort( bool_vector )")
    _rsort               = EclPrototype("void   bool_vector_rsort( bool_vector )")
    _reset               = EclPrototype("void   bool_vector_reset( bool_vector )")
    _set_read_only       = EclPrototype("void   bool_vector_set_read_only( bool_vector , bool )")
    _get_read_only       = EclPrototype("bool   bool_vector_get_read_only( bool_vector )")
    _get_max             = EclPrototype("bool   bool_vector_get_max( bool_vector )")
    _get_min             = EclPrototype("bool   bool_vector_get_min( bool_vector )")
    _get_max_index       = EclPrototype("int    bool_vector_get_max_index( bool_vector , bool)")
    _get_min_index       = EclPrototype("int    bool_vector_get_min_index( bool_vector , bool)")
    _shift               = EclPrototype("void   bool_vector_shift( bool_vector , bool )")
    _scale               = EclPrototype("void   bool_vector_scale( bool_vector , bool )")
    _div                 = EclPrototype("void   bool_vector_div( bool_vector , bool )")
    _inplace_add         = EclPrototype("void   bool_vector_inplace_add( bool_vector , bool_vector )")
    _inplace_mul         = EclPrototype("void   bool_vector_inplace_mul( bool_vector , bool_vector )")
    _assign              = EclPrototype("void   bool_vector_set_all( bool_vector , bool)")
    _memcpy              = EclPrototype("void   bool_vector_memcpy(bool_vector , bool_vector )")
    _set_default         = EclPrototype("void   bool_vector_set_default( bool_vector , bool)")
    _get_default         = EclPrototype("bool   bool_vector_get_default( bool_vector )")
    _element_size        = EclPrototype("int    bool_vector_element_size( bool_vector )")

    _permute             = EclPrototype("void bool_vector_permute(bool_vector, permutation_vector)")
    _sort_perm           = EclPrototype("permutation_vector_obj bool_vector_alloc_sort_perm(bool_vector)")
    _rsort_perm          = EclPrototype("permutation_vector_obj bool_vector_alloc_rsort_perm(bool_vector)")

    _contains            = EclPrototype("bool bool_vector_contains(bool_vector, bool)")
github equinor / libecl / python / ecl / util / util / rng.py View on Github external
#  See the GNU General Public License at 
#  for more details.
import os.path

from cwrap import BaseCClass
from ecl import EclPrototype
from ecl.util.enums import RngInitModeEnum, RngAlgTypeEnum


class RandomNumberGenerator(BaseCClass):
    TYPE_NAME = "rng"

    _rng_alloc = EclPrototype("void* rng_alloc(rng_alg_type_enum, rng_init_mode_enum)" , bind = False)
    _free = EclPrototype("void rng_free(rng)")
    _get_double = EclPrototype("double rng_get_double(rng)")
    _get_int = EclPrototype("int rng_get_int(rng, int)")
    _get_max_int = EclPrototype("uint rng_get_max_int(rng)")
    _state_size = EclPrototype("int rng_state_size(rng)")
    _set_state = EclPrototype("void rng_set_state(rng , char*)")
    _load_state = EclPrototype("void rng_load_state(rng , char*)")
    _save_state = EclPrototype("void rng_save_state(rng , char*)")

    def __init__(self, alg_type=RngAlgTypeEnum.MZRAN, init_mode=RngInitModeEnum.INIT_CLOCK):
        assert isinstance(alg_type, RngAlgTypeEnum)
        assert isinstance(init_mode, RngInitModeEnum)

        c_ptr = self._rng_alloc(alg_type, init_mode)
        super(RandomNumberGenerator, self).__init__(c_ptr)

    def stateSize(self):
        return self._state_size()
github equinor / libecl / python / ecl / eclfile / ecl_file.py View on Github external
from ecl import EclFileEnum
from ecl.eclfile import EclKW, EclFileView


class EclFile(BaseCClass):
    TYPE_NAME = "ecl_file"
    _open                        = EclPrototype("void*       ecl_file_open( char* , int )" , bind = False)
    _get_file_type               = EclPrototype("ecl_file_enum ecl_util_get_file_type( char* , bool* , int*)" , bind = False)
    _writable                    = EclPrototype("bool        ecl_file_writable( ecl_file )")
    _save_kw                     = EclPrototype("void        ecl_file_save_kw( ecl_file , ecl_kw )")
    _close                       = EclPrototype("void        ecl_file_close( ecl_file )")
    _iget_restart_time           = EclPrototype("time_t      ecl_file_iget_restart_sim_date( ecl_file , int )")
    _iget_restart_days           = EclPrototype("double      ecl_file_iget_restart_sim_days( ecl_file , int )")
    _get_restart_index           = EclPrototype("int         ecl_file_get_restart_index( ecl_file , time_t)")
    _get_src_file                = EclPrototype("char*       ecl_file_get_src_file( ecl_file )")
    _replace_kw                  = EclPrototype("void        ecl_file_replace_kw( ecl_file , ecl_kw , ecl_kw , bool)")
    _fwrite                      = EclPrototype("void        ecl_file_fwrite_fortio( ecl_file , fortio , int)")
    _has_report_step             = EclPrototype("bool        ecl_file_has_report_step( ecl_file , int)")
    _has_sim_time                = EclPrototype("bool        ecl_file_has_sim_time( ecl_file , time_t )")
    _get_global_view             = EclPrototype("ecl_file_view_ref ecl_file_get_global_view( ecl_file )")
    _write_index                 = EclPrototype("bool        ecl_file_write_index( ecl_file , char*)")
    _fast_open                   = EclPrototype("void*       ecl_file_fast_open( char* , char* , int )" , bind=False)


    @staticmethod
    def get_filetype(filename):
        fmt_file    = ctypes.c_bool()
        report_step = ctypes.c_int()

        file_type = EclFile._get_file_type( filename , ctypes.byref( fmt_file ) , ctypes.byref(report_step))
        if file_type in [EclFileEnum.ECL_RESTART_FILE , EclFileEnum.ECL_SUMMARY_FILE]:
            report_step = report_step.value
github equinor / libecl / python / ecl / util / geometry / geo_pointset.py View on Github external
#  (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 
#  for more details.
from cwrap import BaseCClass
from ecl import EclPrototype

class GeoPointset(BaseCClass):
    TYPE_NAME = "geo_pointset"

    _alloc      = EclPrototype("void*   geo_pointset_alloc(bool)", bind=False)
    _free       = EclPrototype("void    geo_pointset_free(geo_pointset)")
    #_add_xyz    = EclPrototype("void    geo_pointset_add_xyz(geo_pointset, double, double, double)")
    _get_size   = EclPrototype("int     geo_pointset_get_size(geo_pointset)")
    #_iget_xy    = EclPrototype("void    geo_pointset_iget_xy(geo_pointset, int, double*, double*)")
    #_get_zcoord = EclPrototype("double* geo_pointset_get_zcoord(geo_pointset)")
    _equal      = EclPrototype("bool    geo_pointset_equal(geo_pointset, geo_pointset)")
    _iget_z     = EclPrototype("double  geo_pointset_iget_z(geo_pointset, int)")
    #_iset_z     = EclPrototype("void    geo_pointset_iset_z(geo_pointset, int, double)")
    #_memcpy     = EclPrototype("void    geo_pointset_memcpy(geo_pointset, geo_pointset, bool)")
    #_shift_z    = EclPrototype("void    geo_pointset_shift_z(geo_pointset, double)")
    #_assign_z   = EclPrototype("void    geo_pointset_assign_z(geo_pointset, double)")
    #_scale_z    = EclPrototype("void    geo_pointset_scale_z(geo_pointset, double)")
    #_imul       = EclPrototype("void    geo_pointset_imul(geo_pointset, geo_pointset)")
    #_iadd       = EclPrototype("void    geo_pointset_iadd(geo_pointset, geo_pointset)")
    #_isub       = EclPrototype("void    geo_pointset_isub(geo_pointset, geo_pointset)")
    #_isqrt      = EclPrototype("void    geo_pointset_isqrt(geo_pointset)")
github equinor / libecl / python / ecl / grid / faults / layer.py View on Github external
import ctypes

from ecl.grid import EclGrid
from cwrap import BaseCClass
from ecl.util.util import monkey_the_camel
from ecl.util.util import IntVector
from ecl import EclPrototype


class Layer(BaseCClass):
    TYPE_NAME = "layer"
    _alloc              = EclPrototype("void* layer_alloc(int,  int)", bind=False)
    _copy               = EclPrototype("void  layer_memcpy(layer, layer)")
    _free               = EclPrototype("void  layer_free(layer)")
    _get_nx             = EclPrototype("int   layer_get_nx(layer)")
    _get_ny             = EclPrototype("int   layer_get_ny(layer)")
    _set_cell           = EclPrototype("void  layer_iset_cell_value(layer, int, int, int)")
    _get_cell           = EclPrototype("int   layer_iget_cell_value(layer, int, int)")
    _get_bottom_barrier = EclPrototype("bool  layer_iget_bottom_barrier(layer, int, int)")
    _get_left_barrier   = EclPrototype("bool  layer_iget_left_barrier(layer, int, int)")
    _cell_contact       = EclPrototype("bool  layer_cell_contact(layer, int, int, int, int)")
    _add_barrier        = EclPrototype("void  layer_add_barrier(layer, int, int)")
    _add_ijbarrier      = EclPrototype("void  layer_add_ijbarrier(layer, int, int, int, int)")
    _add_interp_barrier = EclPrototype("void  layer_add_interp_barrier(layer, int, int)")
    _clear_cells        = EclPrototype("void  layer_clear_cells(layer)")
    _assign             = EclPrototype("void  layer_assign(layer, int)")
    _cell_sum           = EclPrototype("int   layer_get_cell_sum(layer)")
    _update_connected   = EclPrototype("void  layer_update_connected_cells(layer,int,int,int,int)")
    _cells_equal        = EclPrototype("void  layer_cells_equal(layer, int,int_vector,int_vector)")
    _count_equal        = EclPrototype("int   layer_count_equal(layer, int)")
    _active_cell        = EclPrototype("bool  layer_iget_active(layer, int,int)")
    _update_active      = EclPrototype("bool  layer_update_active(layer, ecl_grid, int)")