MercuryDPM  Alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SpeciesHandler.cc
Go to the documentation of this file.
1 //Copyright (c) 2013-2014, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 
27 #include "SpeciesHandler.h"
28 #include "DPMBase.h"
29 
32 #include "Species/SinterSpecies.h"
45 
56 
63 
67 
69 
74 {
75  logger(DEBUG, "SpeciesHandler::SpeciesHandler() finished");
76 }
77 
85 {
86  clear();
87  setDPMBase(other.getDPMBase());
89  for (BaseSpecies* mixSpec : other.mixedObjects_)
90  {
91  mixedObjects_.push_back(mixSpec->copy());
92  mixedObjects_.back()->setHandler(this);
93  }
94  logger(DEBUG, "SpeciesHandler::SpeciesHandler(const SpeciesHandler &other) finished");
95 }
96 
105 {
106  if (this != &rhs)
107  {
108  clear();
110  for (BaseSpecies* mixSpec : mixedObjects_)
111  {
112  delete mixSpec;
113  }
114  mixedObjects_.clear();
115  for (BaseSpecies* mixSpec : rhs.mixedObjects_)
116  {
117  mixedObjects_.push_back(mixSpec->copy());
118  mixedObjects_.back()->setHandler(this);
119  }
120  }
121 
122  logger(DEBUG, "SpeciesHandler SpeciesHandler::operator =(const SpeciesHandler& rhs)");
123  return *this;
124 }
129 {
130  clear(); //this deletes everything that comes from the BaseHandler.
131  /*for (BaseSpecies* o : mixedObjects_)
132  {
133  delete o;
134  }*/
135  for (BaseSpecies* mixSpec : mixedObjects_)
136  {
137  delete mixSpec;
138  }
139  mixedObjects_.clear();
140  logger(DEBUG, "SpeciesHandler::~SpeciesHandler() finished");
141 }
147 void SpeciesHandler::readObject(std::istream& is)
148 {
149  std::string type;
150  is >> type;
151  logger.log(Log::DEBUG, "SpeciesHandler::readObject(is): reading type %.", type);
152 // if (strncmp(type,"LinearViscoelastic",strlen("LinearViscoelastic")))
153 // {
154 // typedef LinearViscoelasticNormalSpecies NormalSpecies;
155 // }
156  if (type == "LinearViscoelasticSpecies")
157  {
159  is >> species;
160  copyAndAddObject(species);
161  }
162  else if (type == "LinearPlasticViscoelasticSpecies")
163  {
165  is >> species;
166  copyAndAddObject(species);
167  }
168  else if (type == "SinterSpecies")
169  {
170  SinterSpecies species;
171  is >> species;
172  copyAndAddObject(species);
173  }
174  else if (type == "SinterReversibleAdhesiveSpecies")
175  {
177  is >> species;
178  copyAndAddObject(species);
179  }
180  else if (type == "SinterFrictionReversibleAdhesiveSpecies")
181  {
183  is >> species;
184  copyAndAddObject(species);
185  }
186  else if (type == "SinterFrictionSpecies")
187  {
188  SinterFrictionSpecies species;
189  is >> species;
190  copyAndAddObject(species);
191  }
192  else if (type == "HertzianSinterSpecies")
193  {
194  HertzianSinterSpecies species;
195  is >> species;
196  copyAndAddObject(species);
197  }
198  else if (type == "HertzianSinterFrictionSpecies")
199  {
201  is >> species;
202  copyAndAddObject(species);
203  }
204  else if (type == "HertzianSinterSlidingFrictionSpecies")
205  {
207  is >> species;
208  copyAndAddObject(species);
209  }
210  else if (type == "LinearViscoelasticSlidingFrictionSpecies")
211  {
213  is >> species;
214  copyAndAddObject(species);
215  }
216  else if (type == "LinearPlasticViscoelasticSlidingFrictionSpecies")
217  {
219  is >> species;
220  copyAndAddObject(species);
221  }
222  else if (type == "LinearViscoelasticFrictionSpecies")
223  {
225  is >> species;
226  copyAndAddObject(species);
227  }
228  else if (type == "LinearPlasticViscoelasticFrictionSpecies")
229  {
231  is >> species;
232  copyAndAddObject(species);
233  }
234  else if (type == "LinearViscoelasticIrreversibleAdhesiveSpecies")
235  {
237  is >> species;
238  copyAndAddObject(species);
239  }
240  else if (type == "LinearViscoelasticBondedSpecies")
241  {
243  is >> species;
244  copyAndAddObject(species);
245  }
246  else if (type == "LinearPlasticViscoelasticIrreversibleAdhesiveSpecies")
247  {
249  is >> species;
250  copyAndAddObject(species);
251  }
252  else if (type == "LinearViscoelasticSlidingFrictionIrreversibleAdhesiveSpecies")
253  {
255  is >> species;
256  copyAndAddObject(species);
257  }
258  else if (type == "LinearPlasticViscoelasticSlidingFrictionIrreversibleAdhesiveSpecies")
259  {
261  is >> species;
262  copyAndAddObject(species);
263  }
264  else if (type == "LinearViscoelasticFrictionIrreversibleAdhesiveSpecies")
265  {
267  is >> species;
268  copyAndAddObject(species);
269  }
270  else if (type == "LinearPlasticViscoelasticFrictionIrreversibleAdhesiveSpecies")
271  {
273  is >> species;
274  copyAndAddObject(species);
275  }
276  else if (type == "LinearViscoelasticReversibleAdhesiveSpecies")
277  {
279  is >> species;
280  copyAndAddObject(species);
281  }
282  else if (type == "LinearPlasticViscoelasticReversibleAdhesiveSpecies")
283  {
285  is >> species;
286  copyAndAddObject(species);
287  }
288  else if (type == "LinearViscoelasticSlidingFrictionReversibleAdhesiveSpecies")
289  {
291  is >> species;
292  copyAndAddObject(species);
293  }
294  else if (type == "LinearPlasticViscoelasticSlidingFrictionReversibleAdhesiveSpecies")
295  {
297  is >> species;
298  copyAndAddObject(species);
299  }
300  else if (type == "LinearViscoelasticFrictionReversibleAdhesiveSpecies")
301  {
303  is >> species;
304  copyAndAddObject(species);
305  }
306  else if (type == "LinearPlasticViscoelasticFrictionReversibleAdhesiveSpecies")
307  {
309  is >> species;
310  copyAndAddObject(species);
311  }
312  else if (type == "LinearViscoelasticFrictionLiquidBridgeWilletSpecies")
313  {
315  is >> species;
316  copyAndAddObject(species);
317  }
318  else if (type == "LinearViscoelasticFrictionLiquidMigrationWilletSpecies")
319  {
321  is >> species;
322  copyAndAddObject(species);
323  }
324  else if (type == "HertzianViscoelasticMindlinRollingTorsionSpecies")
325  {
327  is >> species;
328  copyAndAddObject(species);
329  }
330  else if (type == "HertzianViscoelasticFrictionChargedBondedSpecies")
331  {
333  is >> species;
334  copyAndAddObject(species);
335  }
336  else if (type == "LinearViscoelasticFrictionChargedBondedSpecies")
337  {
339  is >> species;
340  copyAndAddObject(species);
341  }
342  else if (type == "HertzianViscoelasticMindlinSpecies")
343  {
345  is >> species;
346  copyAndAddObject(species);
347  }
348  else if (type == "ThermalSinterSlidingFrictionSpecies")
349  {
351  is >> species;
352  copyAndAddObject(species);
353  }
354  else if (type == "ThermalSinterFrictionSpecies")
355  {
357  is >> species;
358  copyAndAddObject(species);
359  }
360  else if (type == "k") //for backwards compatibility
361  {
363  }
364  else
365  {
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);
369  }
370 
371  //remove the default mixed species
372  for (unsigned int i = 0; i + 1 < getNumberOfObjects(); i++)
373  {
380  delete mixedObjects_.back();
381  mixedObjects_.pop_back();
382  }
383 
384  //Read the mixed species.
385  for (unsigned int i = 0; i+1 < getNumberOfObjects(); i++)
386  {
387  is >> type;
388  if (type == "LinearViscoelasticMixedSpecies")
389  {
391  is >> species;
392  mixedObjects_.push_back(species.copy());
393  }
394  else if (type == "LinearPlasticViscoelasticMixedSpecies")
395  {
397  is >> species;
398  mixedObjects_.push_back(species.copy());
399  }
400  else if (type == "SinterMixedSpecies")
401  {
402  SinterMixedSpecies species;
403  is >> species;
404  mixedObjects_.push_back(species.copy());
405  }
406  else if (type == "SinterReversibleAdhesiveMixedSpecies")
407  {
409  is >> species;
410  mixedObjects_.push_back(species.copy());
411  }
412  else if (type == "SinterFrictionReversibleAdhesiveMixedSpecies")
413  {
415  is >> species;
416  mixedObjects_.push_back(species.copy());
417  }
418  else if (type == "SinterFrictionMixedSpecies")
419  {
421  is >> species;
422  mixedObjects_.push_back(species.copy());
423  }
424  else if (type == "HertzianSinterMixedSpecies")
425  {
427  is >> species;
428  mixedObjects_.push_back(species.copy());
429  }
430  else if (type == "HertzianSinterFrictionMixedSpecies")
431  {
433  is >> species;
434  mixedObjects_.push_back(species.copy());
435  }
436  else if (type == "HertzianSinterSlidingFrictionMixedSpecies")
437  {
439  is >> species;
440  mixedObjects_.push_back(species.copy());
441  }
442  else if (type == "LinearViscoelasticSlidingFrictionMixedSpecies")
443  {
445  is >> species;
446  mixedObjects_.push_back(species.copy());
447  }
448  else if (type == "LinearPlasticViscoelasticSlidingFrictionMixedSpecies")
449  {
451  is >> species;
452  mixedObjects_.push_back(species.copy());
453  }
454  else if (type == "LinearViscoelasticFrictionMixedSpecies")
455  {
457  is >> species;
458  mixedObjects_.push_back(species.copy());
459  }
460  else if (type == "LinearPlasticViscoelasticFrictionMixedSpecies")
461  {
463  is >> species;
464  mixedObjects_.push_back(species.copy());
465  }
466  else if (type == "LinearViscoelasticIrreversibleAdhesiveMixedSpecies")
467  {
469  is >> species;
470  mixedObjects_.push_back(species.copy());
471  }
472  else if (type == "LinearViscoelasticBondedMixedSpecies")
473  {
475  is >> species;
476  mixedObjects_.push_back(species.copy());
477  }
478  else if (type == "LinearPlasticViscoelasticIrreversibleAdhesiveMixedSpecies")
479  {
481  is >> species;
482  mixedObjects_.push_back(species.copy());
483  }
484  else if (type == "LinearViscoelasticSlidingFrictionIrreversibleAdhesiveMixedSpecies")
485  {
487  is >> species;
488  mixedObjects_.push_back(species.copy());
489  }
490  else if (type == "LinearPlasticViscoelasticSlidingFrictionIrreversibleAdhesiveMixedSpecies")
491  {
493  is >> species;
494  mixedObjects_.push_back(species.copy());
495  }
496  else if (type == "LinearViscoelasticFrictionIrreversibleAdhesiveMixedSpecies")
497  {
499  is >> species;
500  mixedObjects_.push_back(species.copy());
501  }
502  else if (type == "LinearPlasticViscoelasticFrictionIrreversibleAdhesiveMixedSpecies")
503  {
505  is >> species;
506  mixedObjects_.push_back(species.copy());
507  }
508  else if (type == "LinearViscoelasticReversibleAdhesiveMixedSpecies")
509  {
511  is >> species;
512  mixedObjects_.push_back(species.copy());
513  }
514  else if (type == "LinearPlasticViscoelasticReversibleAdhesiveMixedSpecies")
515  {
517  is >> species;
518  mixedObjects_.push_back(species.copy());
519  }
520  else if (type == "LinearViscoelasticSlidingFrictionReversibleAdhesiveMixedSpecies")
521  {
523  is >> species;
524  mixedObjects_.push_back(species.copy());
525  }
526  else if (type == "LinearPlasticViscoelasticSlidingFrictionReversibleAdhesiveMixedSpecies")
527  {
529  is >> species;
530  mixedObjects_.push_back(species.copy());
531  }
532  else if (type == "LinearViscoelasticFrictionReversibleAdhesiveMixedSpecies")
533  {
535  is >> species;
536  mixedObjects_.push_back(species.copy());
537  }
538  else if (type == "LinearPlasticViscoelasticFrictionReversibleAdhesiveMixedSpecies")
539  {
541  is >> species;
542  mixedObjects_.push_back(species.copy());
543  }
544  else if (type == "LinearViscoelasticFrictionLiquidBridgeWilletMixedSpecies")
545  {
547  is >> species;
548  mixedObjects_.push_back(species.copy());
549  }
550  else if (type == "LinearViscoelasticFrictionLiquidMigrationWilletMixedSpecies")
551  {
553  is >> species;
554  mixedObjects_.push_back(species.copy());
555  }
556  else if (type == "HertzianViscoelasticMindlinRollingTorsionMixedSpecies")
557  {
559  is >> species;
560  mixedObjects_.push_back(species.copy());
561  }
562  else if (type == "HertzianViscoelasticFrictionChargedBondedMixedSpecies")
563  {
565  is >> species;
566  mixedObjects_.push_back(species.copy());
567  }
568  else if (type == "LinearViscoelasticFrictionChargedBondedMixedSpecies")
569  {
571  is >> species;
572  mixedObjects_.push_back(species.copy());
573  }
574  else if (type == "HertzianViscoelasticMindlinMixedSpecies")
575  {
577  is >> species;
578  }
579  else if (type == "ThermalSinterSlidingFrictionMixedSpecies")
580  {
582  is >> species;
583  }
584  else if (type == "ThermalSinterFrictionMixedSpecies")
585  {
587  is >> species;
588  }
589  else if (type == "k") //for backwards compatibility
590  {
591  mixedObjects_.push_back(readOldObject(is));
592  }
593  else
594  {
595  logger(ERROR, "Species type % not understood in restart file: You need to add this species to SpeciesHandler::readMixedObject.", type);
596  }
597  }
598 }
599 
609 {
610  //read in next line
611  std::stringstream line(std::stringstream::in | std::stringstream::out);
613 
614  //read each property
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;
618  line >> stiffness;
619  while (true)
620  {
621  line >> property;
622  if (property == "disp")
623  line >> dissipation;
624  else if (property == "rho")
625  line >> density;
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")
635  {
636  line >> particleDimension;
637  getDPMBase()->setParticleDimensions(particleDimension);
638  }
639  else if (property == "(mixed)")
640  {
641  density = 0;
642  }
643  else
644  {
645  logger(WARN, "Warning: % is not a species property", property);
646  break;
647  }
648  if (line.eof())
649  break;
650  }
651 
652  //create the correct species
653  if (slidingFrictionCoefficient == 0.0)
654  {
656  species->setDensity(density);
657  species->setStiffness(stiffness);
658  species->setDissipation(dissipation);
659  return species;
660  }
661  else
662  {
664  species->setDensity(density);
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);
673  return species;
674  }
675 }
676 
686 unsigned int SpeciesHandler::getMixedId(const unsigned int id1, const unsigned int id2) const
687 {
688  unsigned int maxId = std::max(id1,id2);
689  return (maxId*(maxId-1))/2 + std::min(id1,id2);
690 }
691 
695 const std::vector<BaseSpecies*>& SpeciesHandler::getMixedObjects() const
696 {
697  return mixedObjects_;
698 }
699 
707 BaseSpecies* SpeciesHandler::getMixedObject(const unsigned int id1, const unsigned int id2)
708 {
709  if (id1 == id2)
710  {
711  return getObject(id1);
712  }
713  else
714  {
715  if (std::max(id1,id2) >= getNumberOfObjects())
716  {
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());
718  return nullptr;
719  }
720  else
721  {
722  return mixedObjects_[getMixedId(id1,id2)];
723  }
724  }
725 }
738 {
740  //logger(INFO, "Part / Mix: % / %", objects_.size(), mixedObjects_.size());
742  for (unsigned int id = 0; id + 1 < getNumberOfObjects(); ++id)
743  {
744  mixedObjects_.push_back(S->copyMixed());
745  mixedObjects_.back()->setIndex(id);
746  mixedObjects_.back()->setId(getNumberOfObjects()-1);
747  mixedObjects_.back()->mixAll(S,getObject(id));
748  }
749  S->setHandler(this);
753 }
754 
762 void SpeciesHandler::removeObject(unsigned const int index)
763 {
765  for (unsigned int index2 = 0; index2 < getNumberOfObjects(); ++index2)
766  {
767  mixedObjects_.erase(mixedObjects_.begin()+getMixedId(index, index2));
768  }
770 }
771 
777 void SpeciesHandler::write(std::ostream& os) const
778 {
779  os << "Species " << getNumberOfObjects() << std::endl;
780  std::vector<BaseSpecies*>::const_iterator it2 = mixedObjects_.begin();
781  for (std::vector<ParticleSpecies*>::const_iterator it = begin(); it != end(); ++it)
782  {
783  os << (**it) << std::endl;
784  for (unsigned int id2 =0; id2 < (*it)->getIndex(); id2++)
785  {
786  os << (**it2) << std::endl;
787  it2++;
788  }
789  }
790  /*
791  This behaves like the code above but is actually readable
792  @weinhartt is there a reason?
793 
794  there is a reason. Curernt architecture does not allow this
795  \todo define new restart format. @dducks
796 
797  The code is written such that it writes PS0, then PS1 and MS01, then PS2 and
798  MS02, MS12, and so on (PS=ParticleSpecies, MS=MixedSpecies). We can change
799  the restart format, but we should write the read(os) function such that
800  it can also read the old format @weinhartt
801 
802  for (ParticleSpecies * spec : objects_) {
803  os << *spec << std::endl;
804  }
805  for (BaseSpecies * spec : mixedObjects_) {
806  os << *spec << std::endl;
807  }
808  */
809 }
813 std::string SpeciesHandler::getName() const
814 {
815  return "SpeciesHandler";
816 }
817 
822 {
823  for (unsigned int i = 0; i < getNumberOfObjects(); i++)
824  {
825  if (getObject(i)->getUseAngularDOFs())
826  return true;
827  for (unsigned int j = 0; j + 1 < i; j++)
828  {
829  if (getMixedObject(i, j)->getUseAngularDOFs())
830  return true;
831  }
832  }
833  return false;
834 }
Container to store all ParticleSpecies.
unsigned int getIndex() const
Returns the index of the object in the handler.
Definition: BaseObject.cc:108
BaseSpecies is the class from which all other species are derived.
Definition: BaseSpecies.h:44
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.
double Mdouble
void setParticleDimensions(unsigned int particleDimensions)
Allows the dimension of the particle (f.e. for mass) to be changed. e.g. discs or spheres...
Definition: DPMBase.cc:583
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.
Definition: DPMBase.cc:231
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...
Definition: Helpers.cc:396
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.
Definition: BaseHandler.h:333
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1001
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.
Definition: BaseSpecies.cc:66
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...
Definition: MixedSpecies.h:40
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.
Definition: BaseHandler.h:313
Contains material and contact force properties.
Definition: Interaction.h:35
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.
Definition: BaseHandler.h:543
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...