SET(TIMEOUT 500)
# Add all test subdirs
-SUBDIRS( test1001
- test1002
+SUBDIRS(
+ test1001
+ test1002
+ test6701
+ test6702
+ test6703
)
include $(top_srcdir)/adm_local/make_common_starter.am
-EXTRA_DIST = test1001 test1002 CTestTestfileInstall.cmake.in
+EXTRA_DIST = test1001 test1002 test6701 test6702 test6703 CTestTestfileInstall.cmake.in
DIR = $(top_srcdir)/test/
${mkinstalldirs} $(SALOMETESTDIR)
cp -R $(DIR)test1001 $(SALOMETESTDIR)
cp -R $(DIR)test1002 $(SALOMETESTDIR)
+ cp -R $(DIR)test6701 $(SALOMETESTDIR)
+ cp -R $(DIR)test6702 $(SALOMETESTDIR)
+ cp -R $(DIR)test6703 $(SALOMETESTDIR)
cp $(DIR)CTestTestfileInstall.cmake.in $(SALOMETESTDIR)/CTestTestfile.cmake
uninstall-local:
chmod -R +w $(SALOMETESTDIR)
rm -rf $(SALOMETESTDIR)/test1001
rm -rf $(SALOMETESTDIR)/test1002
+ rm -rf $(SALOMETESTDIR)/test6701
+ rm -rf $(SALOMETESTDIR)/test6702
+ rm -rf $(SALOMETESTDIR)/test6703
rm $(SALOMETESTDIR)/CTestTestfile.cmake
--- /dev/null
+# Copyright (C) 2008-2016 EDF R&D
+#
+# This file is part of SALOME ADAO module
+#
+# 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, or (at your option) any later version.
+#
+# 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
+#
+
+#FILE(GLOB ADAO_TEST1001_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.py")
+
+SET(TEST_NAMES
+ Doc_TUI_Exemple_01
+ )
+
+FOREACH(tfile ${TEST_NAMES})
+ SET(TEST_NAME ADAO_${tfile})
+ ADD_TEST(${TEST_NAME} python ${tfile}.py)
+ #ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ${tfile}.py)
+ SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}")
+ENDFOREACH()
--- /dev/null
+#-*-coding:iso-8859-1-*-
+#
+# Copyright (C) 2008-2016 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
+#
+# Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
+
+# ==============================================================================
+def test1():
+
+ from numpy import array, matrix
+ import adaoBuilder
+ case = adaoBuilder.New()
+ case.set( 'AlgorithmParameters', Algorithm='3DVAR' )
+ case.set( 'Background', Vector=[0, 1, 2] )
+ case.set( 'BackgroundError', ScalarSparseMatrix=1.0 )
+ case.set( 'Observation', Vector=array([0.5, 1.5, 2.5]) )
+ case.set( 'ObservationError', DiagonalSparseMatrix='1 1 1' )
+ case.set( 'ObservationOperator', Matrix='1 0 0;0 2 0;0 0 3' )
+ case.set( 'Observer', Variable="Analysis", Template="ValuePrinter" )
+ case.execute()
+
+# ==============================================================================
+if __name__ == "__main__":
+ print '\n AUTODIAGNOSTIC \n'
+ print """Exemple de la doc :
+
+ Un exemple simple de création d'un cas de calcul TUI ADAO
+ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ """
+ test1()
--- /dev/null
+# Copyright (C) 2008-2016 EDF R&D
+#
+# This file is part of SALOME ADAO module
+#
+# 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, or (at your option) any later version.
+#
+# 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
+#
+
+#FILE(GLOB ADAO_TEST1001_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.py")
+
+SET(TEST_NAMES
+ Doc_TUI_Exemple_02
+ )
+
+FOREACH(tfile ${TEST_NAMES})
+ SET(TEST_NAME ADAO_${tfile})
+ ADD_TEST(${TEST_NAME} python ${tfile}.py)
+ #ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ${tfile}.py)
+ SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}")
+ENDFOREACH()
--- /dev/null
+#-*-coding:iso-8859-1-*-
+#
+# Copyright (C) 2008-2016 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
+#
+# Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
+
+# ==============================================================================
+def test1():
+
+ from numpy import array, matrix
+ import adaoBuilder
+ case = adaoBuilder.New()
+ case.set( 'AlgorithmParameters', Algorithm='3DVAR' )
+ case.set( 'Background', Vector=[0, 1, 2] )
+ case.set( 'BackgroundError', ScalarSparseMatrix=1.0 )
+ case.set( 'Observation', Vector=array([0.5, 1.5, 2.5]) )
+ case.set( 'ObservationError', DiagonalSparseMatrix='1 1 1' )
+ case.set( 'ObservationOperator', Matrix='1 0 0;0 2 0;0 0 3' )
+ case.set( 'Observer', Variable="Analysis", Template="ValuePrinter" )
+ case.execute()
+
+def test2():
+
+ from numpy import array, matrix
+ import adaoBuilder
+ case = adaoBuilder.New()
+ case.set( 'AlgorithmParameters', Algorithm='3DVAR' )
+ case.set( 'Background', Vector=[0, 1, 2] )
+ case.set( 'BackgroundError', ScalarSparseMatrix=1.0 )
+ case.set( 'Observation', Vector=array([0.5, 1.5, 2.5]) )
+ case.set( 'ObservationError', DiagonalSparseMatrix='1 1 1' )
+ def simulation(x):
+ import numpy
+ __x = numpy.matrix(numpy.ravel(numpy.matrix(x))).T
+ __H = numpy.matrix("1 0 0;0 2 0;0 0 3")
+ return __H * __x
+ #
+ case.set( 'ObservationOperator',
+ OneFunction = simulation,
+ Parameters = {"DifferentialIncrement":0.01},
+ )
+ case.set( 'Observer', Variable="Analysis", Template="ValuePrinter" )
+ case.execute()
+
+# ==============================================================================
+if __name__ == "__main__":
+ print '\n AUTODIAGNOSTIC \n'
+ print """Exemple de la doc :
+
+ Création détaillée d'un cas de calcul TUI ADAO
+ ++++++++++++++++++++++++++++++++++++++++++++++
+ Les deux résultats doivent être identiques.
+ """
+ test1()
+ test2()
--- /dev/null
+# Copyright (C) 2008-2016 EDF R&D
+#
+# This file is part of SALOME ADAO module
+#
+# 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, or (at your option) any later version.
+#
+# 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
+#
+
+#FILE(GLOB ADAO_TEST1001_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.py")
+
+SET(TEST_NAMES
+ Doc_TUI_Exemple_03
+ )
+
+FOREACH(tfile ${TEST_NAMES})
+ SET(TEST_NAME ADAO_${tfile})
+ ADD_TEST(${TEST_NAME} python ${tfile}.py)
+ #ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ${tfile}.py)
+ SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}")
+ENDFOREACH()
--- /dev/null
+#-*-coding:iso-8859-1-*-
+#
+# Copyright (C) 2008-2016 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
+#
+# Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
+"Vérification d'un exemple de la documentation"
+
+# ==============================================================================
+
+#
+# Construction artificielle d'un exemple de données utilisateur
+# -------------------------------------------------------------
+alpha = 5.
+beta = 7
+gamma = 9.0
+#
+alphamin, alphamax = 0., 10.
+betamin, betamax = 3, 13
+gammamin, gammamax = 1.5, 15.5
+#
+def simulation(x):
+ "Fonction de simulation H pour effectuer Y=H(X)"
+ import numpy
+ __x = numpy.matrix(numpy.ravel(numpy.matrix(x))).T
+ __H = numpy.matrix("1 0 0;0 2 0;0 0 3; 1 2 3")
+ return __H * __x
+#
+# Observations obtenues par simulation
+# ------------------------------------
+observations = simulation((2, 3, 4))
+
+# ==============================================================================
+def test1():
+ "Test"
+ import numpy
+ import adaoBuilder
+ #
+ # Mise en forme des entrées
+ # -------------------------
+ Xb = (alpha, beta, gamma)
+ Bounds = (
+ (alphamin, alphamax),
+ (betamin, betamax ),
+ (gammamin, gammamax))
+ #
+ # TUI ADAO
+ # --------
+ case = adaoBuilder.New()
+ case.set(
+ 'AlgorithmParameters',
+ Algorithm = '3DVAR',
+ Parameters = {
+ "Bounds":Bounds,
+ "MaximumNumberOfSteps":100,
+ "StoreSupplementaryCalculations":[
+ "CostFunctionJ",
+ "CurrentState",
+ "SimulatedObservationAtOptimum",
+ ],
+ }
+ )
+ case.set( 'Background', Vector = numpy.array(Xb), Stored = True )
+ case.set( 'Observation', Vector = numpy.array(observations) )
+ case.set( 'BackgroundError', ScalarSparseMatrix = 1.0e10 )
+ case.set( 'ObservationError', ScalarSparseMatrix = 1.0 )
+ case.set(
+ 'ObservationOperator',
+ OneFunction = simulation,
+ Parameters = {"DifferentialIncrement":0.0001},
+ )
+ case.set( 'Observer', Variable="CurrentState", Template="ValuePrinter" )
+ case.execute()
+ #
+ # Exploitation indépendante
+ # -------------------------
+ Xbackground = case.get("Background")
+ Xoptimum = case.get("Analysis")[-1]
+ FX_at_optimum = case.get("SimulatedObservationAtOptimum")[-1]
+ J_values = case.get("CostFunctionJ")[:]
+ print
+ print "Nombre d'itérations internes...: %i"%len(J_values)
+ print "Etat initial...................:",numpy.ravel(Xbackground)
+ print "Etat optimal...................:",numpy.ravel(Xoptimum)
+ print "Simulation à l'état optimal....:",numpy.ravel(FX_at_optimum)
+ print
+
+# ==============================================================================
+if __name__ == "__main__":
+ print '\n AUTODIAGNOSTIC \n'
+ print """Exemple de la doc :
+
+ Exploitation indépendante des résultats d'un cas de calcul
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ """
+ test1()