1 #-*-coding:iso-8859-1-*-
3 # Copyright (C) 2008-2013 EDF R&D
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
24 from daCore import BasicObjects, PlatformInfo
25 m = PlatformInfo.SystemUsage()
29 # ==============================================================================
30 class ElementaryAlgorithm(BasicObjects.Algorithm):
32 BasicObjects.Algorithm.__init__(self, "FUNCTIONTEST")
33 self.defineRequiredParameter(
37 message = "Titre du tableau et de la figure",
40 def run(self, Xb=None, Y=None, U=None, HO=None, EM=None, CM=None, R=None, B=None, Q=None, Parameters=None):
41 logging.debug("%s Lancement"%self._name)
42 logging.debug("%s Taille mémoire utilisée de %.1f Mo"%(self._name, m.getUsedMemory("M")))
44 # Paramètres de pilotage
45 # ----------------------
46 self.setParameters(Parameters)
50 Hm = HO["Direct"].appliedTo
52 # Calcul du point nominal
53 # -----------------------
54 Xn = numpy.asmatrix(numpy.ravel( Xb )).T
58 if len(self._parameters["ResultTitle"]) > 0:
59 msg = " ====" + "="*len(self._parameters["ResultTitle"]) + "====\n"
60 msg += " " + self._parameters["ResultTitle"] + "\n"
61 msg += " ====" + "="*len(self._parameters["ResultTitle"]) + "====\n"
64 msg = "===> Information before launching:\n"
65 msg += " -----------------------------\n"
66 msg += " Characteristics of input parameter X, internally converted:\n"
67 msg += " Type...............: %s\n"%type( Xn )
68 msg += " Lenght of vector...: %i\n"%max(numpy.matrix( Xn ).shape)
69 msg += " Minimum value......: %.5e\n"%numpy.min( Xn )
70 msg += " Maximum value......: %.5e\n"%numpy.max( Xn )
71 msg += " Mean of vector.....: %.5e\n"%numpy.mean( Xn )
72 msg += " Standard error.....: %.5e\n"%numpy.std( Xn )
73 msg += " L2 norm of vector..: %.5e\n"%numpy.linalg.norm( Xn )
76 CUR_LEVEL = logging.getLogger().getEffectiveLevel()
77 logging.getLogger().setLevel(logging.DEBUG)
78 print( "===> Launching direct operator evaluation, activating debug\n")
80 print("\n===> End of direct operator evaluation, deactivating debug\n")
81 logging.getLogger().setLevel(CUR_LEVEL)
83 msg = "===> Information after launching:\n"
84 msg += " ----------------------------\n"
85 msg += " Characteristics of output parameter Y, to compare to observation:\n"
86 msg += " Type...............: %s\n"%type( Y )
87 msg += " Lenght of vector...: %i\n"%max(numpy.matrix( Y ).shape)
88 msg += " Minimum value......: %.5e\n"%numpy.min( Y )
89 msg += " Maximum value......: %.5e\n"%numpy.max( Y )
90 msg += " Mean of vector.....: %.5e\n"%numpy.mean( Y )
91 msg += " Standard error.....: %.5e\n"%numpy.std( Y )
92 msg += " L2 norm of vector..: %.5e\n"%numpy.linalg.norm( Y )
95 logging.debug("%s Taille mémoire utilisée de %.1f Mo"%(self._name, m.getUsedMemory("M")))
96 logging.debug("%s Terminé"%self._name)
100 # ==============================================================================
101 if __name__ == "__main__":
102 print '\n AUTODIAGNOSTIC \n'