本文整理汇总了Python中cwrap.CWrapper.registerType方法的典型用法代码示例。如果您正苦于以下问题:Python CWrapper.registerType方法的具体用法?Python CWrapper.registerType怎么用?Python CWrapper.registerType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cwrap.CWrapper
的用法示例。
在下文中一共展示了CWrapper.registerType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_method_type
# 需要导入模块: from cwrap import CWrapper [as 别名]
# 或者: from cwrap.CWrapper import registerType [as 别名]
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: isinstance
# 需要导入模块: from cwrap import CWrapper [as 别名]
# 或者: from cwrap.CWrapper import registerType [as 别名]
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: __iter__
# 需要导入模块: from cwrap import CWrapper [as 别名]
# 或者: from cwrap.CWrapper import registerType [as 别名]
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: SchedFile
# 需要导入模块: from cwrap import CWrapper [as 别名]
# 或者: from cwrap.CWrapper import registerType [as 别名]
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: getTemplateNames
# 需要导入模块: from cwrap import CWrapper [as 别名]
# 或者: from cwrap.CWrapper import registerType [as 别名]
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: enumerate
# 需要导入模块: from cwrap import CWrapper [as 别名]
# 或者: from cwrap.CWrapper import registerType [as 别名]
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)")
示例7: len
# 需要导入模块: from cwrap import CWrapper [as 别名]
# 或者: from cwrap.CWrapper import registerType [as 别名]
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)")
示例8: Copyright
# 需要导入模块: from cwrap import CWrapper [as 别名]
# 或者: from cwrap.CWrapper import registerType [as 别名]
# 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)
示例9: __init__
# 需要导入模块: from cwrap import CWrapper [as 别名]
# 或者: from cwrap.CWrapper import registerType [as 别名]
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)")
示例10: alloc_from_sched_file
# 需要导入模块: from cwrap import CWrapper [as 别名]
# 或者: from cwrap.CWrapper import registerType [as 别名]
"""
@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*)")
示例11: NodeId
# 需要导入模块: from cwrap import CWrapper [as 别名]
# 或者: from cwrap.CWrapper import registerType [as 别名]
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)
示例12: __len__
# 需要导入模块: from cwrap import CWrapper [as 别名]
# 或者: from cwrap.CWrapper import registerType [as 别名]
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: PlotConfig
# 需要导入模块: from cwrap import CWrapper [as 别名]
# 或者: from cwrap.CWrapper import registerType [as 别名]
# 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: GeoPolygon
# 需要导入模块: from cwrap import CWrapper [as 别名]
# 或者: from cwrap.CWrapper import registerType [as 别名]
# 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 )")
示例15: getMaxValues
# 需要导入模块: from cwrap import CWrapper [as 别名]
# 或者: from cwrap.CWrapper import registerType [as 别名]
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)")