Version: 9.15.0
YACS::ENGINE::AbstractPoint Class Referenceabstract

#include <AbstractPoint.hxx>

Inheritance diagram for YACS::ENGINE::AbstractPoint:
Collaboration diagram for YACS::ENGINE::AbstractPoint:

Public Member Functions

 AbstractPoint ()=default
 
 AbstractPoint (AbstractPoint *father)
 
AbstractPointgetFather () const
 
AbstractPointgetGodFather ()
 
bool amIGod ()
 
void setFather (AbstractPoint *father)
 
bool isBegin ()
 
bool isLast ()
 
bool isSimplyLinkedBeforeAfter (BlocPoint *sop)
 
bool isSimplyLinkedAfterNullBefore (BlocPoint *sop)
 
bool isSimplyLinkedBeforeNullAfter (BlocPoint *sop)
 
bool isNullBeforeNullAfter (BlocPoint *sop)
 
LinkedBlocPointtryAsLink (BlocPoint *sop)
 
ForkBlocPointtryAsFork (BlocPoint *sop)
 
ForkBlocPointtryAsForkBis (BlocPoint *sop)
 
ForkBlocPointtryAsForkTer (BlocPoint *sop)
 
ForkBlocPointtryAsForkQuatro (BlocPoint *sop)
 
virtual AbstractPointdeepCopy (AbstractPoint *father) const =0
 
virtual NodegetFirstNode ()=0
 
virtual NodegetLastNode ()=0
 
virtual AbstractPointfindPointWithNode (Node *node)=0
 
virtual bool contains (Node *node) const =0
 
virtual bool anyOf (const std::set< Node * > &nodes) const =0
 
virtual int getNumberOfNodes () const =0
 
virtual int getMaxLevelOfParallelism () const =0
 
virtual void getWeightRegardingDPL (ComplexWeight *weight)=0
 
virtual void partitionRegardingDPL (const PartDefinition *pd, std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &zeMap) const =0
 
virtual std::string getRepr () const =0
 
virtual void accept (PointVisitor *pv)=0
 
virtual AbstractPointexpandNonSimpleCaseOn (NotSimpleCasePoint *pathologicalPt, const std::set< Node * > &uncatchedNodes)=0
 
virtual ~AbstractPoint ()
 
bool isSimplyLinkedAfter (BlocPoint *sop, Node *node)
 
bool isSimplyLinkedBefore (BlocPoint *sop, Node *node)
 

Static Public Member Functions

static void TryAsNotSimpleCase (AbstractPoint *father, const std::vector< AbstractPoint * > &ptsToKill, std::list< AbstractPoint * > &nodes, bool &somethingDone)
 
static bool IsGatherB4Ext (Node *node)
 
static bool IsSimplyLinkedAfterExt (Node *node)
 
static bool IsScatterAfterExt (Node *node)
 
static bool IsSimplyLinkedBeforeExt (Node *node)
 
static bool IsNoLinksBefore (Node *node)
 
static bool IsNoLinksAfter (Node *node)
 
static NodeGetNodeB4 (Node *node)
 
static NodeGetNodeAfter (Node *node)
 
static AbstractPointGetDirectSonOf (AbstractPoint *refFather, AbstractPoint *sonOrLittleSon)
 
static bool IsCommonDirectSonOf (AbstractPoint *refFather, const std::list< OutGate * > &outgs, AbstractPoint *&ret)
 
static bool IsCommonDirectSonOf (AbstractPoint *refFather, const std::list< InGate * > &ings, AbstractPoint *&ret)
 
static void FeedData (AbstractPoint *ptToBeRewired, std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr< Bloc > > > *m)
 
static void FeedData (const std::list< AbstractPoint * > &ptsToBeRewired, std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr< Bloc > > > *m)
 
static void Rewire (const std::vector< AbstractPoint * > &ptsToKill, std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr< Bloc > > > *m)
 
static void UnRewire (std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr< Bloc > > > &m)
 
static void Display (std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr< Bloc > > > *m)
 

Protected Attributes

AbstractPoint_father = nullptr
 

Detailed Description

Definition at line 50 of file AbstractPoint.hxx.

Constructor & Destructor Documentation

◆ AbstractPoint() [1/2]

YACS::ENGINE::AbstractPoint::AbstractPoint ( )
default

◆ AbstractPoint() [2/2]

YACS::ENGINE::AbstractPoint::AbstractPoint ( AbstractPoint father)
inline

Definition at line 54 of file AbstractPoint.hxx.

54 :_father(father) { }

◆ ~AbstractPoint()

AbstractPoint::~AbstractPoint ( )
virtual

Definition at line 34 of file AbstractPoint.cxx.

35 {
36 }

