]> SALOME platform Git repositories - modules/adao.git/blob - src/tests/daSalome/test_aster_zzzz159a_functions.py
Salome HOME
Adding UnscentedKalmanFilter algorithm
[modules/adao.git] / src / tests / daSalome / test_aster_zzzz159a_functions.py
1 # Copyright (C) 2010-2013 EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19 # Author: André Ribes, andre.ribes@edf.fr, EDF R&D
20
21 import numpy
22 import sys
23
24 sys.path.insert(0, init_data['SOURCES_ROOT'])
25 import test_aster_zzzz159a_aster_functions as Code_Aster
26
27 # Configuration du module
28 Code_Aster.debug = init_data["debug"]
29 Code_Aster.ASTER_ROOT = init_data["ASTER_ROOT"]
30 Code_Aster.SOURCES_ROOT = init_data['SOURCES_ROOT']
31 Code_Aster.export = init_data["export"]
32 Code_Aster.calcul = init_data["calcul"]
33 Code_Aster.parametres = init_data["parametres"]
34 Code_Aster.python_version = init_data["python_version"]
35
36 print computation
37 method = ""
38 for param in computation["specificParameters"]:
39   if param["name"] == "method":
40     method = param["value"]
41
42 # Extraction des données et remise en forme (normalement à faire
43 # dans le code
44 # On sait qu'on a trois variables
45 input_data = []
46 for i in range(3):
47   input_data.append(computation["inputValues"][0][0][i][0])
48
49 if method == "Adjoint":
50   input_data = (input_data, [])
51   for i in range(22):
52     if i < 11:
53       input_data[1].append(computation["inputValues"][0][0][3][i])
54     else:
55       input_data[1].append(computation["inputValues"][0][0][4][i-11])
56
57 result = {}
58 result["specificOutputInfos"] = []
59 result["returnCode"] = 0
60 result["errorMessage"] = ""
61
62 outputValues = [[[[]]]]
63 if method == "Direct":
64   output_data = Code_Aster.Calcul_Aster_Ponctuel(input_data)
65   outputValues[0][0] = [[],[]]
66   for i in range(22):
67     if i < 11:
68       outputValues[0][0][0].append(output_data[i])
69     else:
70       outputValues[0][0][1].append(output_data[i])
71
72 if method == "Tangent":
73   output_data = Code_Aster.Calcul_Aster_Ponctuel(input_data)
74   outputValues[0][0] = [[],[]]
75   for i in range(22):
76     if i < 11:
77       outputValues[0][0][0].append(output_data[i])
78     else:
79       outputValues[0][0][1].append(output_data[i])
80
81 if method == "Adjoint":
82   output_data = Code_Aster.Calcul_Aster_Adjoint(input_data)
83   outputValues[0][0] = [[],[],[]]
84   outputValues[0][0][0].append(output_data[0])
85   outputValues[0][0][1].append(output_data[1])
86   outputValues[0][0][2].append(output_data[2])
87
88 result["outputValues"] = outputValues
89
90 print "Computation end"