SpeciesHandler Class Referencefinal

Container to store all ParticleSpecies. More...

#include <SpeciesHandler.h>

+ Inheritance diagram for SpeciesHandler:

Public Member Functions

 SpeciesHandler ()
 Default constructor, it creates an empty SpeciesHandler. More...
 
 SpeciesHandler (const SpeciesHandler &other)
 Constructor that copies all species and the pointer to the DPMBase from the given SpeciesHandler. More...
 
SpeciesHandleroperator= (const SpeciesHandler &rhs)
 Assignment operator that copies all species and the pointer to the DPMBase from the given SpeciesHandler. More...
 
 ~SpeciesHandler () override
 Destructor, it destructs the SpeciesHandler and all ParticleSpecies it contains. More...
 
void addObject (ParticleSpecies *S) override
 Adds a new ParticleSpecies to the SpeciesHandler. More...
 
void clear () override
 Empties the whole BaseHandler by removing all Objects and setting all other variables to 0. More...
 
void removeObject (unsigned int index) override
 Remove the ParticleSpecies with given id. More...
 
void readAndAddObject (std::istream &is) override
 Reads Species data into the SpeciesHandler from restart file. More...
 
ParticleSpeciesreadOldObject (std::istream &is)
 Reads ParticleSpecies into the SpeciesHandler from old-style restart data. More...
 
unsigned int getMixedId (unsigned int id1, unsigned int id2) const
 Gets the Id of the behaviour between two given species. More...
 
template<typename U >
std::enable_if<!std::is_pointer< typename U::MixedSpeciesType >::value, typename U::MixedSpeciesType * >::type getMixedObject (const U *S, const U *T)
 
BaseSpeciesgetMixedObject (unsigned int id1, unsigned int id2)
 Gets the mixed object that is constructed from two given species. More...
 
const std::vector< BaseSpecies * > & getMixedObjects () const
 Returns a pointer to the vector of all mixed objects. More...
 
void updateMixedObjects ()
 Updates the mixed species. More...
 
virtual void write (std::ostream &os) const
 Write all the species and mixed species to an output stream. More...
 
std::string getName () const override
 Returns the name of the handler, namely the string "SpeciesHandler". More...
 
bool useAngularDOFs ()
 Check if angular DOF have to be used. More...
 
- Public Member Functions inherited from BaseHandler< ParticleSpecies >
 BaseHandler ()
 Default BaseHandler constructor, it creates an empty BaseHandler and assigns DPMBase_ to a null pointer. More...
 
 BaseHandler (const BaseHandler< ParticleSpecies > &BH)
 Constructor that copies the objects of the given handler into itself and sets other variables to 0/nullptr. More...
 
virtual ~BaseHandler ()
 Destructor, it destructs the BaseHandler and all Object it contains. More...
 
void copyContentsFromOtherHandler (const BaseHandler< ParticleSpecies > &BH)
 Function that copies the contents (vector of pointers, maxObject_, nextId_, DPMBase_) from one handler (container) to the other. More...
 
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddObject (const U &object)
 Creates a copy of a Object and adds it to the BaseHandler. More...
 
std::enable_if< std::is_pointer< U >::value, U >::type copyAndAddObject (const U object)
 Creates a copy of a Object and adds it to the BaseHandler. More...
 
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddGhostObject (const U &object)
 Creates a copy of a Object and adds it to the BaseHandler. This is one locally for inserting mpi particles, they avoid the global check if the particle can actually be inserted, because the mpi domain already knows that is the case. More...
 
std::enable_if< std::is_pointer< U >::value, U >::type copyAndAddGhostObject (const U object)
 Creates a copy of a Object and adds it to the BaseHandler. This is one locally for inserting mpi particles, they avoid the global check if the particle can actually be inserted, because the mpi domain already knows that is the case. More...
 
virtual void addExistingObject (ParticleSpecies *O)
 Adds an existing object to the BaseHandler without changing the id of the object. More...
 
virtual void addObject (ParticleSpecies *object)
 Adds a new Object to the BaseHandler. More...
 
virtual void addGhostObject (ParticleSpecies *O)
 Adds a new Object to the BaseHandler. called by the to avoid increasing the id. More...
 
void removeIf (const std::function< bool(ParticleSpecies *)> cond)
 
virtual void removeObjects (std::vector< unsigned int > indices)
 
void removeLastObject ()
 Removes the last Object from the BaseHandler. More...
 
void read (std::istream &is)
 Reads all objects from restart data. More...
 
ParticleSpeciesgetObjectById (const unsigned int id)
 Gets a pointer to the Object at the specified index in the BaseHandler. More...
 
std::vector< ParticleSpecies * > getObjectsById (const unsigned int id)
 Gets a vector of pointers to the objects with the specific id. More...
 
ParticleSpeciesgetObject (const unsigned int id)
 Gets a pointer to the Object at the specified index in the BaseHandler.
More...
 
const ParticleSpeciesgetObject (const unsigned int id) const
 Gets a constant pointer to the Object at the specified index in the BaseHandler. More...
 
ParticleSpeciesgetLastObject ()
 Gets a pointer to the last Object in this BaseHandler. More...
 
const ParticleSpeciesgetLastObject () const
 Gets a constant pointer to the last Object in this BaseHandler. More...
 
virtual unsigned int getNumberOfObjects () const
 Gets the number of real Object in this BaseHandler. (i.e. no mpi or periodic particles) More...
 
unsigned int getSize () const
 Gets the size of the particleHandler (including mpi and periodic particles) More...
 
unsigned int getStorageCapacity () const
 Gets the storage capacity of this BaseHandler. More...
 
void setStorageCapacity (const unsigned int N)
 Sets the storage capacity of this BaseHandler. More...
 
void resize (const unsigned int N, const ParticleSpecies &obj)
 Resizes the container to contain N elements. More...
 
const std::vector< ParticleSpecies * >::const_iterator begin () const
 Gets the begin of the const_iterator over all Object in this BaseHandler. More...
 
const std::vector< ParticleSpecies * >::iterator begin ()
 Gets the begin of the iterator over all BaseBoundary in this BaseHandler. More...
 
const std::vector< ParticleSpecies * >::const_iterator end () const
 Gets the end of the const_iterator over all BaseBoundary in this BaseHandler. More...
 
const std::vector< ParticleSpecies * >::iterator end ()
 Gets the end of the iterator over all BaseBoundary in this BaseHandler. More...
 
void setDPMBase (DPMBase *DPMBase)
 Sets the problem that is solved using this handler. More...
 