Member Function Documentation

◆ accept()

virtual void YACS::ENGINE::AbstractPoint::accept ( PointVisitor pv)
pure virtual

◆ amIGod()

bool YACS::ENGINE::AbstractPoint::amIGod ( )
inline

Definition at line 57 of file AbstractPoint.hxx.

57 { return getGodFather()==nullptr; }
AbstractPoint * getGodFather()

◆ anyOf()

virtual bool YACS::ENGINE::AbstractPoint::anyOf ( const std::set< Node * > &  nodes) const
pure virtual

◆ contains()

virtual bool YACS::ENGINE::AbstractPoint::contains ( Node node) const
pure virtual

◆ deepCopy()

◆ Display()

void AbstractPoint::Display ( std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr< Bloc > > > *  m)
static

Definition at line 375 of file AbstractPoint.cxx.

376 {
377  for(auto it : *m)
378  {
379  ElementaryPoint *pt(std::get<0>(it.second));
380  auto newNode(pt->getNode());
381  for(auto it2 : newNode->getOutGate()->edSetInGate())
382  {
383  std::cerr << pt->getNodeName() << " -> " << it2->getNode()->getName() << " " << newNode->typeName() << std::endl;
384  }
385  }
386 }

References YACS::ENGINE::ElementaryPoint::getNode(), YACS::ENGINE::ElementaryPoint::getNodeName(), and gui.GraphViewer::m.

◆ expandNonSimpleCaseOn()

virtual AbstractPoint* YACS::ENGINE::AbstractPoint::expandNonSimpleCaseOn ( NotSimpleCasePoint pathologicalPt,
const std::set< Node * > &  uncatchedNodes 
)
pure virtual

◆ FeedData() [1/2]

void AbstractPoint::FeedData ( AbstractPoint ptToBeRewired,
std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr< Bloc > > > *  m 
)
static

Feed m with all ElementaryPoints inside ptToBeRewired.

Definition at line 290 of file AbstractPoint.cxx.

291 {
292  Visitor1 vis(m);
293  ptToBeRewired->accept(&vis);
294 }
virtual void accept(PointVisitor *pv)=0

References accept(), and gui.GraphViewer::m.

Referenced by FeedData(), and TryAsNotSimpleCase().

◆ FeedData() [2/2]

void AbstractPoint::FeedData ( const std::list< AbstractPoint * > &  ptsToBeRewired,
std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr< Bloc > > > *  m 
)
static

Feed m with all ElementaryPoints inside ptsToBeRewired.

Definition at line 299 of file AbstractPoint.cxx.

300 {
301  for(auto it : ptsToBeRewired)
302  FeedData(it,m);
303 }
static void FeedData(AbstractPoint *ptToBeRewired, std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr< Bloc > > > *m)

References FeedData(), and gui.GraphViewer::m.

◆ findPointWithNode()

virtual AbstractPoint* YACS::ENGINE::AbstractPoint::findPointWithNode ( Node node)
pure virtual

◆ GetDirectSonOf()

AbstractPoint * AbstractPoint::GetDirectSonOf ( AbstractPoint refFather,
AbstractPoint sonOrLittleSon 
)
static

Definition at line 518 of file AbstractPoint.cxx.

519 {
520  if(!sonOrLittleSon)
521  throw YACS::Exception("AbstractPoint::GetDirectSonOf : sonOrLittleSon is null !");
522  AbstractPoint *curFath(sonOrLittleSon->getFather()),*cur(sonOrLittleSon);
523  while(curFath && curFath!=refFather)
524  {
525  cur=curFath;
526  curFath=cur->getFather();
527  }
528  if(!curFath)
529  throw YACS::Exception("AbstractPoint::GetDirectSonOf : not in the same family !");
530  return cur;
531 }
AbstractPoint * getFather() const

References getFather().

Referenced by YACS::ENGINE::BlocPoint::findPointWithNode(), and IsCommonDirectSonOf().

◆ getFather()

◆ getFirstNode()

◆ getGodFather()

AbstractPoint * AbstractPoint::getGodFather ( )

Definition at line 38 of file AbstractPoint.cxx.

39 {
40  if(_father==0)
41  return this;
42  else
43  return _father->getGodFather();
44 }

References _father, and getGodFather().

Referenced by getGodFather().

◆ getLastNode()

◆ getMaxLevelOfParallelism()

virtual int YACS::ENGINE::AbstractPoint::getMaxLevelOfParallelism ( ) const
pure virtual

◆ GetNodeAfter()

Node * AbstractPoint::GetNodeAfter ( Node node)
static

Definition at line 507 of file AbstractPoint.cxx.

