58 logger(
DEBUG,
"SpeciesHandler::SpeciesHandler() finished");
77 logger(
DEBUG,
"SpeciesHandler::SpeciesHandler(const SpeciesHandler &other) finished");
97 mixedObjects_.clear();
100 mixedObjects_.push_back(mixSpec->
copy());
101 mixedObjects_.back()->setHandler(
this);
105 logger(
DEBUG,
"SpeciesHandler SpeciesHandler::operator =(const SpeciesHandler& rhs)");
122 mixedObjects_.clear();
123 logger(
DEBUG,
"SpeciesHandler::~SpeciesHandler() finished");
134 if (type ==
"LinearViscoelasticSpecies")
140 else if (type ==
"LinearPlasticViscoelasticSpecies")
146 else if (type ==
"LinearViscoelasticSlidingFrictionSpecies")
152 else if (type ==
"LinearPlasticViscoelasticSlidingFrictionSpecies")
158 else if (type ==
"LinearViscoelasticFrictionSpecies")
164 else if (type ==
"LinearPlasticViscoelasticFrictionSpecies")
170 else if (type ==
"LinearViscoelasticIrreversibleAdhesiveSpecies")
176 else if (type ==
"LinearPlasticViscoelasticIrreversibleAdhesiveSpecies")
182 else if (type ==
"LinearViscoelasticSlidingFrictionIrreversibleAdhesiveSpecies")
188 else if (type ==
"LinearPlasticViscoelasticSlidingFrictionIrreversibleAdhesiveSpecies")
194 else if (type ==
"LinearViscoelasticFrictionIrreversibleAdhesiveSpecies")
200 else if (type ==
"LinearPlasticViscoelasticFrictionIrreversibleAdhesiveSpecies")
206 else if (type ==
"LinearViscoelasticReversibleAdhesiveSpecies")
212 else if (type ==
"LinearPlasticViscoelasticReversibleAdhesiveSpecies")
218 else if (type ==
"LinearViscoelasticSlidingFrictionReversibleAdhesiveSpecies")
224 else if (type ==
"LinearPlasticViscoelasticSlidingFrictionReversibleAdhesiveSpecies")
230 else if (type ==
"LinearViscoelasticFrictionReversibleAdhesiveSpecies")
236 else if (type ==
"LinearPlasticViscoelasticFrictionReversibleAdhesiveSpecies")
242 else if (type ==
"LinearViscoelasticFrictionLiquidBridgeWilletSpecies")
248 else if (type ==
"k")
254 std::stringstream line(std::stringstream::in | std::stringstream::out);
256 logger(
ERROR,
"Species type % not understood in restart file. %", type, line.str());
276 if (type ==
"LinearViscoelasticMixedSpecies")
282 else if (type ==
"LinearPlasticViscoelasticMixedSpecies")
288 else if (type ==
"LinearViscoelasticSlidingFrictionMixedSpecies")
294 else if (type ==
"LinearPlasticViscoelasticSlidingFrictionMixedSpecies")
300 else if (type ==
"LinearViscoelasticFrictionMixedSpecies")
306 else if (type ==
"LinearPlasticViscoelasticFrictionMixedSpecies")
312 else if (type ==
"LinearViscoelasticIrreversibleAdhesiveMixedSpecies")
318 else if (type ==
"LinearPlasticViscoelasticIrreversibleAdhesiveMixedSpecies")
324 else if (type ==
"LinearViscoelasticSlidingFrictionIrreversibleAdhesiveMixedSpecies")
330 else if (type ==
"LinearPlasticViscoelasticSlidingFrictionIrreversibleAdhesiveMixedSpecies")
336 else if (type ==
"LinearViscoelasticFrictionIrreversibleAdhesiveMixedSpecies")
342 else if (type ==
"LinearPlasticViscoelasticFrictionIrreversibleAdhesiveMixedSpecies")
348 else if (type ==
"LinearViscoelasticReversibleAdhesiveMixedSpecies")
354 else if (type ==
"LinearPlasticViscoelasticReversibleAdhesiveMixedSpecies")
360 else if (type ==
"LinearViscoelasticSlidingFrictionReversibleAdhesiveMixedSpecies")
366 else if (type ==
"LinearPlasticViscoelasticSlidingFrictionReversibleAdhesiveMixedSpecies")
372 else if (type ==
"LinearViscoelasticFrictionReversibleAdhesiveMixedSpecies")
378 else if (type ==
"LinearPlasticViscoelasticFrictionReversibleAdhesiveMixedSpecies")
383 else if (type ==
"LinearViscoelasticFrictionLiquidBridgeWilletMixedSpecies")
388 else if (type ==
"k")
394 logger(
ERROR,
"Species type: % not understood in restart file", type);
410 std::stringstream line(std::stringstream::in | std::stringstream::out);
414 std::string property;
415 unsigned int particleDimension=0;
416 Mdouble density=0.0, stiffness=0.0, dissipation=0.0, slidingFrictionCoefficient=0.0, slidingFrictionCoefficientStatic=0.0, slidingStiffness=0.0, slidingDissipation=0.0;
421 if (property ==
"disp")
423 else if (property ==
"rho")
425 else if (property ==
"kt")
426 line >> slidingStiffness;
427 else if (property ==
"dispt")
428 line >> slidingDissipation;
429 else if (property ==
"mu")
430 line >> slidingFrictionCoefficient;
431 else if (property ==
"mus")
432 line >> slidingFrictionCoefficientStatic;
433 else if (property ==
"dim_particle")
435 line >> particleDimension;
438 else if (property ==
"(mixed)")
444 logger(
WARN,
"Warning: % is not a species property", property);
452 if (slidingFrictionCoefficient == 0.0)
456 species->setStiffness(stiffness);
457 species->setDissipation(dissipation);
464 species->setStiffness(stiffness);
465 species->setDissipation(dissipation);
466 species->setSlidingStiffness(slidingStiffness);
467 species->setSlidingDissipation(slidingDissipation);
468 species->setSlidingFrictionCoefficient(slidingFrictionCoefficient);
469 if (slidingFrictionCoefficientStatic == 0.0)
470 slidingFrictionCoefficientStatic = slidingFrictionCoefficient;
471 species->setSlidingFrictionCoefficientStatic(slidingFrictionCoefficientStatic);
487 unsigned int maxId = std::max(id1,id2);
488 return (maxId*(maxId-1))/2 + std::min(id1,id2);
498 return dynamic_cast<typename U::MixedSpeciesType*
>(
getMixedObject(S->getIndex(),T->getIndex()));
526 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());
586 std::vector<BaseSpecies*>::const_iterator it2 =
mixedObjects_.begin();
587 for (std::vector<ParticleSpecies*>::const_iterator it =
begin(); it !=
end(); ++it)
589 os << (**it) << std::endl;
590 for (
unsigned int id2 =0; id2 < (*it)->getIndex(); id2++)
592 os << (**it2) << std::endl;
621 return "SpeciesHandler";
633 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")
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.
~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...
U * copyAndAddObject(const U &O)
Creates a copy of a Object and adds it to the BaseHandler.
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.
void removeObject(unsigned const int id)
Remove the ParticleSpecies with given id.
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 the density to be changed.
ParticleSpecies * readOldObject(std::istream &is)
Reads ParticleSpecies into the SpeciesHandler from old-style restart data.
void readObject(std::istream &is)
Reads Species data into the SpeciesHandler from restart file.
virtual void addObject(T *O)
Adds a new Object to the BaseHandler.
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.
U::MixedSpeciesType * getMixedObject(const U *S, const U *T)
void setHandler(SpeciesHandler *handler)
Sets the pointer to the handler to which this species belongs.
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.
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...