void setId (ParticleSpecies *object, unsigned int id)
 
void increaseId ()
 
unsigned int getNextId ()
 
void setNextId (unsigned int id)
 
DPMBasegetDPMBase ()
 Gets the problem that is solved using this handler. More...
 
DPMBasegetDPMBase () const
 Gets the problem that is solved using this handler and does not change the class. More...
 
virtual void writeVTK () const
 now empty function for writing VTK files. More...
 
unsigned getNextGroupId ()
 Should be called each time you assign a groupId. Returns the value of nextGroupId_ and increases nextGroupId_ by one. More...
 

Private Attributes

std::vector< BaseSpecies * > mixedObjects_
 The list of pointers to the mixed species. More...
 

Additional Inherited Members

- Protected Attributes inherited from BaseHandler< ParticleSpecies >
std::vector< ParticleSpecies * > objects_
 The actual list of Object pointers. More...
 

Detailed Description

Container to store all ParticleSpecies.

The SpeciesHandler is a container to store all ParticleSpecies. It is implemented by a vector of pointers to ParticleSpecies.

Constructor & Destructor Documentation

◆ SpeciesHandler() [1/2]

SpeciesHandler::SpeciesHandler ( )

Default constructor, it creates an empty SpeciesHandler.

Constructor of the SpeciesHandler class. It creates an empty SpeciesHandler.

77 {
78  logger(DEBUG, "SpeciesHandler::SpeciesHandler() finished");
79 }
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ DEBUG

References DEBUG, and logger.

◆ SpeciesHandler() [2/2]

SpeciesHandler::SpeciesHandler ( const SpeciesHandler other)

Constructor that copies all species and the pointer to the DPMBase from the given SpeciesHandler.

Parameters
[in]otherThe SpeciesHandler that has to be copied.

This is not a copy constructor! This constructor copies only all BaseSpecies and MixedSpecies and copies the pointer to the DPMBase. It sets all other data members to 0 or nullptr.

88 {
89  clear();
90  setDPMBase(other.getDPMBase());
92  for (BaseSpecies* mixSpec : other.mixedObjects_)
93  {
94  mixedObjects_.push_back(mixSpec->copy());
95  mixedObjects_.back()->setHandler(this);
96  }
97  logger(DEBUG, "SpeciesHandler::SpeciesHandler(const SpeciesHandler &other) finished");
98 }
void setDPMBase(DPMBase *DPMBase)
Sets the problem that is solved using this handler.
Definition: BaseHandler.h:726
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Definition: BaseHandler.h:733
void copyContentsFromOtherHandler(const BaseHandler< ParticleSpecies > &BH)
Function that copies the contents (vector of pointers, maxObject_, nextId_, DPMBase_) from one handle...
Definition: BaseHandler.h:348
BaseSpecies is the class from which all other species are derived.
Definition: BaseSpecies.h:29
virtual BaseSpecies * copy() const =0
Creates a deep copy of the object from which it is called.
void clear() override
Empties the whole BaseHandler by removing all Objects and setting all other variables to 0.
Definition: SpeciesHandler.h:32
std::vector< BaseSpecies * > mixedObjects_
The list of pointers to the mixed species.
Definition: SpeciesHandler.h:77

References clear(), BaseSpecies::copy(), BaseHandler< ParticleSpecies >::copyContentsFromOtherHandler(), DEBUG, BaseHandler< T >::getDPMBase(), logger, mixedObjects_, and BaseHandler< ParticleSpecies >::setDPMBase().

◆ ~SpeciesHandler()

SpeciesHandler::~SpeciesHandler ( )
override

Destructor, it destructs the SpeciesHandler and all ParticleSpecies it contains.

Destructor: first destroys the objects of the BaseHandler, then destroys the mixedObjects

Todo:
TW Note: deleting the species does not delete the particles and walls of this species.
134 {
135  clear(); //this deletes everything that comes from the BaseHandler.
136  /*for (BaseSpecies* o : mixedObjects_)
137  {
138  delete o;
139  }*/
140  for (BaseSpecies* mixedObject : mixedObjects_)
141  {
142  delete mixedObject;
143  }
144  mixedObjects_.clear();
145  logger(DEBUG, "SpeciesHandler::~SpeciesHandler() finished");
146 }

References clear(), DEBUG, logger, and mixedObjects_.

Member Function Documentation

◆ addObject()

void SpeciesHandler::addObject ( ParticleSpecies S)
override

Adds a new ParticleSpecies to the SpeciesHandler.

Parameters
[in]SA pointer to the ParticleSpecies that has to be added.

First, add the ParticleSpecies to the vector of ParticleSpecies (object_), then construct all MixedSpecies. Tell the ParticleSpecies that this is its handler and compute all masses and whether it should use angular degrees of freedom.

Note: The MixedSpecies objects are initialized with averaged values from both species: e.g., the mixedSpecies between Species A and B will have a stiffness $fk=(1/k_a+1/k_b)^{-1}$f, you have to change the MixedSpecies properties if you don't like these defaults.

Todo:
TW don't put logger messages that only make sense for one application!
1009 {
1011  //logger(INFO, "Part / Mix: % / %", objects_.size(), mixedObjects_.size());
1013  S->setHandler(this);
1014  for (unsigned int id = 0; id + 1 < getNumberOfObjects(); ++id)
1015  {
1016  mixedObjects_.push_back(S->copyMixed());
1017  mixedObjects_.back()->setIndex(id);
1018  mixedObjects_.back()->setId(getNumberOfObjects() - 1);
1019  mixedObjects_.back()->mixAll(S, getObject(id));
1020  }
1021  getDPMBase()->particleHandler.computeAllMasses(S->getIndex());
1023  S->setMaxInteractionDistance(S->getInteractionDistance());
1024 }
virtual unsigned int getNumberOfObjects() const
Gets the number of real Object in this BaseHandler. (i.e. no mpi or periodic particles)
Definition: BaseHandler.h:656
virtual void addObject(T *object)
Adds a new Object to the BaseHandler.
Definition: BaseHandler.h:412
ParticleSpecies * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:621
void setRotation(bool rotation)
Sets whether particle rotation is enabled or disabled.
Definition: DPMBase.h:547
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1443
void computeAllMasses(unsigned int indSpecies)
Computes the mass for all BaseParticle of the given species in this ParticleHandler.
Definition: ParticleHandler.cc:1213
bool useAngularDOFs()
Check if angular DOF have to be used.
Definition: SpeciesHandler.cc:1073
@ S
Definition: quadtree.h:62