508 {
509  OutGate *oug(node->getOutGate());
510  std::list<InGate *> fl(oug->edSetInGate());
511  if(fl.size()>1)
512  throw Exception("AbstractPoint::GetNodeAfter : precond not OK !");
513  if(fl.size()==0)
514  return 0;
515  return (*fl.begin())->getNode();
516 }
OutGate * getOutGate()
Definition: Node.hxx:124

References YACS::ENGINE::OutGate::edSetInGate(), and YACS::ENGINE::Node::getOutGate().

Referenced by tryAsFork(), tryAsForkBis(), tryAsForkQuatro(), and tryAsForkTer().

◆ GetNodeB4()

Node * AbstractPoint::GetNodeB4 ( Node node)
static

Definition at line 496 of file AbstractPoint.cxx.

497 {
498  InGate *ing(node->getInGate());
499  std::list<OutGate *> bl(ing->getBackLinks());
500  if(bl.size()>1)
501  throw Exception("AbstractPoint::GetNodeB4 : precond not OK !");
502  if(bl.size()==0)
503  return 0;
504  return bl.front()->getNode();
505 }
InGate * getInGate()
Definition: Node.hxx:123

References YACS::ENGINE::InGate::getBackLinks(), and YACS::ENGINE::Node::getInGate().

Referenced by tryAsFork(), tryAsForkBis(), tryAsForkQuatro(), and tryAsForkTer().

◆ getNumberOfNodes()

virtual int YACS::ENGINE::AbstractPoint::getNumberOfNodes ( ) const
pure virtual

◆ getRepr()

virtual std::string YACS::ENGINE::AbstractPoint::getRepr ( ) const
pure virtual

◆ getWeightRegardingDPL()

virtual void YACS::ENGINE::AbstractPoint::getWeightRegardingDPL ( ComplexWeight weight)
pure virtual

◆ isBegin()

bool AbstractPoint::isBegin ( )

Definition at line 46 of file AbstractPoint.cxx.

47 {
48  Node *beg(getFirstNode());
49  InGate *ing(beg->getInGate());
50  return ing->getBackLinks().empty();
51 }
virtual Node * getFirstNode()=0
Base class for all nodes.
Definition: Node.hxx:70

References YACS::ENGINE::InGate::getBackLinks(), getFirstNode(), and YACS::ENGINE::Node::getInGate().

◆ IsCommonDirectSonOf() [1/2]

bool AbstractPoint::IsCommonDirectSonOf ( AbstractPoint refFather,
const std::list< InGate * > &  ings,
AbstractPoint *&  ret 
)
static

Definition at line 549 of file AbstractPoint.cxx.

550 {
551  if(ings.size()<1)
552  throw YACS::Exception("AbstractPoint::GetCommonDirectSonOf2 : not enough !");
553  std::list<InGate *>::const_iterator it(ings.begin());
554  InGate *ref(*(it++));
555  AbstractPoint *ref2(GetDirectSonOf(refFather,refFather->findPointWithNode(ref->getNode())));
556  for(;it!=ings.end();it++)
557  {
558  if(!ref2->contains((*it)->getNode()))
559  return false;
560  }
561  ret=ref2;
562  return true;
563 }
virtual AbstractPoint * findPointWithNode(Node *node)=0
static AbstractPoint * GetDirectSonOf(AbstractPoint *refFather, AbstractPoint *sonOrLittleSon)
def ref(target, callback=None)
Definition: CONNECTOR.py:120

References contains(), findPointWithNode(), GetDirectSonOf(), and gui.CONNECTOR::ref().

◆ IsCommonDirectSonOf() [2/2]

bool AbstractPoint::IsCommonDirectSonOf ( AbstractPoint refFather,
const std::list< OutGate * > &  outgs,
AbstractPoint *&  ret 
)
static

Definition at line 533 of file AbstractPoint.cxx.

534 {
535  if(outgs.size()<1)
536  throw YACS::Exception("AbstractPoint::GetCommonDirectSonOf1 : not enough !");
537  std::list<OutGate *>::const_iterator it(outgs.begin());
538  OutGate *ref(*(it++));
539  AbstractPoint *ref2(GetDirectSonOf(refFather,refFather->findPointWithNode(ref->getNode())));
540  for(;it!=outgs.end();it++)
541  {
542  if(!ref2->contains((*it)->getNode()))
543  return false;
544  }
545  ret=ref2;
546  return true;
547 }

References contains(), findPointWithNode(), GetDirectSonOf(), and gui.CONNECTOR::ref().

Referenced by YACS::ENGINE::BlocPoint::getNodeAfter(), YACS::ENGINE::BlocPoint::getNodeB4(), isSimplyLinkedAfter(), and isSimplyLinkedBefore().

