-// Copyright (C) 2006-2016 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2023 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "AnyInputPort.hxx"
#include "AnyOutputPort.hxx"
#include "OutputPort.hxx"
+#include "NbBranches.hxx"
+
+#include <memory>
namespace YACS
{
Node *_finalizeNode;
unsigned _nbOfEltConsumed;
std::vector<int> _execIds;
- AnyInputPort _nbOfBranches;
+ //NbBranches _nbOfBranches2;
+ std::unique_ptr<NbBranchesAbstract> _nbOfBranches;
AnyOutputPort _splittedPort;
std::vector<Node *> _execNodes;
std::vector<Node *> _execInitNodes;
int _initializingCounter;
int _unfinishedCounter;
int _failedCounter;
- double _weight;
+ ComplexWeight _weight;
+ double _loopWeight;
protected:
static const char NAME_OF_SPLITTED_SEQ_OUT[];
static const char OLD_NAME_OF_SPLITTED_SEQ_OUT[];
- static const char NAME_OF_NUMBER_OF_BRANCHES[];
protected:
- DynParaLoop(const std::string& name, TypeCode *typeOfDataSplitted);
+ DynParaLoop(const std::string& name, TypeCode *typeOfDataSplitted, std::unique_ptr<NbBranchesAbstract>&& branchManager);
virtual ~DynParaLoop();
DynParaLoop(const DynParaLoop& other, ComposedNode *father, bool editionOnly);
public:
Node *edSetNode(Node *DISOWNnode);
Node *edSetInitNode(Node *DISOWNnode);
Node *edSetFinalizeNode(Node *DISOWNnode);
- virtual bool edAddDFLink(OutPort *start, InPort *end) throw(Exception);
+ virtual bool edAddDFLink(OutPort *start, InPort *end) ;
void init(bool start=true);
- InputPort *edGetNbOfBranchesPort() { return &_nbOfBranches; }
+ InputPort *edGetNbOfBranchesPort() { return _nbOfBranches->getPort(); }
int getNumberOfInputPorts() const;
int getNumberOfOutputPorts() const;
unsigned getNumberOfEltsConsumed() const { return _nbOfEltConsumed; }
std::list<OutputPort *> getSetOfOutputPort() const;
std::list<OutputPort *> getLocalOutputPorts() const;
OutputPort *edGetSamplePort() { return &_splittedPort; }
- OutPort *getOutPort(const std::string& name) const throw(Exception);
- InputPort *getInputPort(const std::string& name) const throw(Exception);
- OutputPort *getOutputPort(const std::string& name) const throw(Exception);
+ OutPort *getOutPort(const std::string& name) const ;
+ InputPort *getInputPort(const std::string& name) const ;
+ OutputPort *getOutputPort(const std::string& name) const ;
//! For the moment false is returned : impovement about it coming soon.
bool isPlacementPredictableB4Run() const;
- void edRemoveChild(Node *node) throw(Exception);
- virtual bool edAddChild(Node *DISOWNnode) throw(Exception);
+ void edRemoveChild(Node *node) ;
+ bool isLoop() const override { return true; }
+ virtual bool edAddChild(Node *DISOWNnode) ;
std::list<Node *> edGetDirectDescendants() const;
std::list<InputPort *> getSetOfInputPort() const;
std::list<InputPort *> getLocalInputPorts() const;
- unsigned getNumberOfBranchesCreatedDyn() const throw(Exception);
- Node *getChildByShortName(const std::string& name) const throw(Exception);
- Node *getChildByNameExec(const std::string& name, unsigned id) const throw(Exception);
+ unsigned getNumberOfBranchesCreatedDyn() const ;
+ Node *getChildByShortName(const std::string& name) const ;
+ Node *getChildByNameExec(const std::string& name, unsigned id) const ;
std::vector<Node *> getNodes() const { return _execNodes; } // need to use in GUI part for adding observers for clone nodes
- double getWeight() const { return _weight; }
- void setWeight(double newVal);
- double getWeightRegardingDPL() const { return getWeight(); }
+ ComplexWeight * getWeight();
+ void setWeight(double loopWeight);
+ void getWeightRegardingDPL(ComplexWeight *weight) {weight->addWeight(getWeight());}
bool isMultiplicitySpecified(unsigned& value) const;
void forceMultiplicity(unsigned value);
- virtual void checkBasicConsistency() const throw(Exception);
+ virtual void checkBasicConsistency() const ;
virtual std::string getErrorReport();
void accept(Visitor *visitor);
Node * getInitNode();
Node * getFinalizeNode();
int getMaxLevelOfParallelism() const;
void partitionRegardingDPL(const PartDefinition *pd, std::map<ComposedNode *, YACS::BASES::AutoRefCnt<PartDefinition> >& zeMap);
+ virtual void cleanDynGraph();
protected:
void buildDelegateOf(InPort * & port, OutPort *initialStart, const std::list<ComposedNode *>& pointsOfView);
void buildDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView);
std::map< ComposedNode *, std::list < OutPort *>, SortHierarc >& bw,
LinkInfo& info) const;
virtual void checkLinkPossibility(OutPort *start, const std::list<ComposedNode *>& pointsOfViewStart,
- InPort *end, const std::list<ComposedNode *>& pointsOfViewEnd) throw(Exception);
+ InPort *end, const std::list<ComposedNode *>& pointsOfViewEnd) ;
protected:
- void cleanDynGraph();
void prepareInputsFromOutOfScope(int branchNb);
void putValueOnBranch(Any *val, unsigned branchId, bool first);
TypeOfNode getIdentityOfNotifyerNode(const Node *node, unsigned& id);