1 """Abstract root classes of user-defined Python features producing a Body
2 Author: Daniel Brunier-Coulin
3 Copyright (C) 2014-20xx CEA/DEN, EDF R&D
9 class Feature(ModelAPI_Feature):
10 """Base class of user-defined Python features."""
13 ModelAPI_Feature.__init__(self)
15 def addRealInput (self, inputid):
16 self.data().addAttribute(inputid, ModelAPI_AttributeDouble_typeId())
18 def getRealInput (self, inputid):
19 return self.data().real(inputid).value()
21 def addResult (self, result):
22 shape = result.shape()
23 body = self.document().createBody( self.data() )
29 """Base class of hight level Python interfaces to features."""
31 def __init__(self, container, fid):
32 self.my = container.addFeature(fid)
34 def setRealInput (self, inputid, value):
35 self.my.data().real(inputid).setValue(value)
37 def areInputValid (self):
38 return ModelAPI_Session.get().validators().validate(self.my)