1 <?xml version='1.0' encoding='iso-8859-1' ?>
4 <objref name="computeAD" id="python:computeAD:1.0">
8 <!-- Types for parametric computations -->
9 <!-- TODO On devrait pouvoir le lire depuis le KERNEL !!!-->
10 <type name="long" kind="int"/>
11 <struct name="SALOME_TYPES/Parameter">
12 <member type="string" name="name"></member>
13 <member type="string" name="value"></member>
15 <sequence content="SALOME_TYPES/Parameter" name="SALOME_TYPES/ParameterList"></sequence>
16 <sequence content="double" name="Value1D"></sequence>
17 <sequence content="Value1D" name="SALOME_TYPES/Value"></sequence>
18 <sequence content="string" name="SALOME_TYPES/VarList"></sequence>
19 <sequence content="SALOME_TYPES/Value" name="SALOME_TYPES/ValueList"></sequence>
20 <struct name="SALOME_TYPES/ParametricInput">
21 <member type="SALOME_TYPES/VarList" name="inputVarList"></member>
22 <member type="SALOME_TYPES/VarList" name="outputVarList"></member>
23 <member type="SALOME_TYPES/ValueList" name="inputValues"></member>
24 <member type="SALOME_TYPES/ParameterList" name="specificParameters"></member>
26 <struct name="SALOME_TYPES/ParametricOutput">
27 <member type="SALOME_TYPES/ValueList" name="outputValues"></member>
28 <member type="SALOME_TYPES/ParameterList" name="specificOutputInfos"></member>
29 <member type="long" name="returnCode"></member>
30 <member type="string" name="errorMessage"></member>
34 <inline name="CreateAssimilationStudy">
39 print "Entering in CreateAssimilationStudy"
41 print "Algorithm is", Algorithm
42 print "Debug is set to", Debug
44 # Create Assimilation study
45 from daYacsIntegration.daStudy import *
46 assim_study = daStudy(Name, Algorithm, Debug)
48 # Algorithm parameters
54 assim_study.setAlgorithmParameters(AlgorithmParameters)
57 print "Data entered are:"
64 #print "Background is", Background
65 #print "BackgroundType is", BackgroundType
66 assim_study.setBackgroundType(BackgroundType)
67 assim_study.setBackground(Background)
75 #print "BackgroundError is", BackgroundError
76 #print "BackgroundErrorType is", BackgroundErrorType
77 assim_study.setBackgroundError(BackgroundError)
85 #print "Observation is", Observation
86 #print "ObservationType is", ObservationType
87 assim_study.setObservationType(ObservationType)
88 assim_study.setObservation(Observation)
96 #print "ObservationError is", ObservationError
97 #print "ObservationErrorType is", ObservationErrorType
98 assim_study.setObservationError(ObservationError)
100 # ObservationOperator
101 ObservationOperatorOk = 0
107 #print "ObservationOperator is", ObservationOperator
108 #print "ObservationOperatorType is", ObservationOperatorType
109 assim_study.setObservationOperatorType("Matrix", ObservationOperatorType)
110 assim_study.setObservationOperator("Matrix", ObservationOperator)
111 ObservationOperatorOk = 1
113 if ObservationOperatorOk == 0:
115 ObservationOperatorDirect
119 #print "ObservationOperatorDirect is", ObservationOperatorDirect
120 assim_study.setObservationOperatorType("Direct", "Function")
121 assim_study.setObservationOperator("Direct", ObservationOperatorDirect)
123 ObservationOperatorTangent
127 #print "ObservationOperatorTangent is", ObservationOperatorTangent
128 assim_study.setObservationOperatorType("Tangent", "Function")
129 assim_study.setObservationOperator("Tangent", ObservationOperatorTangent)
131 ObservationOperatorAdjoint
135 #print "ObservationOperatorAdjoint is", ObservationOperatorAdjoint
136 assim_study.setObservationOperatorType("Adjoint", "Function")
137 assim_study.setObservationOperator("Adjoint", ObservationOperatorAdjoint)
140 for name, size in zip(InputVariablesNames, InputVariablesSizes):
141 assim_study.setInputVariable(name, size)
142 for name, size in zip(OutputVariablesNames, OutputVariablesSizes):
143 assim_study.setOutputVariable(name, size)
149 <inport name="Name" type="string"/>
150 <inport name="Algorithm" type="string"/>
151 <inport name="Debug" type="bool"/>
152 <inport name="InputVariablesNames" type="stringvec"/>
153 <inport name="InputVariablesSizes" type="intvec"/>
154 <inport name="OutputVariablesNames" type="stringvec"/>
155 <inport name="OutputVariablesSizes" type="intvec"/>
156 <outport name="Study" type="pyobj"/>
159 <inline name="CreateNumpyMatrixFromString">
160 <script><code><![CDATA[
161 print "Entering in CreateNumpyMatrixFromString"
163 matrix = numpy.matrix(matrix_in_string)
165 print "Matrix is", matrix
167 <inport name="matrix_in_string" type="string"/>
168 <outport name="matrix" type="pyobj"/>
169 <outport name="type" type="string"/>
172 <inline name="CreateNumpyMatrixFromScript">
173 <script><code><![CDATA[
174 print "Entering in CreateNumpyMatrixFromScript"
178 <inport name="script" type="string"/>
179 <outport name="type" type="string"/>
182 <inline name="CreateNumpyVectorFromString">
183 <script><code><![CDATA[
184 print "Entering in CreateNumpyVectorFromString"
186 vector = numpy.matrix(vector_in_string)
188 print "Vector is", vector
190 <inport name="vector_in_string" type="string"/>
191 <outport name="vector" type="pyobj"/>
192 <outport name="type" type="string"/>
195 <inline name="CreateNumpyVectorFromScript">
196 <script><code><![CDATA[
197 print "Entering in CreateNumpyVectorFromScript"
201 <inport name="script" type="string"/>
202 <outport name="type" type="string"/>
205 <inline name="SimpleExecuteDirectAlgorithm">
206 <script><code><![CDATA[
207 print "Entering in SimpleExecuteDirectAlgorithm"
208 from daYacsIntegration.daStudy import *
209 ADD = Study.getAssimilationStudy()
212 <inport name="Study" type="pyobj"/>
213 <outport name="Study" type="pyobj"/>
216 <inline name="SimpleUserAnalysis">
217 <script><code><![CDATA[
218 #-*-coding:iso-8859-1-*-
219 print "Entering in SimpleUserAnalysis"
220 from daYacsIntegration.daStudy import *
221 ADD = Study.getAssimilationStudy()
225 <inport name="Study" type="pyobj"/>
228 <inline name="FakeOptimizerLoopNode">
229 <script><code><![CDATA[
230 print "Entering in FakeOptimizerLoopNode"
233 <inport name="computation" type="SALOME_TYPES/ParametricInput"/>
234 <outport name="result" type="SALOME_TYPES/ParametricOutput"/>
237 <inline name="CreateDictFromScript">
238 <script><code><![CDATA[
239 print "Entering in CreateDictFromScript"
242 <inport name="script" type="string"/>
245 <inline name="UserDataInitFromScript">
246 <script><code><![CDATA[
247 print "Entering in UserDataInitFromScript"
250 <inport name="script" type="string"/>
251 <outport name="init_data" type="pyobj"/>