MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BaseObject Class Referenceabstract

It is an abstract base class due to the purely virtual functions declared below. Even if the function is purely virtual, it does not imply that it cannot have a definition. Abstract classes are useful to define a interface. More...

#include <BaseObject.h>

+ Inheritance diagram for BaseObject:

Public Member Functions

 BaseObject ()=default
 Default constructor. More...
 
 BaseObject (const BaseObject &p)=default
 Copy constructor, copies all the objects BaseObject contains. More...
 
virtual ~BaseObject ()=default
 virtual destructor More...
 
virtual void read (std::istream &is)=0
 
virtual void write (std::ostream &os) const =0
 A purely virtual function which has an implementation which writes the name and the object id_ to the output stream. More...
 
virtual std::string getName () const =0
 A purely virtual function. More...
 
virtual void moveInHandler (unsigned int index)
 Except that it is virtual, it does the same thing as setIndex() does. More...
 
void setIndex (unsigned int index)
 Allows one to assign an index to an object in the handler/container. More...
 
void setId (unsigned long id)
 Assigns a unique identifier to each object in the handler (container) which remains constant even after the object is deleted from the container/handler. More...
 
unsigned int getIndex () const
 Returns the index of the object in the handler. More...
 
unsigned int getId () const
 Returns the unique identifier of any particular object. More...
 
void setGroupId (unsigned groupId)
 
unsigned getGroupId () const
 

Private Attributes

unsigned int index_ = 0
 location in BaseHandler::objects_ More...
 
unsigned int id_ = 0
 unique identifier within handler (remains constant even if particle is moved) More...
 
unsigned int groupId_ = 0
 Identifier of a group within handler. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const BaseObject &o)
 A purely virtual method with an implementation which reads the index from the stream and assigns it to id_. More...
 
std::istream & operator>> (std::istream &is, BaseObject &o)
 Operator overloading for reading the data from an input stream into the BAseObject "o". More...
 

Detailed Description

It is an abstract base class due to the purely virtual functions declared below. Even if the function is purely virtual, it does not imply that it cannot have a definition. Abstract classes are useful to define a interface.

Definition at line 50 of file BaseObject.h.

Constructor & Destructor Documentation

BaseObject::BaseObject ( )
default

Default constructor.

BaseObject::BaseObject ( const BaseObject p)
default

Copy constructor, copies all the objects BaseObject contains.

virtual BaseObject::~BaseObject ( )
virtualdefault

virtual destructor

Member Function Documentation

unsigned BaseObject::getGroupId ( ) const
inline
See also
groupId_.

Definition at line 137 of file BaseObject.h.

References groupId_.

Referenced by BaseWall::getInteractionWith().

138  { return groupId_; }
unsigned int groupId_
Identifier of a group within handler.
Definition: BaseObject.h:157
unsigned int BaseObject::getId ( ) const
inline

Returns the unique identifier of any particular object.

Returns
id number of the current object

Definition at line 125 of file BaseObject.h.

References id_.

Referenced by ParticleHandler::addExistingObject(), ParticleHandler::addGhostObject(), WallHandler::addObject(), ParticleHandler::addObject(), SubcriticalMaserBoundary::addParticleToMaser(), ConstantMassFlowMaserBoundary::addParticleToMaser(), DeletionBoundary::checkBoundaryAfterParticleMoved(), DPMBase::computeInternalForce(), MPISphericalParticle::copyDataFromParticleToMPIParticle(), copyPositionFrom(), PeriodicBoundaryHandler::findNewParticle(), Screw::getDistanceAndNormalLabCoordinates(), BaseInteraction::getEffectiveMass(), BaseInteraction::getEffectiveRadius(), BaseInteraction::getI(), BaseParticle::getInfo(), BaseInteraction::getP(), BaseInteraction::importI(), BaseInteraction::importP(), HGrid::insertParticleToHgrid(), PeriodicBoundaryHandler::processLocalGhostParticles(), Domain::processReceivedBoundaryParticleData(), WallHandler::readAndAddObject(), BaseInteraction::setI(), BaseWall::setIndSpecies(), BaseParticle::setIndSpecies(), BaseSpecies::setInteractionDistance(), BaseInteraction::setP(), PeriodicBoundaryHandler::updateMaserParticle(), PeriodicBoundaryHandler::updateParticles(), Domain::updateParticles(), PeriodicBoundaryHandler::updateParticleStatus(), MixedSpecies< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >::write(), BaseInteraction::write(), BaseInteraction::writeInteraction(), BaseInteractable::~BaseInteractable(), BaseParticle::~BaseParticle(), and SuperQuadricParticle::~SuperQuadricParticle().

