Salome HOME
onItem=Deplie
[tools/eficas.git] / generator / OpenturnsBase.py
index 316a34ebe6c080a3eface529d1c0318261c3d8c0..465c6f8dcfdfee07ec9c4da54bc69376b53889a9 100644 (file)
@@ -1,6 +1,22 @@
-#@ AJOUT OpenturnsSolver Macro
 # -*- coding: iso-8859-1 -*-
-# RESPONSABLE
+# Copyright (C) 2007-2013   EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
 
 """
 Ce module contient la partie commune 
@@ -30,15 +46,19 @@ class Generateur :
   ListeVariables : chaque variable est decrite par un dictionnaire ; cette liste les regroupe
   DictLois : dictionnaires des lois
   '''
-  def __init__ (self, DictMCVal, ListeVariables, DictLois ) :
+  def __init__ (self, appli, DictMCVal = {}, ListeVariables = [], DictLois = {}, DictVariables = {} ) :
   #---------------------------------------------------------#
     self.ListeVariables = ListeVariables
     self.ListeVariablesIn = []
+    self.ListeVariablesOut = []
     self.DictLois = DictLois
+    self.DictVariables = DictVariables
     self.DictMCVal = DictMCVal
     self.DictTypeVar = {}
     self.nbVarIn = 0
+    self.nbVarOut = 0
     self.creeInfoVar()
+    self.appli = appli
     #
     # On charge eventuellement le Solver par defaut
     # et les valeurs par defaut du Solver (dans l init)
@@ -58,10 +78,10 @@ class Generateur :
   #--------------------------#
     try :
        gener = self.module.__dict__["MonSTDGenerateur"]
-       monSTDGenerateur=gener( self.DictMCVal, self.ListeVariablesIn, self.DictLois )
+       monSTDGenerateur=gener( self.DictMCVal, self.ListeVariablesIn, self.ListeVariablesOut, self.DictLois )
     except :
         from OpenturnsSTD import STDGenerateur
-        monSTDGenerateur = STDGenerateur( self.DictMCVal, self.ListeVariablesIn, self.DictLois )
+        monSTDGenerateur = STDGenerateur( self.appli, self.DictMCVal, self.ListeVariablesIn, self.ListeVariablesOut, self.DictLois )
     return monSTDGenerateur
       
   def getXMLGenerateur(self) :
@@ -71,7 +91,7 @@ class Generateur :
        monXMLGenerateur=gener( self.DictMCVal, self.ListeVariables, self.DictLois )
     except :
         from OpenturnsXML import XMLGenerateur
-        monXMLGenerateur = XMLGenerateur( self.DictMCVal, self.ListeVariables, self.DictLois )
+        monXMLGenerateur = XMLGenerateur( self.appli, self.DictMCVal, self.DictVariables )
     return monXMLGenerateur
       
   def creeInfoVar (self) :
@@ -87,6 +107,11 @@ class Generateur :
       if DictVariable["Type"] == "in" : 
          self.nbVarIn = self.nbVarIn + 1
          self.ListeVariablesIn.append( DictVariable )
+         print "OpenturnsBase.py: new input variable = ", DictVariable
+      else:
+         self.nbVarOut = self.nbVarOut + 1
+         self.ListeVariablesOut.append( DictVariable )
+         print "OpenturnsBase.py: new output variable = ", DictVariable
       liste.append( DictVariable )
       num = num + 1
     self.ListeVariables = liste