References BaseHandler< T >::addObject(), ParticleHandler::computeAllMasses(), BaseHandler< ParticleSpecies >::getDPMBase(), BaseHandler< ParticleSpecies >::getNumberOfObjects(), BaseHandler< ParticleSpecies >::getObject(), mixedObjects_, DPMBase::particleHandler, oomph::QuadTreeNames::S, DPMBase::setRotation(), and useAngularDOFs().

Referenced by GranularCollapse::GranularCollapse(), main(), MD_demo::MD_demo(), ParticleParticleInteraction::ParticleParticleInteraction(), ParticleParticleInteractionWithPlasticForces::ParticleParticleInteractionWithPlasticForces(), ParticleWallInteraction::ParticleWallInteraction(), readAndAddObject(), DPMBase::readParAndIniFiles(), BoundingRadiusTester::test(), InertiaTensorTester::test(), VolumeTest::test(), ShapeGradientHessianTester::testCushion(), ShapeGradientHessianTester::testEllipsoid(), ShapeGradientHessianTester::testRoundedBeam(), and ShapeGradientHessianTester::testSphere().

◆ clear()

void SpeciesHandler::clear ( )
inlineoverridevirtual

Empties the whole BaseHandler by removing all Objects and setting all other variables to 0.

Delete all objects stored in objects_ and set the maximum number of objects that have been in this container to 0, and set the Id of the next object that will be added to 0.

Reimplemented from BaseHandler< ParticleSpecies >.

33  {
35  mixedObjects_.clear();
36  }
virtual void clear()
Empties the whole BaseHandler by removing all Objects and setting all other variables to 0.
Definition: BaseHandler.h:536

References BaseHandler< T >::clear(), and mixedObjects_.

Referenced by operator=(), DPMBase::readParAndIniFiles(), DrumRot::setupInitialConditions(), RotatingDrum::setupInitialConditions(), BaseCluster::setupInitialConditions(), SpeciesHandler(), and ~SpeciesHandler().

◆ getMixedId()

unsigned int SpeciesHandler::getMixedId ( unsigned int  id1,
unsigned int  id2 
) const

Gets the Id of the behaviour between two given species.

Parameters
[in]id1Id of the first species.
[in]id2Id of the second species.
Returns
An unsigned integer that denotes the Id of the mixed species.

The numbering of the mixed species is 0-1, 0-2, 1-2, 0-3, 1-3, 2-3, 0-4, 1-4, 2-4, 3-4, ..., where each pair of numbers a and b denotes the mixed species between ParticleSpecies a and b. Thus, first compute which id has a higher value, the id of the mixed species is then given by (maxId*(maxId-1))/2 + minId.

933 {
934  unsigned int maxId = std::max(id1, id2);
935  return (maxId * (maxId - 1)) / 2 + std::min(id1, id2);
936 }
#define min(a, b)
Definition: datatypes.h:22
#define max(a, b)
Definition: datatypes.h:23

References max, and min.

Referenced by getMixedObject(), removeObject(), and updateMixedObjects().

◆ getMixedObject() [1/2]

template<typename U >
std::enable_if<!std::is_pointer<typename U::MixedSpeciesType>::value, typename U::MixedSpeciesType*>::type SpeciesHandler::getMixedObject ( const U *  S,
const U *  T 
)
inline
53  {
54  return static_cast<typename U::MixedSpeciesType*>(getMixedObject(S->getIndex(), T->getIndex()));
55  }
std::enable_if<!std::is_pointer< typename U::MixedSpeciesType >::value, typename U::MixedSpeciesType * >::type getMixedObject(const U *S, const U *T)
Definition: SpeciesHandler.h:52

References oomph::QuadTreeNames::S.

Referenced by InteractionHandler::addInteraction(), ConstantMassFlowMaserBoundary::addParticleToMaser(), SubcriticalMaserBoundary::addParticleToMaser(), ChuteWithPeriodicInflow::computeInternalForces(), AngleOfRepose::createBaseSpecies(), SilbertPeriodic::createBaseSpecies(), NurbsWall::getDistanceAndNormal(), Screw::getDistanceAndNormal(), IntersectionOfWalls::getDistanceAndNormal(), InteractionHandler::getInteraction(), SuperQuadricParticle::getInteractionRadius(), ParticleSpecies::getMixedSpecies(), MembraneDemo::initializeSpecies(), MembraneSelfTest::initializeSpecies(), main(), protectiveWall::protectiveWall(), RotatingDrumBidisperseInitialise::RotatingDrumBidisperseInitialise(), MercuryOS::setMaterialProperties(), ParticleSpecies::setMaxInteractionDistance(), Calibration::setSpecies(), Material::setSpecies(), MercuryLogo::setupInitialConditions(), RotatingDrumWet::setupInitialConditions(), Binary::setupInitialConditions(), my_problem::setupInitialConditions(), Chutebelt::setupInitialConditions(), ConstantMassFlowMaserBoundaryMixedSpeciesSelfTest::setupInitialConditions(), DPM::setupInitialConditions(), ContactDetectionIntersectionOfWallsTest::setupInitialConditions(), DrumRot::setupInitialConditions(), RotatingDrum::setupInitialConditions(), SpeciesTest::setupInitialConditions(), WallSpecies::setupInitialConditions(), T_protectiveWall::T_protectiveWall(), and useAngularDOFs().

◆ getMixedObject() [2/2]

BaseSpecies * SpeciesHandler::getMixedObject ( unsigned int  id1,
unsigned int  id2 
)

Gets the mixed object that is constructed from two given species.

Parameters
[in]id1Id of the first BaseSpecies.
[in]id2Id of the second BaseSpecies.
Returns
A pointer to an object that is a MixedSpecies of both input Species.
Todo:
This function should probably be made private. The user should use the function SpeciesHandler::getMixedObject(const U* S, const U* T), which deals with pointers.
954 {
955  if (id1 == id2)
956  {
957  return getObject(id1);
958  }
959  else
960  {
961  const unsigned int mixedId = getMixedId(id1, id2);
962  if (mixedId>=mixedObjects_.size())
963  {
964  logger(WARN,
965  "In: Object* SpeciesHandler::getMixedObject(const unsigned int id) const. No Object exist with index %, number of objects is %",
966  std::max(id1, id2), getNumberOfObjects());
967  return nullptr;
968  }
969  else
970  {
971  return mixedObjects_[mixedId];
972  }
973  }
974 }
@ WARN
unsigned int getMixedId(unsigned int id1, unsigned int id2) const
Gets the Id of the behaviour between two given species.
Definition: SpeciesHandler.cc:932

