]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
Adding new example for observers
authorAndré Ribes <andre.ribes@edf.fr>
Tue, 28 Feb 2012 10:10:11 +0000 (11:10 +0100)
committerAndré Ribes <andre.ribes@edf.fr>
Tue, 28 Feb 2012 10:10:11 +0000 (11:10 +0100)
configure.ac
examples/daSalome/Makefile.am
examples/daSalome/test004_ADAO_JDC_Observers_using_scripts.comm.in [new file with mode: 0644]

index fcd747a4836ec3fe55569d60c6f7222b4897f32b..737babc6580ecf5539c123437490f68d85b68b1e 100644 (file)
@@ -126,6 +126,7 @@ AC_CONFIG_FILES([
         examples/daSalome/Makefile
         examples/daSalome/test003_ADAO_JDC_using_scripts.comm
         examples/daSalome/test004_ADAO_JDC_using_scripts.comm
+        examples/daSalome/test004_ADAO_JDC_Observers_using_scripts.comm
         examples/daSalome/test005_ADAO_Operators.comm
         examples/daSalome/test003_bis_ADAO_JDC_using_user_data_init.comm
         examples/daSkeletons/Makefile
index 981ac536713788cac976fce73ce67b000373b605..ee228af53133b0b0152ba161abfc60d9555e3f91 100644 (file)
@@ -27,6 +27,7 @@ DATA_INST = \
            test003_ADAO_scripts_for_JDC.py \
            test004_ADAO_JDC_using_scripts.comm \
            test004_ADAO_scripts_for_JDC.py \
+           test004_ADAO_JDC_Observers_using_scripts.comm \
            test005_ADAO_Operators.comm \
            test005_ADAO_scripts_for_JDC.py \
            test003_bis_ADAO_JDC_using_user_data_init.comm \
@@ -42,6 +43,7 @@ EXTRA_DIST = \
             test003_ADAO_scripts_for_JDC.py \
             test004_ADAO_JDC_using_scripts.comm.in \
             test004_ADAO_scripts_for_JDC.py \
+            test004_ADAO_JDC_Observers_using_scripts.comm.in \
             test005_ADAO_Operators.comm.in \
             test005_ADAO_scripts_for_JDC.py \
             test003_bis_ADAO_JDC_using_user_data_init.comm.in \
diff --git a/examples/daSalome/test004_ADAO_JDC_Observers_using_scripts.comm.in b/examples/daSalome/test004_ADAO_JDC_Observers_using_scripts.comm.in
new file mode 100644 (file)
index 0000000..07bf1d0
--- /dev/null
@@ -0,0 +1,47 @@
+
+ASSIMILATION_STUDY(Study_name='Test',
+                   Study_repertory='@prefix@/share/salome/adao_examples/daSalome',
+                   Debug=0,
+                   Algorithm='Blue',
+                   Background=_F(INPUT_TYPE='Vector',
+                                 data=_F(FROM='Script',
+                                         SCRIPT_FILE='test004_ADAO_scripts_for_JDC.py',),),
+                   BackgroundError=_F(INPUT_TYPE='Matrix',
+                                      data=_F(FROM='Script',
+                                              SCRIPT_FILE='test004_ADAO_scripts_for_JDC.py',),),
+                   Observation=_F(INPUT_TYPE='Vector',
+                                  data=_F(FROM='Script',
+                                          SCRIPT_FILE='test004_ADAO_scripts_for_JDC.py',),),
+                   ObservationError=_F(INPUT_TYPE='Matrix',
+                                       data=_F(FROM='Script',
+                                               SCRIPT_FILE='test004_ADAO_scripts_for_JDC.py',),),
+                   ObservationOperator=_F(INPUT_TYPE='Matrix',
+                                          data=_F(FROM='Script',
+                                                  SCRIPT_FILE='test004_ADAO_scripts_for_JDC.py',),),
+                   UserPostAnalysis=_F(FROM='String',
+                                       STRING=
+"""import numpy
+Xa = ADD.get("Analysis").valueserie(-1)
+print
+print "Size of Analysis = %i"%len(Xa)
+print "Min, mean, max   = %8.3f, %8.3f, %8.3f"%(min(Xa),numpy.mean(Xa),max(Xa))
+print
+""",),
+                   Observers=_F(SELECTION='Analysis',
+                                Analysis_data=_F(NodeType='pyscript',
+                                                 Value=
+"""print "  ---> Mise en oeuvre de l'observer : affichage de la valeur courante"
+        print "       var  =",var.valueserie(-1)
+        print "       info =",info
+        #
+        import Gnuplot
+        gp = Gnuplot.Gnuplot()
+        gp('set style data lines')
+        gp('set title  "'+str(info)+'"')
+        gp.plot( Gnuplot.Data( var.valueserie(-1) ) )
+        global numero
+        numero += 1
+        filename = "image_%02i.ps"%numero
+        print "       sauvegarde image \"%s\""%filename
+        gp.hardcopy(filename=filename, color=1)
+""",),),);