Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F78365967
prologue.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Aug 20, 06:17
Size
3 KB
Mime Type
text/x-python
Expires
Thu, Aug 22, 06:17 (2 d)
Engine
blob
Format
Raw Data
Handle
20033383
Attached To
rLIBMULTISCALE LibMultiScale
prologue.py
View Options
class
LMParameters
:
def
__init__
(
self
,
component
):
yop
=
{
o
.
lower
():
o
for
o
in
component
.
getPossibleKeywords
()}
self
.
_keywords
=
yop
self
.
_component
=
component
def
__getattribute__
(
self
,
name
):
if
name
==
'_keywords'
:
return
super
(
LMParameters
,
self
)
.
__getattribute__
(
name
)
if
name
==
'getManager'
:
return
super
(
LMParameters
,
self
)
.
__getattribute__
(
name
)
name
=
name
.
lower
()
if
name
in
self
.
_keywords
:
return
self
.
_component
.
getParam
(
self
.
_keywords
[
name
])
return
super
(
LMParameters
,
self
)
.
__getattribute__
(
name
)
@staticmethod
def
getManager
(
val
):
bases
=
[
e
.
__name__
for
e
in
val
.
__class__
.
__bases__
]
manager
=
None
import
pylibmultiscale
as
lm
if
"DomainInterface"
in
bases
:
manager
=
lm
.
DomainMultiScale
.
getManager
()
elif
"DumperInterface"
in
bases
:
manager
=
lm
.
DumperManager
.
getManager
()
elif
"FilterInterface"
in
bases
:
manager
=
lm
.
FilterManager
.
getManager
()
elif
"StimulationInterface"
in
bases
:
manager
=
lm
.
StimulationManager
.
getManager
()
return
manager
def
__setattr__
(
self
,
name
,
val
):
name
=
name
.
lower
()
if
name
==
'_keywords'
:
super
(
LMParameters
,
self
)
.
__setattr__
(
name
,
val
)
return
if
name
in
self
.
_keywords
:
if
name
==
'input'
and
(
not
isinstance
(
val
,
str
)):
import
pylibmultiscale
as
lm
manager
=
self
.
getManager
(
val
)
if
not
manager
:
compute_input
=
lm
.
ComputeCompatibility
(
self
.
_component
.
getID
()
+
'auto_input'
)
# compute_input.createOutput('output')
compute_input
.
getOutput
(
'output'
)
.
make_argument
(
val
)
val
=
compute_input
try
:
manager
.
addObject
(
val
)
except
lm
.
LibMultiScaleException
as
e
:
print
(
e
,
"Registration in the managers is "
"done automatically: no need to do it"
)
val
=
val
.
getID
()
self
.
_component
.
setParam
(
self
.
_keywords
[
name
],
val
)
return
super
(
LMParameters
,
self
)
.
__setattr__
(
name
,
val
)
def
__dir__
(
self
):
return
self
.
_keywords
class
LMInputs
:
def
__init__
(
self
,
component
):
yop
=
{(
o
.
lower
(),
o
)
for
o
in
component
.
getInputs
()}
self
.
_keywords
=
yop
# print(yop)
self
.
_component
=
component
def
__getattribute__
(
self
,
name
):
if
name
==
'_keywords'
:
return
super
(
LMInputs
,
self
)
.
__getattribute__
(
name
)
name
=
name
.
lower
()
if
name
in
self
.
_keywords
:
return
self
.
_component
.
getParam
(
self
.
_keywords
[
name
])
return
super
(
LMInputs
,
self
)
.
__getattribute__
(
name
)
def
__setattr__
(
self
,
name
,
val
):
name
=
name
.
lower
()
if
name
==
'_keywords'
:
super
(
LMInputs
,
self
)
.
__setattr__
(
name
,
val
)
return
if
name
in
self
.
_keywords
:
self
.
_component
.
setInput
(
name
,
val
)
else
:
super
(
LMInputs
,
self
)
.
__setattr__
(
name
,
val
)
def
__dir__
(
self
):
return
self
.
_keywords
Event Timeline
Log In to Comment