References getMixedId(), BaseHandler< ParticleSpecies >::getNumberOfObjects(), BaseHandler< ParticleSpecies >::getObject(), logger, max, mixedObjects_, and WARN.

◆ getMixedObjects()

const std::vector< BaseSpecies * > & SpeciesHandler::getMixedObjects ( ) const

Returns a pointer to the vector of all mixed objects.

Returns
A reference to the vector of pointers of all the mixedObjects.
942 {
943  return mixedObjects_;
944 }

References mixedObjects_.

Referenced by BaseSpecies::setInteractionDistance().

◆ getName()

std::string SpeciesHandler::getName ( ) const
overridevirtual

Returns the name of the handler, namely the string "SpeciesHandler".

Returns
The string "SpeciesHandler"

Implements BaseHandler< ParticleSpecies >.

1066 {
1067  return "SpeciesHandler";
1068 }

◆ operator=()

SpeciesHandler & SpeciesHandler::operator= ( const SpeciesHandler rhs)

Assignment operator that copies all species and the pointer to the DPMBase from the given SpeciesHandler.

Parameters
[in]rhsThe BoundaryHandler on the right hand side of the assignment.
Returns
The SpeciesHandler that is a copy of the input SpeciesHandler rhs.

This is not a copy assignment operator! It copies only all BaseSpecies and MixedSpecies and copies the pointer to the DPMBase. It sets all other data members to 0 or nullptr.

108 {
109  if (this != &rhs)
110  {
111  clear();
113  for (BaseSpecies* mixSpec : mixedObjects_)
114  {
115  delete mixSpec;
116  }
117  mixedObjects_.clear();
118  for (BaseSpecies* mixSpec : rhs.mixedObjects_)
119  {
120  mixedObjects_.push_back(mixSpec->copy());
121  mixedObjects_.back()->setHandler(this);
122  }
123  }
124 
125  logger(DEBUG, "SpeciesHandler SpeciesHandler::operator =(const SpeciesHandler& rhs)");
126  return *this;
127 }

References clear(), BaseSpecies::copy(), BaseHandler< ParticleSpecies >::copyContentsFromOtherHandler(), DEBUG, logger, and mixedObjects_.

◆ readAndAddObject()

void SpeciesHandler::readAndAddObject ( std::istream &  is)
overridevirtual

Reads Species data into the SpeciesHandler from restart file.

Parameters
[in]isThe input stream from which the information is read.

First determine the type of the object we want to read, then read the actual object. After that, clear the mixed objects and read the mixed objects.

Todo:
TW why does deleting these objects create a segmentation fault How do you create the segmentation fault?
Author
weinhartt
Todo:
IFCD how does the numbering of mixedSpecies_ work? the numbering of mixed species is 01, 02, 12, 03, 13, 23, 04, 14, 24, 34, i.e. if you add the n-th ParticleSpecies, then you have to add n-1 MixedSpecies. So here I remove the last n-1 MixedSpecies and add n-1 new ones.
Author
weinhartt

Implements BaseHandler< ParticleSpecies >.

