/usr/include/openturns/swig/wrapper_module.i is in python-openturns-dev 1.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | // SWIG file wrapper_module.i
// @author schueller
// @date 2012-07-16 12:24:33 +0200 (Mon, 16 Jul 2012)
%module(package="openturns", docstring="Wrapping utilities.") wrapper
#pragma SWIG nowarn=509
%feature("autodoc","1");
%pythoncode %{
def makeVariableList( vars ):
"""
Transform the vars list into a WrapperVariableList structure
ex : vars = ({ "id_" : "F", "type_" : WrapperDataVariableType.IN },
{ "id_" : "E", "type_" : WrapperDataVariableType.IN },
{ "id_" : "Z", "type_" : WrapperDataVariableType.OUT },
)
varlist = makeVariableList( vars )
Note: The keys of the dictionary are the field of the WrapperDataVariable structure.
"""
vl = WrapperDataVariableCollection()
for var in vars:
if var.__class__ == dict().__class__ :
v = WrapperDataVariable()
for key in var.keys():
v.__setattr__( key, var[key] )
vl.add( v )
return vl
def makeFileList( files ):
"""
Transform the files list into a WrapperFileList structure
ex : files = ({ "id_" : "infile", "type_" : WrapperDataFileType.IN,
"path_" : "/tmp/inFILE", "subst_" : "E,F"
},
{ "id_" : "outfile", "type_" : WrapperDataFileType.OUT,
"path_" : "/tmp/outFILE", "subst_" : "Z"
},
)
filelist = makeFileList( files )
Note: The keys of the dictionary are the field of the WrapperDataFile structure.
"""
fl = WrapperDataFileCollection()
for file in files:
if file.__class__ == dict().__class__ :
f = WrapperDataFile()
for key in file.keys():
f.__setattr__( key, file[key] )
fl.add( f )
return fl
def makeParameters( params ):
"""
Transform the params dictionnary into a WrapperParameter structure
ex : params = { "command_" : "/path/to/my/code < someredir > anotherredir",
"userPrefix_" : "MyCode",
}
parameters = makeParameters( params )
Note: The keys of the dictionary are the field of the WrapperParameter structure.
"""
p = WrapperParameter()
for key in params.keys():
p.__setattr__( key, params[key] )
return p
def makeFramework( fw ):
"""
Transform the fw dictionnary into a WrapperFramework structure
ex : fw = { "studyid_" : 1733,
"studycase_" : "SalomeOpenTURNS_testcase",
"componentname_" : "SalomeOpenTURNSComponent"
}
framework = makeFramework( fw )
Note: The keys of the dictionary are the field of the WrapperFrameworkData structure.
"""
f = WrapperFrameworkData()
for key in fw.keys():
f.__setattr__( key, fw[key] )
return f
def makeWrapper( vars, files, params, framework ):
"""
Build a new WrapperFile object from the data provided by the "generic" wrapper
and replace them with the data from vars, files, params and framework.
See docstring for makeVariableList(), makeFileList(), makeParameters() and
makeFramework() functions to get the actual structure of these arguments.
"""
wrp = WrapperFile.FindWrapperByName( "generic" )
wd = wrp.getWrapperData()
vl = makeVariableList( vars )
wd.setVariableList( vl )
fl = makeFileList( files )
wd.setFileList( fl )
wp = makeParameters( params )
wd.setParameters( wp )
fw = makeFramework( framework )
wd.setFrameworkData( fw )
wrp.setWrapperData( wd )
return wrp
%}
%{
#include "OTconfig.hxx"
#include "OTCommon.hxx"
#include "Collection.hxx"
#include "WrapperData.hxx"
#include "WrapperFile.hxx"
%}
%include typemaps.i
%include OTtypes.i
%include OTexceptions.i
%include std_vector.i
/* Base/Common */
%import common_module.i
/* Base/Type */
%include Collection.i
/* Base/Func */
%include WrapperData.i
%include WrapperFile.i
/* At last we include template definitions */
%include BaseWrapperTemplateDefs.i
|