◆ IsGatherB4Ext()

bool AbstractPoint::IsGatherB4Ext ( Node node)
static

Definition at line 436 of file AbstractPoint.cxx.

437 {
438  InGate *ing(node->getInGate());
439  return ing->getBackLinks().size()!=1;
440 }

References YACS::ENGINE::InGate::getBackLinks(), and YACS::ENGINE::Node::getInGate().

Referenced by tryAsLink().

◆ isLast()

bool AbstractPoint::isLast ( )

Definition at line 53 of file AbstractPoint.cxx.

54 {
55  Node *endd(getLastNode());
56  OutGate *oug(endd->getOutGate());
57  return oug->edSetInGate().empty();
58 }
virtual Node * getLastNode()=0

References YACS::ENGINE::OutGate::edSetInGate(), getLastNode(), and YACS::ENGINE::Node::getOutGate().

◆ IsNoLinksAfter()

bool AbstractPoint::IsNoLinksAfter ( Node node)
static

Definition at line 490 of file AbstractPoint.cxx.

491 {
492  OutGate *oug(node->getOutGate());
493  return oug->edSetInGate().size()==0;
494 }

References YACS::ENGINE::OutGate::edSetInGate(), and YACS::ENGINE::Node::getOutGate().

Referenced by isNullBeforeNullAfter(), isSimplyLinkedBeforeNullAfter(), tryAsForkQuatro(), and tryAsForkTer().

◆ IsNoLinksBefore()

bool AbstractPoint::IsNoLinksBefore ( Node node)
static

Definition at line 484 of file AbstractPoint.cxx.

485 {
486  InGate *ing(node->getInGate());
487  return ing->getBackLinks().size()==0;
488 }

References YACS::ENGINE::InGate::getBackLinks(), and YACS::ENGINE::Node::getInGate().

Referenced by isNullBeforeNullAfter(), isSimplyLinkedAfterNullBefore(), tryAsForkBis(), and tryAsForkQuatro().

◆ isNullBeforeNullAfter()

bool AbstractPoint::isNullBeforeNullAfter ( BlocPoint sop)

Definition at line 78 of file AbstractPoint.cxx.

79 {
80  Node *beg(getFirstNode()),*endd(getLastNode());
81  return IsNoLinksBefore(beg) && IsNoLinksAfter(endd);
82 }
static bool IsNoLinksAfter(Node *node)
static bool IsNoLinksBefore(Node *node)

References getFirstNode(), getLastNode(), IsNoLinksAfter(), and IsNoLinksBefore().

◆ IsScatterAfterExt()

bool AbstractPoint::IsScatterAfterExt ( Node node)
static

Definition at line 460 of file AbstractPoint.cxx.

461 {
462  OutGate *oug(node->getOutGate());
463  return oug->edSetInGate().size()!=1;
464 }

References YACS::ENGINE::OutGate::edSetInGate(), and YACS::ENGINE::Node::getOutGate().

Referenced by tryAsLink().

◆ isSimplyLinkedAfter()

bool AbstractPoint::isSimplyLinkedAfter ( BlocPoint sop,
Node node 
)

Definition at line 442 of file AbstractPoint.cxx.

443 {
444  OutGate *oug(node->getOutGate());
445  std::list<InGate *> ings(oug->edSetInGate());
446  if(ings.size()==1)
447  return true;
448  if(ings.size()==0)
449  return false;
450  AbstractPoint *dummy=0;
451  return IsCommonDirectSonOf(sop,ings,dummy);
452 }
static bool IsCommonDirectSonOf(AbstractPoint *refFather, const std::list< OutGate * > &outgs, AbstractPoint *&ret)

References YACS::ENGINE::OutGate::edSetInGate(), YACS::ENGINE::Node::getOutGate(), and IsCommonDirectSonOf().

Referenced by isSimplyLinkedAfterNullBefore(), isSimplyLinkedBeforeAfter(), and tryAsLink().

◆ IsSimplyLinkedAfterExt()

bool AbstractPoint::IsSimplyLinkedAfterExt ( Node node)
static

Definition at line 454 of file AbstractPoint.cxx.

455 {
456  OutGate *oug(node->getOutGate());
457  return oug->edSetInGate().size()<=1;
458 }

References YACS::ENGINE::OutGate::edSetInGate(), and YACS::ENGINE::Node::getOutGate().

Referenced by tryAsFork(), and tryAsForkBis().

◆ isSimplyLinkedAfterNullBefore()

bool AbstractPoint::isSimplyLinkedAfterNullBefore ( BlocPoint sop)

Definition at line 66 of file AbstractPoint.cxx.

