]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
Adding advanced doc on TUI mode and observers use
authorJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Thu, 12 Apr 2012 20:53:26 +0000 (22:53 +0200)
committerJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Fri, 13 Apr 2012 06:23:40 +0000 (08:23 +0200)
doc/advanced.rst

index 1aba956e4801d5c8ef1731dfcc86f4a010d6a896..ba595fffba47601a8e12cad9d2c6147b9e35b57d 100644 (file)
@@ -7,8 +7,8 @@ Advanced usage of the ADAO module
 This section presents advanced methods to use the ADAO module, how to get more
 information, or how to use it without the graphical user interface (GUI).
 
-Exporting an ADAO command file (JDC) to YACS in console mode
-------------------------------------------------------------
+Exporting an ADAO command file (JDC) to YACS using a console user mode
+----------------------------------------------------------------------
 
 An export command can use the Python file generated by the editor used to build
 the ADAO command file (JDC). If the ADAO command file is named "Study1.comm",
@@ -30,13 +30,13 @@ path specifications.
 It is not necessary to launch and shut down SALOME each time if the application
 is already running.
 
-Running an ADAO calculation scheme in YACS in console mode
-----------------------------------------------------------
+Running an ADAO calculation scheme in YACS using a console user mode
+--------------------------------------------------------------------
 
 This section describes how to execute in console mode a YACS calculation scheme,
 obtained using the ADAO "Export to YACS" function. It uses the standard YACS
-console mode, which will be briefly recall here (see YACS documentation for more
-information).
+console mode, which is briefly recalled here (see YACS documentation for more
+information) through a simple example.
 
 The way to do that is as follows:
 
@@ -51,8 +51,83 @@ The way to do that is as follows:
 It is not necessary to launch and shut down SALOME each time if the application
 is already running.
 
-Getting more information when running an assimilation calculation
------------------------------------------------------------------
+Running an ADAO calculation scheme in YACS using a TUI user mode
+----------------------------------------------------------------
+
+This section describes how to execute in TUI (Text User Interface) mode a YACS
+calculation scheme, obtained using the ADAO "Export to YACS" function. It uses
+the standard YACS TUI mode, which is briefly recalled here (see YACS
+documentation for more information) through a simple example. As seen in
+documentation, a XML scheme can be loaded in a Python. We give here a whole
+sequence of command lines to test the validity of the scheme before executing
+it, adding some initial supplementary ones to explicitly load the types catalog
+to avoid weird difficulties::
+
+    import pilot
+    import SALOMERuntime
+    import loader
+    SALOMERuntime.RuntimeSALOME_setRuntime()
+
+    r = pilot.getRuntime()
+    xmlLoader = loader.YACSLoader()
+    xmlLoader.registerProcCataLoader()
+    try:
+     catalogAd = r.loadCatalog("proc", "<ADAO YACS xml scheme>")
+    except:
+      pass
+    r.addCatalog(catalogAd)
+
+    try:
+        p = xmlLoader.load("<ADAO YACS xml scheme>")
+    except IOError,ex:
+        print "IO exception:",ex
+
+    logger = p.getLogger("parser")
+    if not logger.isEmpty():
+        print "The imported file has errors :"
+        print logger.getStr()
+
+    if not p.isValid():
+        print "The schema is not valid and can not be executed"
+        print p.getErrorReport()
+
+    info=pilot.LinkInfo(pilot.LinkInfo.ALL_DONT_STOP)
+    p.checkConsistency(info)
+    if info.areWarningsOrErrors():
+        print "The schema is not consistent and can not be executed"
+        print info.getGlobalRepr()
+
+    e = pilot.ExecutorSwig()
+    e.RunW(p)
+    if p.getEffectiveState() != pilot.DONE:
+        print p.getErrorReport()
+
+This method allows for example to edit the YACS XML scheme in TUI, or to gather
+results for futher use.
+
+Getting informations on special variables during the ADAO calculation in YACS
+-----------------------------------------------------------------------------
+
+Some special variables, used during calculations, can be monitored during the
+ADAO calculation in YACS. These variables can be printed, plotted, saved, etc.
+This can be done using "*observers*", that are scripts associated with one
+variable. In order to use this feature, one has to build scripts using as
+standard inputs (available in the namespace) the variable ``var``. This variable
+is to be used in the same way as for the final ADD object.
+
+As an example, here is one very simple script used to print the value of one
+monitored variable::
+
+    print "    ---> Value =",var.valueserie(-1)
+
+Stored in a python file, this script can be associated to each variable
+available in the "*SELECTION*" keyword of the "*Observers*" command:
+"*Analysis*", "*CurrentState*", "*CostFunction*"... The current value of the
+variable will be printed at each step of the optimization or assimilation
+algorithm.
+
+Getting more information when running a calculation
+---------------------------------------------------
 
 When running, the ADAO module is logging useful data and messages. There are two
 ways to obtain theses informations.