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.

Constructor & Destructor Documentation

◆ BaseObject() [1/2]

BaseObject::BaseObject ( )
default

Default constructor.

◆ BaseObject() [2/2]

BaseObject::BaseObject ( const BaseObject p)
default

Copy constructor, copies all the objects BaseObject contains.

◆ ~BaseObject()

virtual BaseObject::~BaseObject ( )
virtualdefault

virtual destructor

Member Function Documentation

◆ getGroupId()

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

References groupId_.

Referenced by BaseWall::getInteractionWith(), and MeshTriangle::getInteractionWith().

◆ getId()

unsigned int BaseObject::getId ( ) const
inline

Returns the unique identifier of any particular object.

Returns
id number of the current object
126  { return id_; }
unsigned int id_
unique identifier within handler (remains constant even if particle is moved)
Definition: BaseObject.h:149

References id_.

Referenced by WallHandler::addObject(), ConstantMassFlowMaserBoundary::addParticleToMaser(), SubcriticalMaserBoundary::addParticleToMaser(), DeletionBoundary::checkBoundaryAfterParticleMoved(), DPMBase::computeInternalForce(), Mercury3Dclump::computeInternalForce(), MPISphericalParticle::copyDataFromParticleToMPIParticle(), MPIInteraction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >::copyFromInteraction(), copyPositionFrom(), PeriodicBoundaryHandler::findNewParticle(), Screw::getDistanceAndNormalLabCoordinates(), MeshTriangle::getDistanceNormalOverlapType(), BaseInteraction::getEffectiveMass(), BaseInteraction::getEffectiveRadius(), BaseInteraction::getI(), BaseParticle::getInfo(), MeshTriangle::getInteractionWith(), BaseInteraction::getP(), BaseInteraction::importI(), BaseInteraction::importP(), HGrid::insertParticleToHgrid(), TriangleMeshWall::moveVerticesToMatchVolume(), PeriodicBoundaryHandler::processLocalGhostParticles(), Domain::processReceivedBoundaryParticleData(), Domain::processReceivedInteractionData(), WallHandler::readAndAddObject(), CurvyChute::recreateBottom(), BaseInteraction::setI(), BaseParticle::setIndSpecies(), BaseWall::setIndSpecies(), BaseSpecies::setInteractionDistance(), BaseInteraction::setP(), SphericalIndenter::setupInitialConditions(), Membrane::updateFaceNeighbors(), PeriodicBoundaryHandler::updateMaserParticle(), PeriodicBoundaryHandler::updateParticles(), Domain::updateParticles(), PeriodicBoundaryHandler::updateParticleStatus(), MixedSpecies< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >::write(), BaseInteraction::write(), Membrane::write(), MembraneDemo::write(), MembraneSelfTest::write(), BaseInteraction::writeInteraction(), BaseInteractable::~BaseInteractable(), BaseParticle::~BaseParticle(), and SuperQuadricParticle::~SuperQuadricParticle().

◆ getIndex()

unsigned int BaseObject::getIndex ( ) const
inline

Returns the index of the object in the handler.

119  { return index_; };
unsigned int index_
location in BaseHandler::objects_
Definition: BaseObject.h:144

References index_.

Referenced by T_protectiveWall::actionsAfterTimeStep(), Chutebelt::actionsAfterTimeStep(), BoundariesSelfTest::actionsAfterTimeStep(), protectiveWall::actionsAfterTimeStep(), PossibleContactList::add_PossibleContact(), SpeciesHandler::addObject(), BaseWall::addParticlesAtWall(), ConstantMassFlowMaserBoundary::checkBoundaryAfterParticleMoved(), DeletionBoundary::checkBoundaryAfterParticleMoved(), ScaleCoupling< M, O >::computeCouplingForce(), ScaleCoupling< M, O >::computeExternalForces(), ChuteWithPeriodicInflow::computeInternalForces(), ScaleCoupling< M, O >::computeProjectionMatrix(), BaseInteraction::gatherContactStatistics(), AxisymmetricIntersectionOfWalls::getDistanceAndNormal(), HorizontalBaseScrew::getDistanceAndNormal(), ScrewsymmetricIntersectionOfWalls::getDistanceAndNormal(), RestrictedWall::getInteractionWith(), TriangleMeshWall::getInteractionWith(), SuperQuadricParticle::getInteractionWithSuperQuad(), ParticleSpecies::getMixedSpecies(), PossibleContact::getNext(), PossibleContact::getOtherParticle(), PossibleContact::getPrevious(), HGrid::insertParticleToHgrid(), PossibleContactList::remove_ParticlePosibleContacts(), ScaleCoupling< M, O >::CoupledParticle::removeCoupledElement(), BaseInteraction::removeFromHandler(), InteractionHandler::removeObjectKeepingPeriodics(), ScaleCoupling< M, O >::CoupledParticle::setCoupledElement(), ParticleSpecies::setDensity(), ParticleSpecies::setMaxInteractionDistance(), PossibleContact::setNextPosition(), PossibleContact::setPreviousPosition(), BaseInteractable::setSpecies(), SphericalIndenter::setupInitialConditions(), MixedSpecies< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >::write(), BaseInteraction::writeToFStat(), BaseWall::writeVTK(), and BaseInteractable::~BaseInteractable().