67 {
68  Node *beg(getFirstNode()),*endd(getLastNode());
69  return IsNoLinksBefore(beg) && isSimplyLinkedAfter(sop,endd);
70 }
bool isSimplyLinkedAfter(BlocPoint *sop, Node *node)

References getFirstNode(), getLastNode(), IsNoLinksBefore(), and isSimplyLinkedAfter().

◆ isSimplyLinkedBefore()

bool AbstractPoint::isSimplyLinkedBefore ( BlocPoint sop,
Node node 
)

Definition at line 466 of file AbstractPoint.cxx.

467 {
468  InGate *ing(node->getInGate());
469  std::list<OutGate *> outgs(ing->getBackLinks());
470  if(outgs.size()==1)
471  return true;
472  if(outgs.size()==0)
473  return false;
474  AbstractPoint *dummy=0;
475  return IsCommonDirectSonOf(sop,outgs,dummy);
476 }

References YACS::ENGINE::InGate::getBackLinks(), YACS::ENGINE::Node::getInGate(), and IsCommonDirectSonOf().

Referenced by isSimplyLinkedBeforeAfter(), isSimplyLinkedBeforeNullAfter(), and tryAsLink().

◆ isSimplyLinkedBeforeAfter()

bool AbstractPoint::isSimplyLinkedBeforeAfter ( BlocPoint sop)

Definition at line 60 of file AbstractPoint.cxx.

61 {
62  Node *beg(getFirstNode()),*endd(getLastNode());
63  return isSimplyLinkedBefore(sop,beg) && isSimplyLinkedAfter(sop,endd);
64 }
bool isSimplyLinkedBefore(BlocPoint *sop, Node *node)

References getFirstNode(), getLastNode(), isSimplyLinkedAfter(), and isSimplyLinkedBefore().

Referenced by tryAsLink().

◆ IsSimplyLinkedBeforeExt()

bool AbstractPoint::IsSimplyLinkedBeforeExt ( Node node)
static

Definition at line 478 of file AbstractPoint.cxx.

479 {
480  InGate *ing(node->getInGate());
481  return ing->getBackLinks().size()<=1;
482 }

References YACS::ENGINE::InGate::getBackLinks(), and YACS::ENGINE::Node::getInGate().

Referenced by tryAsFork(), and tryAsForkTer().

◆ isSimplyLinkedBeforeNullAfter()

bool AbstractPoint::isSimplyLinkedBeforeNullAfter ( BlocPoint sop)

Definition at line 72 of file AbstractPoint.cxx.

73 {
74  Node *beg(getFirstNode()),*endd(getLastNode());
75  return IsNoLinksAfter(endd) && isSimplyLinkedBefore(sop,beg);
76 }

References getFirstNode(), getLastNode(), IsNoLinksAfter(), and isSimplyLinkedBefore().

◆ partitionRegardingDPL()

virtual void YACS::ENGINE::AbstractPoint::partitionRegardingDPL ( const PartDefinition pd,
std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &  zeMap 
) const
pure virtual

◆ Rewire()

void AbstractPoint::Rewire ( const std::vector< AbstractPoint * > &  ptsToKill,
std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr< Bloc > > > *  m 
)
static

This method go throw all ElementaryPoints of m. For each ElementaryPoint change the Node instance underneath. And then create links between those new Node by excluding all links going whose destination :

  • is inside ptToKill
  • is not refered by m

CF links of old nodes are NOT touched for unrewire phase. Typically all ElementaryPoints inside ptToKill are NOT into m.

Definition at line 322 of file AbstractPoint.cxx.

323 {
324  for(auto it : *m)
325  {
326  ElementaryPoint *pt(std::get<0>(it.second));
327  Node *node(std::get<1>(it.second));
328  auto newNode(std::get<2>(it.second).get());
329  pt->setNode(newNode);
330  }
331  for(auto it : *m)
332  {
333  ElementaryPoint *pt(std::get<0>(it.second));
334  Node *node(std::get<1>(it.second));
335  auto newNode(std::get<2>(it.second).get());
336  if(containsPtsToKill(ptsToKill,newNode))
337  continue;
338  for(auto it2 : node->getOutGate()->edSetInGate())
339  {
340  Node *nodeFwd(it2->getNode());
341  std::string nodeFwdName(nodeFwd->getName());
342  auto it3(m->find(nodeFwdName));
343  if(it3!=m->end())
344  {
345  Node *nodeFwdNew = std::get<2>(it3->second).get();
346  if(!containsPtsToKill(ptsToKill,newNode))
347  {
348  newNode->getOutGate()->edAddInGate(nodeFwdNew->getInGate());
349  }
350  //else
351  // node after nodeFwd is not in m fall into \a ptToKill
352  // -> ignore link.
353  }
354  //else
355  // node after nodeFwd is not in m. Typically because nodeFwd has not been put in m
356  // concretely : do not link incoming links to Node * inside ptToKill
357  }
358  }
359 }
bool containsPtsToKill(const std::vector< AbstractPoint * > &ptsToKill, Node *node)
bool edAddInGate(InGate *inGate)
Definition: OutGate.cxx:98