126  { return id_; }
unsigned int id_
unique identifier within handler (remains constant even if particle is moved)
Definition: BaseObject.h:149
unsigned int BaseObject::getIndex ( ) const
inline

Returns the index of the object in the handler.

Definition at line 118 of file BaseObject.h.

References index_.

Referenced by PossibleContactList::add_PossibleContact(), SpeciesHandler::addObject(), BaseWall::addParticlesAtWall(), CircularPeriodicBoundary::checkBoundaryAfterParticleMoved(), DeletionBoundary::checkBoundaryAfterParticleMoved(), ConstantMassFlowMaserBoundary::checkBoundaryAfterParticleMoved(), LiquidMigrationWilletInteraction::form(), BaseInteraction::gatherContactStatistics(), HorizontalBaseScrew::getDistanceAndNormal(), AxisymmetricIntersectionOfWalls::getDistanceAndNormal(), ScrewsymmetricIntersectionOfWalls::getDistanceAndNormal(), RestrictedWall::getInteractionWith(), ParticleSpecies::getMixedSpecies(), PossibleContact::getNext(), PossibleContact::getOtherParticle(), PossibleContact::getPrevious(), HGrid::insertParticleToHgrid(), PossibleContactList::remove_ParticlePosibleContacts(), BaseInteraction::removeFromHandler(), InteractionHandler::removeObjectKeepingPeriodics(), ParticleSpecies::setDensity(), ParticleSpecies::setMaxInteractionDistance(), PossibleContact::setNextPosition(), PossibleContact::setPreviousPosition(), BaseInteractable::setSpecies(), AngledPeriodicBoundary::shiftPosition(), MixedSpecies< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >::write(), BaseInteraction::writeToFStat(), BaseWall::writeVTK(), and BaseInteractable::~BaseInteractable().

119  { return index_; };
unsigned int index_
location in BaseHandler::objects_
Definition: BaseObject.h:144
virtual std::string BaseObject::getName ( ) const
pure virtual

A purely virtual function.

Implemented in BaseParticle, IntersectionOfWalls, ScrewsymmetricIntersectionOfWalls, AxisymmetricIntersectionOfWalls, Species< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >, PeriodicBoundary, BaseClusterInsertionBoundary, DeletionBoundary, InfiniteWall, TriangulatedWall, FluxBoundary, CG< Coordinates, BaseFunction, Fields >, CG< CGCoordinates::XYZ, BaseFunction, Fields >, ConstantMassFlowMaserBoundary, InfiniteWallWithHole, CubeInsertionBoundary, SubcriticalMaserBoundary, PolydisperseInsertionBoundary, SphericalWall, Domain, BaseInteraction, AngledPeriodicBoundary, Screw, Coil, HeaterBoundary, CircularPeriodicBoundary, HopperInsertionBoundary, HorizontalScrew, RestrictedWall, BasicIntersectionOfWalls, BasicUnionOfWalls, SuperQuadricParticle, TimeSmoothedCG< Coordinates, BaseFunction, Fields >, SimpleDrumSuperquadrics, BidisperseCubeInsertionBoundary, RandomClusterInsertionBoundary, LevelSetWall, TimeAveragedCG< Coordinates, BaseFunction, Fields >, TimeAveragedCG< CGCoordinates::XYZ, BaseFunction, Fields >, HorizontalBaseScrew, CylindricalWall, NurbsWall, FixedClusterInsertionBoundary, ChuteInsertionBoundary, TriangleWall, ArcWall, LeesEdwardsBoundary, CubeDeletionBoundary, MixedSpecies< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >, SineWall, Combtooth, StressStrainControlBoundary, SphericalParticle, ParabolaChute, SubcriticalMaserBoundaryTEST, ShearBoxBoundary, LiquidFilmParticle, ThermalParticle, DropletBoundary, and VChute.

Referenced by MixedSpecies< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >::mixAll(), BaseCG::write(), write(), and BaseWall::writeVTK().

void BaseObject::moveInHandler ( unsigned int  index)
virtual

Except that it is virtual, it does the same thing as setIndex() does.

Parameters
[in]index

Definition at line 56 of file BaseObject.cc.

References index_.

57 {
58  index_ = index;
59 }
unsigned int index_
location in BaseHandler::objects_
Definition: BaseObject.h:144
void BaseObject::read ( std::istream &  is)
pure virtual
Parameters
[in]param[in] is stream object from which data is read

