Salome HOME
Correst warning when using default Minimizer
[modules/adao.git] / resources / ADAOSchemaCatalog.xml
1 <?xml version='1.0' encoding='iso-8859-1' ?>
2 <!--
3   Copyright (C) 2010-2011 EDF R&D
4
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.
9
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.
14
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
18
19   See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20   
21   Author: Andre Ribes, andre.ribes@edf.fr, EDF R&D
22 -->
23 <proc>
24
25   <objref name="computeAD" id="python:computeAD:1.0">
26     <base>pyobj</base>
27   </objref>
28
29   <!-- Types for parametric computations -->
30   <!-- TODO On devrait pouvoir le lire depuis le KERNEL !!!-->
31   <type name="long" kind="int"/>
32   <struct name="SALOME_TYPES/Parameter">
33     <member type="string" name="name"></member>
34     <member type="string" name="value"></member>
35   </struct>
36   <sequence content="SALOME_TYPES/Parameter" name="SALOME_TYPES/ParameterList"></sequence>
37   <sequence content="double" name="SALOME_TYPES/Variable"></sequence>
38   <sequence content="SALOME_TYPES/Variable" name="SALOME_TYPES/VariableSequence"></sequence>
39   <sequence content="SALOME_TYPES/VariableSequence" name="SALOME_TYPES/StateSequence"></sequence>
40   <sequence content="SALOME_TYPES/StateSequence" name="SALOME_TYPES/TimeSequence"></sequence>
41   <sequence content="string" name="SALOME_TYPES/VarList"></sequence>
42   <struct name="SALOME_TYPES/ParametricInput">
43     <member type="SALOME_TYPES/VarList" name="inputVarList"></member>
44     <member type="SALOME_TYPES/VarList" name="outputVarList"></member>
45     <member type="SALOME_TYPES/TimeSequence" name="inputValues"></member>
46     <member type="SALOME_TYPES/ParameterList" name="specificParameters"></member>
47   </struct>
48   <struct name="SALOME_TYPES/ParametricOutput">
49     <member type="SALOME_TYPES/TimeSequence" name="outputValues"></member>
50     <member type="SALOME_TYPES/ParameterList" name="specificOutputInfos"></member>
51     <member type="long" name="returnCode"></member>
52     <member type="string" name="errorMessage"></member>
53   </struct>
54
55
56   <inline name="CreateAssimilationStudy">
57     <script><code>
58
59 <![CDATA[
60 import numpy
61 print "Entering in CreateAssimilationStudy"
62 print "Name is", Name
63 print "Algorithm is", Algorithm
64 print "Debug is set to", Debug
65
66 # Create Assimilation study
67 from daYacsIntegration.daStudy import *
68 assim_study = daStudy(Name, Algorithm, Debug)
69
70 # Algorithm parameters
71 try:
72   AlgorithmParameters
73 except NameError:
74   pass
75 else:
76   assim_study.setAlgorithmParameters(AlgorithmParameters)
77
78 # Data
79 print "Data entered are:"
80 # Background
81 try:
82   Background
83 except NameError:
84   pass
85 else:
86   #print "Background is", Background
87   #print "BackgroundType is", BackgroundType
88   assim_study.setBackgroundType(BackgroundType)
89   assim_study.setBackground(Background)
90
91 # BackgroundError
92 try:
93   BackgroundError
94 except NameError:
95   pass
96 else:
97   #print "BackgroundError is", BackgroundError
98   #print "BackgroundErrorType is", BackgroundErrorType
99   assim_study.setBackgroundError(BackgroundError)
100
101 # Observation
102 try:
103   Observation
104 except NameError:
105   pass
106 else:
107   #print "Observation is", Observation
108   #print "ObservationType is", ObservationType
109   assim_study.setObservationType(ObservationType)
110   assim_study.setObservation(Observation)
111
112 # ObservationError
113 try:
114   ObservationError
115 except NameError:
116   pass
117 else:
118   #print "ObservationError is", ObservationError
119   #print "ObservationErrorType is", ObservationErrorType
120   assim_study.setObservationError(ObservationError)
121
122 # ObservationOperator
123 ObservationOperatorOk = 0
124 try:
125   ObservationOperator
126 except NameError:
127   pass
128 else:
129   #print "ObservationOperator is", ObservationOperator
130   #print "ObservationOperatorType is", ObservationOperatorType
131   assim_study.setObservationOperatorType("Matrix", ObservationOperatorType)
132   assim_study.setObservationOperator("Matrix", ObservationOperator)
133   ObservationOperatorOk = 1
134
135 if ObservationOperatorOk == 0:
136   try:
137     ObservationOperatorDirect
138   except NameError:
139     pass
140   else:
141     #print "ObservationOperatorDirect is", ObservationOperatorDirect
142     assim_study.setObservationOperatorType("Direct", "Function")
143     assim_study.setObservationOperator("Direct", ObservationOperatorDirect)
144   try:
145     ObservationOperatorTangent
146   except NameError:
147     pass
148   else:
149     #print "ObservationOperatorTangent is", ObservationOperatorTangent
150     assim_study.setObservationOperatorType("Tangent", "Function")
151     assim_study.setObservationOperator("Tangent", ObservationOperatorTangent)
152   try:
153     ObservationOperatorAdjoint
154   except NameError:
155     pass
156   else:
157     #print "ObservationOperatorAdjoint is", ObservationOperatorAdjoint
158     assim_study.setObservationOperatorType("Adjoint", "Function")
159     assim_study.setObservationOperator("Adjoint", ObservationOperatorAdjoint)
160
161 # Variables
162 for name, size in zip(InputVariablesNames, InputVariablesSizes):
163   assim_study.setInputVariable(name, size)
164 for name, size in zip(OutputVariablesNames, OutputVariablesSizes):
165   assim_study.setOutputVariable(name, size)
166
167 Study = assim_study
168 ]]>
169
170 </code></script>
171     <inport name="Name" type="string"/>
172     <inport name="Algorithm" type="string"/>
173     <inport name="Debug" type="bool"/>
174     <inport name="InputVariablesNames" type="stringvec"/>
175     <inport name="InputVariablesSizes" type="intvec"/>
176     <inport name="OutputVariablesNames" type="stringvec"/>
177     <inport name="OutputVariablesSizes" type="intvec"/>
178     <outport name="Study" type="pyobj"/>
179   </inline>
180
181   <inline name="CreateNumpyMatrixFromString">
182     <script><code><![CDATA[
183 print "Entering in CreateNumpyMatrixFromString"
184 import numpy
185 matrix = numpy.matrix(matrix_in_string)
186 type = "Matrix"
187 print "Matrix is", matrix
188 ]]></code></script>
189     <inport name="matrix_in_string" type="string"/>
190     <outport name="matrix" type="pyobj"/>
191     <outport name="type" type="string"/>
192   </inline>
193
194   <inline name="CreateNumpyMatrixFromScript">
195     <script><code><![CDATA[
196 print "Entering in CreateNumpyMatrixFromScript"
197 type = "Matrix"
198
199 # Get file path and filename
200 import sys
201 import os
202 filepath = os.path.dirname(script)
203 filename = os.path.basename(script)
204 module_name = os.path.splitext(filename)[0]
205 sys.path.insert(0,filepath)
206
207 # Import script
208 __import__(module_name)
209 user_script_module = sys.modules[module_name]
210
211 # Get Data from script
212 ]]></code></script>
213     <inport name="script" type="string"/>
214     <outport name="type" type="string"/>
215   </inline>
216
217   <inline name="CreateNumpyVectorFromString">
218     <script><code><![CDATA[
219 print "Entering in CreateNumpyVectorFromString"
220 import numpy
221 vector = numpy.matrix(vector_in_string)
222 type = "Vector"
223 print "Vector is", vector
224 ]]></code></script>
225     <inport name="vector_in_string" type="string"/>
226     <outport name="vector" type="pyobj"/>
227     <outport name="type" type="string"/>
228   </inline>
229
230   <inline name="CreateNumpyVectorFromScript">
231     <script><code><![CDATA[
232 print "Entering in CreateNumpyVectorFromScript"
233 type = "Vector"
234
235 # Get file path and filename
236 import sys
237 import os
238 filepath = os.path.dirname(script)
239 filename = os.path.basename(script)
240 module_name = os.path.splitext(filename)[0]
241 sys.path.insert(0,filepath)
242
243 # Import script
244 __import__(module_name)
245 user_script_module = sys.modules[module_name]
246
247 # Get Data from script
248 ]]></code></script>
249     <inport name="script" type="string"/>
250     <outport name="type" type="string"/>
251   </inline>
252
253   <inline name="SimpleExecuteDirectAlgorithm">
254     <script><code><![CDATA[
255 print "Entering in SimpleExecuteDirectAlgorithm"
256 from daYacsIntegration.daStudy import *
257 ADD = Study.getAssimilationStudy()
258 ADD.analyze()
259 ]]></code></script>
260     <inport name="Study" type="pyobj"/>
261     <outport name="Study" type="pyobj"/>
262   </inline>
263
264   <inline name="SimpleUserAnalysis">
265     <script><code><![CDATA[
266 #-*-coding:iso-8859-1-*-
267 print "Entering in SimpleUserAnalysis"
268 from daYacsIntegration.daStudy import *
269 ADD = Study.getAssimilationStudy()
270 # User code is below
271
272 ]]></code></script>
273     <inport name="Study" type="pyobj"/>
274   </inline>
275
276   <inline name="FakeOptimizerLoopNode">
277     <script><code><![CDATA[
278 print "Entering in FakeOptimizerLoopNode"
279 result = None
280 ]]></code></script>
281     <inport name="computation" type="SALOME_TYPES/ParametricInput"/>
282     <outport name="result" type="SALOME_TYPES/ParametricOutput"/>
283   </inline>
284
285   <inline name="CreateDictFromScript">
286     <script><code><![CDATA[
287 print "Entering in CreateDictFromScript"
288
289 # Get file path and filename
290 import sys
291 import os
292 filepath = os.path.dirname(script)
293 filename = os.path.basename(script)
294 module_name = os.path.splitext(filename)[0]
295 sys.path.insert(0,filepath)
296
297 # Import script
298 __import__(module_name)
299 user_script_module = sys.modules[module_name]
300
301 # Get Data from script
302 ]]></code></script>
303     <inport name="script" type="string"/>
304   </inline>
305
306   <inline name="UserDataInitFromScript">
307     <script><code><![CDATA[
308 print "Entering in UserDataInitFromScript"
309
310 # Get file path and filename
311 import sys
312 import os
313 filepath = os.path.dirname(script)
314 filename = os.path.basename(script)
315 module_name = os.path.splitext(filename)[0]
316 sys.path.insert(0,filepath)
317
318 # Import script
319 __import__(module_name)
320 user_script_module = sys.modules[module_name]
321
322 # Get Data from script
323 ]]></code></script>
324     <inport name="script" type="string"/>
325     <outport name="init_data" type="pyobj"/>
326   </inline>
327
328 </proc>