Esempio n. 1
0
    def scale(self, S, E=None, D=None, R=None, D_obs=None):
        assert isinstance(S, Matrix)
        assert isinstance(E, (Matrix, NoneType))
        assert isinstance(D, (Matrix, NoneType))
        assert isinstance(R, (Matrix, NoneType))
        assert isinstance(D_obs, (Matrix, NoneType))
        ObsData.cNamespace().scale(self, S, E, D, R, D_obs)


    def free(self):
        ObsData.cNamespace().free(self)



cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("obs_data", ObsData)

ObsData.cNamespace().alloc       = cwrapper.prototype("c_void_p obs_data_alloc(double)")
ObsData.cNamespace().free        = cwrapper.prototype("void obs_data_free(obs_data)")
ObsData.cNamespace().total_size  = cwrapper.prototype("int obs_data_get_total_size(obs_data)")
ObsData.cNamespace().iget_value  = cwrapper.prototype("double obs_data_iget_value(obs_data)")
ObsData.cNamespace().iget_std  = cwrapper.prototype("double obs_data_iget_std(obs_data)")
ObsData.cNamespace().add_block   = cwrapper.prototype("obs_block_ref obs_data_add_block(obs_data , char* , int , matrix , bool)")

ObsData.cNamespace().allocdObs   = cwrapper.prototype("matrix_obj obs_data_allocdObs(obs_data)")
ObsData.cNamespace().allocR      = cwrapper.prototype("matrix_obj obs_data_allocR(obs_data)")
ObsData.cNamespace().allocD      = cwrapper.prototype("matrix_obj obs_data_allocD(obs_data , matrix , matrix)")
ObsData.cNamespace().allocE      = cwrapper.prototype("matrix_obj obs_data_allocE(obs_data , rng , int)")
ObsData.cNamespace().scale       = cwrapper.prototype("void obs_data_scale(obs_data, matrix, matrix, matrix, matrix, matrix)")
ObsData.cNamespace().scale_matrix = cwrapper.prototype("void obs_data_scale_matrix(obs_data, matrix)")
ObsData.cNamespace().scale_Rmatrix = cwrapper.prototype("void obs_data_scale_Rmatrix(obs_data, matrix)")
Esempio n. 2
0
    def getCaseFormat(self):
        """ @rtype: str """
        return AnalysisIterConfig.cNamespace().get_case_fmt(self)

    def setCaseFormat(self, case_fmt):
        AnalysisIterConfig.cNamespace().set_case_fmt(self, case_fmt)

    def caseFormatSet(self):
        return AnalysisIterConfig.cNamespace().case_fmt_set(self)

    def free(self):
        AnalysisIterConfig.cNamespace().free(self)


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("analysis_iter_config", AnalysisIterConfig)


