]> SALOME platform Git repositories - tools/ydefx.git/commitdiff
Salome HOME
Fix order of outputs in c++ mode. V9_10_0 V9_10_0a1 V9_10_0a2 V9_10_0b1 V9_10_0rc1
authorOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Tue, 20 Sep 2022 15:58:35 +0000 (17:58 +0200)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Tue, 20 Sep 2022 15:58:35 +0000 (17:58 +0200)
src/cpp/PyStudyFunction.cxx
src/cpp/PyStudyFunction.hxx
src/cpp/SamplePyConversions.hxx
src/cpp/TMonoPyJob.hxx
src/cpp/TPyStudyJob.hxx
src/pyexample/multijob/launch_multi.py

index 03ab8b650b97ccdbb2466c6051904b3a7aa8bba6..6c4dc4c09efd2c845bb530915ada18ec8d087aba 100644 (file)
@@ -149,4 +149,13 @@ std::list<std::string> PyStudyFunction::datafiles()const
   return std::list<std::string>();
 }
 
+py2cpp::PyPtr PyStudyFunction::createEmptySample()const
+{
+  py2cpp::PyPtr sample;
+  py2cpp::PyFunction fnCreateEmptySample;
+  fnCreateEmptySample.loadExp(_pyObject, "CreateEmptySample");
+  sample = fnCreateEmptySample();
+  return sample;
+}
+
 }
index 17ae27d06ac5643a01062c4059517073b27104d7..6b4541634fc909d1349608396cb2befea08f2035 100644 (file)
@@ -40,6 +40,7 @@ public:
   virtual std::string errors()const;
   virtual bool isValid()const;
   virtual std::list<std::string> datafiles()const;
+  py2cpp::PyPtr createEmptySample()const;
   friend PyObject * py2cpp::toPy(const PyStudyFunction& jp);
 private:
   py2cpp::PyPtr _pyObject;
index b720bbdbaed7f0efbdfa74ebe59f17915e281bbb..8fdeca341f97a88f9131ea079cf016416915f1f5 100644 (file)
@@ -86,14 +86,6 @@ YDEFX_EXPORT py2cpp::ConversionCheck outputFromPy(PyObject* obj, Sample<Ts...>&
 template <class ...Ts>
 YDEFX_EXPORT py2cpp::ConversionCheck errorsFromPy(PyObject* obj, Sample<Ts...>& sample);
 
-/*!
- * A python sample object is created and it contains input and output names of
- * variables. It also contains input values, but output values and errors are
- * not copied.
- */
-template <class ...Ts>
-YDEFX_EXPORT py2cpp::PyPtr createPySample(const Sample<Ts...>& sample);
-
 /*!
  * Fetch output values and errors from the python objet.
  * The c++ sample should already contain the names of variables when this
@@ -355,21 +347,6 @@ YDEFX_EXPORT py2cpp::ConversionCheck errorsFromPy(PyObject* obj, Sample<Ts...>&
   return check;
 }
 
-template <class ...Ts>
-YDEFX_EXPORT py2cpp::PyPtr createPySample(const Sample<Ts...>& sample)
-{
-  py2cpp::PyFunction sampleConstructor;
-  sampleConstructor.loadExp("pydefx", "Sample");
-  py2cpp::PyPtr result = sampleConstructor(sample.allInputNames(),
-                                           sample.allOutputNames());
-
-  py2cpp::PyFunction setInputValues;
-  setInputValues.loadExp(result, "setInputValues");
-  setInputValues(inputToPy(sample));
-
-  return result;
-}
-
 template <class ...Ts>
 YDEFX_EXPORT py2cpp::ConversionCheck fetchResults(const py2cpp::PyPtr& obj, Sample<Ts...>& sample)
 {
index 54753d8e7ce69128d50c898c8bf820b779dfecfd..8d50f63209506671532560f2e4657a3ad2697757 100644 (file)
@@ -41,7 +41,11 @@ public:
     {
       try
       {
-        py2cpp::PyPtr pySample = createPySample(sample);
+        py2cpp::PyPtr pySample = fnScript.createEmptySample();
+        py2cpp::PyFunction setInputValues;
+        setInputValues.loadExp(pySample, "setInputValues");
+        setInputValues(inputToPy(_sample));
+
         py2cpp::PyFunction pyFn;
         pyFn.loadExp(_pyStudy, "createNewJob");
         pyFn(fnScript, pySample, params);
index 02e3e803a21917c5a0ceda3496e94531dcaab44e..0922d45bd11f250f34f686e8ca9709ef7847e4da 100644 (file)
@@ -99,7 +99,11 @@ private:
     {
       try
       {
-        py2cpp::PyPtr pySample = createPySample(_sample);
+        py2cpp::PyPtr pySample = fnScript.createEmptySample();
+        py2cpp::PyFunction setInputValues;
+        setInputValues.loadExp(pySample, "setInputValues");
+        setInputValues(inputToPy(_sample));
+
         py2cpp::PyFunction pyFn;
         pyFn.loadExp(_pyStudy, "createNewJob");
         pyFn(fnScript, pySample, params);
index 2fa057fc9000e871396fe0b1d5effadf532c3a19..95fdc64037f6bf01e8092557e759e452d1903e03 100755 (executable)
@@ -2,7 +2,7 @@ import pydefx
 import os
 
 myParams = pydefx.Parameters()
-myParams.configureResource("eole")
+myParams.configureResource("gaia")
 #myParams.createResultDirectory("/tmp")
 myParams.nb_branches = 4
 myParams.salome_parameters.resource_required.nb_proc = 1