Implemented in BaseParticle, IntersectionOfWalls, ScrewsymmetricIntersectionOfWalls, Species< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >, AxisymmetricIntersectionOfWalls, BaseSpecies, InsertionBoundary, PeriodicBoundary, BaseClusterInsertionBoundary, DeletionBoundary, InfiniteWall, TriangulatedWall, ConstantMassFlowMaserBoundary, FluxBoundary, SubcriticalMaserBoundary, PolydisperseInsertionBoundary, SphericalWall, Domain, InfiniteWallWithHole, HeaterBoundary, CubeInsertionBoundary, BaseInteraction, AngledPeriodicBoundary, SuperQuadricParticle, Screw, HorizontalScrew, TriangleWall, LevelSetWall, CircularPeriodicBoundary, Coil, SimpleDrumSuperquadrics, RestrictedWall, BidisperseCubeInsertionBoundary, HopperInsertionBoundary, BasicIntersectionOfWalls, BasicUnionOfWalls, LiquidMigrationWilletInteraction, EmptyFrictionInteraction, HorizontalBaseScrew, EmptyAdhesiveInteraction, HertzianViscoelasticInteraction, BaseCG, FrictionInteraction, MindlinInteraction, MindlinRollingTorsionInteraction, ArcWall, SlidingFrictionInteraction, LinearPlasticViscoelasticInteraction, NurbsWall, BaseInteractable, BaseBoundary, ChargedBondedInteraction, LiquidBridgeWilletInteraction, ParhamiMcMeekingSinterInteraction, RegimeSinterInteraction, ReversibleAdhesiveInteraction, HertzianSinterInteraction, LinearViscoelasticInteraction, SinterInteraction, BondedInteraction, IrreversibleAdhesiveInteraction, BaseWall, CylindricalWall, DropletBoundary, ChuteInsertionBoundary, LeesEdwardsBoundary, MixedSpecies< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >, SineWall, CubeDeletionBoundary, Combtooth, ParticleSpecies, StressStrainControlBoundary, LiquidFilmParticle, ThermalParticle, ParabolaChute, BasePeriodicBoundary, SubcriticalMaserBoundaryTEST, VChute, and ShearBoxBoundary.

Definition at line 81 of file BaseObject.cc.

References groupId_, id_, and helpers::readOptionalVariable().

Referenced by operator>>(), ParticleSpecies::read(), BaseBoundary::read(), and BaseInteractable::read().

82 {
83  std::string dummy;
84  is >> dummy >> id_;
86 }
unsigned int id_
unique identifier within handler (remains constant even if particle is moved)
Definition: BaseObject.h:149
bool readOptionalVariable(std::istream &is, const std::string &name, T &variable)
Reads optional variables in the restart file.
Definition: Helpers.h:247
unsigned int groupId_
Identifier of a group within handler.
Definition: BaseObject.h:157
void BaseObject::setGroupId ( unsigned  groupId)
inline
See also
groupId_.

Definition at line 131 of file BaseObject.h.

References groupId_.

Referenced by BaseCluster::particleInsertionSuccessful(), and WallHandler::readTriangleWall().

132  { groupId_ = groupId; }
unsigned int groupId_
Identifier of a group within handler.
Definition: BaseObject.h:157
void BaseObject::setId ( unsigned long  id)

Assigns a unique identifier to each object in the handler (container) which remains constant even after the object is deleted from the container/handler.

Parameters
[in]idid number of the current object
Todo:
TW: here we should update BaseHandler::nextId_

Definition at line 72 of file BaseObject.cc.

References id_.

Referenced by SubcriticalMaserBoundary::addParticleToMaser(), ConstantMassFlowMaserBoundary::addParticleToMaser(), MPISphericalParticle::copyDataFromMPIParticleToParticle(), BaseParticle::oldRead(), MixedSpecies< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >::read(), WallHandler::readAndAddObject(), and PeriodicBoundaryHandler::updateMaserParticle().

73 {
74  id_ = id;
76 }
unsigned int id_
unique identifier within handler (remains constant even if particle is moved)
Definition: BaseObject.h:149
void BaseObject::setIndex ( unsigned int  index)

Allows one to assign an index to an object in the handler/container.

Parameters
[in]indexindex number of the current object

Definition at line 64 of file BaseObject.cc.

References index_.

Referenced by SubcriticalMaserBoundary::addParticleToMaser(), ConstantMassFlowMaserBoundary::addParticleToMaser(), RestrictedWall::getInteractionWith(), BaseParticle::oldRead(), and MixedSpecies< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >::read().

65 {
66  index_ = index;
67 }
unsigned int index_
location in BaseHandler::objects_
Definition: BaseObject.h:144
void BaseObject::write ( std::ostream &  os) const
pure virtual

A purely virtual function which has an implementation which writes the name and the object id_ to the output stream.

Parameters
[in]osstream object to which data is written