References containsPtsToKill(), YACS::ENGINE::OutGate::edAddInGate(), YACS::ENGINE::OutGate::edSetInGate(), YACS::ENGINE::Node::getInGate(), YACS::ENGINE::Node::getName(), YACS::ENGINE::Node::getOutGate(), gui.GraphViewer::m, and YACS::ENGINE::ElementaryPoint::setNode().

Referenced by TryAsNotSimpleCase().

◆ setFather()

◆ tryAsFork()

ForkBlocPoint * AbstractPoint::tryAsFork ( BlocPoint sop)

precondition : isSimplyLinkedBeforeAfter must return true on this.

Definition at line 145 of file AbstractPoint.cxx.

146 {
148  AbstractPoint *bb2(sop->findPointWithNode(bb)),*ee2(sop->findPointWithNode(ee));
149  //
150  const std::list<AbstractPoint *>& lp(sop->getListOfPoints());
151  std::list<AbstractPoint *> l; l.push_back(this);
152  for(std::list<AbstractPoint *>::const_iterator it=lp.begin();it!=lp.end();it++)
153  {
154  if(*it==this)
155  continue;
156  if(dynamic_cast<NotSimpleCasePoint *>(*it))
157  continue;
158  Node *curFirst((*it)->getFirstNode()),*curEnd((*it)->getLastNode());
159  if(!IsSimplyLinkedBeforeExt(curFirst) || !IsSimplyLinkedAfterExt(curEnd))
160  continue;
161  Node *curbb(GetNodeB4(curFirst)),*curee(GetNodeAfter(curEnd));
162  AbstractPoint *bb3(sop->findPointWithNode(curbb)),*ee3(sop->findPointWithNode(curee));
163  if(bb2==bb3 && ee2==ee3)
164  l.push_back(*it);
165  }
166  if(l.size()>1)
167  {
168  return new ForkBlocPoint(l,getFather());
169  }
170  else
171  return nullptr;
172 }
static bool IsSimplyLinkedBeforeExt(Node *node)
static bool IsSimplyLinkedAfterExt(Node *node)
static Node * GetNodeB4(Node *node)
static Node * GetNodeAfter(Node *node)
const std::list< AbstractPoint * > & getListOfPoints() const
Definition: BlocPoint.hxx:46
AbstractPoint * findPointWithNode(Node *node)
Definition: BlocPoint.cxx:52

References YACS::ENGINE::BlocPoint::findPointWithNode(), getFather(), getFirstNode(), getLastNode(), YACS::ENGINE::BlocPoint::getListOfPoints(), GetNodeAfter(), GetNodeB4(), IsSimplyLinkedAfterExt(), IsSimplyLinkedBeforeExt(), and testCppPluginInvokation::l.

◆ tryAsForkBis()

ForkBlocPoint * AbstractPoint::tryAsForkBis ( BlocPoint sop)

Definition at line 174 of file AbstractPoint.cxx.

175 {
177  AbstractPoint *ee2(sop->findPointWithNode(ee));
178  //
179  const std::list<AbstractPoint *>& lp(sop->getListOfPoints());
180  std::list<AbstractPoint *> l; l.push_back(this);
181  for(std::list<AbstractPoint *>::const_iterator it=lp.begin();it!=lp.end();it++)
182  {
183  if(*it==this)
184  continue;
185  if(dynamic_cast<NotSimpleCasePoint *>(*it))
186  continue;
187  Node *curFirst((*it)->getFirstNode()),*curEnd((*it)->getLastNode());
188  if(!IsNoLinksBefore(curFirst) || !IsSimplyLinkedAfterExt(curEnd))
189  continue;
190  Node *curee(GetNodeAfter(curEnd));
191  AbstractPoint *ee3(sop->findPointWithNode(curee));
192  if(ee2==ee3)
193  l.push_back(*it);
194  }
195  if(l.size()>1)
196  {
197  return new ForkBlocPoint(l,getFather());
198  }
199  else
200  return nullptr;
201 }

References YACS::ENGINE::BlocPoint::findPointWithNode(), getFather(), getFirstNode(), getLastNode(), YACS::ENGINE::BlocPoint::getListOfPoints(), GetNodeAfter(), GetNodeB4(), IsNoLinksBefore(), IsSimplyLinkedAfterExt(), and testCppPluginInvokation::l.

