示例#1
0
文件: test_cwrap.py 项目: agchitu/ert
    def test_method_type(self):
        wrapper =  CWrapper(test_lib)
        def stringObj(c_ptr):
            char_ptr = ctypes.c_char_p( c_ptr )
            python_string = char_ptr.value
            test_lib.free(c_ptr)
            return python_string

        wrapper.registerType("string_obj", stringObj)

        dateStamp  = wrapper.prototype("string_obj util_alloc_date_stamp_utc()")
        date_stamp = dateStamp()
        self.assertIsInstance(date_stamp, str)
示例#2
0
文件: enkf_state.py 项目: agchitu/ert
        Will add a key -> value pair which can be used for search replace
        operations in the data file. Observe that the key will be
        surrounded by \'<\' and \'>\'.
        """
        doc_string = None
        if isinstance(value , str):
            EnKFState.cNamespace().add_subst_kw( self , key , value , doc_string )
        else:
            raise TypeError("The value argument must be a string")

    def getDataKW(self):
        """
        Will return the substitution map for this realisation.
        """
        return EnKFState.cNamespace().get_subst_list( self )


        

cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerType("enkf_state", EnKFState)
cwrapper.registerType("enkf_state_obj", EnKFState.createPythonObject)
cwrapper.registerType("enkf_state_ref", EnKFState.createCReference)


EnKFState.cNamespace().free     = cwrapper.prototype("void enkf_state_free( enkf_state )")
EnKFState.cNamespace().has_key  = cwrapper.prototype("bool enkf_state_has_node( enkf_state , char* )")
EnKFState.cNamespace().get_node = cwrapper.prototype("enkf_node_ref enkf_state_get_node( enkf_state , char* )")
EnKFState.cNamespace().add_subst_kw = cwrapper.prototype("void enkf_state_add_subst_kw( enkf_state , char* , char* , char*)")
EnKFState.cNamespace().get_subst_list  = cwrapper.prototype("subst_list_ref enkf_state_get_subst_list( enkf_state )")
示例#3
0
        return PcaPlotData.cNamespace().get(self, index).setParent(self)

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

    def getSingularValues(self):
        """ @rtype: DoubleVector """
        return PcaPlotData.cNamespace().get_singular_values(self).setParent(self)

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



cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerType("pca_plot_data", PcaPlotData)
cwrapper.registerType("pca_plot_data_obj", PcaPlotData.createPythonObject)
cwrapper.registerType("pca_plot_data_ref", PcaPlotData.createCReference)

PcaPlotData.cNamespace().alloc             = cwrapper.prototype("c_void_p pca_plot_data_alloc(char*, matrix, matrix , double_vector)")
PcaPlotData.cNamespace().free              = cwrapper.prototype("void pca_plot_data_free(pca_plot_data)")

PcaPlotData.cNamespace().component_count      = cwrapper.prototype("int pca_plot_data_get_size(pca_plot_data)")
PcaPlotData.cNamespace().realization_count    = cwrapper.prototype("int pca_plot_data_get_ens_size(pca_plot_data)")
PcaPlotData.cNamespace().get                  = cwrapper.prototype("pca_plot_vector_ref pca_plot_data_iget_vector(pca_plot_data, int)")
PcaPlotData.cNamespace().get_name             = cwrapper.prototype("char* pca_plot_data_get_name(pca_plot_data)")
PcaPlotData.cNamespace().get_singular_values  = cwrapper.prototype("double_vector_ref pca_plot_data_get_singular_values(pca_plot_data)")
示例#4
0
文件: sched_file.py 项目: agchitu/ert
class SchedFile(BaseCClass):
    def __init__(self, filename, start_time):
        if os.path.isfile(filename):
            c_ptr = SchedFile.cNamespace().parse(filename, CTime(start_time))
            super(SchedFile, self).__init__(c_ptr)
        else:
            raise IOError("No such file: %s" % filename)

    @property
    def length(self):
        """ @rtype: int """
        return SchedFile.cNamespace().length(self)

    def write(self, filename, num_dates, add_end=True):
        SchedFile.cNamespace().write(self, num_dates, filename, add_end)

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


cwrapper = CWrapper(SCHED_LIB)
cwrapper.registerType("sched_file", SchedFile)
cwrapper.registerType("sched_file_obj", SchedFile.createPythonObject)
cwrapper.registerType("sched_file_ref", SchedFile.createCReference)

SchedFile.cNamespace().parse = cwrapper.prototype("c_void_p sched_file_parse_alloc( char*, time_t )")
SchedFile.cNamespace().write = cwrapper.prototype("void sched_file_fprintf_i( sched_file , int , char* , bool)")
SchedFile.cNamespace().length = cwrapper.prototype("int sched_file_get_num_restart_files( sched_file )")
SchedFile.cNamespace().free = cwrapper.prototype("void sched_file_free( sched_file )")
示例#5
0
    def getTemplateNames(self):
        """ @rtype: StringList """
        return ErtTemplates.cNamespace().alloc_list(self).setParent(self)

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

    def get_template(self, key):
        """ @rtype: ErtTemplate """
        return ErtTemplates.cNamespace().get_template(self, key).setParent(self)

    def add_template(self, key, template_file, target_file, arg_string):
        """ @rtype: ErtTemplate """
        return ErtTemplates.cNamespace().add_template(self, key, template_file, target_file, arg_string).setParent(self)

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


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerType("ert_templates", ErtTemplates)
cwrapper.registerType("ert_templates_obj", ErtTemplates.createPythonObject)
cwrapper.registerType("ert_templates_ref", ErtTemplates.createCReference)

ErtTemplates.cNamespace().free = cwrapper.prototype("void ert_templates_free( ert_templates )")
ErtTemplates.cNamespace().alloc_list = cwrapper.prototype("stringlist_ref ert_templates_alloc_list(ert_templates)")
ErtTemplates.cNamespace().get_template = cwrapper.prototype("ert_template_ref ert_templates_get_template(ert_templates, char*)")
ErtTemplates.cNamespace().clear = cwrapper.prototype("void ert_templates_clear(ert_templates)")
ErtTemplates.cNamespace().add_template = cwrapper.prototype("ert_template_ref ert_templates_add_template(ert_templates, char*, char*, char*, char*)")
示例#6
0
#  Copyright (C) 2012  Statoil ASA, Norway. 
#   
#  The file 'field_config.py' is part of ERT - Ensemble based Reservoir Tool. 
#   
#  ERT is free software: you can redistribute it and/or modify 
#  it under the terms of the GNU General Public License as published by 
#  the Free Software Foundation, either version 3 of the License, or 
#  (at your option) any later version. 
#   
#  ERT is distributed in the hope that it will be useful, but WITHOUT ANY 
#  WARRANTY; without even the implied warranty of MERCHANTABILITY or 
#  FITNESS FOR A PARTICULAR PURPOSE.   
#   
#  See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html> 
#  for more details.
from cwrap import BaseCClass, CWrapper
from ert.enkf import ENKF_LIB


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


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerType("summary_config", SummaryConfig)
cwrapper.registerType("summary_config", SummaryConfig.createPythonObject)
cwrapper.registerType("summary_config", SummaryConfig.createCReference)

示例#7
0
        """ @rtype: float """
        return len(self)

    def getIndex(self, obs_index):
        """ @rtype: int """
        return self.getDataIndex(obs_index)

    def getDataIndex(self, obs_index):
        return GenObservation.cNamespace().get_data_index(self, obs_index)

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


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerType("gen_obs", GenObservation)
cwrapper.registerType("gen_obs_obj", GenObservation.createPythonObject)
cwrapper.registerType("gen_obs_ref", GenObservation.createCReference)

GenObservation.cNamespace().alloc = cwrapper.prototype(
    "c_void_p gen_obs_alloc__(gen_data_config , char*)")
GenObservation.cNamespace().free = cwrapper.prototype(
    "void gen_obs_free(gen_data_config)")
GenObservation.cNamespace().load = cwrapper.prototype(
    "void gen_obs_load_observation(gen_obs , char*)")
GenObservation.cNamespace().scalar_set = cwrapper.prototype(
    "void gen_obs_set_scalar(gen_obs , double , double)")
GenObservation.cNamespace().get_value = cwrapper.prototype(
    "double gen_obs_iget_value(summary_obs)")
GenObservation.cNamespace().get_std_scaling = cwrapper.prototype(
    "double gen_obs_iget_std_scaling(summary_obs)")
示例#8
0
文件: history.py 项目: agchitu/ert
        """
        @type refcase: EclSum
        @type use_history: bool
        @rtype: HistoryType
        """
        return History.cNamespace().alloc_from_refcase(refcase, use_history)

    @staticmethod
    def alloc_from_sched_file(sched_file):
        """ @rtype: HistoryType """
        assert isinstance(sched_file, SchedFile)
        return History.cNamespace().alloc_from_sched_file(":", sched_file)

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


cwrapper = CWrapper(SCHED_LIB)
cwrapper.registerType("history", History)
cwrapper.registerType("history_obj", History.createPythonObject)
cwrapper.registerType("history_ref", History.createCReference)



History.cNamespace().free = cwrapper.prototype("void history_free( history )")
History.cNamespace().get_source_string = cwrapper.prototype("char* history_get_source_string(history_source_enum)")
History.cNamespace().alloc_from_refcase = cwrapper.prototype("history_obj history_alloc_from_refcase(ecl_sum, bool)")
History.cNamespace().alloc_from_sched_file = cwrapper.prototype("history_obj history_alloc_from_sched_file(char*, sched_file)")

# History.cNamespace().history_get_source_type = cwrapper.prototype("history_source_type_enum history_get_source_type(char*)")
示例#9
0
        return len(self)

    def getIndex(self, obs_index):
        """ @rtype: int """
        return self.getDataIndex( obs_index )
        
    def getDataIndex(self, obs_index):
        return GenObservation.cNamespace().get_data_index(self, obs_index)

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



cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerType("gen_obs", GenObservation)
cwrapper.registerType("gen_obs_obj", GenObservation.createPythonObject)
cwrapper.registerType("gen_obs_ref", GenObservation.createCReference)

GenObservation.cNamespace().alloc = cwrapper.prototype("c_void_p gen_obs_alloc__(gen_data_config , char*)")
GenObservation.cNamespace().free = cwrapper.prototype("void gen_obs_free(gen_data_config)")
GenObservation.cNamespace().load = cwrapper.prototype("void gen_obs_load_observation(gen_obs , char*)")
GenObservation.cNamespace().scalar_set = cwrapper.prototype("void gen_obs_set_scalar(gen_obs , double , double)")
GenObservation.cNamespace().get_value = cwrapper.prototype("double gen_obs_iget_value(summary_obs)")
GenObservation.cNamespace().get_std_scaling = cwrapper.prototype("double gen_obs_iget_std_scaling(summary_obs)")
GenObservation.cNamespace().get_std = cwrapper.prototype("double gen_obs_iget_std(gen_obs, int)")
GenObservation.cNamespace().get_size = cwrapper.prototype("int gen_obs_get_size(gen_obs)")
GenObservation.cNamespace().get_data_index = cwrapper.prototype("int gen_obs_get_obs_index(gen_obs, int)")
GenObservation.cNamespace().load_data_index = cwrapper.prototype("void gen_obs_load_data_index(gen_obs , char*)")
GenObservation.cNamespace().add_data_index = cwrapper.prototype("void gen_obs_attach_data_index(gen_obs , int_vector)")
GenObservation.cNamespace().update_std_scaling = cwrapper.prototype("void gen_obs_update_std_scale(gen_obs , double , active_list)")
示例#10
0
文件: node_id.py 项目: agchitu/ert
from ctypes import Structure, c_int
from cwrap import CWrapper

class NodeId(Structure):
    """
    NodeId is specified in enkf_types.h
    """
    _fields_ = [("report_step", c_int),
                ("iens", c_int)]

    def __init__(self, report_step, realization_number):
        """
        @type report_step: int
        @type realization_number: int
        """
        super(NodeId, self).__init__(report_step, realization_number)


CWrapper.registerType("node_id", NodeId)

示例#11
0
    def __init__(self):
        raise NotImplementedError("Class can not be instantiated directly!")

    def __len__(self):
        """ @rtype: int """
        return EnsemblePlotDataVector.cNamespace().size(self)

    def getValue(self, index):
        """ @rtype: float """
        return EnsemblePlotDataVector.cNamespace().get_value(self, index)

    def getTime(self, index):
        """ @rtype: CTime """
        return EnsemblePlotDataVector.cNamespace().get_time(self, index)

    def isActive(self, index):
        """ @rtype: bool """
        return EnsemblePlotDataVector.cNamespace().is_active(self, index)



cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerType("ensemble_plot_data_vector", EnsemblePlotDataVector)
cwrapper.registerType("ensemble_plot_data_vector_obj", EnsemblePlotDataVector.createPythonObject)
cwrapper.registerType("ensemble_plot_data_vector_ref", EnsemblePlotDataVector.createCReference)

EnsemblePlotDataVector.cNamespace().size = cwrapper.prototype("int enkf_plot_tvector_size(ensemble_plot_data_vector)")
EnsemblePlotDataVector.cNamespace().get_value = cwrapper.prototype("double enkf_plot_tvector_iget_value(ensemble_plot_data_vector, int)")
EnsemblePlotDataVector.cNamespace().get_time = cwrapper.prototype("time_t enkf_plot_tvector_iget_time(ensemble_plot_data_vector, int)")
EnsemblePlotDataVector.cNamespace().is_active = cwrapper.prototype("bool enkf_plot_tvector_iget_active(ensemble_plot_data_vector, int)")
示例#12
0
    def __len__(self):
        """ @rtype: int """
        return EnsemblePlotGenKWVector.cNamespace().size(self)

    def getValue(self, index):
        """ @rtype: float """
        return self[index]

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

    def __getitem__(self, index):
        """ @rtype: float """
        return EnsemblePlotGenKWVector.cNamespace().get_value(self, index)




cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerType("ensemble_plot_gen_kw_vector", EnsemblePlotGenKWVector)
cwrapper.registerType("ensemble_plot_gen_kw_vector_obj", EnsemblePlotGenKWVector.createPythonObject)
cwrapper.registerType("ensemble_plot_gen_kw_vector_ref", EnsemblePlotGenKWVector.createCReference)

EnsemblePlotGenKWVector.cNamespace().size = cwrapper.prototype("int enkf_plot_gen_kw_vector_get_size(ensemble_plot_gen_kw_vector)")
EnsemblePlotGenKWVector.cNamespace().get_value = cwrapper.prototype("double enkf_plot_gen_kw_vector_iget(ensemble_plot_gen_kw_vector, int)")

示例#13
0
#  See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html> 
#  for more details.
from cwrap import BaseCClass, CWrapper
from ert.enkf import ENKF_LIB


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

    def getPath(self):
        """ @rtype: str """
        return PlotConfig.cNamespace().get_path(self)

    def setPath(self, path):
        PlotConfig.cNamespace().set_path(self, path)

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


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerType("plot_config", PlotConfig)
cwrapper.registerType("plot_config_obj", PlotConfig.createPythonObject)
cwrapper.registerType("plot_config_ref", PlotConfig.createCReference)

PlotConfig.cNamespace().free = cwrapper.prototype("void plot_config_free( plot_config )")
PlotConfig.cNamespace().get_path = cwrapper.prototype("char* plot_config_get_path(plot_config)")
PlotConfig.cNamespace().set_path = cwrapper.prototype("void plot_config_set_path(plot_config, char*)")

示例#14
0
文件: time_map.py 项目: agchitu/ert
        for step,t in enumerate(self):
            step_list.append( (step , t , self.getSimulationDays( step )) )
        return step_list


    def getLastStep(self):
        return TimeMap.cNamespace().last_step(self)


    def upgrade107(self, refcase):
        TimeMap.cNamespace().upgrade107(self, refcase)

    
##################################################################
cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerType("time_map", TimeMap)
cwrapper.registerType("time_map_obj", TimeMap.createPythonObject)
cwrapper.registerType("time_map_ref", TimeMap.createCReference)


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

TimeMap.cNamespace().free = cwrapper.prototype("void time_map_free( time_map )")
TimeMap.cNamespace().fread_alloc_readonly = cwrapper.prototype("c_void_p time_map_fread_alloc_readonly(char*)")
TimeMap.cNamespace().alloc = cwrapper.prototype("c_void_p time_map_alloc()")
TimeMap.cNamespace().load = cwrapper.prototype("bool time_map_fread(time_map , char*)")
TimeMap.cNamespace().save = cwrapper.prototype("void time_map_fwrite(time_map , char*)")
TimeMap.cNamespace().fload = cwrapper.prototype("bool time_map_fscanf(time_map , char*)")
TimeMap.cNamespace().iget_sim_days = cwrapper.prototype("double time_map_iget_sim_days(time_map, int)")
TimeMap.cNamespace().iget = cwrapper.prototype("time_t time_map_iget(time_map, int)")
示例#15
0
#  See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html> 
#  for more details. 
"""
Create a polygon
"""
from cwrap import CClass, CWrapper, CWrapperNameSpace
from ert.geo import ERT_GEOMETRY_LIB


class GeoPolygon(CClass):
    def __init__(self, points):
        c_ptr = cfunc.alloc_new()
        self.init_cobj(c_ptr, cfunc.free)
        for (xc, yc) in points:
            self.add_point(xc, yc)


    def add_point( self, xc, yc ):
        cfunc.add_point(self, xc, yc)


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

cwrapper = CWrapper(ERT_GEOMETRY_LIB)
cwrapper.registerType("geo_polygon", GeoPolygon)

cfunc           = CWrapperNameSpace("geo_polygon")
cfunc.alloc_new = cwrapper.prototype("c_void_p geo_polygon_alloc( )")
cfunc.add_point = cwrapper.prototype("void     geo_polygon_add_point( geo_polygon , double , double )")
cfunc.free      = cwrapper.prototype("void     geo_polygon_free( geo_polygon )")
示例#16
0
        host_list = SiteConfig.cNamespace().get_rsh_host_list(self)
        return host_list

    def addRshHost(self, host, max_running):
        SiteConfig.cNamespace().add_rsh_host(self, host, max_running)

    def getLocation(self):
        """ @rtype: str """
        return SiteConfig.cNamespace().get_location(self)

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


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerType("site_config", SiteConfig)
cwrapper.registerType("site_config_obj", SiteConfig.createPythonObject)
cwrapper.registerType("site_config_ref", SiteConfig.createCReference)


SiteConfig.cNamespace().free = cwrapper.prototype("void site_config_free( site_config )")
SiteConfig.cNamespace().get_queue_name = cwrapper.prototype("char* site_config_get_queue_name(site_config)")
SiteConfig.cNamespace().get_lsf_queue = cwrapper.prototype("char* site_config_get_lsf_queue(site_config)")
SiteConfig.cNamespace().set_lsf_queue = cwrapper.prototype("void site_config_set_lsf_queue(site_config, char*)")
SiteConfig.cNamespace().get_max_running_lsf = cwrapper.prototype("int site_config_get_max_running_lsf(site_config)")
SiteConfig.cNamespace().set_max_running_lsf = cwrapper.prototype(
    "void site_config_set_max_running_lsf(site_config, int)"
)
SiteConfig.cNamespace().get_lsf_request = cwrapper.prototype("char* site_config_get_lsf_request(site_config)")
SiteConfig.cNamespace().set_lsf_request = cwrapper.prototype("void site_config_set_lsf_request(site_config, char*)")
示例#17
0
    def getMaxValues(self):
        """ @rtype: DoubleVector """
        return EnsemblePlotGenData.cNamespace().max_values(self).setParent(self)

    def getMinValues(self):
        """ @rtype: DoubleVector """
        return EnsemblePlotGenData.cNamespace().min_values(self).setParent(self)

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



cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerType("ensemble_plot_gen_data", EnsemblePlotGenData)
cwrapper.registerType("ensemble_plot_gen_data_obj", EnsemblePlotGenData.createPythonObject)
cwrapper.registerType("ensemble_plot_gen_data_ref", EnsemblePlotGenData.createCReference)

EnsemblePlotGenData.cNamespace().free = cwrapper.prototype("void enkf_plot_gendata_free(ensemble_plot_gen_data)")
EnsemblePlotGenData.cNamespace().alloc = cwrapper.prototype("c_void_p enkf_plot_gendata_alloc(enkf_config_node)")

EnsemblePlotGenData.cNamespace().size = cwrapper.prototype("int enkf_plot_gendata_get_size(ensemble_plot_gen_data)")
EnsemblePlotGenData.cNamespace().load = cwrapper.prototype("void enkf_plot_gendata_load(ensemble_plot_gen_data, enkf_fs, int, bool_vector)")
EnsemblePlotGenData.cNamespace().get = cwrapper.prototype("ensemble_plot_gen_data_vector_ref enkf_plot_gendata_iget(ensemble_plot_gen_data, int)")

EnsemblePlotGenData.cNamespace().min_values = cwrapper.prototype("double_vector_ref enkf_plot_gendata_get_min_values(ensemble_plot_gen_data)")
EnsemblePlotGenData.cNamespace().max_values = cwrapper.prototype("double_vector_ref enkf_plot_gendata_get_max_values(ensemble_plot_gen_data)")


示例#18
0
            kw = self.getKeyWordForIndex(index)
            if kw == keyword:
                return index
        return None

    def shouldUseLogScale(self, index):
        """ @rtype: bool """
        return bool(EnsemblePlotGenKW.cNamespace().should_use_log_scale(self, index))

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



cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerType("ensemble_plot_gen_kw", EnsemblePlotGenKW)
cwrapper.registerType("ensemble_plot_gen_kw_obj", EnsemblePlotGenKW.createPythonObject)
cwrapper.registerType("ensemble_plot_gen_kw_ref", EnsemblePlotGenKW.createCReference)

EnsemblePlotGenKW.cNamespace().free = cwrapper.prototype("void enkf_plot_gen_kw_free(ensemble_plot_gen_kw)")
EnsemblePlotGenKW.cNamespace().alloc = cwrapper.prototype("c_void_p enkf_plot_gen_kw_alloc(enkf_config_node)")

EnsemblePlotGenKW.cNamespace().size = cwrapper.prototype("int enkf_plot_gen_kw_get_size(ensemble_plot_gen_kw)")
EnsemblePlotGenKW.cNamespace().load = cwrapper.prototype("void enkf_plot_gen_kw_load(ensemble_plot_gen_kw, enkf_fs, bool, int, bool_vector)")
EnsemblePlotGenKW.cNamespace().get = cwrapper.prototype("ensemble_plot_gen_kw_vector_ref enkf_plot_gen_kw_iget(ensemble_plot_gen_kw, int)")
EnsemblePlotGenKW.cNamespace().iget_key = cwrapper.prototype("char* enkf_plot_gen_kw_iget_key(ensemble_plot_gen_kw, int)")
EnsemblePlotGenKW.cNamespace().get_keyword_count = cwrapper.prototype("int enkf_plot_gen_kw_get_keyword_count(ensemble_plot_gen_kw)")
EnsemblePlotGenKW.cNamespace().should_use_log_scale = cwrapper.prototype("bool enkf_plot_gen_kw_should_use_log_scale(ensemble_plot_gen_kw, int)")


示例#19
0
        cur = 0
        while cur < len(self):
            yield self[cur]
            cur += 1

    def getObservation(self):
        """ @rtype: float """
        return PcaPlotVector.cNamespace().get_obs(self)

    def getSingularValue(self):
        """ @rtype: float """
        return PcaPlotVector.cNamespace().get_singular_value(self)

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


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerType("pca_plot_vector", PcaPlotVector)
cwrapper.registerType("pca_plot_vector_obj", PcaPlotVector.createPythonObject)
cwrapper.registerType("pca_plot_vector_ref", PcaPlotVector.createCReference)

PcaPlotVector.cNamespace().alloc = cwrapper.prototype("c_void_p pca_plot_vector_alloc(int, matrix, matrix)")
PcaPlotVector.cNamespace().free = cwrapper.prototype("void pca_plot_vector_free(pca_plot_vector)")
PcaPlotVector.cNamespace().size = cwrapper.prototype("int pca_plot_vector_get_size(pca_plot_vector)")
PcaPlotVector.cNamespace().get = cwrapper.prototype("double pca_plot_vector_iget_sim_value(pca_plot_vector, int)")
PcaPlotVector.cNamespace().get_obs = cwrapper.prototype("double pca_plot_vector_get_obs_value(pca_plot_vector)")
PcaPlotVector.cNamespace().get_singular_value = cwrapper.prototype(
    "double pca_plot_vector_get_singular_value(pca_plot_vector)"
)
示例#20
0
文件: ecl_config.py 项目: agchitu/ert
        EclConfig.cNamespace().clear_static_kw(self)

    def add_static_kw(self, kw):
        EclConfig.cNamespace().add_static_kw(self, kw)

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

    def getDepthUnit(self):
        return EclConfig.cNamespace().get_depth_unit(self)

    def getPressureUnit(self):
        return EclConfig.cNamespace().get_pressure_unit(self)


cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerType("ecl_config", EclConfig)
cwrapper.registerType("ecl_config_obj", EclConfig.createPythonObject)
cwrapper.registerType("ecl_config_ref", EclConfig.createCReference)


EclConfig.cNamespace().alloc = cwrapper.prototype("c_void_p ecl_config_alloc( )")
EclConfig.cNamespace().free = cwrapper.prototype("void ecl_config_free( ecl_config )")

EclConfig.cNamespace().get_eclbase = cwrapper.prototype("char* ecl_config_get_eclbase( ecl_config )")
EclConfig.cNamespace().validate_eclbase = cwrapper.prototype("ui_return_obj ecl_config_validate_eclbase( ecl_config , char*)")
EclConfig.cNamespace().set_eclbase = cwrapper.prototype("void ecl_config_set_eclbase( ecl_config , char*)")

EclConfig.cNamespace().get_data_file = cwrapper.prototype("char* ecl_config_get_data_file(ecl_config)")
EclConfig.cNamespace().set_data_file = cwrapper.prototype("void ecl_config_set_data_file(ecl_config , char*)")
EclConfig.cNamespace().validate_data_file = cwrapper.prototype("ui_return_obj ecl_config_validate_data_file(ecl_config , char*)")