◆ getName()

virtual std::string BaseObject::getName ( ) const
pure virtual

A purely virtual function.

Implemented in NonSphericalParticle, WearableTriangulatedWall, WearableTriangleMeshWall, VChute, TriangulatedWall, TriangleWall, TriangleMeshWall, SphericalWall, SineWall, RestrictedWall, ParabolaChute, NurbsWall, MeshTriangle, Membrane, LevelSetWall, IntersectionOfWalls, InfiniteWallWithHole, InfiniteWall, CylindricalWall, Combtooth, Coil, BasicUnionOfWalls, BasicIntersectionOfWalls, ArcWall, SuperQuadricParticle, SphericalParticle, ClumpParticle, BaseParticle, BaseInteraction, Domain, TimeSmoothedCG< Coordinates, BaseFunction, Fields >, TimeAveragedCG< Coordinates, BaseFunction, Fields >, TimeAveragedCG< CGCoordinates::XYZ, BaseFunction, CGFields::StandardFields >, CG< Coordinates, BaseFunction, Fields >, CG< Coordinates, CGFunctions::Lucy, CGFields::StandardFields >, CG< CGCoordinates::O, CGFunctions::Lucy, CGFields::StandardFields >, TimeDependentPeriodicBoundary, SubcriticalMaserBoundaryTEST, SubcriticalMaserBoundary, StressStrainControlBoundary, ShearBoxBoundary, RandomClusterInsertionBoundary, PolydisperseInsertionBoundary, PeriodicBoundary, LeesEdwardsBoundary, HopperInsertionBoundary, HeaterBoundary, FluxBoundary, FixedClusterInsertionBoundary, DropletBoundary, DeletionBoundary, CubeInsertionBoundary, CubeDeletionBoundary, ConstantMassFlowMaserBoundary, CircularPeriodicBoundary, ChuteInsertionBoundary, BidisperseCubeInsertionBoundary, BaseClusterInsertionBoundary, AngledPeriodicBoundary, WearableNurbsWall, SimpleDrumSuperquadrics, ScrewsymmetricIntersectionOfWalls, Screw, HorizontalScrew, HorizontalBaseScrew, AxisymmetricIntersectionOfWalls, Species< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >, Species< LinearViscoelasticNormalSpecies >, Species< LinearPlasticViscoelasticNormalSpecies, SlidingFrictionSpecies, IrreversibleAdhesiveSpecies >, Species< LinearViscoelasticNormalSpecies, SlidingFrictionSpecies, IrreversibleAdhesiveSpecies >, MixedSpecies< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >, and Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >.

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

◆ moveInHandler()

void BaseObject::moveInHandler ( unsigned int  index)
virtual

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

Parameters
[in]index
57 {
58  index_ = index;
59 }

References index_.

◆ read()

void BaseObject::read ( std::istream &  is)
pure virtual
Parameters
[in]

Implemented in BaseBoundary, WearableTriangulatedWall, WearableTriangleMeshWall, WearableNurbsWall, VChute, TriangulatedWall, TriangleWall, TriangleMeshWall, SphericalWall, SineWall, Screw, RestrictedWall, ParabolaChute, NurbsWall, MeshTriangle, Membrane, LevelSetWall, IntersectionOfWalls, InfiniteWallWithHole, InfiniteWall, HorizontalScrew, CylindricalWall, Combtooth, Coil, BasicUnionOfWalls, BasicIntersectionOfWalls, BaseWall, ArcWall, ParticleSpecies, BaseSpecies, SuperQuadricParticle, ClumpParticle, BaseParticle, SPHInteraction, SinterLinInteraction, SinterInteraction, LinearViscoelasticInteraction, LinearPlasticViscoelasticInteraction, HertzianViscoelasticInteraction, HertzianSinterInteraction, HertzianBSHPViscoelasticInteraction, SlidingFrictionInteraction, MindlinRollingTorsionInteraction, MindlinInteraction, FrictionInteraction, EmptyFrictionInteraction, BaseInteraction, ReversibleAdhesiveInteraction, RegimeSinterInteraction, ParhamiMcMeekingSinterInteraction, LiquidMigrationWilletInteraction, LiquidMigrationLSInteraction, LiquidBridgeWilletInteraction, IrreversibleAdhesiveInteraction, EmptyAdhesiveInteraction, ChargedBondedInteraction, BondedInteraction, Domain, BaseCG, TimeDependentPeriodicBoundary, SubcriticalMaserBoundaryTEST, SubcriticalMaserBoundary, StressStrainControlBoundary, ShearBoxBoundary, PolydisperseInsertionBoundary, PeriodicBoundary, LeesEdwardsBoundary, InsertionBoundary, HopperInsertionBoundary, HeaterBoundary, FluxBoundary, DropletBoundary, DeletionBoundary, CubeInsertionBoundary, CubeDeletionBoundary, ConstantMassFlowMaserBoundary, CircularPeriodicBoundary, ChuteInsertionBoundary, BidisperseCubeInsertionBoundary, BasePeriodicBoundary, BaseClusterInsertionBoundary, AngledPeriodicBoundary, BaseInteractable, SimpleDrumSuperquadrics, ScrewsymmetricIntersectionOfWalls, HorizontalBaseScrew, AxisymmetricIntersectionOfWalls, Species< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >, Species< LinearViscoelasticNormalSpecies >, Species< LinearPlasticViscoelasticNormalSpecies, SlidingFrictionSpecies, IrreversibleAdhesiveSpecies >, Species< LinearViscoelasticNormalSpecies, SlidingFrictionSpecies, IrreversibleAdhesiveSpecies >, MixedSpecies< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >, and Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >.