Implemented in BaseParticle, IntersectionOfWalls, ScrewsymmetricIntersectionOfWalls, Species< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >, AxisymmetricIntersectionOfWalls, InsertionBoundary, PeriodicBoundary, BaseSpecies, BaseClusterInsertionBoundary, DeletionBoundary, TriangulatedWall, FluxBoundary, ConstantMassFlowMaserBoundary, CG< Coordinates, BaseFunction, Fields >, CG< CGCoordinates::XYZ, BaseFunction, Fields >, InfiniteWallWithHole, SubcriticalMaserBoundary, PolydisperseInsertionBoundary, SphericalWall, CubeInsertionBoundary, Domain, AngledPeriodicBoundary, HeaterBoundary, Screw, BaseInteraction, Coil, CircularPeriodicBoundary, HopperInsertionBoundary, HorizontalScrew, RestrictedWall, TriangleWall, BasicIntersectionOfWalls, BasicUnionOfWalls, SimpleDrumSuperquadrics, BidisperseCubeInsertionBoundary, TimeSmoothedCG< Coordinates, BaseFunction, Fields >, TimeAveragedCG< Coordinates, BaseFunction, Fields >, LiquidMigrationWilletInteraction, SuperQuadricParticle, TimeAveragedCG< CGCoordinates::XYZ, BaseFunction, Fields >, EmptyFrictionInteraction, HorizontalBaseScrew, EmptyAdhesiveInteraction, HertzianViscoelasticInteraction, BaseCG, FrictionInteraction, MindlinInteraction, MindlinRollingTorsionInteraction, CylindricalWall, BaseInteractable, BaseBoundary, SlidingFrictionInteraction, LinearPlasticViscoelasticInteraction, NurbsWall, ChargedBondedInteraction, LiquidBridgeWilletInteraction, ParhamiMcMeekingSinterInteraction, RegimeSinterInteraction, ReversibleAdhesiveInteraction, HertzianSinterInteraction, LinearViscoelasticInteraction, SinterInteraction, ArcWall, ChuteInsertionBoundary, BondedInteraction, IrreversibleAdhesiveInteraction, BaseWall, DropletBoundary, LeesEdwardsBoundary, CubeDeletionBoundary, MixedSpecies< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >, SineWall, Combtooth, ParticleSpecies, StressStrainControlBoundary, BasePeriodicBoundary, ParabolaChute, SubcriticalMaserBoundaryTEST, ShearBoxBoundary, LiquidFilmParticle, ThermalParticle, and VChute.

Definition at line 91 of file BaseObject.cc.

References getName(), groupId_, and id_.

Referenced by operator<<(), ParticleSpecies::write(), BaseBoundary::write(), and BaseInteractable::write().

92 {
93  os << getName();
94  os << " id " << id_;
95  if (groupId_) os << " groupID " << groupId_;
96 }
unsigned int id_
unique identifier within handler (remains constant even if particle is moved)
Definition: BaseObject.h:149
virtual std::string getName() const =0
A purely virtual function.
unsigned int groupId_
Identifier of a group within handler.
Definition: BaseObject.h:157

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const BaseObject o 
)
friend

A purely virtual method with an implementation which reads the index from the stream and assigns it to id_.

Parameters
[in]is
[in,out]os
[in]o
Returns
std::ostream &

Definition at line 36 of file BaseObject.cc.

37 {
38  o.write(os);
39  return os;
40 }
virtual void write(std::ostream &os) const =0
A purely virtual function which has an implementation which writes the name and the object id_ to the...
Definition: BaseObject.cc:91
std::istream& operator>> ( std::istream &  is,
BaseObject o 
)
friend

Operator overloading for reading the data from an input stream into the BAseObject "o".

Parameters
[in]o
[in,out]is
Returns
std::istream&

Definition at line 47 of file BaseObject.cc.

48 {
49  o.read(is);
50  return (is);
51 }
virtual void read(std::istream &is)=0
Definition: BaseObject.cc:81

Member Data Documentation

unsigned int BaseObject::groupId_ = 0
private

Identifier of a group within handler.

Useful to define properties to particle or wall clusters, etc. E.g. one can apply an action to a specific group, visualise a specific group, coarse-grain a specific group, etc.

See also
BaseHandler::nextGroupId_

Definition at line 157 of file BaseObject.h.

Referenced by getGroupId(), read(), setGroupId(), and write().

unsigned int BaseObject::id_ = 0
private

unique identifier within handler (remains constant even if particle is moved)

Definition at line 149 of file BaseObject.h.

Referenced by getId(), read(), setId(), and write().

unsigned int BaseObject::index_ = 0
private

location in BaseHandler::objects_

Definition at line 144 of file BaseObject.h.

Referenced by getIndex(), moveInHandler(), and setIndex().


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