154 {
156  is >> type;
157  logger(DEBUG, "SpeciesHandler::readAndAddObject(is): reading type %.", type);
158  if (type == "LinearViscoelasticSpecies")
159  {
161  is >> species;
162  copyAndAddObject(species);
163  }
164  else if (type == "SPHSpecies")
165  {
166  SPHSpecies species;
167  is >> species;
168  copyAndAddObject(species);
169  }
170  else if (type == "LinearPlasticViscoelasticSpecies")
171  {
173  is >> species;
174  copyAndAddObject(species);
175  }
176  else if (type == "SinterSpecies")
177  {
178  SinterSpecies species;
179  is >> species;
180  copyAndAddObject(species);
181  }
182  else if (type == "SinterReversibleAdhesiveSpecies")
183  {
185  is >> species;
186  copyAndAddObject(species);
187  }
188  else if (type == "SinterFrictionReversibleAdhesiveSpecies")
189  {
191  is >> species;
192  copyAndAddObject(species);
193  }
194  else if (type == "SinterFrictionSpecies")
195  {
196  SinterFrictionSpecies species;
197  is >> species;
198  copyAndAddObject(species);
199  }
200  else if (type == "HertzianSinterSpecies")
201  {
202  HertzianSinterSpecies species;
203  is >> species;
204  copyAndAddObject(species);
205  }
206  else if (type == "HertzianSinterFrictionSpecies")
207  {
209  is >> species;
210  copyAndAddObject(species);
211  }
212  else if (type == "HertzianSinterSlidingFrictionSpecies")
213  {
215  is >> species;
216  copyAndAddObject(species);
217  }
218  else if (type == "LinearViscoelasticSlidingFrictionSpecies")
219  {
221  is >> species;
222  copyAndAddObject(species);
223  }
224  else if (type == "LinearPlasticViscoelasticSlidingFrictionSpecies")
225  {
227  is >> species;
228  copyAndAddObject(species);
229  }
230  else if (type == "LinearViscoelasticFrictionSpecies")
231  {
233  is >> species;
234  copyAndAddObject(species);
235  }
236  else if (type == "LinearPlasticViscoelasticFrictionSpecies")
237  {
239  is >> species;
240  copyAndAddObject(species);
241  }
242  else if (type == "LinearPlasticViscoelasticFrictionBondedSpecies")
243  {
245  is >> species;
246  copyAndAddObject(species);
247  }
248  else if (type == "LinearViscoelasticIrreversibleAdhesiveSpecies")
249  {
251  is >> species;
252  copyAndAddObject(species);
253  }
254  else if (type == "LinearViscoelasticBondedSpecies")
255  {
257  is >> species;
258  copyAndAddObject(species);
259  }
260  else if (type == "LinearPlasticViscoelasticIrreversibleAdhesiveSpecies")
261  {
263  is >> species;
264  copyAndAddObject(species);
265  }
266  else if (type == "LinearViscoelasticSlidingFrictionIrreversibleAdhesiveSpecies")
267  {
269  is >> species;
270  copyAndAddObject(species);
271  }
272  else if (type == "LinearPlasticViscoelasticSlidingFrictionIrreversibleAdhesiveSpecies")
273  {
275  is >> species;
276  copyAndAddObject(species);
277  }
278  else if (type == "LinearViscoelasticFrictionIrreversibleAdhesiveSpecies")
279  {
281  is >> species;
282  copyAndAddObject(species);
283  }
284  else if (type == "LinearPlasticViscoelasticFrictionIrreversibleAdhesiveSpecies")
285  {
287  is >> species;
288  copyAndAddObject(species);
289  }
290  else if (type == "LinearViscoelasticReversibleAdhesiveSpecies")
291  {
293  is >> species;
294  copyAndAddObject(species);
295  }
296  else if (type == "LinearPlasticViscoelasticReversibleAdhesiveSpecies")
297  {
299  is >> species;
300  copyAndAddObject(species);
301  }
302  else if (type == "LinearViscoelasticSlidingFrictionReversibleAdhesiveSpecies")
303  {
305  is >> species;
306  copyAndAddObject(species);
307  }
308  else if (type == "LinearPlasticViscoelasticSlidingFrictionReversibleAdhesiveSpecies")
309  {
311  is >> species;
312  copyAndAddObject(species);
313  }
314  else if (type == "LinearViscoelasticFrictionReversibleAdhesiveSpecies")
315  {
317  is >> species;
318  copyAndAddObject(species);
319  }
320  else if (type == "LinearViscoelasticFrictionJKRAdhesiveSpecies")
321  {
323  is >> species;
324  copyAndAddObject(species);
325  }
326  else if (type == "MeltableFrictionSpecies")
327  {
328  MeltableFrictionSpecies species;
329  is >> species;
330  copyAndAddObject(species);
331  }
332  else if (type == "MeltableSpecies")
333  {
334  MeltableSpecies species;
335  is >> species;
336  copyAndAddObject(species);
337  }
338  else if (type == "LinearPlasticViscoelasticFrictionReversibleAdhesiveSpecies")
339  {
341  is >> species;
342  copyAndAddObject(species);
343  }
344  else if (type == "LinearViscoelasticFrictionLiquidBridgeWilletSpecies")
345  {
347  is >> species;
348  copyAndAddObject(species);
349  }
350  else if (type == "LinearViscoelasticFrictionLiquidMigrationWilletSpecies")
351  {
353  is >> species;
354  copyAndAddObject(species);
355  }
356  else if (type == "HertzianViscoelasticMindlinLiquidMigrationWilletSpecies")
357  {
359  is >> species;
360  copyAndAddObject(species);
361  }
362  else if (type == "HertzianViscoelasticMindlinLiquidBridgeClassicalWilletSpecies")
363  {
365  is >> species;
366  copyAndAddObject(species);
367  }
368  else if (type == "HertzianViscoelasticMindlinLiquidBridgeBagheriSpecies")
369  {
371  is >> species;
372  copyAndAddObject(species);
373  }
374  else if (type == "LinearPlasticViscoelasticFrictionLiquidMigrationWilletSpecies")
375  {
377  is >> species;
378  copyAndAddObject(species);
379  }
380  else if (type == "LinearViscoelasticSlidingFrictionLiquidMigrationLSSpecies")
381  {
383  is >> species;
384  copyAndAddObject(species);
385  }
386  else if (type == "LinearViscoelasticFrictionLiquidMigrationLSSpecies")
387  {
389  is >> species;
390  copyAndAddObject(species);
391  }
392  else if (type == "LinearViscoelasticFrictionLiquidMigrationWilletViscousSpecies")
393  {
395  is >> species;
396  copyAndAddObject(species);
397  }
398  else if (type == "LinearPlasticViscoelasticSlidingFrictionLiquidMigrationWilletSpecies")
399  {
401  is >> species;
402  copyAndAddObject(species);
403  }
404  else if (type == "HeatFluidCoupledLinearViscoelasticFrictionLiquidMigrationWilletSpecies")
405  {
407  is >> species;
408  copyAndAddObject(species);
409  }
410  else if (type == "HeatFluidCoupledLinearViscoelasticFrictionSolidifyingLiquidMigrationWilletSpecies")
411  {
413  is >> species;
414  copyAndAddObject(species);
415  }
416  else if (type == "HertzianViscoelasticMindlinSpecies")
417  {
419  is >> species;
420  copyAndAddObject(species);
421  }
422  else if (type == "HertzianViscoelasticMindlinRollingTorsionSpecies" ||
423  type == "HertzianViscoelasticFrictionSpecies")
424  {
426  is >> species;
427  copyAndAddObject(species);
428  }
429  else if (type == "HertzianViscoelasticFrictionChargedBondedSpecies")
430  {
432  is >> species;
433  copyAndAddObject(species);
434  }
435  else if (type == "HertzianBSHPViscoelasticMindlinSpecies")
436  {
438  is >> species;
439  copyAndAddObject(species);
440  }
441  else if (type == "HertzianBSHPViscoelasticMindlinLiquidBridgeBagheriSpecies")
442  {
444  is >> species;
445  copyAndAddObject(species);
446  }
447  else if (type == "HertzianBSHPViscoelasticSpecies")
448  {
450  is >> species;
451  copyAndAddObject(species);
452  }
453  else if (type == "LinearViscoelasticFrictionChargedBondedSpecies")
454  {
456  is >> species;
457  copyAndAddObject(species);
458  }
459  else if (type == "ThermalSinterSlidingFrictionSpecies")
460  {
462  is >> species;
463  copyAndAddObject(species);
464  }
465  else if (type == "ThermalSinterFrictionSpecies")
466  {
468  is >> species;
469  copyAndAddObject(species);
470  }
471  else if (type == "LinearPlasticViscoelasticFrictionLiquidBridgeWilletSpecies")
472  {
474  is >> species;
475  copyAndAddObject(species);
476  }
477  else if (type == "ThermalSinterLinFrictionReversibleAdhesiveSpecies")
478  {
480  is >> species;
481  copyAndAddObject(species);
482  }
483  else if (type == "k") //for backwards compatibility
484  {
486  }
487  else
488  {
489  logger(WARN,
490  "Species type % not understood in restart file: You need to add this species to SpeciesHandler::readObject.",
491  type);
492  std::stringstream line;
495  }
496 
497  //remove the default mixed species
498  for (unsigned int i = 0; i + 1 < getNumberOfObjects(); i++)
499  {
506  delete mixedObjects_.back();
507  mixedObjects_.pop_back();
508  }
509 
510  //Read the mixed species.
511  for (unsigned int i = 0; i + 1 < getNumberOfObjects(); i++)
512  {
513  is >> type;
514  if (type == "LinearViscoelasticMixedSpecies")
515  {
517  is >> species;
518  mixedObjects_.push_back(species.copy());
519  }
520  else if (type == "LinearPlasticViscoelasticMixedSpecies")
521  {
523  is >> species;
524  mixedObjects_.push_back(species.copy());
525  }
526  else if (type == "SinterMixedSpecies")
527  {
528  SinterMixedSpecies species;
529  is >> species;
530  mixedObjects_.push_back(species.copy());
531  }
532  else if (type == "SinterReversibleAdhesiveMixedSpecies")
533  {
535  is >> species;
536  mixedObjects_.push_back(species.copy());
537  }
538  else if (type == "SinterFrictionReversibleAdhesiveMixedSpecies")
539  {
541  is >> species;
542  mixedObjects_.push_back(species.copy());
543  }
544  else if (type == "SinterFrictionMixedSpecies")
545  {
547  is >> species;
548  mixedObjects_.push_back(species.copy());
549  }
550  else if (type == "HertzianSinterMixedSpecies")
551  {
553  is >> species;
554  mixedObjects_.push_back(species.copy());
555  }
556  else if (type == "HertzianSinterFrictionMixedSpecies")
557  {
559  is >> species;
560  mixedObjects_.push_back(species.copy());
561  }
562  else if (type == "HertzianSinterSlidingFrictionMixedSpecies")
563  {
565  is >> species;
566  mixedObjects_.push_back(species.copy());
567  }
568  else if (type == "LinearViscoelasticSlidingFrictionMixedSpecies")
569  {
571  is >> species;
572  mixedObjects_.push_back(species.copy());
573  }
574  else if (type == "LinearPlasticViscoelasticSlidingFrictionMixedSpecies")
575  {
577  is >> species;
578  mixedObjects_.push_back(species.copy());
579  }
580  else if (type == "LinearViscoelasticFrictionMixedSpecies")
581  {
583  is >> species;
584  mixedObjects_.push_back(species.copy());
585  }
586  else if (type == "LinearPlasticViscoelasticFrictionMixedSpecies")
587  {
589  is >> species;
590  mixedObjects_.push_back(species.copy());
591  }
592  else if (type == "LinearPlasticViscoelasticFrictionBondedMixedSpecies")
593  {
595  is >> species;
596  mixedObjects_.push_back(species.copy());
597  }
598  else if (type == "LinearViscoelasticIrreversibleAdhesiveMixedSpecies")
599  {
601  is >> species;
602  mixedObjects_.push_back(species.copy());
603  }
604  else if (type == "LinearViscoelasticBondedMixedSpecies")
605  {
607  is >> species;
608  mixedObjects_.push_back(species.copy());
609  }
610  else if (type == "LinearPlasticViscoelasticIrreversibleAdhesiveMixedSpecies")
611  {
613  is >> species;
614  mixedObjects_.push_back(species.copy());
615  }
616  else if (type == "LinearViscoelasticSlidingFrictionIrreversibleAdhesiveMixedSpecies")
617  {
619  is >> species;
620  mixedObjects_.push_back(species.copy());
621  }
622  else if (type == "LinearPlasticViscoelasticSlidingFrictionIrreversibleAdhesiveMixedSpecies")
623  {
625  is >> species;
626  mixedObjects_.push_back(species.copy());
627  }
628  else if (type == "LinearViscoelasticFrictionIrreversibleAdhesiveMixedSpecies")
629  {
631  is >> species;
632  mixedObjects_.push_back(species.copy());
633  }
634  else if (type == "LinearPlasticViscoelasticFrictionIrreversibleAdhesiveMixedSpecies")
635  {
637  is >> species;
638  mixedObjects_.push_back(species.copy());
639  }
640  else if (type == "LinearPlasticViscoelasticSlidingFrictionLiquidMigrationWilletMixedSpecies")
641  {
643  is >> species;
644  mixedObjects_.push_back(species.copy());
645  }
646  else if (type == "LinearPlasticViscoelasticFrictionLiquidBridgeWilletMixedSpecies")
647  {
649  is >> species;
650  mixedObjects_.push_back(species.copy());
651  }
652  else if (type == "HertzianViscoelasticMindlinLiquidMigrationWilletMixedSpecies")
653  {
655  is >> species;
656  mixedObjects_.push_back(species.copy());
657  }
658  else if (type == "HertzianViscoelasticMindlinLiquidBridgeClassicalWilletMixedSpecies")
659  {
661  is >> species;
662  mixedObjects_.push_back(species.copy());
663  }
664  else if (type == "HertzianViscoelasticMindlinLiquidBridgeBagheriMixedSpecies")
665  {
667  is >> species;
668  mixedObjects_.push_back(species.copy());
669  }
670  else if (type == "HeatFluidCoupledLinearViscoelasticFrictionLiquidMigrationWilletMixedSpecies")
671  {
673  is >> species;
674  mixedObjects_.push_back(species.copy());
675  }
676  else if (type == "HeatFluidCoupledLinearViscoelasticFrictionSolidifyingLiquidMigrationWilletMixedSpecies")
677  {
679  is >> species;
680  mixedObjects_.push_back(species.copy());
681  }
682  else if (type == "LinearViscoelasticReversibleAdhesiveMixedSpecies")
683  {
685  is >> species;
686  mixedObjects_.push_back(species.copy());
687  }
688  else if (type == "LinearPlasticViscoelasticReversibleAdhesiveMixedSpecies")
689  {
691  is >> species;
692  mixedObjects_.push_back(species.copy());
693  }
694  else if (type == "LinearViscoelasticSlidingFrictionReversibleAdhesiveMixedSpecies")
695  {
697  is >> species;
698  mixedObjects_.push_back(species.copy());
699  }
700  else if (type == "LinearPlasticViscoelasticSlidingFrictionReversibleAdhesiveMixedSpecies")
701  {
703  is >> species;
704  mixedObjects_.push_back(species.copy());
705  }
706  else if (type == "LinearViscoelasticFrictionReversibleAdhesiveMixedSpecies")
707  {
709  is >> species;
710  mixedObjects_.push_back(species.copy());
711  }
712  else if (type == "LinearPlasticViscoelasticFrictionReversibleAdhesiveMixedSpecies")
713  {
715  is >> species;
716  mixedObjects_.push_back(species.copy());
717  }
718  else if (type == "LinearViscoelasticFrictionJKRAdhesiveMixedSpecies")
719  {
721  is >> species;
722  mixedObjects_.push_back(species.copy());
723  }
724  else if (type == "MeltableFrictionMixedSpecies")
725  {
727  is >> species;
728  mixedObjects_.push_back(species.copy());
729  }
730  else if (type == "LinearViscoelasticFrictionLiquidBridgeWilletMixedSpecies")
731  {
733  is >> species;
734  mixedObjects_.push_back(species.copy());
735  }
736  else if (type == "LinearViscoelasticFrictionLiquidMigrationWilletMixedSpecies")
737  {
739  is >> species;
740  mixedObjects_.push_back(species.copy());
741  }
742  else if (type == "LinearPlasticViscoelasticFrictionLiquidMigrationWilletMixedSpecies")
743  {
745  is >> species;
746  mixedObjects_.push_back(species.copy());
747  }
748  else if (type == "LinearViscoelasticSlidingFrictionLiquidMigrationLSMixedSpecies")
749  {
751  is >> species;
752  mixedObjects_.push_back(species.copy());
753  }
754  else if (type == "LinearViscoelasticFrictionLiquidMigrationLSMixedSpecies")
755  {
757  is >> species;
758  mixedObjects_.push_back(species.copy());
759  }
760  else if (type == "LinearViscoelasticFrictionLiquidMigrationWilletViscousMixedSpecies")
761  {
763  is >> species;
764  mixedObjects_.push_back(species.copy());
765  }
766  else if (type == "HertzianViscoelasticMindlinMixedSpecies")
767  {
769  is >> species;
770  mixedObjects_.push_back(species.copy());
771  }
772  else if (type == "HertzianViscoelasticMindlinRollingTorsionMixedSpecies" ||
773  type == "HertzianViscoelasticFrictionMixedSpecies")
774  {
776  is >> species;
777  mixedObjects_.push_back(species.copy());
778  }
779  else if (type == "HertzianViscoelasticFrictionChargedBondedMixedSpecies")
780  {
782  is >> species;
783  mixedObjects_.push_back(species.copy());
784  }
785  else if (type == "HertzianBSHPViscoelasticMindlinMixedSpecies")
786  {
788  is >> species;
789  mixedObjects_.push_back(species.copy());
790  }
791  else if (type == "HertzianBSHPViscoelasticMindlinLiquidBridgeBagheriMixedSpecies")
792  {
794  is >> species;
795  mixedObjects_.push_back(species.copy());
796  }
797  else if (type == "HertzianBSHPViscoelasticMixedSpecies")
798  {
800  is >> species;
801  mixedObjects_.push_back(species.copy());
802  }
803  else if (type == "LinearViscoelasticFrictionChargedBondedMixedSpecies")
804  {
806  is >> species;
807  mixedObjects_.push_back(species.copy());
808  }
809  else if (type == "ThermalSinterSlidingFrictionMixedSpecies")
810  {
812  is >> species;
813  mixedObjects_.push_back(species.copy());
814  }
815  else if (type == "ThermalSinterFrictionMixedSpecies")
816  {
818  is >> species;
819  mixedObjects_.push_back(species.copy());
820  }
821  else if (type == "ThermalSinterLinFrictionReversibleAdhesiveMixedSpecies")
822  {
824  is >> species;
825  mixedObjects_.push_back(species.copy());
826  }
827  else if (type == "ThermalSinterFrictionMixedSpecies")
828  {
830  is >> species;
831  mixedObjects_.push_back(species.copy());
832  }
833  else
834  {
835  logger(WARN,
836  "Species type % not understood in restart file: You need to add this species to SpeciesHandler::readMixedObject.",
837  type);
838  std::stringstream line;
841  mixedObjects_.push_back(species.copy());
842  }
843  }
844 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Species< LinearViscoelasticNormalSpecies > LinearViscoelasticSpecies
Definition: LinearViscoelasticSpecies.h:11
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddObject(const U &object)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:360
FrictionSpecies contains the parameters used to describe sliding, rolling and torsional friction.
Definition: FrictionSpecies.h:18
Contains contact force properties for contacts between particles with two different species.
Definition: MixedSpecies.h:22
MixedSpecies< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies > * copy() const final
Creates a deep copy of the MixedSpecies from which it is called.
Definition: MixedSpecies.h:130
ReversibleAdhesiveSpecies contains the parameters used to describe a linear reversible short-range fo...
Definition: ReversibleAdhesiveSpecies.h:17
SlidingFrictionSpecies contains the parameters used to describe sliding friction.
Definition: SlidingFrictionSpecies.h:17
void addObject(ParticleSpecies *S) override
Adds a new ParticleSpecies to the SpeciesHandler.
Definition: SpeciesHandler.cc:1008
ParticleSpecies * readOldObject(std::istream &is)
Reads ParticleSpecies into the SpeciesHandler from old-style restart data.
Definition: SpeciesHandler.cc:854
line
Definition: calibrate.py:103
type
Definition: compute_granudrum_aor.py:141
void getLineFromStringStream(std::istream &in, std::stringstream &out)
Reads a line from one stringstream into another, and prepares the latter for reading in.
Definition: StringHelpers.cc:41
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286

References addObject(), MixedSpecies< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies >::copy(), BaseHandler< ParticleSpecies >::copyAndAddObject(), DEBUG, helpers::getLineFromStringStream(), BaseHandler< ParticleSpecies >::getNumberOfObjects(), i, calibrate::line, logger, mixedObjects_, readOldObject(), oomph::Global_string_for_annotation::string(), compute_granudrum_aor::type, and WARN.

◆ readOldObject()

ParticleSpecies * SpeciesHandler::readOldObject ( std::istream &  is)

Reads ParticleSpecies into the SpeciesHandler from old-style restart data.

Parameters
[in]isThe input stream from which the information is read.
Returns
A pointer to the ParticleSpecies that has just been read.

To read the old object, we first make a stringstream of the line that describes this ParticleSpecies. After that, we read the properties one by one, first the stiffness and after that the other properties. We stop when we either reach the end of the file(eof) or if a string is not recognized as a property.

855 {
856  //read in next line
857  std::stringstream line;
859 
860  //read each property
861  std::string property;
862  unsigned int particleDimension = 0;
863  Mdouble density = 0.0, stiffness = 0.0, dissipation = 0.0, slidingFrictionCoefficient = 0.0, slidingFrictionCoefficientStatic = 0.0, slidingStiffness = 0.0, slidingDissipation = 0.0;
864  line >> stiffness;
865  while (true)
866  {
867  line >> property;
868  if (property == "disp")
869  line >> dissipation;
870  else if (property == "rho")
871  line >> density;
872  else if (property == "kt")
873  line >> slidingStiffness;
874  else if (property == "dispt")
875  line >> slidingDissipation;
876  else if (property == "mu")
877  line >> slidingFrictionCoefficient;
878  else if (property == "mus")
879  line >> slidingFrictionCoefficientStatic;
880  else if (property == "dim_particle")
881  {
882  line >> particleDimension;
883  getDPMBase()->setParticleDimensions(particleDimension);
884  }
885  else if (property == "(mixed)")
886  {
887  density = 0;
888  }
889  else
890  {
891  logger(WARN, "Warning: % is not a species property", property);
892  break;
893  }
894  if (line.eof())
895  break;
896  }
897 
898  //create the correct species
899  if (slidingFrictionCoefficient == 0.0)
900  {
902  species->setDensity(density);
903  species->setStiffness(stiffness);
904  species->setDissipation(dissipation);
905  return species;
906  }
907  else
908  {
910  species->setDensity(density);
911  species->setStiffness(stiffness);
912  species->setDissipation(dissipation);
913  species->setSlidingStiffness(slidingStiffness);
914  species->setSlidingDissipation(slidingDissipation);
915  species->setSlidingFrictionCoefficient(slidingFrictionCoefficient);
916  if (slidingFrictionCoefficientStatic == 0.0)
917  slidingFrictionCoefficientStatic = slidingFrictionCoefficient;
918  species->setSlidingFrictionCoefficientStatic(slidingFrictionCoefficientStatic);
919  return species;
920  }
921 }
Species< LinearViscoelasticNormalSpecies, SlidingFrictionSpecies > LinearViscoelasticSlidingFrictionSpecies
Definition: LinearViscoelasticSlidingFrictionSpecies.h:12
void setParticleDimensions(unsigned int particleDimensions)
Sets the particle dimensionality.
Definition: DPMBase.cc:1439
void setDissipation(Mdouble dissipation)
Allows the normal dissipation to be changed.
Definition: LinearViscoelasticNormalSpecies.cc:96
void setStiffness(Mdouble new_k)
Allows the spring constant to be changed.
Definition: LinearViscoelasticNormalSpecies.cc:72
void setDensity(Mdouble density)
Definition: ParticleSpecies.cc:88
density
Definition: UniformPSDSelfTest.py:19

References UniformPSDSelfTest::density, BaseHandler< ParticleSpecies >::getDPMBase(), helpers::getLineFromStringStream(), calibrate::line, logger, ParticleSpecies::setDensity(), LinearViscoelasticNormalSpecies::setDissipation(), DPMBase::setParticleDimensions(), LinearViscoelasticNormalSpecies::setStiffness(), oomph::Global_string_for_annotation::string(), and WARN.

Referenced by readAndAddObject().

◆ removeObject()

void SpeciesHandler::removeObject ( unsigned int  index)
overridevirtual

Remove the ParticleSpecies with given id.

Parameters
[in]indexThe index of which ParticleSpecies has to be removed from this ParticleHandler.

The ParticleSpecies with index is removed and the last ParticleSpecies in the vector is moved to its position. It also removes all mixed species for this ParticleSpecies.

Reimplemented from BaseHandler< ParticleSpecies >.

1034 {
1036  for (unsigned int index2 = 0; index2 < getNumberOfObjects(); ++index2)
1037  {
1038  mixedObjects_.erase(mixedObjects_.begin() + getMixedId(index, index2));
1039  }
1041 }
virtual void removeObject(unsigned const int index)
Removes an Object from the BaseHandler.
Definition: BaseHandler.h:453

References BaseHandler< ParticleSpecies >::getDPMBase(), getMixedId(), BaseHandler< ParticleSpecies >::getNumberOfObjects(), mixedObjects_, BaseHandler< T >::removeObject(), DPMBase::setRotation(), and useAngularDOFs().

Referenced by CurvyChute::recreateBottom().

◆ updateMixedObjects()

void SpeciesHandler::updateMixedObjects ( )

Updates the mixed species.

Updates mixed species by calling the function mixAll() with the corresponding original species.

See also
mixAll(Object1, Object2) which creates sensible default values for mixed species based on the two species. Remember mixedSpecies properties can be set independently if required.

This may (should) be called, if a value is changed in the original species and the mixed species need to be aware of this change and update by the default rule. Note this only make sense if you are using the default mixed species and not a custom implementation.

987 {
988  for (unsigned int index1 = 0; index1 < getNumberOfObjects(); ++index1)
989  {
990  for (unsigned int index2 = index1+1; index2 < getNumberOfObjects(); ++index2)
991  {
992  mixedObjects_[getMixedId(index1, index2)]->mixAll(getObject(index1), getObject(index2));
993  }
994  }
995 }

References getMixedId(), BaseHandler< ParticleSpecies >::getNumberOfObjects(), BaseHandler< ParticleSpecies >::getObject(), and mixedObjects_.

◆ useAngularDOFs()

bool SpeciesHandler::useAngularDOFs ( )

Check if angular DOF have to be used.

Returns
The boolean which says whether or not AnuglarDOFs must be used in this handler.
1074 {
1075  for (unsigned int i = 0; i < getSize(); i++)
1076  {
1077  if (getObject(i)->getUseAngularDOFs())
1078  return true;
1079  for (unsigned int j = 0; j + 1 < i; j++)
1080  {
1081  if (getMixedObject(i, j)->getUseAngularDOFs())
1082  return true;
1083  }
1084  }
1085  return false;
1086 }
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Definition: BaseHandler.h:663
virtual bool getUseAngularDOFs() const =0
Returns true if torques (i.e. angular degrees of freedom) have to be calculated.
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References getMixedObject(), BaseHandler< ParticleSpecies >::getObject(), BaseHandler< ParticleSpecies >::getSize(), BaseSpecies::getUseAngularDOFs(), i, and j.

Referenced by addObject(), and removeObject().

◆ write()

void SpeciesHandler::write ( std::ostream &  os) const
virtual

Write all the species and mixed species to an output stream.

First write "Species" and the amount of species in this handler, then write all ParticleSpecies and MixedSpecies.

1048 {
1049  os << "Species " << getNumberOfObjects() << "\n";
1050  unsigned idMixed = 0;
1051  for (const ParticleSpecies* species : objects_)
1052  {
1053  os << *species << "\n";
1054  for (unsigned int id2 = 0; id2 < species->getIndex(); id2++)
1055  {
1056  os << *mixedObjects_[idMixed] << "\n";
1057  idMixed++;
1058  }
1059  }
1060 }
std::vector< ParticleSpecies * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:283
Definition: ParticleSpecies.h:16

References BaseHandler< ParticleSpecies >::getNumberOfObjects(), mixedObjects_, and BaseHandler< ParticleSpecies >::objects_.

Referenced by DPMBase::write().

Member Data Documentation

◆ mixedObjects_

std::vector<BaseSpecies*> SpeciesHandler::mixedObjects_
private

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