◆ tryAsForkQuatro()

ForkBlocPoint * AbstractPoint::tryAsForkQuatro ( BlocPoint sop)

Definition at line 232 of file AbstractPoint.cxx.

233 {
235  AbstractPoint *bb2(sop->findPointWithNode(bb));
236  //
237  const std::list<AbstractPoint *>& lp(sop->getListOfPoints());
238  std::list<AbstractPoint *> l; l.push_back(this);
239  for(std::list<AbstractPoint *>::const_iterator it=lp.begin();it!=lp.end();it++)
240  {
241  if(*it==this)
242  continue;
243  if(dynamic_cast<NotSimpleCasePoint *>(*it))
244  continue;
245  Node *curFirst((*it)->getFirstNode()),*curEnd((*it)->getLastNode());
246  if(!IsNoLinksBefore(curFirst) || !IsNoLinksAfter(curEnd))
247  continue;
248  Node *curbb(GetNodeB4(curFirst));
249  AbstractPoint *bb3(sop->findPointWithNode(curbb));
250  if(bb2==bb3)
251  l.push_back(*it);
252  }
253  if(l.size()>1)
254  {
255  return new ForkBlocPoint(l,getFather());
256  }
257  else
258  return nullptr;
259 }

References YACS::ENGINE::BlocPoint::findPointWithNode(), getFather(), getFirstNode(), getLastNode(), YACS::ENGINE::BlocPoint::getListOfPoints(), GetNodeAfter(), GetNodeB4(), IsNoLinksAfter(), IsNoLinksBefore(), and testCppPluginInvokation::l.

◆ tryAsForkTer()

ForkBlocPoint * AbstractPoint::tryAsForkTer ( BlocPoint sop)

Definition at line 203 of file AbstractPoint.cxx.

204 {
206  AbstractPoint *bb2(sop->findPointWithNode(bb));
207  //
208  const std::list<AbstractPoint *>& lp(sop->getListOfPoints());
209  std::list<AbstractPoint *> l; l.push_back(this);
210  for(std::list<AbstractPoint *>::const_iterator it=lp.begin();it!=lp.end();it++)
211  {
212  if(*it==this)
213  continue;
214  if(dynamic_cast<NotSimpleCasePoint *>(*it))
215  continue;
216  Node *curFirst((*it)->getFirstNode()),*curEnd((*it)->getLastNode());
217  if(!IsSimplyLinkedBeforeExt(curFirst) || !IsNoLinksAfter(curEnd))
218  continue;
219  Node *curbb(GetNodeB4(curFirst));
220  AbstractPoint *bb3(sop->findPointWithNode(curbb));
221  if(bb2==bb3)
222  l.push_back(*it);
223  }
224  if(l.size()>1)
225  {
226  return new ForkBlocPoint(l,getFather());
227  }
228  else
229  return nullptr;
230 }

References YACS::ENGINE::BlocPoint::findPointWithNode(), getFather(), getFirstNode(), getLastNode(), YACS::ENGINE::BlocPoint::getListOfPoints(), GetNodeAfter(), GetNodeB4(), IsNoLinksAfter(), IsSimplyLinkedBeforeExt(), and testCppPluginInvokation::l.

◆ tryAsLink()

LinkedBlocPoint * AbstractPoint::tryAsLink ( BlocPoint sop)

precondition : isSimplyLinkedBeforeAfter must return true on this.

Definition at line 87 of file AbstractPoint.cxx.

88 {
89  Node *bb(getFirstNode()),*ee(getLastNode());
90  std::list<AbstractPoint *> l; l.push_back(this);
91  AbstractPoint *cur2(0);
92  //
93  cur2=sop->getNodeB4(bb);
94  while(cur2)
95  {
96  if(dynamic_cast<NotSimpleCasePoint *>(cur2))
97  continue;
98  Node *cur3(cur2->getFirstNode());
99  if(cur2->isSimplyLinkedBeforeAfter(sop))
100  {
101  l.push_front(cur2);
102  cur2=sop->getNodeB4(cur3);
103  continue;
104  }
105  else if(IsGatherB4Ext(cur3) && isSimplyLinkedAfter(sop,cur2->getLastNode()))
106  {
107  l.push_front(cur2);
108  break;
109  }
110  else
111  break;
112  }
113  //
114  cur2=sop->getNodeAfter(ee);
115  while(cur2)
116  {
117  if(dynamic_cast<NotSimpleCasePoint *>(cur2))
118  continue;
119  Node *cur3(cur2->getLastNode());
120  if(cur2->isSimplyLinkedBeforeAfter(sop))
121  {
122  l.push_back(cur2);
123  cur2=sop->getNodeAfter(cur3);
124  continue;
125  }
126  else if(IsScatterAfterExt(cur3) && isSimplyLinkedBefore(sop,cur2->getFirstNode()))
127  {
128  l.push_back(cur2);
129  break;
130  }
131  else
132  break;
133  }
134  if(l.size()>1)
135  {
136  return new LinkedBlocPoint(l,getFather());
137  }
138  else
139  return nullptr;
140 }
static bool IsScatterAfterExt(Node *node)
static bool IsGatherB4Ext(Node *node)
AbstractPoint * getNodeB4(Node *node)
Definition: BlocPoint.cxx:77
AbstractPoint * getNodeAfter(Node *node)
Definition: BlocPoint.cxx:63