82 {
83  std::string dummy;
84  is >> dummy >> id_;
86 }
bool readOptionalVariable(std::istream &is, const std::string &name, T &variable)
Reads optional variables in the restart file.
Definition: FileIOHelpers.h:82

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

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

◆ setGroupId()

◆ setId()

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_
73 {
74  id_ = id;
76 }

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

◆ setIndex()

void BaseObject::setIndex ( unsigned int  index)

◆ write()

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 BaseBoundary, WearableTriangulatedWall, WearableTriangleMeshWall, WearableNurbsWall, VChute, TriangulatedWall, TriangleWall, TriangleMeshWall, SphericalWall, SineWall, Screw, RestrictedWall, ParabolaChute, NurbsWall, MeshTriangle, Membrane, IntersectionOfWalls, InfiniteWallWithHole, HorizontalScrew, CylindricalWall, Combtooth, Coil, BasicUnionOfWalls, BasicIntersectionOfWalls, BaseWall, ArcWall, ParticleSpecies, BaseSpecies, SuperQuadricParticle, ClumpParticle, BaseParticle, SPHInteraction, SinterLinInteraction, SinterInteraction, LinearViscoelasticInteraction, LinearPlasticViscoelasticInteraction, HertzianViscoelasticInteraction, HertzianSinterInteraction, HertzianBSHPViscoelasticInteraction, SlidingFrictionInteraction, MindlinRollingTorsionInteraction, MindlinInteraction, FrictionInteraction, EmptyFrictionInteraction, BaseInteraction, ReversibleAdhesiveInteraction, RegimeSinterInteraction, ParhamiMcMeekingSinterInteraction, LiquidMigrationWilletInteraction, LiquidMigrationLSInteraction, LiquidBridgeWilletInteraction, IrreversibleAdhesiveInteraction, EmptyAdhesiveInteraction, ChargedBondedInteraction, BondedInteraction, Domain, TimeSmoothedCG< Coordinates, BaseFunction, Fields >, TimeAveragedCG< Coordinates, BaseFunction, Fields >, TimeAveragedCG< CGCoordinates::XYZ, BaseFunction, CGFields::StandardFields >, CG< Coordinates, BaseFunction, Fields >, CG< Coordinates, CGFunctions::Lucy, CGFields::StandardFields >, CG< CGCoordinates::O, CGFunctions::Lucy, CGFields::StandardFields >, BaseCG, TimeDependentPeriodicBoundary, SubcriticalMaserBoundaryTEST, SubcriticalMaserBoundary, StressStrainControlBoundary, ShearBoxBoundary, PolydisperseInsertionBoundary, PeriodicBoundary, LeesEdwardsBoundary, InsertionBoundary, HopperInsertionBoundary, HeaterBoundary, FluxBoundary, DropletBoundary, DeletionBoundary, CubeInsertionBoundary, CubeDeletionBoundary, ConstantMassFlowMaserBoundary, CircularPeriodicBoundary, ChuteInsertionBoundary, BidisperseCubeInsertionBoundary, BasePeriodicBoundary, BaseClusterInsertionBoundary, AngledPeriodicBoundary, BaseInteractable, SimpleDrumSuperquadrics, ScrewsymmetricIntersectionOfWalls, HorizontalBaseScrew, AxisymmetricIntersectionOfWalls, Species< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >, Species< LinearViscoelasticNormalSpecies >, Species< LinearPlasticViscoelasticNormalSpecies, SlidingFrictionSpecies, IrreversibleAdhesiveSpecies >, Species< LinearViscoelasticNormalSpecies, SlidingFrictionSpecies, IrreversibleAdhesiveSpecies >, MixedSpecies< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >, and Interaction< NormalForceInteraction, FrictionForceInteraction, AdhesiveForceInteraction >.

92 {
93  os << getName();
94  os << " id " << id_;
95  if (groupId_) os << " groupID " << groupId_;
96 }
virtual std::string getName() const =0
A purely virtual function.

References getName(), groupId_, and id_.

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

Friends And Related Function Documentation

◆ operator<<

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 &
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

◆ operator>>

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&
48 {
49  o.read(is);
50  return (is);
51 }
virtual void read(std::istream &is)=0
Definition: BaseObject.cc:81

Member Data Documentation

◆ groupId_

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_

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

◆ id_

unsigned int BaseObject::id_ = 0
private

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

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

◆ index_

unsigned int BaseObject::index_ = 0
private

location in BaseHandler::objects_

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


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