MercuryDPM  Trunk
 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-2020, 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 
58 
65 
66 
71 
74 
79 {
80  logger(DEBUG, "SpeciesHandler::SpeciesHandler() finished");
81 }
82 
90 {
91  clear();
92  setDPMBase(other.getDPMBase());
94  for (BaseSpecies* mixSpec : other.mixedObjects_)
95  {
96  mixedObjects_.push_back(mixSpec->copy());
97  mixedObjects_.back()->setHandler(this);
98  }
99  logger(DEBUG, "SpeciesHandler::SpeciesHandler(const SpeciesHandler &other) finished");
100 }
101 
110 {
111  if (this != &rhs)
112  {
113  clear();
115  for (BaseSpecies* mixSpec : mixedObjects_)
116  {
117  delete mixSpec;
118  }
119  mixedObjects_.clear();
120  for (BaseSpecies* mixSpec : rhs.mixedObjects_)
121  {
122  mixedObjects_.push_back(mixSpec->copy());
123  mixedObjects_.back()->setHandler(this);
124  }
125  }
126 
127  logger(DEBUG, "SpeciesHandler SpeciesHandler::operator =(const SpeciesHandler& rhs)");
128  return *this;
129 }
130 
136 {
137  clear(); //this deletes everything that comes from the BaseHandler.
138  /*for (BaseSpecies* o : mixedObjects_)
139  {
140  delete o;
141  }*/
142  for (BaseSpecies* mixSpec : mixedObjects_)
143  {
144  delete mixSpec;
145  }
146  mixedObjects_.clear();
147  logger(DEBUG, "SpeciesHandler::~SpeciesHandler() finished");
148 }
149 
155 void SpeciesHandler::readAndAddObject(std::istream& is)
156 {
157  std::string type;
158  is >> type;
159  logger(DEBUG, "SpeciesHandler::readAndAddObject(is): reading type %.", type);
160  if (type == "LinearViscoelasticSpecies")
161  {
163  is >> species;
164  copyAndAddObject(species);
165  }
166  else if (type == "LinearPlasticViscoelasticSpecies")
167  {
169  is >> species;
170  copyAndAddObject(species);
171  }
172  else if (type == "SinterSpecies")
173  {
174  SinterSpecies species;
175  is >> species;
176  copyAndAddObject(species);
177  }
178  else if (type == "SinterReversibleAdhesiveSpecies")
179  {
181  is >> species;
182  copyAndAddObject(species);
183  }
184  else if (type == "SinterFrictionReversibleAdhesiveSpecies")
185  {
187  is >> species;
188  copyAndAddObject(species);
189  }
190  else if (type == "SinterFrictionSpecies")
191  {
192  SinterFrictionSpecies species;
193  is >> species;
194  copyAndAddObject(species);
195  }
196  else if (type == "HertzianSinterSpecies")
197  {
198  HertzianSinterSpecies species;
199  is >> species;
200  copyAndAddObject(species);
201  }
202  else if (type == "HertzianSinterFrictionSpecies")
203  {
205  is >> species;
206  copyAndAddObject(species);
207  }
208  else if (type == "HertzianSinterSlidingFrictionSpecies")
209  {
211  is >> species;
212  copyAndAddObject(species);
213  }
214  else if (type == "LinearViscoelasticSlidingFrictionSpecies")
215  {
217  is >> species;
218  copyAndAddObject(species);
219  }
220  else if (type == "LinearPlasticViscoelasticSlidingFrictionSpecies")
221  {
223  is >> species;
224  copyAndAddObject(species);
225  }
226  else if (type == "LinearViscoelasticFrictionSpecies")
227  {
229  is >> species;
230  copyAndAddObject(species);
231  }
232  else if (type == "LinearPlasticViscoelasticFrictionSpecies")
233  {
235  is >> species;
236  copyAndAddObject(species);
237  }
238  else if (type == "LinearViscoelasticIrreversibleAdhesiveSpecies")
239  {
241  is >> species;
242  copyAndAddObject(species);
243  }
244  else if (type == "LinearViscoelasticBondedSpecies")
245  {
247  is >> species;
248  copyAndAddObject(species);
249  }
250  else if (type == "LinearPlasticViscoelasticIrreversibleAdhesiveSpecies")
251  {
253  is >> species;
254  copyAndAddObject(species);
255  }
256  else if (type == "LinearViscoelasticSlidingFrictionIrreversibleAdhesiveSpecies")
257  {
259  is >> species;
260  copyAndAddObject(species);
261  }
262  else if (type == "LinearPlasticViscoelasticSlidingFrictionIrreversibleAdhesiveSpecies")
263  {
265  is >> species;
266  copyAndAddObject(species);
267  }
268  else if (type == "LinearViscoelasticFrictionIrreversibleAdhesiveSpecies")
269  {
271  is >> species;
272  copyAndAddObject(species);
273  }
274  else if (type == "LinearPlasticViscoelasticFrictionIrreversibleAdhesiveSpecies")
275  {
277  is >> species;
278  copyAndAddObject(species);
279  }
280  else if (type == "LinearViscoelasticReversibleAdhesiveSpecies")
281  {
283  is >> species;
284  copyAndAddObject(species);
285  }
286  else if (type == "LinearPlasticViscoelasticReversibleAdhesiveSpecies")
287  {
289  is >> species;
290  copyAndAddObject(species);
291  }
292  else if (type == "LinearViscoelasticSlidingFrictionReversibleAdhesiveSpecies")
293  {
295  is >> species;
296  copyAndAddObject(species);
297  }
298  else if (type == "LinearPlasticViscoelasticSlidingFrictionReversibleAdhesiveSpecies")
299  {
301  is >> species;
302  copyAndAddObject(species);
303  }
304  else if (type == "LinearViscoelasticFrictionReversibleAdhesiveSpecies")
305  {
307  is >> species;
308  copyAndAddObject(species);
309  }
310  else if (type == "LinearPlasticViscoelasticFrictionReversibleAdhesiveSpecies")
311  {
313  is >> species;
314  copyAndAddObject(species);
315  }
316  else if (type == "LinearViscoelasticFrictionLiquidBridgeWilletSpecies")
317  {
319  is >> species;
320  copyAndAddObject(species);
321  }
322  else if (type == "LinearViscoelasticFrictionLiquidMigrationWilletSpecies")
323  {
325  is >> species;
326  copyAndAddObject(species);
327  }
328  else if (type == "LinearPlasticViscoelasticSlidingFrictionLiquidMigrationWilletSpecies")
329  {
331  is >> species;
332  copyAndAddObject(species);
333  }
334  else if (type == "HertzianViscoelasticMindlinSpecies")
335  {
337  is >> species;
338  copyAndAddObject(species);
339  }
340  else if (type == "HertzianViscoelasticMindlinRollingTorsionSpecies" ||
341  type == "HertzianViscoelasticFrictionSpecies")
342  {
344  is >> species;
345  copyAndAddObject(species);
346  }
347  else if (type == "HertzianViscoelasticFrictionChargedBondedSpecies")
348  {
350  is >> species;
351  copyAndAddObject(species);
352  }
353  else if (type == "LinearViscoelasticFrictionChargedBondedSpecies")
354  {
356  is >> species;
357  copyAndAddObject(species);
358  }
359  else if (type == "ThermalSinterSlidingFrictionSpecies")
360  {
362  is >> species;
363  copyAndAddObject(species);
364  }
365  else if (type == "ThermalSinterFrictionSpecies")
366  {
368  is >> species;
369  copyAndAddObject(species);
370  }
371  else if (type == "LinearPlasticViscoelasticFrictionLiquidBridgeWilletSpecies")
372  {
374  is >> species;
375  copyAndAddObject(species);
376  }
377  else if (type == "ThermalSinterLinFrictionReversibleAdhesiveSpecies")
378  {
380  is >> species;
381  copyAndAddObject(species);
382  }
383  else if (type == "k") //for backwards compatibility
384  {
386  }
387  else
388  {
389  logger(WARN,
390  "Species type % not understood in restart file: You need to add this species to SpeciesHandler::readObject.",
391  type);
392  std::stringstream line;
395  }
396 
397  //remove the default mixed species
398  for (unsigned int i = 0; i + 1 < getNumberOfObjects(); i++)
399  {
406  delete mixedObjects_.back();
407  mixedObjects_.pop_back();
408  }
409 
410  //Read the mixed species.
411  for (unsigned int i = 0; i + 1 < getNumberOfObjects(); i++)
412  {
413  is >> type;
414  if (type == "LinearViscoelasticMixedSpecies")
415  {
417  is >> species;
418  mixedObjects_.push_back(species.copy());
419  }
420  else if (type == "LinearPlasticViscoelasticMixedSpecies")
421  {
423  is >> species;
424  mixedObjects_.push_back(species.copy());
425  }
426  else if (type == "SinterMixedSpecies")
427  {
428  SinterMixedSpecies species;
429  is >> species;
430  mixedObjects_.push_back(species.copy());
431  }
432  else if (type == "SinterReversibleAdhesiveMixedSpecies")
433  {
435  is >> species;
436  mixedObjects_.push_back(species.copy());
437  }
438  else if (type == "SinterFrictionReversibleAdhesiveMixedSpecies")
439  {
441  is >> species;
442  mixedObjects_.push_back(species.copy());
443  }
444  else if (type == "SinterFrictionMixedSpecies")
445  {
447  is >> species;
448  mixedObjects_.push_back(species.copy());
449  }
450  else if (type == "HertzianSinterMixedSpecies")
451  {
453  is >> species;
454  mixedObjects_.push_back(species.copy());
455  }
456  else if (type == "HertzianSinterFrictionMixedSpecies")
457  {
459  is >> species;
460  mixedObjects_.push_back(species.copy());
461  }
462  else if (type == "HertzianSinterSlidingFrictionMixedSpecies")
463  {
465  is >> species;
466  mixedObjects_.push_back(species.copy());
467  }
468  else if (type == "LinearViscoelasticSlidingFrictionMixedSpecies")
469  {
471  is >> species;
472  mixedObjects_.push_back(species.copy());
473  }
474  else if (type == "LinearPlasticViscoelasticSlidingFrictionMixedSpecies")
475  {
477  is >> species;
478  mixedObjects_.push_back(species.copy());
479  }
480  else if (type == "LinearViscoelasticFrictionMixedSpecies")
481  {
483  is >> species;
484  mixedObjects_.push_back(species.copy());
485  }
486  else if (type == "LinearPlasticViscoelasticFrictionMixedSpecies")
487  {
489  is >> species;
490  mixedObjects_.push_back(species.copy());
491  }
492  else if (type == "LinearViscoelasticIrreversibleAdhesiveMixedSpecies")
493  {
495  is >> species;
496  mixedObjects_.push_back(species.copy());
497  }
498  else if (type == "LinearViscoelasticBondedMixedSpecies")
499  {
501  is >> species;
502  mixedObjects_.push_back(species.copy());
503  }
504  else if (type == "LinearPlasticViscoelasticIrreversibleAdhesiveMixedSpecies")
505  {
507  is >> species;
508  mixedObjects_.push_back(species.copy());
509  }
510  else if (type == "LinearViscoelasticSlidingFrictionIrreversibleAdhesiveMixedSpecies")
511  {
513  is >> species;
514  mixedObjects_.push_back(species.copy());
515  }
516  else if (type == "LinearPlasticViscoelasticSlidingFrictionIrreversibleAdhesiveMixedSpecies")
517  {
519  is >> species;
520  mixedObjects_.push_back(species.copy());
521  }
522  else if (type == "LinearViscoelasticFrictionIrreversibleAdhesiveMixedSpecies")
523  {
525  is >> species;
526  mixedObjects_.push_back(species.copy());
527  }
528  else if (type == "LinearPlasticViscoelasticFrictionIrreversibleAdhesiveMixedSpecies")
529  {
531  is >> species;
532  mixedObjects_.push_back(species.copy());
533  }
534  else if (type == "LinearPlasticViscoelasticSlidingFrictionLiquidMigrationWilletMixedSpecies")
535  {
537  is >> species;
538  mixedObjects_.push_back(species.copy());
539  }
540  else if (type == "LinearPlasticViscoelasticFrictionLiquidBridgeWilletMixedSpecies")
541  {
543  is >> species;
544  mixedObjects_.push_back(species.copy());
545  }
546  else if (type == "LinearViscoelasticReversibleAdhesiveMixedSpecies")
547  {
549  is >> species;
550  mixedObjects_.push_back(species.copy());
551  }
552  else if (type == "LinearPlasticViscoelasticReversibleAdhesiveMixedSpecies")
553  {
555  is >> species;
556  mixedObjects_.push_back(species.copy());
557  }
558  else if (type == "LinearViscoelasticSlidingFrictionReversibleAdhesiveMixedSpecies")
559  {
561  is >> species;
562  mixedObjects_.push_back(species.copy());
563  }
564  else if (type == "LinearPlasticViscoelasticSlidingFrictionReversibleAdhesiveMixedSpecies")
565  {
567  is >> species;
568  mixedObjects_.push_back(species.copy());
569  }
570  else if (type == "LinearViscoelasticFrictionReversibleAdhesiveMixedSpecies")
571  {
573  is >> species;
574  mixedObjects_.push_back(species.copy());
575  }
576  else if (type == "LinearPlasticViscoelasticFrictionReversibleAdhesiveMixedSpecies")
577  {
579  is >> species;
580  mixedObjects_.push_back(species.copy());
581  }
582  else if (type == "LinearViscoelasticFrictionLiquidBridgeWilletMixedSpecies")
583  {
585  is >> species;
586  mixedObjects_.push_back(species.copy());
587  }
588  else if (type == "LinearViscoelasticFrictionLiquidMigrationWilletMixedSpecies")
589  {
591  is >> species;
592  mixedObjects_.push_back(species.copy());
593  }
594  else if (type == "HertzianViscoelasticMindlinMixedSpecies")
595  {
597  is >> species;
598  mixedObjects_.push_back(species.copy());
599  }
600  else if (type == "HertzianViscoelasticMindlinRollingTorsionMixedSpecies" ||
601  type == "HertzianViscoelasticFrictionMixedSpecies")
602  {
604  is >> species;
605  mixedObjects_.push_back(species.copy());
606  }
607  else if (type == "HertzianViscoelasticFrictionChargedBondedMixedSpecies")
608  {
610  is >> species;
611  mixedObjects_.push_back(species.copy());
612  }
613  else if (type == "LinearViscoelasticFrictionChargedBondedMixedSpecies")
614  {
616  is >> species;
617  mixedObjects_.push_back(species.copy());
618  }
619  else if (type == "ThermalSinterSlidingFrictionMixedSpecies")
620  {
622  is >> species;
623  mixedObjects_.push_back(species.copy());
624  }
625  else if (type == "ThermalSinterFrictionMixedSpecies")
626  {
628  is >> species;
629  mixedObjects_.push_back(species.copy());
630  }
631  else if (type == "ThermalSinterLinFrictionReversibleAdhesiveMixedSpecies")
632  {
634  is >> species;
635  mixedObjects_.push_back(species.copy());
636  }
637  else if (type == "ThermalSinterFrictionMixedSpecies")
638  {
640  is >> species;
641  mixedObjects_.push_back(species.copy());
642  }
643  else
644  {
645  logger(WARN,
646  "Species type % not understood in restart file: You need to add this species to SpeciesHandler::readMixedObject.",
647  type);
648  std::stringstream line;
651  mixedObjects_.push_back(species.copy());
652  }
653  }
654 }
655 
665 {
666  //read in next line
667  std::stringstream line;
669 
670  //read each property
671  std::string property;
672  unsigned int particleDimension = 0;
673  Mdouble density = 0.0, stiffness = 0.0, dissipation = 0.0, slidingFrictionCoefficient = 0.0, slidingFrictionCoefficientStatic = 0.0, slidingStiffness = 0.0, slidingDissipation = 0.0;
674  line >> stiffness;
675  while (true)
676  {
677  line >> property;
678  if (property == "disp")
679  line >> dissipation;
680  else if (property == "rho")
681  line >> density;
682  else if (property == "kt")
683  line >> slidingStiffness;
684  else if (property == "dispt")
685  line >> slidingDissipation;
686  else if (property == "mu")
687  line >> slidingFrictionCoefficient;
688  else if (property == "mus")
689  line >> slidingFrictionCoefficientStatic;
690  else if (property == "dim_particle")
691  {
692  line >> particleDimension;
693  getDPMBase()->setParticleDimensions(particleDimension);
694  }
695  else if (property == "(mixed)")
696  {
697  density = 0;
698  }
699  else
700  {
701  logger(WARN, "Warning: % is not a species property", property);
702  break;
703  }
704  if (line.eof())
705  break;
706  }
707 
708  //create the correct species
709  if (slidingFrictionCoefficient == 0.0)
710  {
712  species->setDensity(density);
713  species->setStiffness(stiffness);
714  species->setDissipation(dissipation);
715  return species;
716  }
717  else
718  {
720  species->setDensity(density);
721  species->setStiffness(stiffness);
722  species->setDissipation(dissipation);
723  species->setSlidingStiffness(slidingStiffness);
724  species->setSlidingDissipation(slidingDissipation);
725  species->setSlidingFrictionCoefficient(slidingFrictionCoefficient);
726  if (slidingFrictionCoefficientStatic == 0.0)
727  slidingFrictionCoefficientStatic = slidingFrictionCoefficient;
728  species->setSlidingFrictionCoefficientStatic(slidingFrictionCoefficientStatic);
729  return species;
730  }
731 }
732 
742 unsigned int SpeciesHandler::getMixedId(const unsigned int id1, const unsigned int id2) const
743 {
744  unsigned int maxId = std::max(id1, id2);
745  return (maxId * (maxId - 1)) / 2 + std::min(id1, id2);
746 }
747 
751 const std::vector<BaseSpecies*>& SpeciesHandler::getMixedObjects() const
752 {
753  return mixedObjects_;
754 }
755 
763 BaseSpecies* SpeciesHandler::getMixedObject(const unsigned int id1, const unsigned int id2)
764 {
765  if (id1 == id2)
766  {
767  return getObject(id1);
768  }
769  else
770  {
771  const unsigned int mixedId = getMixedId(id1, id2);
772  if (mixedId>=mixedObjects_.size())
773  {
774  logger(WARN,
775  "In: Object* SpeciesHandler::getMixedObject(const unsigned int id) const. No Object exist with index %, number of objects is %",
776  std::max(id1, id2), getNumberOfObjects());
777  return nullptr;
778  }
779  else
780  {
781  return mixedObjects_[mixedId];
782  }
783  }
784 }
785 
798 {
800  //logger(INFO, "Part / Mix: % / %", objects_.size(), mixedObjects_.size());
802  S->setHandler(this);
803  for (unsigned int id = 0; id + 1 < getNumberOfObjects(); ++id)
804  {
805  mixedObjects_.push_back(S->copyMixed());
806  mixedObjects_.back()->setIndex(id);
807  mixedObjects_.back()->setId(getNumberOfObjects() - 1);
808  mixedObjects_.back()->mixAll(S, getObject(id));
809  }
813 }
814 
822 void SpeciesHandler::removeObject(unsigned const int index)
823 {
825  for (unsigned int index2 = 0; index2 < getNumberOfObjects(); ++index2)
826  {
827  mixedObjects_.erase(mixedObjects_.begin() + getMixedId(index, index2));
828  }
830 }
831 
836 void SpeciesHandler::write(std::ostream& os) const
837 {
838  os << "Species " << getNumberOfObjects() << "\n";
839  unsigned idMixed = 0;
840  for (const ParticleSpecies* species : objects_)
841  {
842  os << *species << "\n";
843  for (unsigned int id2 = 0; id2 < species->getIndex(); id2++)
844  {
845  os << *mixedObjects_[idMixed] << "\n";
846  idMixed++;
847  }
848  }
849 }
850 
854 std::string SpeciesHandler::getName() const
855 {
856  return "SpeciesHandler";
857 }
858 
863 {
864  for (unsigned int i = 0; i < getSize(); i++)
865  {
866  if (getObject(i)->getUseAngularDOFs())
867  return true;
868  for (unsigned int j = 0; j + 1 < i; j++)
869  {
870  if (getMixedObject(i, j)->getUseAngularDOFs())
871  return true;
872  }
873  }
874  return false;
875 }
Container to store all ParticleSpecies.
unsigned int getIndex() const
Returns the index of the object in the handler.
Definition: BaseObject.h:118
std::enable_if<!std::is_pointer< typename U::MixedSpeciesType >::value, typename U::MixedSpeciesType * >::type getMixedObject(const U *S, const U *T)
~SpeciesHandler() override
Destructor, it destructs the SpeciesHandler and all ParticleSpecies it contains.
void setMaxInteractionDistance(Mdouble interactionDistance=0)
Sets maxInteractionDistance_.
BaseSpecies is the class from which all other species are derived.
Definition: BaseSpecies.h:49
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here...
double Mdouble
Definition: GeneralDefine.h:34
FrictionSpecies contains the parameters used to describe sliding, rolling and torsional friction...
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::complex< Mdouble > i
Definition: ExtendedMath.h:51
void setParticleDimensions(unsigned int particleDimensions)
Sets the particle dimensionality.
Definition: DPMBase.cc:1439
SpeciesHandler()
Default constructor, it creates an empty SpeciesHandler.
Species< LinearViscoelasticNormalSpecies, SlidingFrictionSpecies > LinearViscoelasticSlidingFrictionSpecies
ReversibleAdhesiveSpecies contains the parameters used to describe a linear reversible short-range fo...
virtual void write(std::ostream &os) const
Write all the species and mixed species to an output stream.
Mdouble getInteractionDistance() const
returns the largest separation distance at which adhesive short-range forces can occur.
Definition: BaseSpecies.h:146
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:423
virtual void removeObject(unsigned const int index)
Removes an Object from the BaseHandler.
Definition: BaseHandler.h:472
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1395
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.
SpeciesHandler & operator=(const SpeciesHandler &rhs)
Assignment operator that copies all species and the pointer to the DPMBase from the given SpeciesHand...
std::vector< ParticleSpecies * > objects_
The actual list of Object pointers.
Definition: BaseHandler.h:302
std::vector< BaseSpecies * > mixedObjects_
The list of pointers to the mixed species.
void clear() override
Empties the whole BaseHandler by removing all Objects and setting all other variables to 0...
Species< LinearViscoelasticNormalSpecies > LinearViscoelasticSpecies
virtual unsigned int getNumberOfObjects() const
Gets the number of real Object in this BaseHandler. (i.e. no mpi or periodic particles) ...
void setHandler(SpeciesHandler *handler)
Sets the pointer to the handler to which this species belongs.
Definition: BaseSpecies.cc:91
MixedSpecies< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies > * copy() const final
Creates a deep copy of the MixedSpecies from which it is called.
Definition: MixedSpecies.h:145
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:42
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:431
void setRotation(bool rotation)
Sets whether particle rotation is enabled or disabled.
Definition: DPMBase.h:552
void readAndAddObject(std::istream &is) override
Reads Species data into the SpeciesHandler from restart file.
void removeObject(unsigned int index) override
Remove the ParticleSpecies with given id.
Contains material and contact force properties.
Definition: Interaction.h:42
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:725
std::string getName() const override
Returns the name of the handler, namely the string "SpeciesHandler".
bool useAngularDOFs()
Check if angular DOF have to be used.
unsigned int getMixedId(unsigned int id1, unsigned int id2) const
Gets the Id of the behaviour between two given species.
void addObject(ParticleSpecies *S) override
Adds a new ParticleSpecies to the SpeciesHandler.