Version: 9.15.0
YACS::ENGINE::NonContigPartDefinition Class Reference

#include <PlayGround.hxx>

Inheritance diagram for YACS::ENGINE::NonContigPartDefinition:
Collaboration diagram for YACS::ENGINE::NonContigPartDefinition:

Public Member Functions

 NonContigPartDefinition (const PlayGround *pg, const std::vector< int > &ids)
 
 NonContigPartDefinition (const ContigPartDefinition &other)
 
std::string printSelf () const
 
std::vector< bool > getCoresOn () const
 
std::vector< int > getIDs () const
 
NonContigPartDefinitioncopy () const
 
int getNumberOfCoresConsumed () const
 
- Public Member Functions inherited from YACS::ENGINE::PartDefinition
const PlayGroundgetPlayGround () const
 
int getSpaceSize () const
 
void stashPart (int nbCoresStashed, double weightOfRemain, YACS::BASES::AutoRefCnt< PartDefinition > &pdStashed, YACS::BASES::AutoRefCnt< PartDefinition > &pdRemain) const
 
std::vector< std::size_t > computeWorkerIdsCovered (int nbCoresPerComp) const
 
- Public Member Functions inherited from YACS::ENGINE::RefCounter
unsigned int getRefCnt () const
 
void incrRef () const
 
bool decrRef () const
 

Private Member Functions

void checkOKIds () const
 
 ~NonContigPartDefinition ()
 

Private Attributes

std::vector< int > _ids
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::ENGINE::PartDefinition
static YACS::BASES::AutoRefCnt< PartDefinitionBuildFrom (const PlayGround *pg, const std::vector< int > &coreIds)
 
- Static Public Attributes inherited from YACS::ENGINE::RefCounter
static unsigned int _totalCnt =0
 
- Protected Member Functions inherited from YACS::ENGINE::PartDefinition
 PartDefinition (const PlayGround *pg)
 
 PartDefinition (const PartDefinition &other)
 
virtual ~PartDefinition ()
 
- Protected Member Functions inherited from YACS::ENGINE::RefCounter
 RefCounter ()
 
 RefCounter (const RefCounter &other)
 
virtual ~RefCounter ()
 
- Protected Attributes inherited from YACS::ENGINE::RefCounter
unsigned int _cnt
 

Detailed Description

Definition at line 157 of file PlayGround.hxx.

Constructor & Destructor Documentation

◆ NonContigPartDefinition() [1/2]

NonContigPartDefinition::NonContigPartDefinition ( const PlayGround pg,
const std::vector< int > &  ids 
)

Definition at line 722 of file PlayGround.cxx.

722  :PartDefinition(pg),_ids(ids)
723 {
724  checkOKIds();
725 }
PartDefinition(const PlayGround *pg)
Definition: PlayGround.cxx:590

References checkOKIds().

Referenced by copy().

◆ NonContigPartDefinition() [2/2]

NonContigPartDefinition::NonContigPartDefinition ( const ContigPartDefinition other)

Definition at line 727 of file PlayGround.cxx.

727  :PartDefinition(other)
728 {
729 }

◆ ~NonContigPartDefinition()

YACS::ENGINE::NonContigPartDefinition::~NonContigPartDefinition ( )
inlineprivate

Definition at line 169 of file PlayGround.hxx.

169 { }

Member Function Documentation

◆ checkOKIds()

void NonContigPartDefinition::checkOKIds ( ) const
private

Definition at line 758 of file PlayGround.cxx.

759 {
760  int maxVal(getSpaceSize());
761  if(_ids.empty())
762  return;
763  int val(_ids.front());
764  if(val<0 || val>=maxVal)
765  throw Exception("checkOKIds : error 2 !");
766  std::size_t sz(_ids.size());
767  for(std::size_t i=0;i<sz-1;i++)
768  {
769  if(_ids[i+1]<=_ids[i])
770  throw Exception("checkOKIds : error 1 !");
771  if(_ids[i+1]>=maxVal)
772  throw Exception("checkOKIds : error 3 !");
773  }
774 }

References _ids, YACS::ENGINE::PartDefinition::getSpaceSize(), and yacsorb.CORBAEngineTest::i.

Referenced by NonContigPartDefinition().

◆ copy()

NonContigPartDefinition * NonContigPartDefinition::copy ( ) const
virtual

Implements YACS::ENGINE::PartDefinition.

Definition at line 748 of file PlayGround.cxx.

749 {
750  return new NonContigPartDefinition(*this);
751 }
NonContigPartDefinition(const PlayGround *pg, const std::vector< int > &ids)
Definition: PlayGround.cxx:722

References NonContigPartDefinition().

◆ getCoresOn()

std::vector< bool > NonContigPartDefinition::getCoresOn ( ) const
virtual

Implements YACS::ENGINE::PartDefinition.

Definition at line 740 of file PlayGround.cxx.

741 {
742  std::vector<bool> ret(getSpaceSize(),false);
743  for(std::vector<int>::const_iterator it=_ids.begin();it!=_ids.end();it++)
744  ret[*it]=true;
745  return ret;
746 }

References _ids, and YACS::ENGINE::PartDefinition::getSpaceSize().

◆ getIDs()

std::vector<int> YACS::ENGINE::NonContigPartDefinition::getIDs ( ) const
inline

Definition at line 164 of file PlayGround.hxx.

164 { return _ids; }

◆ getNumberOfCoresConsumed()

int NonContigPartDefinition::getNumberOfCoresConsumed ( ) const
virtual

Implements YACS::ENGINE::PartDefinition.

Definition at line 753 of file PlayGround.cxx.

754 {
755  return _ids.size();
756 }

References _ids.

◆ printSelf()

std::string NonContigPartDefinition::printSelf ( ) const
virtual

Implements YACS::ENGINE::PartDefinition.

Definition at line 731 of file PlayGround.cxx.

732 {
733  std::ostringstream oss;
734  oss << "Non contiguous : ";
735  for(std::vector<int>::const_iterator it=_ids.begin();it!=_ids.end();it++)
736  oss << *it << ", ";
737  return oss.str();
738 }

References _ids.

Member Data Documentation

◆ _ids

std::vector<int> YACS::ENGINE::NonContigPartDefinition::_ids
private

Definition at line 171 of file PlayGround.hxx.

Referenced by checkOKIds(), getCoresOn(), getNumberOfCoresConsumed(), and printSelf().


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