]> SALOME platform Git repositories - modules/yacs.git/commitdiff
Salome HOME
WIP
authorAnthony Geay <anthony.geay@edf.fr>
Tue, 17 Mar 2020 10:30:17 +0000 (11:30 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Tue, 17 Mar 2020 10:30:17 +0000 (11:30 +0100)
src/engine/ForEachLoop.cxx
src/engine/NbBranches.cxx
src/engine/NbBranches.hxx

index 76eebb5a7cb21c1c31591441469a042c970fdc46..bafdb85d6153fb09e07c16b32a7b033fa9106e22 100644 (file)
@@ -526,7 +526,8 @@ void ForEachLoop::exUpdateState()
     {
       //internal graph update
       int i;
-      int nbOfBr(_nbOfBranches->getIntValue()),nbOfElts(_splitterNode.getNumberOfElements()),nbOfEltsDone(0);
+      int nbOfElts(_splitterNode.getNumberOfElements()),nbOfEltsDone(0);
+      int nbOfBr(_nbOfBranches->getNumberOfBranches(nbOfElts));
       if(_passedData)
         {
           _passedData->checkCompatibilyWithNb(nbOfElts);
@@ -1168,8 +1169,9 @@ list<ProgressWeight> ForEachLoop::getProgressWeight() const
 
 int ForEachLoop::getNbOfElementsToBeProcessed() const
 {
-  int nbBranches = _nbOfBranches->getIntValue();
-  return _splitterNode.getNumberOfElements()
+  int nbOfElems(_splitterNode.getNumberOfElements());
+  int nbBranches = _nbOfBranches->getNumberOfBranches(nbOfElems);
+  return nbOfElems
          + (_initNode ? nbBranches:0)
          + (_finalizeNode ? nbBranches:0) ;
 }
index bf7a8e1193b8b5d23e5eec2e558117a8933b2762..fe7ae53d3b6fe4d3c7731df3db0db1620d152da3 100644 (file)
@@ -33,6 +33,11 @@ std::unique_ptr<NbBranchesAbstract> NbBranches::copy(Node *node) const
   return std::unique_ptr<NbBranchesAbstract>(new NbBranches(*this,node));
 }
 
+int NbBranches::getNumberOfBranches(int) const
+{
+  return this->getIntValue();
+}
+
 bool NbBranches::isMyName(const std::string& name) const
 {
   return NbBranchesAbstract::IsBranchPortName(name);
@@ -70,6 +75,11 @@ std::unique_ptr<NbBranchesAbstract> NoNbBranches::copy(Node *) const
   return std::unique_ptr<NbBranchesAbstract>(new NoNbBranches);
 }
 
+int NoNbBranches::getNumberOfBranches(int nbOfElems) const
+{
+  return nbOfElems;
+}
+
 void NoNbBranches::exInit(bool start)
 {
 }
index a9cca28f3709c4dd1e0bfaecf6decf49b0a19c48..8268b4c7ed0386a6af9eb4fc76ed8572691ae7c2 100644 (file)
@@ -33,6 +33,7 @@ namespace YACS
     {
       public:
         virtual std::unique_ptr<NbBranchesAbstract> copy(Node *node) const = 0;
+        virtual int getNumberOfBranches(int nbOfElems) const = 0;
         virtual bool isMyName(const std::string& name) const = 0;
         virtual void exInit(bool start) = 0;
         virtual InputPort *getPort() const = 0;
@@ -51,6 +52,7 @@ namespace YACS
         NbBranches(const NbBranches& other, Node *node):_nbOfBranches(other._nbOfBranches,node) { }
         bool isMyName(const std::string& name) const override;
         std::unique_ptr<NbBranchesAbstract> copy(Node *node) const override;
+        int getNumberOfBranches(int nbOfElems) const override;
         void exInit(bool start) override;
         InputPort *getPort() const override;
         bool isMultiplicitySpecified(unsigned& value) const override;
@@ -65,6 +67,7 @@ namespace YACS
       public:
         NoNbBranches() = default;
         std::unique_ptr<NbBranchesAbstract> copy(Node *node) const override;
+        int getNumberOfBranches(int nbOfElems) const override;
         bool isMyName(const std::string& name) const override { return false; }
         void exInit(bool start) override;
         InputPort *getPort() const override;