References getFather(), getFirstNode(), getLastNode(), YACS::ENGINE::BlocPoint::getNodeAfter(), YACS::ENGINE::BlocPoint::getNodeB4(), IsGatherB4Ext(), IsScatterAfterExt(), isSimplyLinkedAfter(), isSimplyLinkedBefore(), isSimplyLinkedBeforeAfter(), and testCppPluginInvokation::l.

◆ TryAsNotSimpleCase()

void AbstractPoint::TryAsNotSimpleCase ( AbstractPoint father,
const std::vector< AbstractPoint * > &  ptsToKill,
std::list< AbstractPoint * > &  nodes,
bool &  somethingDone 
)
static

This methods tries to deal with sop that can t be considered as a composite of Link, Fork.

Do do so, this methods tries to exclude this from sop and then analyze if the graph can be decomposited into Links and Forks. If yes somethingDone is set to true and nodes is updated in consequence.

If the algorithm fails nodes are let untouched and somethingDone is let false.

Definition at line 396 of file AbstractPoint.cxx.

397 {
398  std::list<AbstractPoint *> lp2;
399  for(auto it : nodes)
400  {
401  if(std::find(ptsToKill.cbegin(),ptsToKill.cend(),it)==ptsToKill.cend())
402  lp2.push_back(it->deepCopy(nullptr));
403  }
404  BagPoint *tmp(new BagPoint(lp2,nullptr));
405  for(auto it : lp2)
406  it->setFather(tmp);
407  SetOfPoints sopTest(tmp);
408  std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr<Bloc> > > m;
409  FeedData(tmp,&m);
410  Rewire(ptsToKill,&m);
411  try
412  {
413  sopTest.basicSimplify();
414  }
415  catch(YACS::Exception& ex)
416  {// By removing elements in ptsToKill from this impossible to have a classical case -> un rewire to rollback nodes state
417  UnRewire(m);
418  return ;
419  }
420  AbstractPoint *pt(sopTest.getUniqueAndReleaseIt());
421  pt->setFather(father);
422  UnRewire(m);
423  for(auto it : nodes)
424  if(std::find(ptsToKill.cbegin(),ptsToKill.cend(),it)==ptsToKill.cend())
425  delete it;
426  nodes.clear();
427  nodes.push_back(pt);
428  for(auto it : ptsToKill)
429  {
430  std::list<AbstractPoint *> l; l.push_back(it);
431  nodes.push_back( new NotSimpleCasePoint(l,father) );
432  }
433  somethingDone = true;
434 }
static void Rewire(const std::vector< AbstractPoint * > &ptsToKill, std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr< Bloc > > > *m)
static void UnRewire(std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr< Bloc > > > &m)

References YACS::ENGINE::SetOfPoints::basicSimplify(), testCppPluginInvokation::ex, FeedData(), YACS::ENGINE::SetOfPoints::getUniqueAndReleaseIt(), testCppPluginInvokation::l, gui.GraphViewer::m, Rewire(), setFather(), and UnRewire().

Referenced by YACS::ENGINE::BagPoint::dealNotSimpleCase().

◆ UnRewire()

void AbstractPoint::UnRewire ( std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr< Bloc > > > &  m)
static

Unrewire consists into replacing newly created nodes into old one in ElementaryPoints contained in m. As CF links of old ENGINE::Node * has not be touched the CF graph is the same.

Definition at line 365 of file AbstractPoint.cxx.

366 {
367  for(auto it : m)
368  {
369  ElementaryPoint *pt(std::get<0>(it.second));
370  Node *node(std::get<1>(it.second));
371  pt->setNode(node);
372  }
373 }

References gui.GraphViewer::m, and YACS::ENGINE::ElementaryPoint::setNode().

Referenced by TryAsNotSimpleCase().

Member Data Documentation

◆ _father

AbstractPoint* YACS::ENGINE::AbstractPoint::_father = nullptr
protected

Definition at line 110 of file AbstractPoint.hxx.

Referenced by getGodFather().


The documentation for this class was generated from the following files: