75 logger(
DEBUG,
"SpeciesHandler::SpeciesHandler() finished");
94 logger(
DEBUG,
"SpeciesHandler::SpeciesHandler(const SpeciesHandler &other) finished");
114 mixedObjects_.clear();
117 mixedObjects_.push_back(mixSpec->
copy());
118 mixedObjects_.back()->setHandler(
this);
122 logger(
DEBUG,
"SpeciesHandler SpeciesHandler::operator =(const SpeciesHandler& rhs)");
139 mixedObjects_.clear();
140 logger(
DEBUG,
"SpeciesHandler::~SpeciesHandler() finished");
151 logger.log(
Log::DEBUG,
"SpeciesHandler::readObject(is): reading type %.", type);
156 if (type ==
"LinearViscoelasticSpecies")
162 else if (type ==
"LinearPlasticViscoelasticSpecies")
168 else if (type ==
"SinterSpecies")
174 else if (type ==
"SinterReversibleAdhesiveSpecies")
180 else if (type ==
"SinterFrictionReversibleAdhesiveSpecies")
186 else if (type ==
"SinterFrictionSpecies")
192 else if (type ==
"HertzianSinterSpecies")
198 else if (type ==
"HertzianSinterFrictionSpecies")
204 else if (type ==
"HertzianSinterSlidingFrictionSpecies")
210 else if (type ==
"LinearViscoelasticSlidingFrictionSpecies")
216 else if (type ==
"LinearPlasticViscoelasticSlidingFrictionSpecies")
222 else if (type ==
"LinearViscoelasticFrictionSpecies")
228 else if (type ==
"LinearPlasticViscoelasticFrictionSpecies")
234 else if (type ==
"LinearViscoelasticIrreversibleAdhesiveSpecies")
240 else if (type ==
"LinearViscoelasticBondedSpecies")
246 else if (type ==
"LinearPlasticViscoelasticIrreversibleAdhesiveSpecies")
252 else if (type ==
"LinearViscoelasticSlidingFrictionIrreversibleAdhesiveSpecies")
258 else if (type ==
"LinearPlasticViscoelasticSlidingFrictionIrreversibleAdhesiveSpecies")
264 else if (type ==
"LinearViscoelasticFrictionIrreversibleAdhesiveSpecies")
270 else if (type ==
"LinearPlasticViscoelasticFrictionIrreversibleAdhesiveSpecies")
276 else if (type ==
"LinearViscoelasticReversibleAdhesiveSpecies")
282 else if (type ==
"LinearPlasticViscoelasticReversibleAdhesiveSpecies")
288 else if (type ==
"LinearViscoelasticSlidingFrictionReversibleAdhesiveSpecies")
294 else if (type ==
"LinearPlasticViscoelasticSlidingFrictionReversibleAdhesiveSpecies")
300 else if (type ==
"LinearViscoelasticFrictionReversibleAdhesiveSpecies")
306 else if (type ==
"LinearPlasticViscoelasticFrictionReversibleAdhesiveSpecies")
312 else if (type ==
"LinearViscoelasticFrictionLiquidBridgeWilletSpecies")
318 else if (type ==
"LinearViscoelasticFrictionLiquidMigrationWilletSpecies")
324 else if (type ==
"HertzianViscoelasticMindlinRollingTorsionSpecies")
330 else if (type ==
"HertzianViscoelasticFrictionChargedBondedSpecies")
336 else if (type ==
"LinearViscoelasticFrictionChargedBondedSpecies")
342 else if (type ==
"HertzianViscoelasticMindlinSpecies")
348 else if (type ==
"ThermalSinterSlidingFrictionSpecies")
354 else if (type ==
"ThermalSinterFrictionSpecies")
360 else if (type ==
"k")
366 std::stringstream line(std::stringstream::in | std::stringstream::out);
368 logger(
ERROR,
"Species type % not understood in restart file: You need to add this species to SpeciesHandler::readObject.", type);
388 if (type ==
"LinearViscoelasticMixedSpecies")
394 else if (type ==
"LinearPlasticViscoelasticMixedSpecies")
400 else if (type ==
"SinterMixedSpecies")
406 else if (type ==
"SinterReversibleAdhesiveMixedSpecies")
412 else if (type ==
"SinterFrictionReversibleAdhesiveMixedSpecies")
418 else if (type ==
"SinterFrictionMixedSpecies")
424 else if (type ==
"HertzianSinterMixedSpecies")
430 else if (type ==
"HertzianSinterFrictionMixedSpecies")
436 else if (type ==
"HertzianSinterSlidingFrictionMixedSpecies")
442 else if (type ==
"LinearViscoelasticSlidingFrictionMixedSpecies")
448 else if (type ==
"LinearPlasticViscoelasticSlidingFrictionMixedSpecies")
454 else if (type ==
"LinearViscoelasticFrictionMixedSpecies")
460 else if (type ==
"LinearPlasticViscoelasticFrictionMixedSpecies")
466 else if (type ==
"LinearViscoelasticIrreversibleAdhesiveMixedSpecies")
472 else if (type ==
"LinearViscoelasticBondedMixedSpecies")
478 else if (type ==
"LinearPlasticViscoelasticIrreversibleAdhesiveMixedSpecies")
484 else if (type ==
"LinearViscoelasticSlidingFrictionIrreversibleAdhesiveMixedSpecies")
490 else if (type ==
"LinearPlasticViscoelasticSlidingFrictionIrreversibleAdhesiveMixedSpecies")
496 else if (type ==
"LinearViscoelasticFrictionIrreversibleAdhesiveMixedSpecies")
502 else if (type ==
"LinearPlasticViscoelasticFrictionIrreversibleAdhesiveMixedSpecies")
508 else if (type ==
"LinearViscoelasticReversibleAdhesiveMixedSpecies")
514 else if (type ==
"LinearPlasticViscoelasticReversibleAdhesiveMixedSpecies")
520 else if (type ==
"LinearViscoelasticSlidingFrictionReversibleAdhesiveMixedSpecies")
526 else if (type ==
"LinearPlasticViscoelasticSlidingFrictionReversibleAdhesiveMixedSpecies")
532 else if (type ==
"LinearViscoelasticFrictionReversibleAdhesiveMixedSpecies")
538 else if (type ==
"LinearPlasticViscoelasticFrictionReversibleAdhesiveMixedSpecies")
544 else if (type ==
"LinearViscoelasticFrictionLiquidBridgeWilletMixedSpecies")
550 else if (type ==
"LinearViscoelasticFrictionLiquidMigrationWilletMixedSpecies")
556 else if (type ==
"HertzianViscoelasticMindlinRollingTorsionMixedSpecies")
562 else if (type ==
"HertzianViscoelasticFrictionChargedBondedMixedSpecies")
568 else if (type ==
"LinearViscoelasticFrictionChargedBondedMixedSpecies")
574 else if (type ==
"HertzianViscoelasticMindlinMixedSpecies")
579 else if (type ==
"ThermalSinterSlidingFrictionMixedSpecies")
584 else if (type ==
"ThermalSinterFrictionMixedSpecies")
589 else if (type ==
"k")
595 logger(
ERROR,
"Species type % not understood in restart file: You need to add this species to SpeciesHandler::readMixedObject.", type);
611 std::stringstream line(std::stringstream::in | std::stringstream::out);
615 std::string property;
616 unsigned int particleDimension=0;
617 Mdouble density=0.0, stiffness=0.0, dissipation=0.0, slidingFrictionCoefficient=0.0, slidingFrictionCoefficientStatic=0.0, slidingStiffness=0.0, slidingDissipation=0.0;
622 if (property ==
"disp")
624 else if (property ==
"rho")
626 else if (property ==
"kt")
627 line >> slidingStiffness;
628 else if (property ==
"dispt")
629 line >> slidingDissipation;
630 else if (property ==
"mu")
631 line >> slidingFrictionCoefficient;
632 else if (property ==
"mus")
633 line >> slidingFrictionCoefficientStatic;
634 else if (property ==
"dim_particle")
636 line >> particleDimension;
639 else if (property ==
"(mixed)")
645 logger(
WARN,
"Warning: % is not a species property", property);
653 if (slidingFrictionCoefficient == 0.0)
657 species->setStiffness(stiffness);
658 species->setDissipation(dissipation);
665 species->setStiffness(stiffness);
666 species->setDissipation(dissipation);
667 species->setSlidingStiffness(slidingStiffness);
668 species->setSlidingDissipation(slidingDissipation);
669 species->setSlidingFrictionCoefficient(slidingFrictionCoefficient);
670 if (slidingFrictionCoefficientStatic == 0.0)
671 slidingFrictionCoefficientStatic = slidingFrictionCoefficient;
672 species->setSlidingFrictionCoefficientStatic(slidingFrictionCoefficientStatic);
688 unsigned int maxId = std::max(id1,id2);
689 return (maxId*(maxId-1))/2 + std::min(id1,id2);
717 logger(
ERROR,
"In: Object* SpeciesHandler::getMixedObject(const unsigned int id) const. No Object exist with index %, number of objects is %", std::max(id1, id2),
getNumberOfObjects());
780 std::vector<BaseSpecies*>::const_iterator it2 =
mixedObjects_.begin();
781 for (std::vector<ParticleSpecies*>::const_iterator it =
begin(); it !=
end(); ++it)
783 os << (**it) << std::endl;
784 for (
unsigned int id2 =0; id2 < (*it)->getIndex(); id2++)
786 os << (**it2) << std::endl;
815 return "SpeciesHandler";
827 for (
unsigned int j = 0; j + 1 < i; j++)
Container to store all ParticleSpecies.
unsigned int getIndex() const
Returns the index of the object in the handler.
BaseSpecies is the class from which all other species are derived.
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
FrictionSpecies contains the parameters used to describe sliding, rolling and torsional friction...
unsigned int getMixedId(const unsigned int id1, const unsigned int id2) const
Gets the Id of the behaviour between two given species.
void setDPMBase(DPMBase *DPMBase)
Sets the problem that is solved using this handler.
void computeAllMasses(unsigned int indSpecies)
Computes the mass for all BaseParticle of the given species in this ParticleHandler.
const std::vector< BaseSpecies * > & getMixedObjects() const
Returns a pointer to the vector of all mixed objects.
const std::vector< ParticleSpecies * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
void setParticleDimensions(unsigned int particleDimensions)
Allows the dimension of the particle (f.e. for mass) to be changed. e.g. discs or spheres...
SpeciesHandler()
Default constructor, it creates an empty SpeciesHandler.
Species< LinearViscoelasticNormalSpecies, SlidingFrictionSpecies > LinearViscoelasticSlidingFrictionSpecies
SpeciesHandler operator=(const SpeciesHandler &rhs)
Assignment operator that copies all species and the pointer to the DPMBase from the given SpeciesHand...
virtual void write(std::ostream &os) const
Write all the species and mixed species to an output stream.
const std::vector< ParticleSpecies * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
void setRotation(bool newRotFlag)
Allows to set the flag for enabling or disabling particle rotation in the simulations.
void removeObject(unsigned const int index)
Remove the ParticleSpecies with given id.
~SpeciesHandler()
Destructor, it destructs the SpeciesHandler and all ParticleSpecies it contains.
virtual BaseSpecies * copyMixed() const =0
Creates a new MixedSpecies with the same force properties as the Species from which it is called...
void getLineFromStringStream(std::istream &in, std::stringstream &out)
Reads a line from one stringstream into another, and prepares the latter for reading in...
virtual void addObject(ParticleSpecies *const S)
Adds a new ParticleSpecies to the SpeciesHandler.
virtual void removeObject(unsigned const int id)
Removes an Object from the BaseHandler.
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
ParticleSpecies * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
void setDensity(Mdouble density)
Allows density_ to be changed.
ParticleSpecies * readOldObject(std::istream &is)
Reads ParticleSpecies into the SpeciesHandler from old-style restart data.
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.
void readObject(std::istream &is)
Reads Species data into the SpeciesHandler from restart file.
std::vector< BaseSpecies * > mixedObjects_
The list of pointers to the mixed species.
Species< LinearViscoelasticNormalSpecies > LinearViscoelasticSpecies
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
std::enable_if<!std::is_pointer< typename U::MixedSpeciesType >::value, typename U::MixedSpeciesType * >::type getMixedObject(const U *S, const U *T)
void setHandler(SpeciesHandler *handler)
Sets the pointer to the handler to which this species belongs.
SlidingFrictionSpecies contains the parameters used to describe sliding friction. ...
virtual BaseSpecies * copy() const =0
Creates a deep copy of the object from which it is called.
Contains contact force properties for contacts between particles with two different species...
virtual bool getUseAngularDOFs() const =0
Returns true if torques (i.e. angular degrees of freedom) have to be calculated.
virtual void addObject(T *object)
Adds a new Object to the BaseHandler.
Contains material and contact force properties.
void copyContentsFromOtherHandler(const BaseHandler< ParticleSpecies > &BH)
Function that copies the contents (vector of pointers, maxObject_, nextId_, DPMBase_) from one handle...
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
std::string getName() const
Returns the name of the handler, namely the string "SpeciesHandler".
bool useAngularDOFs()
Check if angular DOF have to be used.
void clear()
Empties the whole BaseHandler by removing all Objects and setting all other variables to 0...