AnalysisIterConfig.cNamespace().alloc = cwrapper.prototype("c_void_p analysis_iter_config_alloc( )")
AnalysisIterConfig.cNamespace().free = cwrapper.prototype("void analysis_iter_config_free( analysis_iter_config )")
AnalysisIterConfig.cNamespace().set_num_iterations = cwrapper.prototype(
    "void analysis_iter_config_set_num_iterations(analysis_iter_config, int)"
)
AnalysisIterConfig.cNamespace().get_num_iterations = cwrapper.prototype(
    "int analysis_iter_config_get_num_iterations(analysis_iter_config)"
)
AnalysisIterConfig.cNamespace().get_num_retries = cwrapper.prototype(
    "int analysis_iter_config_get_num_retries_per_iteration(analysis_iter_config)"
)
AnalysisIterConfig.cNamespace().num_iterations_set = cwrapper.prototype(
    "bool analysis_iter_config_num_iterations_set(analysis_iter_config)"
Esempio n. 3
0
        for i in active_region:
            active_list.addActiveIndex(i)

    def getActiveList(self, key):
        """ @rtype: ActiveList """
        if key in self:
            return LocalDataset.cNamespace().active_list(self, key)
        else:
            raise KeyError("Local key:%s not recognized" % key)

    def free(self):
        LocalDataset.cNamespace().free(self)


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("local_dataset", LocalDataset)

LocalDataset.cNamespace().alloc = cwrapper.prototype(
    "c_void_p local_dataset_alloc(char*)")
LocalDataset.cNamespace().size = cwrapper.prototype(
    "c_void_p local_dataset_get_size(char*)")
LocalDataset.cNamespace().has_key = cwrapper.prototype(
    "bool local_dataset_has_key(local_dataset, char*)")
LocalDataset.cNamespace().free = cwrapper.prototype(
    "void local_dataset_free(local_dataset)")
LocalDataset.cNamespace().name = cwrapper.prototype(
    "char* local_dataset_get_name(local_dataset)")
LocalDataset.cNamespace().active_list = cwrapper.prototype(
    "active_list_ref local_dataset_get_node_active_list(local_dataset, char*)")
LocalDataset.cNamespace().add_node = cwrapper.prototype(
    "void local_dataset_add_node(local_dataset, char*)")
Esempio n. 4
0
                value = ObsBlock.cNamespace().iget_value(self, index)
                std = ObsBlock.cNamespace().iget_std(self, index)

                return (value, std)
            else:
                raise IndexError("Invalid index:%d - valid range: [0,%d)" %
                                 (index, self.totalSize()))
        else:
            raise TypeError("The index item must be integer")

    def free(self):
        ObsBlock.cNamespace().free(self)


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("obs_block", ObsBlock)

ObsBlock.cNamespace().alloc = cwrapper.prototype(
    "c_void_p obs_block_alloc(char*, int, matrix, bool, double)")
ObsBlock.cNamespace().free = cwrapper.prototype(
    "void obs_block_free(obs_block)")
ObsBlock.cNamespace().total_size = cwrapper.prototype(
    "int obs_block_get_size( obs_block )")
ObsBlock.cNamespace().active_size = cwrapper.prototype(
    "int obs_block_get_active_size( obs_block )")
ObsBlock.cNamespace().iset = cwrapper.prototype(
    "void obs_block_iset( obs_block , int , double , double)")
ObsBlock.cNamespace().iget_value = cwrapper.prototype(
    "double obs_block_iget_value( obs_block , int)")
ObsBlock.cNamespace().iget_std = cwrapper.prototype(
    "double obs_block_iget_std( obs_block , int)")
Esempio n. 5
0
    def keys(self):
        """ @rtype: StringList """
        return SummaryKeySet.cNamespace().keys(self)

    def isReadOnly(self):
        """ @rtype: bool """
        return SummaryKeySet.cNamespace().is_read_only(self)


    def writeToFile(self, filename):
        assert isinstance(filename, str)
        SummaryKeySet.cNamespace().fwrite(self, filename)

    def free(self):
        SummaryKeySet.cNamespace().free(self)


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("summary_key_set", SummaryKeySet)

SummaryKeySet.cNamespace().alloc  = cwrapper.prototype("c_void_p summary_key_set_alloc()")
SummaryKeySet.cNamespace().alloc_from_file  = cwrapper.prototype("c_void_p summary_key_set_alloc_from_file(char*, bool)")
SummaryKeySet.cNamespace().free  = cwrapper.prototype("void summary_key_set_free(summary_key_set)")
SummaryKeySet.cNamespace().size  = cwrapper.prototype("int summary_key_set_get_size(summary_key_set)")
SummaryKeySet.cNamespace().add_key  = cwrapper.prototype("bool summary_key_set_add_summary_key(summary_key_set, char*)")
SummaryKeySet.cNamespace().has_key  = cwrapper.prototype("bool summary_key_set_has_summary_key(summary_key_set, char*)")
SummaryKeySet.cNamespace().keys  = cwrapper.prototype("stringlist_obj summary_key_set_alloc_keys(summary_key_set)")
SummaryKeySet.cNamespace().is_read_only  = cwrapper.prototype("bool summary_key_set_is_read_only(summary_key_set)")
SummaryKeySet.cNamespace().fwrite  = cwrapper.prototype("void summary_key_set_fwrite(summary_key_set, char*)")
Esempio n. 6
0
           [  (10, datetime.datetime( 2010 , 1 , 1 , 0 , 0 , 0 ) , 100.0),
              (15, datetime.datetime( 2010 , 3 , 1 , 0 , 0 , 0 ) , 160.0),
              (20, datetime.datetime( 2010 , 5 , 1 , 0 , 0 , 0 ) , 220.0) ]

        For a non-unified restart file the list will have only one element.
        """

        self.assertHeaders()
        time_list = []
        for header in self.rst_headers:
            time_list.append((header.getReportStep(), header.getSimDate(),
                              header.getSimDays()))

        return time_list


CWrapper.registerObjectType("ecl_rsthead", EclRestartHead)
cwrapper = CWrapper(ECL_LIB)
EclRestartHead.cNamespace().alloc = cwrapper.prototype(
    "c_void_p ecl_rsthead_ialloc(ecl_file , int )")
EclRestartHead.cNamespace().alloc_from_kw = cwrapper.prototype(
    "c_void_p ecl_rsthead_alloc_from_kw(int , ecl_kw , ecl_kw , ecl_kw )")
EclRestartHead.cNamespace().free = cwrapper.prototype(
    "void ecl_rsthead_free(ecl_rsthead)")
EclRestartHead.cNamespace().get_report_step = cwrapper.prototype(
    "int ecl_rsthead_get_report_step(ecl_rsthead)")
EclRestartHead.cNamespace().get_sim_time = cwrapper.prototype(
    "time_t ecl_rsthead_get_sim_time(ecl_rsthead)")
EclRestartHead.cNamespace().get_sim_days = cwrapper.prototype(
    "double ecl_rsthead_get_sim_days(ecl_rsthead)")
Esempio n. 7
0


    # def branches(self):
    #     """ @rtype: BranchCollection """

    def isMultiSegmentWell(self):
        """ @rtype: bool """
        return WellState.cNamespace().is_msw(self)

    def hasSegmentData(self):
        """ @rtype: bool """
        return WellState.cNamespace().has_segment_data(self)


CWrapper.registerObjectType("well_state", WellState)
cwrapper = CWrapper(ECL_WELL_LIB)


WellState.cNamespace().get_name = cwrapper.prototype("char* well_state_get_name(well_state)")
WellState.cNamespace().is_open = cwrapper.prototype("bool well_state_is_open(well_state)")
WellState.cNamespace().is_msw = cwrapper.prototype("bool well_state_is_MSW(well_state)")
WellState.cNamespace().well_number = cwrapper.prototype("int well_state_get_well_nr(well_state)")
WellState.cNamespace().report_number = cwrapper.prototype("int well_state_get_report_nr(well_state)")
WellState.cNamespace().sim_time = cwrapper.prototype("time_t well_state_get_sim_time(well_state)")
WellState.cNamespace().well_type = cwrapper.prototype("well_type_enum well_state_get_type(well_state)")
WellState.cNamespace().has_segment_data = cwrapper.prototype("bool well_state_has_segment_data(well_state)")

WellState.cNamespace().has_global_connections = cwrapper.prototype("bool well_state_has_global_connections(well_state)")
WellState.cNamespace().get_global_connections = cwrapper.prototype("c_void_p well_state_get_global_connections(well_state)")
WellState.cNamespace().global_connections_size = cwrapper.prototype("int well_conn_collection_get_size(c_void_p)")
Esempio n. 8
0
            return self.getCustomKeywordModelConfig()
        elif implementation_type == ErtImplType.SUMMARY:
            return SummaryConfig.createCReference(self.getPointerReference(),
                                                  parent=self)
        else:
            print(
                "[EnkfConfigNode::getModelConfig()] Unhandled implementation model type: %i"
                % implementation_type)
            # raise NotImplementedError("Unknown model type: %i" % type)

    def getKey(self):
        return EnkfConfigNode.cNamespace().get_key(self)


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("enkf_config_node", EnkfConfigNode)

EnkfConfigNode.cNamespace().free = cwrapper.prototype(
    "void enkf_config_node_free(enkf_config_node)")
EnkfConfigNode.cNamespace().get_ref = cwrapper.prototype(
    "c_void_p enkf_config_node_get_ref(enkf_config_node)"
)  #todo: fix return type
EnkfConfigNode.cNamespace().get_impl_type = cwrapper.prototype(
    "ert_impl_type_enum enkf_config_node_get_impl_type(enkf_config_node)")

EnkfConfigNode.cNamespace().get_enkf_outfile = cwrapper.prototype(
    "char* enkf_config_node_get_enkf_outfile(enkf_config_node)")
EnkfConfigNode.cNamespace().get_min_std_file = cwrapper.prototype(
    "char* enkf_config_node_get_min_std_file(enkf_config_node)")
EnkfConfigNode.cNamespace().get_enkf_infile = cwrapper.prototype(
    "char* enkf_config_node_get_enkf_infile(enkf_config_node)")
Esempio n. 9
0
    def activeObsSize(self):
        return MeasData.cNamespace().get_active_obs_size(self)

    def getActiveEnsSize(self):
        return MeasData.cNamespace().get_active_ens_size(self)

    def getTotalEnsSize(self):
        return MeasData.cNamespace().get_total_ens_size(self)

    def free(self):
        MeasData.cNamespace().free(self)


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("meas_data", MeasData)

MeasData.cNamespace().alloc = cwrapper.prototype(
    "c_void_p meas_data_alloc(bool_vector)")
MeasData.cNamespace().free = cwrapper.prototype(
    "void meas_data_free(meas_data)")
MeasData.cNamespace().get_active_obs_size = cwrapper.prototype(
    "int meas_data_get_active_obs_size(meas_data)")
MeasData.cNamespace().get_active_ens_size = cwrapper.prototype(
    "int meas_data_get_active_ens_size( meas_data )")
MeasData.cNamespace().get_total_ens_size = cwrapper.prototype(
    "int meas_data_get_total_ens_size( meas_data )")
MeasData.cNamespace().allocS = cwrapper.prototype(
    "matrix_obj meas_data_allocS(meas_data)")
MeasData.cNamespace().add_block = cwrapper.prototype(
    "meas_block_ref meas_data_add_block(meas_data, char* , int , int)")
Esempio n. 10
0
        """ @type rstfile: str or EclFile """
        if isinstance(rst_file, str):
            WellInfo.cNamespace().load_rstfile(self, rst_file, load_segment_information)
        elif isinstance(rst_file, EclFile):
            WellInfo.cNamespace().load_rst_eclfile(self, rst_file, load_segment_information)
        else:
            raise TypeError("Expected the RST file to be a filename or an EclFile instance.")

    def hasWell(self, well_name):
        return well_name in self

    def free(self):
        WellInfo.cNamespace().free(self)


CWrapper.registerObjectType("well_info", WellInfo)

cwrapper = CWrapper(ECL_WELL_LIB)

WellInfo.cNamespace().alloc = cwrapper.prototype("c_void_p well_info_alloc(ecl_grid)")
WellInfo.cNamespace().free = cwrapper.prototype("void well_info_free(well_info)")

WellInfo.cNamespace().load_rstfile = cwrapper.prototype("void well_info_load_rstfile(well_info, char*, bool)")
WellInfo.cNamespace().load_rst_eclfile = cwrapper.prototype(
    "void well_info_load_rst_eclfile(well_info, ecl_file, bool)"
)

WellInfo.cNamespace().get_well_count = cwrapper.prototype("int well_info_get_num_wells(well_info)")
WellInfo.cNamespace().iget_well_name = cwrapper.prototype("char* well_info_iget_well_name(well_info, int)")
WellInfo.cNamespace().get_ts = cwrapper.prototype("well_time_line_ref well_info_get_ts(well_info, char*)")
Esempio n. 11
0
    def igetMean(self , iobs):
        if 0 <= iobs < self.getObsSize():
            return MeasBlock.cNamespace().iget_mean(self , iobs)
        else:
            raise IndexError("Invalid observation index:%d  valid range: [0,%d)" % (iobs , self.getObsSize()))

    def igetStd(self , iobs):
        if 0 <= iobs < self.getObsSize():
            return MeasBlock.cNamespace().iget_std(self , iobs)
        else:
            raise IndexError("Invalid observation index:%d  valid range: [0,%d)" % (iobs , self.getObsSize()))



cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("meas_block", MeasBlock)

MeasBlock.cNamespace().alloc = cwrapper.prototype("c_void_p meas_block_alloc( char* , bool_vector , int)")
MeasBlock.cNamespace().free = cwrapper.prototype("void meas_block_free( meas_block )")
MeasBlock.cNamespace().get_active_ens_size = cwrapper.prototype("int meas_block_get_active_ens_size( meas_block )")
MeasBlock.cNamespace().get_total_ens_size = cwrapper.prototype("int meas_block_get_total_ens_size( meas_block )")
MeasBlock.cNamespace().get_total_obs_size = cwrapper.prototype("int meas_block_get_total_obs_size( meas_block )")
MeasBlock.cNamespace().iget_value = cwrapper.prototype("double meas_block_iget( meas_block , int , int)")
MeasBlock.cNamespace().iset_value = cwrapper.prototype("void meas_block_iset( meas_block , int , int , double)")
MeasBlock.cNamespace().iget_mean = cwrapper.prototype("double meas_block_iget_ens_mean( meas_block , int )")
MeasBlock.cNamespace().iget_std = cwrapper.prototype("double meas_block_iget_ens_std( meas_block , int )")
MeasBlock.cNamespace().iens_active = cwrapper.prototype("bool meas_block_iens_active( meas_block , int )")


    
Esempio n. 12
0
    def __len__(self):
        """ @rtype: int """
        return WellTimeLine.cNamespace().size(self)

    def __getitem__(self, index):
        """
         @type index: int
         @rtype: WellState
        """

        if index < 0:
            index += len(self)

        if not 0 <= index < len(self):
            raise IndexError("Index must be in range 0 <= %d < %d" %
                             (index, len(self)))

        return WellTimeLine.cNamespace().iget(self, index).setParent(self)

    def free(self):
        pass


CWrapper.registerObjectType("well_time_line", WellTimeLine)
cwrapper = CWrapper(ECL_WELL_LIB)

WellTimeLine.cNamespace().size = cwrapper.prototype(
    "int well_ts_get_size(well_time_line)")
WellTimeLine.cNamespace().iget = cwrapper.prototype(
    "well_state_ref well_ts_iget_state(well_time_line, int)")
Esempio n. 13
0
    def realizationList(self, state):
        """
        Will return list of realizations with state == the specified state.
        @type state: ert.enkf.enums.RealizationStateEnum
        @rtype: ert.util.IntVector
        """
        state_map = self.getStateMap()
        return state_map.realizationList(state)

    def getCustomKWConfigSet(self):
        """ @rtype: CustomKWConfigSet """
        return EnkfFs.cNamespace().config_kw_config_set(self)


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("enkf_fs", EnkfFs)

EnkfFs.cNamespace().mount = cwrapper.prototype("c_void_p enkf_fs_mount(char* )")
EnkfFs.cNamespace().create = cwrapper.prototype("enkf_fs_ref enkf_fs_create_fs(char* , enkf_fs_type_enum , c_void_p , bool)")
EnkfFs.cNamespace().exists = cwrapper.prototype("bool enkf_fs_exists(char*)")
EnkfFs.cNamespace().disk_version = cwrapper.prototype("int enkf_fs_disk_version(char*)")
EnkfFs.cNamespace().update_disk_version = cwrapper.prototype("bool enkf_fs_update_disk_version(char*, int, int)")
EnkfFs.cNamespace().decref = cwrapper.prototype("int enkf_fs_decref(enkf_fs)")
EnkfFs.cNamespace().get_refcount = cwrapper.prototype("int enkf_fs_get_refcount(enkf_fs)")
EnkfFs.cNamespace().has_node = cwrapper.prototype("bool enkf_fs_has_node(enkf_fs, char*, c_uint, int, int, c_uint)")
EnkfFs.cNamespace().has_vector = cwrapper.prototype("bool enkf_fs_has_vector(enkf_fs, char*, c_uint, int, c_uint)")
EnkfFs.cNamespace().fread_node = cwrapper.prototype("void enkf_fs_fread_node(enkf_fs, buffer, char*, c_uint, int, int, c_uint)")
EnkfFs.cNamespace().fread_vector = cwrapper.prototype("void enkf_fs_fread_vector(enkf_fs, buffer, char*, c_uint, int, c_uint)")
EnkfFs.cNamespace().get_time_map = cwrapper.prototype("time_map_ref enkf_fs_get_time_map(enkf_fs)")
EnkfFs.cNamespace().get_state_map = cwrapper.prototype("state_map_ref enkf_fs_get_state_map(enkf_fs)")
EnkfFs.cNamespace().get_case_name = cwrapper.prototype("char* enkf_fs_get_case_name(enkf_fs)")
Esempio n. 14
0
        return SummaryKeyMatcher.cNamespace().match_key(self, key)

    def isRequired(self, key):
        """ @rtype: bool """
        return SummaryKeyMatcher.cNamespace().is_required(self, key)

    def keys(self):
        """ @rtype: StringList """
        return SummaryKeyMatcher.cNamespace().keys(self)

    def free(self):
        SummaryKeyMatcher.cNamespace().free(self)


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("summary_key_matcher", SummaryKeyMatcher)

SummaryKeyMatcher.cNamespace().alloc = cwrapper.prototype(
    "c_void_p summary_key_matcher_alloc()")
SummaryKeyMatcher.cNamespace().free = cwrapper.prototype(
    "void summary_key_matcher_free(summary_key_matcher)")
SummaryKeyMatcher.cNamespace().size = cwrapper.prototype(
    "int summary_key_matcher_get_size(summary_key_matcher)")
SummaryKeyMatcher.cNamespace().add_key = cwrapper.prototype(
    "void summary_key_matcher_add_summary_key(summary_key_matcher, char*)")
SummaryKeyMatcher.cNamespace().match_key = cwrapper.prototype(
    "bool summary_key_matcher_match_summary_key(summary_key_matcher, char*)")
SummaryKeyMatcher.cNamespace().keys = cwrapper.prototype(
    "stringlist_obj summary_key_matcher_get_keys(summary_key_matcher)")
SummaryKeyMatcher.cNamespace().is_required = cwrapper.prototype(
    "bool summary_key_matcher_summary_key_is_required(summary_key_matcher, char*)"
Esempio n. 15
0
            layer.addInterpBarrier(c0, c1)
            print('%g,%g -> %d,%d   %d' % (p1[0], p1[1], i, j, c1))
            print('Adding barrier %d -> %d' % (c0, c1))
            c0 = c1

    def getGeoLayer(self):
        """Returns the underlying geometric layer."""
        return self.cNamespace().get_layer(self)

    def cellContact(self, p1, p2):
        layer = self.getGeoLayer()
        return layer.cellContact(p1, p2)


cwrapper = CWrapper(ECL_LIB)
CWrapper.registerObjectType("fault_block_layer", FaultBlockLayer)

FaultBlockLayer.cNamespace().alloc = cwrapper.prototype(
    "c_void_p         fault_block_layer_alloc(ecl_grid ,  int)")
FaultBlockLayer.cNamespace().free = cwrapper.prototype(
    "void             fault_block_layer_free(fault_block_layer)")
FaultBlockLayer.cNamespace().size = cwrapper.prototype(
    "int              fault_block_layer_get_size(fault_block_layer)")
FaultBlockLayer.cNamespace().iget_block = cwrapper.prototype(
    "fault_block_ref  fault_block_layer_iget_block(fault_block_layer, int)")
FaultBlockLayer.cNamespace().add_block = cwrapper.prototype(
    "fault_block_ref  fault_block_layer_add_block(fault_block_layer, int)")
FaultBlockLayer.cNamespace().get_block = cwrapper.prototype(
    "fault_block_ref  fault_block_layer_get_block(fault_block_layer, int)")
FaultBlockLayer.cNamespace().del_block = cwrapper.prototype(
    "void  fault_block_layer_del_block(fault_block_layer, int)")
Esempio n. 16
0
    def tstepActive(self, tstep):
        return LocalObsdataNode.cNamespace().tstep_active(self, tstep)

    def getActiveList(self):
        return LocalObsdataNode.cNamespace().get_active_list(self)

    def allTimeStepActive(self):
        return LocalObsdataNode.cNamespace().all_timestep_active(self)

    def setAllTimeStepActive(self, flag):
        return LocalObsdataNode.cNamespace().set_all_timestep_active(
            self, flag)


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("local_obsdata_node", LocalObsdataNode)

LocalObsdataNode.cNamespace().alloc = cwrapper.prototype(
    "c_void_p local_obsdata_node_alloc(char* , bool)")
LocalObsdataNode.cNamespace().free = cwrapper.prototype(
    "void local_obsdata_node_free(local_obsdata_node)")
LocalObsdataNode.cNamespace().get_key = cwrapper.prototype(
    "char* local_obsdata_node_get_key(local_obsdata_node)")
LocalObsdataNode.cNamespace().add_range = cwrapper.prototype(
    "void local_obsdata_node_add_range(local_obsdata_node, int, int)")
LocalObsdataNode.cNamespace().add_step = cwrapper.prototype(
    "void local_obsdata_node_add_tstep(local_obsdata_node, int)")
LocalObsdataNode.cNamespace().tstep_active = cwrapper.prototype(
    "bool local_obsdata_node_tstep_active(local_obsdata_node, int)")
LocalObsdataNode.cNamespace().get_active_list = cwrapper.prototype(
    "active_list_ref local_obsdata_node_get_active_list(local_obsdata_node)")
Esempio n. 17
0
        """Will return a list of report_step, simulation time and days.

        The return value will be a list tuples. For a unified restart
        file with the three report steps {10,15,20} it can look like:

           [  (10, datetime.datetime( 2010 , 1 , 1 , 0 , 0 , 0 ) , 100.0),
              (15, datetime.datetime( 2010 , 3 , 1 , 0 , 0 , 0 ) , 160.0),
              (20, datetime.datetime( 2010 , 5 , 1 , 0 , 0 , 0 ) , 220.0) ]

        For a non-unified restart file the list will have only one element.
        """

        self.assertHeaders()
        time_list = []
        for header in self.rst_headers:
            time_list.append( (header.getReportStep() , header.getSimDate( ) , header.getSimDays( )) )

        return time_list

    

            
CWrapper.registerObjectType("ecl_rsthead", EclRestartHead)
cwrapper = CWrapper(ECL_LIB)
EclRestartHead.cNamespace().alloc           = cwrapper.prototype("c_void_p ecl_rsthead_alloc(ecl_file_view , int )")
EclRestartHead.cNamespace().alloc_from_kw   = cwrapper.prototype("c_void_p ecl_rsthead_alloc_from_kw(int , ecl_kw , ecl_kw , ecl_kw )")
EclRestartHead.cNamespace().free            = cwrapper.prototype("void ecl_rsthead_free(ecl_rsthead)")
EclRestartHead.cNamespace().get_report_step = cwrapper.prototype("int ecl_rsthead_get_report_step(ecl_rsthead)")
EclRestartHead.cNamespace().get_sim_time    = cwrapper.prototype("time_t ecl_rsthead_get_sim_time(ecl_rsthead)")
EclRestartHead.cNamespace().get_sim_days    = cwrapper.prototype("double ecl_rsthead_get_sim_days(ecl_rsthead)")
Esempio n. 18
0
    def __len__(self):
        return GenKwConfig.cNamespace().size(self)

    def __getitem__(self, index):
        """ @rtype: str """
        return GenKwConfig.cNamespace().iget_name(self, index)

    def __iter__(self):
        index = 0
        while index < len(self):
            yield self[index]
            index += 1


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("gen_kw_config", GenKwConfig)

GenKwConfig.cNamespace().free = cwrapper.prototype(
    "void gen_kw_config_free( gen_kw_config )")
GenKwConfig.cNamespace().alloc_empty = cwrapper.prototype(
    "c_void_p gen_kw_config_alloc_empty( char*, char* )")
GenKwConfig.cNamespace().get_template_file = cwrapper.prototype(
    "char* gen_kw_config_get_template_file(gen_kw_config)")
GenKwConfig.cNamespace().set_template_file = cwrapper.prototype(
    "void gen_kw_config_set_template_file(gen_kw_config , char*)")
GenKwConfig.cNamespace().get_parameter_file = cwrapper.prototype(
    "char* gen_kw_config_get_parameter_file(gen_kw_config)")
GenKwConfig.cNamespace().set_parameter_file = cwrapper.prototype(
    "void gen_kw_config_set_parameter_file( gen_kw_config, char* )")
GenKwConfig.cNamespace().alloc_name_list = cwrapper.prototype(
    "stringlist_obj gen_kw_config_alloc_name_list(gen_kw_config)")
Esempio n. 19
0
import ert
from cwrap import CWrapper, BaseCClass, CWrapError
from ert.test  import ExtendedTestCase

test_lib  = ert.load("libert_util") # create a local namespace (so we don't overwrite StringList)
cwrapper =  CWrapper(test_lib)

class StringListTest(BaseCClass):
    def __init__(self):
        c_pointer = self.cNamespace().alloc()
        super(StringListTest, self).__init__(c_pointer)

    def free(self):
        StringListTest.cNamespace().free(self)

CWrapper.registerObjectType("stringlisttest", StringListTest)

StringListTest.cNamespace().alloc = cwrapper.prototype("c_void_p stringlist_alloc_new( )")
StringListTest.cNamespace().free  = cwrapper.prototype("void stringlist_free(stringlisttest )")


class CWrapTest(ExtendedTestCase):

    def test_return_type(self):
        stringlist_alloc = cwrapper.prototype("c_void_p stringlist_alloc_new( )")
        string_list1 = StringListTest()

        stringlist_alloc = cwrapper.prototype("stringlisttest_obj stringlist_alloc_new( )")
        string_list2 = stringlist_alloc()

        stringlist_alloc = cwrapper.prototype("stringlisttest_ref stringlist_alloc_new( )")
Esempio n. 20
0
        return SummaryKeyMatcher.cNamespace().add_key(self, key)

    def __len__(self):
        return SummaryKeyMatcher.cNamespace().size(self)

    def __contains__(self, key):
        return SummaryKeyMatcher.cNamespace().match_key(self, key)

    def isRequired(self, key):
        """ @rtype: bool """
        return SummaryKeyMatcher.cNamespace().is_required(self, key)

    def keys(self):
        """ @rtype: StringList """
        return SummaryKeyMatcher.cNamespace().keys(self)

    def free(self):
        SummaryKeyMatcher.cNamespace().free(self)


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("summary_key_matcher", SummaryKeyMatcher)

SummaryKeyMatcher.cNamespace().alloc  = cwrapper.prototype("c_void_p summary_key_matcher_alloc()")
SummaryKeyMatcher.cNamespace().free  = cwrapper.prototype("void summary_key_matcher_free(summary_key_matcher)")
SummaryKeyMatcher.cNamespace().size  = cwrapper.prototype("int summary_key_matcher_get_size(summary_key_matcher)")
SummaryKeyMatcher.cNamespace().add_key  = cwrapper.prototype("void summary_key_matcher_add_summary_key(summary_key_matcher, char*)")
SummaryKeyMatcher.cNamespace().match_key  = cwrapper.prototype("bool summary_key_matcher_match_summary_key(summary_key_matcher, char*)")
SummaryKeyMatcher.cNamespace().keys  = cwrapper.prototype("stringlist_obj summary_key_matcher_get_keys(summary_key_matcher)")
SummaryKeyMatcher.cNamespace().is_required  = cwrapper.prototype("bool summary_key_matcher_summary_key_is_required(summary_key_matcher, char*)")
Esempio n. 21
0
            
        self.cNamespace().get_neighbours( self , connected_only , polylines , neighbour_id_list )

        parent_layer = self.getParentLayer()
        neighbour_list = []
        for id in neighbour_id_list:
            neighbour_list.append( parent_layer.getBlock( id ))
        return neighbour_list
        

    def getParentLayer(self):
        return self.parent()
        


cwrapper = CWrapper(ECL_LIB)
CWrapper.registerObjectType("fault_block", FaultBlock)

FaultBlock.cNamespace().get_xc                = cwrapper.prototype("double                fault_block_get_xc(fault_block)")
FaultBlock.cNamespace().get_yc                = cwrapper.prototype("double                fault_block_get_yc(fault_block)")
FaultBlock.cNamespace().get_block_id          = cwrapper.prototype("int                   fault_block_get_id(fault_block)")
FaultBlock.cNamespace().get_size              = cwrapper.prototype("int                   fault_block_get_size(fault_block)")
FaultBlock.cNamespace().export_cell           = cwrapper.prototype("void                  fault_block_export_cell(fault_block , int , int* , int* , int* , double* , double* , double*)")
FaultBlock.cNamespace().assign_to_region      = cwrapper.prototype("void                  fault_block_assign_to_region(fault_block , int)")
FaultBlock.cNamespace().get_region_list       = cwrapper.prototype("int_vector_ref        fault_block_get_region_list(fault_block)")
FaultBlock.cNamespace().add_cell              = cwrapper.prototype("void                  fault_block_add_cell(fault_block,  int , int)")
FaultBlock.cNamespace().get_global_index_list = cwrapper.prototype("int_vector_ref        fault_block_get_global_index_list(fault_block)")
FaultBlock.cNamespace().trace_edge            = cwrapper.prototype("void                  fault_block_trace_edge( fault_block, double_vector , double_vector , int_vector)")  
FaultBlock.cNamespace().get_neighbours        = cwrapper.prototype("void                  fault_block_list_neighbours( fault_block , bool , geo_polygon_collection , int_vector)")  

Esempio n. 22
0
        """
        @type state: c_void_p
        @type obs_index: int
        @type node_id: NodeId
        @rtype: float """

        return BlockObservation.cNamespace().iget_data(self, state, obs_index, node_id)


    def free(self):
        BlockObservation.cNamespace().free(self)

##################################################################

cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("block_obs", BlockObservation)
cwrapper.registerType("block_data_config", BlockDataConfig)

BlockObservation.cNamespace().alloc = cwrapper.prototype("c_void_p block_obs_alloc( char* , block_data_config , ecl_grid )")
BlockObservation.cNamespace().free = cwrapper.prototype("void block_obs_free( block_obs )")
BlockObservation.cNamespace().iget_i = cwrapper.prototype("int block_obs_iget_i(block_obs, int)")
BlockObservation.cNamespace().iget_j =cwrapper.prototype("int block_obs_iget_j( block_obs, int)")
BlockObservation.cNamespace().iget_k = cwrapper.prototype("int block_obs_iget_k( block_obs , int)")
BlockObservation.cNamespace().get_size = cwrapper.prototype("int block_obs_get_size( block_obs )")
BlockObservation.cNamespace().get_std = cwrapper.prototype("double block_obs_iget_std( block_obs, int )")
BlockObservation.cNamespace().get_std_scaling = cwrapper.prototype("double block_obs_iget_std_scaling( block_obs, int )")
BlockObservation.cNamespace().update_std_scaling = cwrapper.prototype("void block_obs_update_std_scale(block_obs , double , active_list)")
BlockObservation.cNamespace().get_value = cwrapper.prototype("double block_obs_iget_value( block_obs, int)")
BlockObservation.cNamespace().get_depth = cwrapper.prototype("double block_obs_iget_depth( block_obs, int)")
BlockObservation.cNamespace().add_field_point = cwrapper.prototype("void block_obs_append_field_obs( block_obs, int,int,int,double,double)")
BlockObservation.cNamespace().add_summary_point = cwrapper.prototype("void block_obs_append_summary_obs( block_obs, int,int,int,double,double)")
Esempio n. 23
0
from cwrap import BaseCClass, CWrapper
from ert.enkf import ENKF_LIB

class ActiveList(BaseCClass):
    def __init__(self):
        c_ptr = ActiveList.cNamespace().alloc()
        super(ActiveList, self).__init__(c_ptr)


    def getMode(self):
        return ActiveList.cNamespace().get_mode(self)

    def addActiveIndex(self, index):
        ActiveList.cNamespace().add_index(self , index)

        
    def free(self):
        ActiveList.cNamespace().free(self)



cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("active_list", ActiveList)


ActiveList.cNamespace().alloc     = cwrapper.prototype("c_void_p active_list_alloc()")
ActiveList.cNamespace().free      = cwrapper.prototype("void     active_list_free(active_list)")
ActiveList.cNamespace().get_mode  = cwrapper.prototype("active_mode_enum active_list_get_mode(active_list)")
ActiveList.cNamespace().add_index = cwrapper.prototype("void active_list_add_index(active_list , int)")
Esempio n. 24
0
        return WellSegment.cNamespace().depth(self)

    def length(self):
        """ @rtype: float """
        return WellSegment.cNamespace().length(self)

    def totalLength(self):
        """ @rtype: float """
        return WellSegment.cNamespace().total_length(self)

    def diameter(self):
        """ @rtype: float """
        return WellSegment.cNamespace().diameter(self)


CWrapper.registerObjectType("well_segment", WellSegment)
cwrapper = CWrapper(ECL_WELL_LIB)


WellSegment.cNamespace().active = cwrapper.prototype("bool well_segment_active(well_segment)")
WellSegment.cNamespace().main_stem = cwrapper.prototype("bool well_segment_main_stem(well_segment)")
WellSegment.cNamespace().nearest_wellhead = cwrapper.prototype("bool well_segment_nearest_wellhead(well_segment)")

WellSegment.cNamespace().id = cwrapper.prototype("int well_segment_get_id(well_segment)")
WellSegment.cNamespace().link_count = cwrapper.prototype("int well_segment_get_link_count(well_segment)")
WellSegment.cNamespace().branch_id = cwrapper.prototype("int well_segment_get_branch_id(well_segment)")
WellSegment.cNamespace().outlet_id = cwrapper.prototype("int well_segment_get_outlet_id(well_segment)")

WellSegment.cNamespace().depth = cwrapper.prototype("double well_segment_get_depth(well_segment)")
WellSegment.cNamespace().length = cwrapper.prototype("double well_segment_get_length(well_segment)")
WellSegment.cNamespace().total_length = cwrapper.prototype("double well_segment_get_total_length(well_segment)")
Esempio n. 25
0
        self.cNamespace().get_neighbours(self, connected_only, polylines,
                                         neighbour_id_list)

        parent_layer = self.getParentLayer()
        neighbour_list = []
        for id in neighbour_id_list:
            neighbour_list.append(parent_layer.getBlock(id))
        return neighbour_list

    def getParentLayer(self):
        return self.parent()


cwrapper = CWrapper(ECL_LIB)
CWrapper.registerObjectType("fault_block", FaultBlock)

FaultBlock.cNamespace().get_xc = cwrapper.prototype(
    "double                fault_block_get_xc(fault_block)")
FaultBlock.cNamespace().get_yc = cwrapper.prototype(
    "double                fault_block_get_yc(fault_block)")
FaultBlock.cNamespace().get_block_id = cwrapper.prototype(
    "int                   fault_block_get_id(fault_block)")
FaultBlock.cNamespace().get_size = cwrapper.prototype(
    "int                   fault_block_get_size(fault_block)")
FaultBlock.cNamespace().export_cell = cwrapper.prototype(
    "void                  fault_block_export_cell(fault_block , int , int* , int* , int* , double* , double* , double*)"
)
FaultBlock.cNamespace().assign_to_region = cwrapper.prototype(
    "void                  fault_block_assign_to_region(fault_block , int)")
FaultBlock.cNamespace().get_region_list = cwrapper.prototype(
Esempio n. 26
0
    def __len__(self):
        """ @rtype: int """
        return WellTimeLine.cNamespace().size(self)


    def __getitem__(self, index):
        """
         @type index: int
         @rtype: WellState
        """

        if index < 0:
            index += len(self)

        if not 0 <= index < len(self):
            raise IndexError("Index must be in range 0 <= %d < %d" % (index, len(self)))

        return WellTimeLine.cNamespace().iget(self, index).setParent(self)


    def free(self):
        pass

CWrapper.registerObjectType("well_time_line", WellTimeLine)
cwrapper = CWrapper(ECL_WELL_LIB)


WellTimeLine.cNamespace().size = cwrapper.prototype("int well_ts_get_size(well_time_line)")
WellTimeLine.cNamespace().iget = cwrapper.prototype("well_state_ref well_ts_iget_state(well_time_line, int)")
Esempio n. 27
0
    def getStoredConfigKeys(self):
        """ @rtype: StringList """
        return CustomKWConfigSet.cNamespace().get_keys(self)

    def updateConfig(self, config):
        """ @type config: CustomKWConfig """
        CustomKWConfigSet.cNamespace().update_config(self, config)

    def fwrite(self, filename):
        """ @type filename: str """
        CustomKWConfigSet.cNamespace().fwrite(self, filename)

    def reset(self):
        CustomKWConfigSet.cNamespace().reset(self)

    def free(self):
        CustomKWConfigSet.cNamespace().free(self)


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("custom_kw_config_set", CustomKWConfigSet)

CustomKWConfigSet.cNamespace().alloc  = cwrapper.prototype("c_void_p custom_kw_config_set_alloc()")
CustomKWConfigSet.cNamespace().alloc_from_file  = cwrapper.prototype("c_void_p custom_kw_config_set_alloc_from_file(char*)")
CustomKWConfigSet.cNamespace().free  = cwrapper.prototype("void custom_kw_config_set_free(custom_kw_config_set)")
CustomKWConfigSet.cNamespace().reset  = cwrapper.prototype("void custom_kw_config_set_reset(custom_kw_config_set)")
CustomKWConfigSet.cNamespace().add_config  = cwrapper.prototype("void custom_kw_config_set_add_config(custom_kw_config_set, custom_kw_config)")
CustomKWConfigSet.cNamespace().update_config  = cwrapper.prototype("void custom_kw_config_set_update_config(custom_kw_config_set, custom_kw_config)")
CustomKWConfigSet.cNamespace().get_keys  = cwrapper.prototype("stringlist_obj custom_kw_config_set_get_keys_alloc(custom_kw_config_set)")
CustomKWConfigSet.cNamespace().fwrite  = cwrapper.prototype("void custom_kw_config_set_fwrite(custom_kw_config_set, char*)")
Esempio n. 28
0
        return FieldConfig.cNamespace().get_ny(self)

    def get_nz(self):
        return FieldConfig.cNamespace().get_nz(self)

    def ijk_active(self, i, j, k):
        return FieldConfig.cNamespace().ijk_active(self, i, j, k)

    def free(self):
        FieldConfig.cNamespace().free(self)

    

        
cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("field_config", FieldConfig)

FieldConfig.cNamespace().alloc = cwrapper.prototype("c_void_p field_config_alloc_empty(char* , ecl_grid , c_void_p , bool)")  
FieldConfig.cNamespace().free = cwrapper.prototype("void field_config_free( field_config )")
FieldConfig.cNamespace().get_type = cwrapper.prototype("int field_config_get_type(field_config)")
FieldConfig.cNamespace().get_truncation_mode = cwrapper.prototype("int field_config_get_truncation_mode(field_config)")
FieldConfig.cNamespace().get_truncation_min = cwrapper.prototype("double field_config_get_truncation_min(field_config)")
FieldConfig.cNamespace().get_truncation_max = cwrapper.prototype("double field_config_get_truncation_max(field_config)")
FieldConfig.cNamespace().get_init_transform_name = cwrapper.prototype("char* field_config_get_init_transform_name(field_config)")
FieldConfig.cNamespace().get_output_transform_name = cwrapper.prototype("char* field_config_get_output_transform_name(field_config)")
FieldConfig.cNamespace().ijk_active = cwrapper.prototype("bool field_config_ijk_active(field_config, int, int, int)")
FieldConfig.cNamespace().get_nx = cwrapper.prototype("int field_config_get_nx(field_config)")
FieldConfig.cNamespace().get_ny = cwrapper.prototype("int field_config_get_ny(field_config)")
FieldConfig.cNamespace().get_nz = cwrapper.prototype("int field_config_get_nz(field_config)")
FieldConfig.cNamespace().get_grid = cwrapper.prototype("c_void_p field_config_get_grid(field_config)")  #todo: fix return type
Esempio n. 29
0
        EnKFMain.cNamespace().submit_simulation(self, run_arg)

    def getRunContextENSEMPLE_EXPERIMENT(self, fs, iactive, init_mode=EnkfInitModeEnum.INIT_CONDITIONAL, iteration=0):
        return EnKFMain.cNamespace().alloc_run_context_ENSEMBLE_EXPERIMENT(self, fs, iactive, init_mode, iteration)

    def getRunpathList(self):
        return EnKFMain.cNamespace().get_runpath_list(self)

    def addNode(self, enkf_config_node):
        EnKFMain.cNamespace().add_node(self, enkf_config_node)


##################################################################

cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("enkf_main", EnKFMain)

EnKFMain.cNamespace().bootstrap = cwrapper.prototype("c_void_p enkf_main_bootstrap(char*, bool, bool)")
EnKFMain.cNamespace().free = cwrapper.prototype("void enkf_main_free(enkf_main)")

EnKFMain.cNamespace().get_ensemble_size = cwrapper.prototype("int enkf_main_get_ensemble_size( enkf_main )")
EnKFMain.cNamespace().get_ens_config = cwrapper.prototype("ens_config_ref enkf_main_get_ensemble_config( enkf_main )")
EnKFMain.cNamespace().get_model_config = cwrapper.prototype("model_config_ref enkf_main_get_model_config( enkf_main )")
EnKFMain.cNamespace().get_local_config = cwrapper.prototype("local_config_ref enkf_main_get_local_config( enkf_main )")
EnKFMain.cNamespace().get_analysis_config = cwrapper.prototype(
    "analysis_config_ref enkf_main_get_analysis_config( enkf_main)"
)
EnKFMain.cNamespace().get_site_config = cwrapper.prototype("site_config_ref enkf_main_get_site_config( enkf_main)")
EnKFMain.cNamespace().get_ecl_config = cwrapper.prototype("ecl_config_ref enkf_main_get_ecl_config( enkf_main)")
EnKFMain.cNamespace().get_plot_config = cwrapper.prototype("plot_config_ref enkf_main_get_plot_config( enkf_main)")
EnKFMain.cNamespace().set_eclbase = cwrapper.prototype("ui_return_obj enkf_main_set_eclbase( enkf_main, char*)")
Esempio n. 30
0
        self.selectMatching(mask, state_value)
        return BoolVector.createActiveList(mask)

    def free(self):
        StateMap.cNamespace().free(self)

    def load(self, filename):
        if not self.cNamespace().fread(self, filename):
            raise IOError("Failed to load state map from:%s" % filename)

    def save(self, filename):
        self.cNamespace().fwrite(self, filename)


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("state_map", StateMap)

StateMap.cNamespace().alloc = cwrapper.prototype("c_void_p state_map_alloc()")
StateMap.cNamespace().fread = cwrapper.prototype(
    "bool state_map_fread(state_map , char*)")
StateMap.cNamespace().fwrite = cwrapper.prototype(
    "void state_map_fwrite(state_map , char*)")
StateMap.cNamespace().equal = cwrapper.prototype(
    "bool state_map_equal(state_map , state_map)")
StateMap.cNamespace().free = cwrapper.prototype(
    "void state_map_free(state_map)")
StateMap.cNamespace().size = cwrapper.prototype(
    "int state_map_get_size(state_map)")
StateMap.cNamespace().iget = cwrapper.prototype(
    "realisation_state_enum state_map_iget(state_map, int)")
StateMap.cNamespace().iset = cwrapper.prototype(
Esempio n. 31
0
    def __len__(self):
        return GenKwConfig.cNamespace().size(self)

    def __getitem__(self, index):
        """ @rtype: str """
        return GenKwConfig.cNamespace().iget_name(self, index)

    def __iter__(self):
        index = 0
        while index < len(self):
            yield self[index]
            index += 1


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("gen_kw_config", GenKwConfig)

GenKwConfig.cNamespace().free = cwrapper.prototype("void gen_kw_config_free( gen_kw_config )")
GenKwConfig.cNamespace().alloc_empty = cwrapper.prototype("c_void_p gen_kw_config_alloc_empty( char*, char* )")
GenKwConfig.cNamespace().get_template_file = cwrapper.prototype("char* gen_kw_config_get_template_file(gen_kw_config)")
GenKwConfig.cNamespace().set_template_file = cwrapper.prototype("void gen_kw_config_set_template_file(gen_kw_config , char*)")
GenKwConfig.cNamespace().get_parameter_file = cwrapper.prototype("char* gen_kw_config_get_parameter_file(gen_kw_config)")
GenKwConfig.cNamespace().set_parameter_file = cwrapper.prototype("void gen_kw_config_set_parameter_file( gen_kw_config, char* )")
GenKwConfig.cNamespace().alloc_name_list = cwrapper.prototype("stringlist_obj gen_kw_config_alloc_name_list(gen_kw_config)")

GenKwConfig.cNamespace().should_use_log_scale = cwrapper.prototype("bool gen_kw_config_should_use_log_scale(gen_kw_config, int)")
GenKwConfig.cNamespace().get_key = cwrapper.prototype("char* gen_kw_config_get_key(gen_kw_config)")
GenKwConfig.cNamespace().size = cwrapper.prototype("int gen_kw_config_get_data_size(gen_kw_config)")
GenKwConfig.cNamespace().iget_name = cwrapper.prototype("char* gen_kw_config_iget_name(gen_kw_config, int)")
Esempio n. 32
0
        assert isinstance(update_step, LocalUpdateStep)
        LocalConfig.cNamespace().attach_ministep(update_step, mini_step)
        

    def writeSummaryFile(self, filename):                                                                                                                          
        """                                                                                                                                                    
        Writes a summary of the local config object                                                                                                            
        The summary contains the Obsset with their respective                                                                                                  
        number of observations and the Datasets with the number of active indices                                                                              
        """                                                                                                                                                    
        assert isinstance(filename, str)                                                                                                                       
        LocalConfig.cNamespace().write_local_config_summary_file(self, filename)                    
        

cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("local_config", LocalConfig)

LocalConfig.cNamespace().free                            = cwrapper.prototype("void local_config_free( local_config )")
LocalConfig.cNamespace().clear                           = cwrapper.prototype("void local_config_clear( local_config )")
LocalConfig.cNamespace().get_updatestep                  = cwrapper.prototype("local_updatestep_ref local_config_get_updatestep( local_config )")
LocalConfig.cNamespace().get_ministep                    = cwrapper.prototype("local_ministep_ref local_config_get_ministep( local_config, char*)")
LocalConfig.cNamespace().create_ministep                 = cwrapper.prototype("void local_config_alloc_ministep( local_config, char*, analysis_module)")
LocalConfig.cNamespace().attach_ministep                 = cwrapper.prototype("void local_updatestep_add_ministep( local_updatestep, local_ministep)")
LocalConfig.cNamespace().get_obsdata                     = cwrapper.prototype("local_obsdata_ref local_config_get_obsdata( local_config, char*)")
LocalConfig.cNamespace().create_obsdata                  = cwrapper.prototype("void local_config_alloc_obsdata( local_config, char*)")
LocalConfig.cNamespace().copy_obsdata                    = cwrapper.prototype("local_obsdata_ref local_config_alloc_obsdata_copy( local_config, char*, char*)")
LocalConfig.cNamespace().has_obsdata                     = cwrapper.prototype("bool local_config_has_obsdata( local_config, char*)")
LocalConfig.cNamespace().get_dataset                     = cwrapper.prototype("local_dataset_ref local_config_get_dataset( local_config, char*)")
LocalConfig.cNamespace().create_dataset                  = cwrapper.prototype("void local_config_alloc_dataset( local_config, char*)")
LocalConfig.cNamespace().copy_dataset                    = cwrapper.prototype("local_dataset_ref local_config_alloc_dataset_copy( local_config, char*, char*)")
LocalConfig.cNamespace().has_dataset                     = cwrapper.prototype("bool local_config_has_dataset( local_config, char*)")
Esempio n. 33
0
        """ @rtype: str """
        return EnkfNode.cNamespace().get_name(self)

    def load(self, fs, node_id):
        if not self.tryLoad(fs, node_id):
            raise Exception("Could not load node: %s iens: %d report: %d" % (self.name(), node_id.iens, node_id.report_step))

    def save(self, fs, node_id):
        assert isinstance(fs, EnkfFs)
        assert isinstance(node_id, NodeId)
        
        return EnkfNode.cNamespace().store(self, fs, False, node_id)

    def free(self):
        EnkfNode.cNamespace().free(self)


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("enkf_node", EnkfNode)

EnkfNode.cNamespace().free = cwrapper.prototype("void enkf_node_free(enkf_node)")
EnkfNode.cNamespace().alloc = cwrapper.prototype("void* enkf_node_alloc(enkf_config_node)")
EnkfNode.cNamespace().alloc_private = cwrapper.prototype("void* enkf_node_alloc_private_container(enkf_config_node)")
EnkfNode.cNamespace().get_name = cwrapper.prototype("char* enkf_node_get_key(enkf_node)")

EnkfNode.cNamespace().value_ptr = cwrapper.prototype("void* enkf_node_value_ptr(enkf_node)")

EnkfNode.cNamespace().try_load = cwrapper.prototype("bool enkf_node_try_load(enkf_node, enkf_fs, node_id)")
EnkfNode.cNamespace().get_impl_type = cwrapper.prototype("ert_impl_type_enum enkf_node_get_impl_type(enkf_node)")
EnkfNode.cNamespace().store = cwrapper.prototype("bool enkf_node_store(enkf_node, enkf_fs, bool, node_id)")
Esempio n. 34
0
        config = self.getConfig()

        if not key in config:
            raise KeyError("The key: '%s' is not available!" % key)

        if isinstance(value, (float, int, long)):
            CustomKW.cNamespace().set_double(self, key, value)
        else:
            CustomKW.cNamespace().set_string(self, key, str(value))


    def getConfig(self):
        """ @rtype: CustomKWConfig """
        return CustomKW.cNamespace().get_config(self)

    def free(self):
       CustomKW.cNamespace().free(self)

cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("custom_kw", CustomKW)

CustomKW.cNamespace().free = cwrapper.prototype("void custom_kw_free(custom_kw)")
CustomKW.cNamespace().alloc = cwrapper.prototype("void* custom_kw_alloc(custom_kw_config)")
CustomKW.cNamespace().fload = cwrapper.prototype("bool custom_kw_fload(custom_kw, char*)")
CustomKW.cNamespace().get_config = cwrapper.prototype("custom_kw_config_ref custom_kw_get_config(custom_kw)")
CustomKW.cNamespace().key_is_null = cwrapper.prototype("bool custom_kw_key_is_null(custom_kw, char*)")
CustomKW.cNamespace().iget_as_double = cwrapper.prototype("double custom_kw_iget_as_double(custom_kw, int)")
CustomKW.cNamespace().iget_as_string = cwrapper.prototype("char* custom_kw_iget_as_string(custom_kw, int)")
CustomKW.cNamespace().set_string = cwrapper.prototype("void custom_kw_set_string(custom_kw, char*, char*)")
CustomKW.cNamespace().set_double = cwrapper.prototype("void custom_kw_set_double(custom_kw, char*, double)")
Esempio n. 35
0
    @classmethod
    def convertDefinition(cls, definition):
        """ @rtype: IntegerHash """
        type_hash = IntegerHash()

        for key, value_type in definition.iteritems():
            if value_type == float:
                value_type = 1
            else:
                value_type = 0  #str
            type_hash[key] = value_type
        return type_hash


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("custom_kw_config", CustomKWConfig)

CustomKWConfig.cNamespace().free = cwrapper.prototype(
    "void custom_kw_config_free(custom_kw_config)")
CustomKWConfig.cNamespace().alloc_empty = cwrapper.prototype(
    "void* custom_kw_config_alloc_empty(char*, char*, char*)")
CustomKWConfig.cNamespace().alloc_with_definition = cwrapper.prototype(
    "void* custom_kw_config_alloc_with_definition(char*, integer_hash)")
CustomKWConfig.cNamespace().get_name = cwrapper.prototype(
    "char* custom_kw_config_get_name(custom_kw_config)")
CustomKWConfig.cNamespace().get_result_file = cwrapper.prototype(
    "char* custom_kw_config_get_result_file(custom_kw_config)")
CustomKWConfig.cNamespace().get_output_file = cwrapper.prototype(
    "char* custom_kw_config_get_output_file(custom_kw_config)")
CustomKWConfig.cNamespace().parse_result_file = cwrapper.prototype(
    "bool custom_kw_config_parse_result_file(custom_kw_config, char*, stringlist)"
Esempio n. 36
0
        else:
            raise IndexError("Invalid index")

    def attachMinistep(self, ministep):
        assert isinstance(ministep, LocalMinistep)
        LocalUpdateStep.cNamespace().attach_ministep(self, ministep)

    def getName(self):
        """ @rtype: str """
        return LocalUpdateStep.cNamespace().name(self)

    def free(self):
        LocalUpdateStep.cNamespace().free(self)


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("local_updatestep", LocalUpdateStep)

LocalUpdateStep.cNamespace().alloc = cwrapper.prototype(
    "c_void_p local_updatestep_alloc(char*)")
LocalUpdateStep.cNamespace().size = cwrapper.prototype(
    "int local_updatestep_get_num_ministep(local_updatestep)")
LocalUpdateStep.cNamespace().iget_ministep = cwrapper.prototype(
    "local_ministep_ref local_updatestep_iget_ministep(local_updatestep, int)")
LocalUpdateStep.cNamespace().free = cwrapper.prototype(
    "void local_updatestep_free(local_updatestep)")
LocalUpdateStep.cNamespace().attach_ministep = cwrapper.prototype(
    "void local_updatestep_add_ministep(local_updatestep,local_ministep)")
LocalUpdateStep.cNamespace().name = cwrapper.prototype(
    "char* local_updatestep_get_name(local_updatestep)")
Esempio n. 37
0
    def __eq__(self, other):
        return WellConnection.cNamespace().equal(self, other)

    def __ne__(self, other):
        return not self == other

    def free(self):
        pass

    def isMultiSegmentWell(self):
        """ @rtype: bool """
        return WellConnection.cNamespace().is_msw(self)


CWrapper.registerObjectType("well_connection", WellConnection)
cwrapper = CWrapper(ECL_WELL_LIB)


WellConnection.cNamespace().i = cwrapper.prototype("int well_conn_get_i(well_connection)")
WellConnection.cNamespace().j = cwrapper.prototype("int well_conn_get_j(well_connection)")
WellConnection.cNamespace().k = cwrapper.prototype("int well_conn_get_k(well_connection)")
WellConnection.cNamespace().get_dir = cwrapper.prototype("well_connection_dir_enum well_conn_get_dir(well_connection)")

WellConnection.cNamespace().segment_id = cwrapper.prototype("int well_conn_get_segment_id(well_connection)")
WellConnection.cNamespace().is_open = cwrapper.prototype("bool well_conn_open(well_connection)")
WellConnection.cNamespace().is_msw = cwrapper.prototype("bool well_conn_MSW(well_connection)")
WellConnection.cNamespace().fracture_connection = cwrapper.prototype("bool well_conn_fracture_connection(well_connection)")
WellConnection.cNamespace().matrix_connection = cwrapper.prototype("bool well_conn_matrix_connection(well_connection)")
WellConnection.cNamespace().connection_factor = cwrapper.prototype("double well_conn_get_connection_factor(well_connection)")
Esempio n. 38
0
    def getJobNames(self):
        """ @rtype: StringList """
        return ErtWorkflowList.cNamespace().get_job_names(self)

    def getPluginJobs(self):
        """ @rtype: list of WorkflowJob """
        plugins = []
        for job_name in self.getJobNames():
            job = self.getJob(job_name)
            if job.isPlugin():
                plugins.append(job)
        return plugins


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("ert_workflow_list", ErtWorkflowList)

ErtWorkflowList.cNamespace().free = cwrapper.prototype(
    "void ert_workflow_list_free(ert_workflow_list)")
ErtWorkflowList.cNamespace().alloc_namelist = cwrapper.prototype(
    "stringlist_obj ert_workflow_list_alloc_namelist(ert_workflow_list)")

ErtWorkflowList.cNamespace().has_workflow = cwrapper.prototype(
    "bool ert_workflow_list_has_workflow(ert_workflow_list, char*)")
ErtWorkflowList.cNamespace().get_workflow = cwrapper.prototype(
    "workflow_ref ert_workflow_list_get_workflow(ert_workflow_list, char*)")
ErtWorkflowList.cNamespace().get_context = cwrapper.prototype(
    "subst_list_ref ert_workflow_list_get_context(ert_workflow_list)")

ErtWorkflowList.cNamespace().add_job = cwrapper.prototype(
    "void ert_workflow_list_add_job(ert_workflow_list, char*, char*)")
Esempio n. 39
0
    def getNumRetries(self):
        """ @rtype: int """
        return AnalysisIterConfig.cNamespace().get_num_retries(self)

    def getCaseFormat(self):
        """ @rtype: str """
        return AnalysisIterConfig.cNamespace().get_case_fmt(self)

    def setCaseFormat(self, case_fmt):
        AnalysisIterConfig.cNamespace().set_case_fmt(self, case_fmt)

    def caseFormatSet(self):
        return AnalysisIterConfig.cNamespace().case_fmt_set(self)

    def free(self):
        AnalysisIterConfig.cNamespace().free(self)

cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("analysis_iter_config", AnalysisIterConfig)


AnalysisIterConfig.cNamespace().alloc = cwrapper.prototype("c_void_p analysis_iter_config_alloc( )")
AnalysisIterConfig.cNamespace().free = cwrapper.prototype("void analysis_iter_config_free( analysis_iter_config )")
AnalysisIterConfig.cNamespace().set_num_iterations = cwrapper.prototype("void analysis_iter_config_set_num_iterations(analysis_iter_config, int)")
AnalysisIterConfig.cNamespace().get_num_iterations = cwrapper.prototype("int analysis_iter_config_get_num_iterations(analysis_iter_config)")
AnalysisIterConfig.cNamespace().get_num_retries = cwrapper.prototype("int analysis_iter_config_get_num_retries_per_iteration(analysis_iter_config)")
AnalysisIterConfig.cNamespace().num_iterations_set = cwrapper.prototype("bool analysis_iter_config_num_iterations_set(analysis_iter_config)")
AnalysisIterConfig.cNamespace().set_case_fmt = cwrapper.prototype("void analysis_iter_config_set_case_fmt( analysis_iter_config , char* )")
AnalysisIterConfig.cNamespace().get_case_fmt = cwrapper.prototype("char* analysis_iter_config_get_case_fmt( analysis_iter_config)")
AnalysisIterConfig.cNamespace().case_fmt_set = cwrapper.prototype("bool analysis_iter_config_case_fmt_set(analysis_iter_config)")
Esempio n. 40
0
    def free(self):
        GenData.cNamespace().free(self)

    def export(self, file_name, file_format_type, fortio):
        """
        @type: str
        @type: GenDataFileType
        @type: FortIO
        """
        GenData.cNamespace().export(self, file_name, file_format_type, fortio)

    def getData(self):
        data = DoubleVector()
        GenData.cNamespace().export_data(self, data)
        return data


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("gen_data", GenData)

GenData.cNamespace().alloc = cwrapper.prototype("c_void_p gen_data_alloc()")
GenData.cNamespace().free = cwrapper.prototype("void gen_data_free(gen_data)")
GenData.cNamespace().size = cwrapper.prototype(
    "int gen_data_get_size(gen_data)")

GenData.cNamespace().export = cwrapper.prototype(
    "void gen_data_export(gen_data , char*, gen_data_file_format_type, fortio)"
)
GenData.cNamespace().export_data = cwrapper.prototype(
    "void gen_data_export_data(gen_data , double_vector)")
Esempio n. 41
0
    def getNumReportStep(self):
        """ @rtype: int """
        return GenDataConfig.cNamespace().get_num_report_step(self)

    def getReportStep(self, index):
        """ @rtype: int """
        return GenDataConfig.cNamespace().iget_report_step(self, index)

    def getReportSteps(self):
        """ @rtype: list of int """
        return [self.getReportStep(index) for index in range(self.getNumReportStep())]


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("gen_data_config", GenDataConfig)


GenDataConfig.cNamespace().alloc = cwrapper.prototype("c_void_p gen_data_config_alloc_GEN_DATA_result( char* , gen_data_file_format_type)")
GenDataConfig.cNamespace().free  = cwrapper.prototype("void gen_data_config_free( gen_data_config )")
GenDataConfig.cNamespace().get_output_format = cwrapper.prototype("gen_data_file_format_type gen_data_config_get_output_format(gen_data_config)")
GenDataConfig.cNamespace().get_input_format = cwrapper.prototype("gen_data_file_format_type gen_data_config_get_input_format(gen_data_config)")
GenDataConfig.cNamespace().get_template_file = cwrapper.prototype("char* gen_data_config_get_template_file(gen_data_config)")
GenDataConfig.cNamespace().get_template_key = cwrapper.prototype("char* gen_data_config_get_template_key(gen_data_config)")
GenDataConfig.cNamespace().get_initial_size = cwrapper.prototype("int gen_data_config_get_initial_size(gen_data_config)")
GenDataConfig.cNamespace().has_report_step = cwrapper.prototype("bool gen_data_config_has_report_step(gen_data_config, int)")
GenDataConfig.cNamespace().get_data_size    = cwrapper.prototype("int gen_data_config_get_data_size__(gen_data_config , int)")
GenDataConfig.cNamespace().get_key          = cwrapper.prototype("char* gen_data_config_get_key(gen_data_config)")
GenDataConfig.cNamespace().get_active_mask  = cwrapper.prototype("bool_vector_ref gen_data_config_get_active_mask(gen_data_config)")

GenDataConfig.cNamespace().get_num_report_step = cwrapper.prototype("int gen_data_config_num_report_step(gen_data_config)")
Esempio n. 42
0

    def getRunpathList(self):
        return EnKFMain.cNamespace().get_runpath_list( self )

    def addNode(self, enkf_config_node):
        EnKFMain.cNamespace().add_node(self, enkf_config_node)





##################################################################

cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("enkf_main", EnKFMain)

EnKFMain.cNamespace().bootstrap = cwrapper.prototype("c_void_p enkf_main_bootstrap(char*, bool, bool)")
EnKFMain.cNamespace().free = cwrapper.prototype("void enkf_main_free(enkf_main)")

EnKFMain.cNamespace().get_ensemble_size = cwrapper.prototype("int enkf_main_get_ensemble_size( enkf_main )")
EnKFMain.cNamespace().get_ens_config = cwrapper.prototype("ens_config_ref enkf_main_get_ensemble_config( enkf_main )")
EnKFMain.cNamespace().get_model_config = cwrapper.prototype("model_config_ref enkf_main_get_model_config( enkf_main )")
EnKFMain.cNamespace().get_local_config = cwrapper.prototype("local_config_ref enkf_main_get_local_config( enkf_main )")
EnKFMain.cNamespace().get_analysis_config = cwrapper.prototype("analysis_config_ref enkf_main_get_analysis_config( enkf_main)")
EnKFMain.cNamespace().get_site_config = cwrapper.prototype("site_config_ref enkf_main_get_site_config( enkf_main)")
EnKFMain.cNamespace().get_ecl_config = cwrapper.prototype("ecl_config_ref enkf_main_get_ecl_config( enkf_main)")
EnKFMain.cNamespace().get_plot_config = cwrapper.prototype("plot_config_ref enkf_main_get_plot_config( enkf_main)")
EnKFMain.cNamespace().set_eclbase = cwrapper.prototype("ui_return_obj enkf_main_set_eclbase( enkf_main, char*)")
EnKFMain.cNamespace().set_datafile = cwrapper.prototype("void enkf_main_set_data_file( enkf_main, char*)")
EnKFMain.cNamespace().get_schedule_prediction_file = cwrapper.prototype("char* enkf_main_get_schedule_prediction_file( enkf_main )")
Esempio n. 43
0
    def free(self):
        LocalObsdataNode.cNamespace().free(self)

    def tstepActive(self , tstep):
        return LocalObsdataNode.cNamespace().tstep_active( self , tstep)


    def getActiveList(self):
        return LocalObsdataNode.cNamespace().get_active_list( self )

    def allTimeStepActive(self):
        return LocalObsdataNode.cNamespace().all_timestep_active( self )

    def setAllTimeStepActive(self, flag):
        return LocalObsdataNode.cNamespace().set_all_timestep_active( self, flag )

cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("local_obsdata_node", LocalObsdataNode)

LocalObsdataNode.cNamespace().alloc            = cwrapper.prototype("c_void_p local_obsdata_node_alloc(char* , bool)")
LocalObsdataNode.cNamespace().free             = cwrapper.prototype("void local_obsdata_node_free(local_obsdata_node)")
LocalObsdataNode.cNamespace().get_key          = cwrapper.prototype("char* local_obsdata_node_get_key(local_obsdata_node)")
LocalObsdataNode.cNamespace().add_range        = cwrapper.prototype("void local_obsdata_node_add_range(local_obsdata_node, int, int)")
LocalObsdataNode.cNamespace().add_step         = cwrapper.prototype("void local_obsdata_node_add_tstep(local_obsdata_node, int)")
LocalObsdataNode.cNamespace().tstep_active     = cwrapper.prototype("bool local_obsdata_node_tstep_active(local_obsdata_node, int)")
LocalObsdataNode.cNamespace().get_active_list  = cwrapper.prototype("active_list_ref local_obsdata_node_get_active_list(local_obsdata_node)")
LocalObsdataNode.cNamespace().all_timestep_active  = cwrapper.prototype("bool local_obsdata_node_all_timestep_active(local_obsdata_node)")
LocalObsdataNode.cNamespace().set_all_timestep_active  = cwrapper.prototype("void local_obsdata_node_set_all_timestep_active(local_obsdata_node, bool)")


Esempio n. 44
0
        return self.__test_context

    def __exit__(self, exc_type, exc_val, exc_tb):
        del self.__test_context
        return False

    def getErt(self):
        return self.__test_context.getErt()

    def getCwd(self):
        """
        Returns the current working directory of this context.
        @rtype: string
        """
        return self.__test_context.getCwd()


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("ert_test", ErtTest)

ErtTest.cNamespace().alloc = cwrapper.prototype(
    "c_void_p ert_test_context_alloc_python( char* , char*)")
ErtTest.cNamespace().set_store = cwrapper.prototype(
    "c_void_p ert_test_context_set_store( ert_test , bool)")
ErtTest.cNamespace().free = cwrapper.prototype(
    "void ert_test_context_free( ert_test )")
ErtTest.cNamespace().get_enkf_main = cwrapper.prototype(
    "enkf_main_ref ert_test_context_get_main( ert_test )")
ErtTest.cNamespace().get_cwd = cwrapper.prototype(
    "char* ert_test_context_get_cwd( ert_test )")
Esempio n. 45
0

    def __exit__(self, exc_type, exc_val, exc_tb):
        del self.__test_context
        return False


    def getErt(self):
        return self.__test_context.getErt()


    def getCwd(self):
        """
        Returns the current working directory of this context.
        @rtype: string
        """
        return self.__test_context.getCwd()




cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("ert_test", ErtTest)

ErtTest.cNamespace().alloc = cwrapper.prototype("c_void_p ert_test_context_alloc_python( char* , char*)")
ErtTest.cNamespace().set_store = cwrapper.prototype("c_void_p ert_test_context_set_store( ert_test , bool)")
ErtTest.cNamespace().free = cwrapper.prototype("void ert_test_context_free( ert_test )")
ErtTest.cNamespace().get_enkf_main = cwrapper.prototype("enkf_main_ref ert_test_context_get_main( ert_test )")
ErtTest.cNamespace().get_cwd = cwrapper.prototype("char* ert_test_context_get_cwd( ert_test )")

Esempio n. 46
0
from cwrap import BaseCClass, CWrapper
from ert.enkf import ENKF_LIB


class RunArg(BaseCClass):
    def __init__(self):
        raise NotImplementedError("Class can not be instantiated directly")

    @classmethod
    def createEnsembleExperimentRunArg(cls, fs, iens, runpath, iter=0):
        return RunArg.cNamespace().alloc_ENSEMBLE_EXPERIMENT(fs, iens, iter, runpath)

    def free(self):
        RunArg.cNamespace().free(self)

    def getQueueIndex(self):
        return RunArg.cNamespace().get_queue_index(self)

    def isSubmitted(self):
        return RunArg.cNamespace().is_submitted(self)


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("run_arg", RunArg)

RunArg.cNamespace().alloc_ENSEMBLE_EXPERIMENT = cwrapper.prototype("run_arg_obj run_arg_alloc_ENSEMBLE_EXPERIMENT(enkf_fs , int, int, char*)")
RunArg.cNamespace().free = cwrapper.prototype("void run_arg_free(run_arg)")
RunArg.cNamespace().get_queue_index = cwrapper.prototype("int run_arg_get_queue_index(run_arg)")
RunArg.cNamespace().is_submitted = cwrapper.prototype("bool run_arg_is_submitted(run_arg)")
Esempio n. 47
0
        else:
            raise TypeError("Index should be integer type")


    def getLayer(self , k):
        """
        @rtype: FaultBlockLayer
        """
        return self[k]

    def free(self):
        self.cNamespace().free(self)


    def scanKeyword(self , fault_block_kw):
        ok = self.cNamespace().scan_keyword( self , fault_block_kw )
        if not ok:
            raise ValueError("The fault block keyword had wrong type/size")

    

cwrapper = CWrapper(ECL_LIB)
CWrapper.registerObjectType("fault_block_collection", FaultBlockCollection)


FaultBlockCollection.cNamespace().alloc      = cwrapper.prototype("c_void_p         fault_block_collection_alloc(ecl_grid )")
FaultBlockCollection.cNamespace().free       = cwrapper.prototype("void             fault_block_collection_free(fault_block_collection)")
FaultBlockCollection.cNamespace().num_layers = cwrapper.prototype("int              fault_block_collection_num_layers(fault_block_collection)")
FaultBlockCollection.cNamespace().get_layer  = cwrapper.prototype("fault_block_layer_ref  fault_block_collection_get_layer(fault_block_collection, int)")
FaultBlockCollection.cNamespace().scan_keyword  = cwrapper.prototype("bool          fault_block_collection_scan_kw(fault_block_collection, ecl_kw)")
Esempio n. 48
0
    def load(self, config_file):
        if not os.path.isfile(config_file):
            raise IOError("The observation config file:%s does not exist" %
                          config_file)
        return EnkfObs.cNamespace().load(self, config_file)

    def clear(self):
        EnkfObs.cNamespace().clear(self)

    def free(self):
        EnkfObs.cNamespace().free(self)


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("enkf_obs", EnkfObs)

EnkfObs.cNamespace().alloc = cwrapper.prototype(
    "c_void_p enkf_obs_alloc( history , time_map , ecl_grid , ecl_sum , ens_config )"
)
EnkfObs.cNamespace().free = cwrapper.prototype(
    "void enkf_obs_free( enkf_obs )")
EnkfObs.cNamespace().get_size = cwrapper.prototype(
    "int enkf_obs_get_size( enkf_obs )")
EnkfObs.cNamespace().load = cwrapper.prototype(
    "bool enkf_obs_load( enkf_obs , char*)")
EnkfObs.cNamespace().clear = cwrapper.prototype(
    "void enkf_obs_clear( enkf_obs )")
EnkfObs.cNamespace().alloc_typed_keylist = cwrapper.prototype(
    "stringlist_obj enkf_obs_alloc_typed_keylist(enkf_obs, enkf_obs_impl_type)"
)
Esempio n. 49
0
    @classmethod
    def convertDefinition(cls, definition):
        """ @rtype: IntegerHash """
        type_hash = IntegerHash()

        for key, value_type in definition.iteritems():
            if value_type == float:
                value_type = 1
            else:
                value_type = 0 #str
            type_hash[key] = value_type
        return type_hash



cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("custom_kw_config", CustomKWConfig)

CustomKWConfig.cNamespace().free = cwrapper.prototype("void custom_kw_config_free(custom_kw_config)")
CustomKWConfig.cNamespace().alloc_empty = cwrapper.prototype("void* custom_kw_config_alloc_empty(char*, char*, char*)")
CustomKWConfig.cNamespace().alloc_with_definition = cwrapper.prototype("void* custom_kw_config_alloc_with_definition(char*, integer_hash)")
CustomKWConfig.cNamespace().get_name = cwrapper.prototype("char* custom_kw_config_get_name(custom_kw_config)")
CustomKWConfig.cNamespace().get_result_file = cwrapper.prototype("char* custom_kw_config_get_result_file(custom_kw_config)")
CustomKWConfig.cNamespace().get_output_file = cwrapper.prototype("char* custom_kw_config_get_output_file(custom_kw_config)")
CustomKWConfig.cNamespace().parse_result_file = cwrapper.prototype("bool custom_kw_config_parse_result_file(custom_kw_config, char*, stringlist)")
CustomKWConfig.cNamespace().has_key = cwrapper.prototype("bool custom_kw_config_has_key(custom_kw_config, char*)")
CustomKWConfig.cNamespace().key_is_double = cwrapper.prototype("bool custom_kw_config_key_is_double(custom_kw_config, char*)")
CustomKWConfig.cNamespace().index_of_key = cwrapper.prototype("int custom_kw_config_index_of_key(custom_kw_config, char*)")
CustomKWConfig.cNamespace().size = cwrapper.prototype("int custom_kw_config_size(custom_kw_config)")
CustomKWConfig.cNamespace().keys = cwrapper.prototype("stringlist_obj custom_kw_config_get_keys(custom_kw_config)")
Esempio n. 50
0
    
    def hasData(self, active_mask, fs):
        """ @rtype: bool """
        return ObsVector.cNamespace().has_data(self, active_mask, fs)

    def free(self):
        ObsVector.cNamespace().free(self)

    def getTotalChi2(self, fs, realization_number):
        """ @rtype: float """
        return ObsVector.cNamespace().get_total_chi2(self, fs, realization_number)


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("obs_vector", ObsVector)

ObsVector.cNamespace().alloc = cwrapper.prototype("c_void_p obs_vector_alloc(enkf_obs_impl_type, char*, enkf_config_node, int)")
ObsVector.cNamespace().free = cwrapper.prototype("void obs_vector_free( obs_vector )")
ObsVector.cNamespace().get_state_kw = cwrapper.prototype("char* obs_vector_get_state_kw( obs_vector )")
ObsVector.cNamespace().get_observation_key = cwrapper.prototype("char* obs_vector_get_key( obs_vector )")
ObsVector.cNamespace().iget_node = cwrapper.prototype("c_void_p obs_vector_iget_node( obs_vector, int)")
ObsVector.cNamespace().get_num_active = cwrapper.prototype("int obs_vector_get_num_active( obs_vector )")
ObsVector.cNamespace().iget_active = cwrapper.prototype("bool obs_vector_iget_active( obs_vector, int)")
ObsVector.cNamespace().get_impl_type = cwrapper.prototype("enkf_obs_impl_type obs_vector_get_impl_type( obs_vector)")
ObsVector.cNamespace().install_node = cwrapper.prototype("void obs_vector_install_node(obs_vector, int, c_void_p)")
ObsVector.cNamespace().get_next_active_step = cwrapper.prototype("int obs_vector_get_next_active_step(obs_vector, int)")
ObsVector.cNamespace().has_data = cwrapper.prototype("bool obs_vector_has_data(obs_vector , bool_vector , enkf_fs)")
ObsVector.cNamespace().get_config_node = cwrapper.prototype("enkf_config_node_ref obs_vector_get_config_node(obs_vector)")
ObsVector.cNamespace().get_total_chi2 = cwrapper.prototype("double obs_vector_total_chi2(obs_vector, enkf_fs, int)")
ObsVector.cNamespace().get_obs_key = cwrapper.prototype("char* obs_vector_get_obs_key(obs_vector)")
Esempio n. 51
0
            
    def getActiveList(self, key):
        """ @rtype: ActiveList """
        if key in self:
            return LocalDataset.cNamespace().active_list(self , key)
        else:
            raise KeyError("Local key:%s not recognized" % key)        
    

    def free(self):
        LocalDataset.cNamespace().free(self)



cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("local_dataset", LocalDataset)

LocalDataset.cNamespace().alloc          = cwrapper.prototype("c_void_p local_dataset_alloc(char*)")
LocalDataset.cNamespace().size           = cwrapper.prototype("c_void_p local_dataset_get_size(char*)")
LocalDataset.cNamespace().has_key        = cwrapper.prototype("bool local_dataset_has_key(local_dataset, char*)")
LocalDataset.cNamespace().free           = cwrapper.prototype("void local_dataset_free(local_dataset)")
LocalDataset.cNamespace().name           = cwrapper.prototype("char* local_dataset_get_name(local_dataset)")
LocalDataset.cNamespace().active_list    = cwrapper.prototype("active_list_ref local_dataset_get_node_active_list(local_dataset, char*)")
LocalDataset.cNamespace().add_node       = cwrapper.prototype("void local_dataset_add_node(local_dataset, char*)")
LocalDataset.cNamespace().del_node       = cwrapper.prototype("void local_dataset_del_node(local_dataset, char*)")

                                                                                 
                                                                                 


Esempio n. 52
0
        else:
            raise IndexError(
                "Invalid observation index:%d  valid range: [0,%d)" %
                (iobs, self.getObsSize()))

    def igetStd(self, iobs):
        if 0 <= iobs < self.getObsSize():
            return MeasBlock.cNamespace().iget_std(self, iobs)
        else:
            raise IndexError(
                "Invalid observation index:%d  valid range: [0,%d)" %
                (iobs, self.getObsSize()))


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("meas_block", MeasBlock)

MeasBlock.cNamespace().alloc = cwrapper.prototype(
    "c_void_p meas_block_alloc( char* , bool_vector , int)")
MeasBlock.cNamespace().free = cwrapper.prototype(
    "void meas_block_free( meas_block )")
MeasBlock.cNamespace().get_active_ens_size = cwrapper.prototype(
    "int meas_block_get_active_ens_size( meas_block )")
MeasBlock.cNamespace().get_total_ens_size = cwrapper.prototype(
    "int meas_block_get_total_ens_size( meas_block )")
MeasBlock.cNamespace().get_total_obs_size = cwrapper.prototype(
    "int meas_block_get_total_obs_size( meas_block )")
MeasBlock.cNamespace().iget_value = cwrapper.prototype(
    "double meas_block_iget( meas_block , int , int)")
MeasBlock.cNamespace().iset_value = cwrapper.prototype(
    "void meas_block_iset( meas_block , int , int , double)")
Esempio n. 53
0
    def realizationList(self, state):
        """
        Will return list of realizations with state == the specified state.
        @type state: ert.enkf.enums.RealizationStateEnum
        @rtype: ert.util.IntVector
        """
        state_map = self.getStateMap()
        return state_map.realizationList(state)

    def getCustomKWConfigSet(self):
        """ @rtype: CustomKWConfigSet """
        return EnkfFs.cNamespace().config_kw_config_set(self)


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("enkf_fs", EnkfFs)

EnkfFs.cNamespace().mount = cwrapper.prototype(
    "c_void_p enkf_fs_mount(char* )")
EnkfFs.cNamespace().create = cwrapper.prototype(
    "enkf_fs_ref enkf_fs_create_fs(char* , enkf_fs_type_enum , c_void_p , bool)"
)
EnkfFs.cNamespace().exists = cwrapper.prototype("bool enkf_fs_exists(char*)")
EnkfFs.cNamespace().disk_version = cwrapper.prototype(
    "int enkf_fs_disk_version(char*)")
EnkfFs.cNamespace().update_disk_version = cwrapper.prototype(
    "bool enkf_fs_update_disk_version(char*, int, int)")
EnkfFs.cNamespace().decref = cwrapper.prototype("int enkf_fs_decref(enkf_fs)")
EnkfFs.cNamespace().get_refcount = cwrapper.prototype(
    "int enkf_fs_get_refcount(enkf_fs)")
EnkfFs.cNamespace().has_node = cwrapper.prototype(