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 
76 {
77  logger(DEBUG, "SpeciesHandler::SpeciesHandler() finished");
78 }
79 
87 {
88  clear();
89  setDPMBase(other.getDPMBase());
91  for (BaseSpecies* mixSpec : other.mixedObjects_)
92  {
93  mixedObjects_.push_back(mixSpec->copy());
94  mixedObjects_.back()->setHandler(this);
95  }
96  logger(DEBUG, "SpeciesHandler::SpeciesHandler(const SpeciesHandler &other) finished");
97 }
98 
107 {
108  if (this != &rhs)
109  {
110  clear();
112  for (BaseSpecies* mixSpec : mixedObjects_)
113  {
114  delete mixSpec;
115  }
116  mixedObjects_.clear();
117  for (BaseSpecies* mixSpec : rhs.mixedObjects_)
118  {
119  mixedObjects_.push_back(mixSpec->copy());
120  mixedObjects_.back()->setHandler(this);
121  }
122  }
123 
124  logger(DEBUG, "SpeciesHandler SpeciesHandler::operator =(const SpeciesHandler& rhs)");
125  return *this;
126 }
127 
133 {
134  clear(); //this deletes everything that comes from the BaseHandler.
135  /*for (BaseSpecies* o : mixedObjects_)
136  {
137  delete o;
138  }*/
139  for (BaseSpecies* mixSpec : mixedObjects_)
140  {
141  delete mixSpec;
142  }
143  mixedObjects_.clear();
144  logger(DEBUG, "SpeciesHandler::~SpeciesHandler() finished");
145 }
146 
152 void SpeciesHandler::readAndAddObject(std::istream& is)
153 {
154  std::string type;
155  is >> type;
156  logger(DEBUG, "SpeciesHandler::readAndAddObject(is): reading type %.", type);
157  if (type == "LinearViscoelasticSpecies")
158  {
160  is >> species;
161  copyAndAddObject(species);
162  }
163  else if (type == "LinearPlasticViscoelasticSpecies")
164  {
166  is >> species;
167  copyAndAddObject(species);
168  }
169  else if (type == "SinterSpecies")
170  {
171  SinterSpecies species;
172  is >> species;
173  copyAndAddObject(species);
174  }
175  else if (type == "SinterReversibleAdhesiveSpecies")
176  {
178  is >> species;
179  copyAndAddObject(species);
180  }
181  else if (type == "SinterFrictionReversibleAdhesiveSpecies")
182  {
184  is >> species;
185  copyAndAddObject(species);
186  }
187  else if (type == "SinterFrictionSpecies")
188  {
189  SinterFrictionSpecies species;
190  is >> species;
191  copyAndAddObject(species);
192  }
193  else if (type == "HertzianSinterSpecies")
194  {
195  HertzianSinterSpecies species;
196  is >> species;
197  copyAndAddObject(species);
198  }
199  else if (type == "HertzianSinterFrictionSpecies")
200  {
202  is >> species;
203  copyAndAddObject(species);
204  }
205  else if (type == "HertzianSinterSlidingFrictionSpecies")
206  {
208  is >> species;
209  copyAndAddObject(species);
210  }
211  else if (type == "LinearViscoelasticSlidingFrictionSpecies")
212  {
214  is >> species;
215  copyAndAddObject(species);
216  }
217  else if (type == "LinearPlasticViscoelasticSlidingFrictionSpecies")
218  {
220  is >> species;
221  copyAndAddObject(species);
222  }
223  else if (type == "LinearViscoelasticFrictionSpecies")
224  {
226  is >> species;
227  copyAndAddObject(species);
228  }
229  else if (type == "LinearPlasticViscoelasticFrictionSpecies")
230  {
232  is >> species;
233  copyAndAddObject(species);
234  }
235  else if (type == "LinearViscoelasticIrreversibleAdhesiveSpecies")
236  {
238  is >> species;
239  copyAndAddObject(species);
240  }
241  else if (type == "LinearViscoelasticBondedSpecies")
242  {
244  is >> species;
245  copyAndAddObject(species);
246  }
247  else if (type == "LinearPlasticViscoelasticIrreversibleAdhesiveSpecies")
248  {
250  is >> species;
251  copyAndAddObject(species);
252  }
253  else if (type == "LinearViscoelasticSlidingFrictionIrreversibleAdhesiveSpecies")
254  {
256  is >> species;
257  copyAndAddObject(species);
258  }
259  else if (type == "LinearPlasticViscoelasticSlidingFrictionIrreversibleAdhesiveSpecies")
260  {
262  is >> species;
263  copyAndAddObject(species);
264  }
265  else if (type == "LinearViscoelasticFrictionIrreversibleAdhesiveSpecies")
266  {
268  is >> species;
269  copyAndAddObject(species);
270  }
271  else if (type == "LinearPlasticViscoelasticFrictionIrreversibleAdhesiveSpecies")
272  {
274  is >> species;
275  copyAndAddObject(species);
276  }
277  else if (type == "LinearViscoelasticReversibleAdhesiveSpecies")
278  {
280  is >> species;
281  copyAndAddObject(species);
282  }
283  else if (type == "LinearPlasticViscoelasticReversibleAdhesiveSpecies")
284  {
286  is >> species;
287  copyAndAddObject(species);
288  }
289  else if (type == "LinearViscoelasticSlidingFrictionReversibleAdhesiveSpecies")
290  {
292  is >> species;
293  copyAndAddObject(species);
294  }
295  else if (type == "LinearPlasticViscoelasticSlidingFrictionReversibleAdhesiveSpecies")
296  {
298  is >> species;
299  copyAndAddObject(species);
300  }
301  else if (type == "LinearViscoelasticFrictionReversibleAdhesiveSpecies")
302  {
304  is >> species;
305  copyAndAddObject(species);
306  }
307  else if (type == "LinearPlasticViscoelasticFrictionReversibleAdhesiveSpecies")
308  {
310  is >> species;
311  copyAndAddObject(species);
312  }
313  else if (type == "LinearViscoelasticFrictionLiquidBridgeWilletSpecies")
314  {
316  is >> species;
317  copyAndAddObject(species);
318  }
319  else if (type == "LinearViscoelasticFrictionLiquidMigrationWilletSpecies")
320  {
322  is >> species;
323  copyAndAddObject(species);
324  }
325  else if (type == "LinearPlasticViscoelasticSlidingFrictionLiquidMigrationWilletSpecies")
326  {
328  is >> species;
329  copyAndAddObject(species);
330  }
331  else if (type == "HertzianViscoelasticMindlinSpecies")
332  {
334  is >> species;
335  copyAndAddObject(species);
336  }
337  else if (type == "HertzianViscoelasticMindlinRollingTorsionSpecies" ||
338  type == "HertzianViscoelasticFrictionSpecies")
339  {
341  is >> species;
342  copyAndAddObject(species);
343  }
344  else if (type == "HertzianViscoelasticFrictionChargedBondedSpecies")
345  {
347  is >> species;
348  copyAndAddObject(species);
349  }
350  else if (type == "LinearViscoelasticFrictionChargedBondedSpecies")
351  {
353  is >> species;
354  copyAndAddObject(species);
355  }
356  else if (type == "ThermalSinterSlidingFrictionSpecies")
357  {
359  is >> species;
360  copyAndAddObject(species);
361  }
362  else if (type == "ThermalSinterFrictionSpecies")
363  {
365  is >> species;
366  copyAndAddObject(species);
367  }
368  else if (type == "LinearPlasticViscoelasticFrictionLiquidBridgeWilletSpecies")
369  {
371  is >> species;
372  copyAndAddObject(species);
373  }
374  else if (type == "k") //for backwards compatibility
375  {
377  }
378  else
379  {
380  logger(WARN,
381  "Species type % not understood in restart file: You need to add this species to SpeciesHandler::readObject.",
382  type);
383  std::stringstream line;
386  }
387 
388  //remove the default mixed species
389  for (unsigned int i = 0; i + 1 < getNumberOfObjects(); i++)
390  {
397  delete mixedObjects_.back();
398  mixedObjects_.pop_back();
399  }
400 
401  //Read the mixed species.
402  for (unsigned int i = 0; i + 1 < getNumberOfObjects(); i++)
403  {
404  is >> type;
405  if (type == "LinearViscoelasticMixedSpecies")
406  {
408  is >> species;
409  mixedObjects_.push_back(species.copy());
410  }
411  else if (type == "LinearPlasticViscoelasticMixedSpecies")
412  {
414  is >> species;
415  mixedObjects_.push_back(species.copy());
416  }
417  else if (type == "SinterMixedSpecies")
418  {
419  SinterMixedSpecies species;
420  is >> species;
421  mixedObjects_.push_back(species.copy());
422  }
423  else if (type == "SinterReversibleAdhesiveMixedSpecies")
424  {
426  is >> species;
427  mixedObjects_.push_back(species.copy());
428  }
429  else if (type == "SinterFrictionReversibleAdhesiveMixedSpecies")
430  {
432  is >> species;
433  mixedObjects_.push_back(species.copy());
434  }
435  else if (type == "SinterFrictionMixedSpecies")
436  {
438  is >> species;
439  mixedObjects_.push_back(species.copy());
440  }
441  else if (type == "HertzianSinterMixedSpecies")
442  {
444  is >> species;
445  mixedObjects_.push_back(species.copy());
446  }
447  else if (type == "HertzianSinterFrictionMixedSpecies")
448  {
450  is >> species;
451  mixedObjects_.push_back(species.copy());
452  }
453  else if (type == "HertzianSinterSlidingFrictionMixedSpecies")
454  {
456  is >> species;
457  mixedObjects_.push_back(species.copy());
458  }
459  else if (type == "LinearViscoelasticSlidingFrictionMixedSpecies")
460  {
462  is >> species;
463  mixedObjects_.push_back(species.copy());
464  }
465  else if (type == "LinearPlasticViscoelasticSlidingFrictionMixedSpecies")
466  {
468  is >> species;
469  mixedObjects_.push_back(species.copy());
470  }
471  else if (type == "LinearViscoelasticFrictionMixedSpecies")
472  {
474  is >> species;
475  mixedObjects_.push_back(species.copy());
476  }
477  else if (type == "LinearPlasticViscoelasticFrictionMixedSpecies")
478  {
480  is >> species;
481  mixedObjects_.push_back(species.copy());
482  }
483  else if (type == "LinearViscoelasticIrreversibleAdhesiveMixedSpecies")
484  {
486  is >> species;
487  mixedObjects_.push_back(species.copy());
488  }
489  else if (type == "LinearViscoelasticBondedMixedSpecies")
490  {
492  is >> species;
493  mixedObjects_.push_back(species.copy());
494  }
495  else if (type == "LinearPlasticViscoelasticIrreversibleAdhesiveMixedSpecies")
496  {
498  is >> species;
499  mixedObjects_.push_back(species.copy());
500  }
501  else if (type == "LinearViscoelasticSlidingFrictionIrreversibleAdhesiveMixedSpecies")
502  {
504  is >> species;
505  mixedObjects_.push_back(species.copy());
506  }
507  else if (type == "LinearPlasticViscoelasticSlidingFrictionIrreversibleAdhesiveMixedSpecies")
508  {
510  is >> species;
511  mixedObjects_.push_back(species.copy());
512  }
513  else if (type == "LinearViscoelasticFrictionIrreversibleAdhesiveMixedSpecies")
514  {
516  is >> species;
517  mixedObjects_.push_back(species.copy());
518  }
519  else if (type == "LinearPlasticViscoelasticFrictionIrreversibleAdhesiveMixedSpecies")
520  {
522  is >> species;
523  mixedObjects_.push_back(species.copy());
524  }
525  else if (type == "LinearPlasticViscoelasticSlidingFrictionLiquidMigrationWilletMixedSpecies")
526  {
528  is >> species;
529  mixedObjects_.push_back(species.copy());
530  }
531  else if (type == "LinearPlasticViscoelasticFrictionLiquidBridgeWilletMixedSpecies")
532  {
534  is >> species;
535  mixedObjects_.push_back(species.copy());
536  }
537  else if (type == "LinearViscoelasticReversibleAdhesiveMixedSpecies")
538  {
540  is >> species;
541  mixedObjects_.push_back(species.copy());
542  }
543  else if (type == "LinearPlasticViscoelasticReversibleAdhesiveMixedSpecies")
544  {
546  is >> species;
547  mixedObjects_.push_back(species.copy());
548  }
549  else if (type == "LinearViscoelasticSlidingFrictionReversibleAdhesiveMixedSpecies")
550  {
552  is >> species;
553  mixedObjects_.push_back(species.copy());
554  }
555  else if (type == "LinearPlasticViscoelasticSlidingFrictionReversibleAdhesiveMixedSpecies")
556  {
558  is >> species;
559  mixedObjects_.push_back(species.copy());
560  }
561  else if (type == "LinearViscoelasticFrictionReversibleAdhesiveMixedSpecies")
562  {
564  is >> species;
565  mixedObjects_.push_back(species.copy());
566  }
567  else if (type == "LinearPlasticViscoelasticFrictionReversibleAdhesiveMixedSpecies")
568  {
570  is >> species;
571  mixedObjects_.push_back(species.copy());
572  }
573  else if (type == "LinearViscoelasticFrictionLiquidBridgeWilletMixedSpecies")
574  {
576  is >> species;
577  mixedObjects_.push_back(species.copy());
578  }
579  else if (type == "LinearViscoelasticFrictionLiquidMigrationWilletMixedSpecies")
580  {
582  is >> species;
583  mixedObjects_.push_back(species.copy());
584  }
585  else if (type == "HertzianViscoelasticMindlinMixedSpecies")
586  {
588  is >> species;
589  mixedObjects_.push_back(species.copy());
590  }
591  else if (type == "HertzianViscoelasticMindlinRollingTorsionMixedSpecies" ||
592  type == "HertzianViscoelasticFrictionMixedSpecies")
593  {
595  is >> species;
596  mixedObjects_.push_back(species.copy());
597  }
598  else if (type == "HertzianViscoelasticFrictionChargedBondedMixedSpecies")
599  {
601  is >> species;
602  mixedObjects_.push_back(species.copy());
603  }
604  else if (type == "LinearViscoelasticFrictionChargedBondedMixedSpecies")
605  {
607  is >> species;
608  mixedObjects_.push_back(species.copy());
609  }
610  else if (type == "ThermalSinterSlidingFrictionMixedSpecies")
611  {
613  is >> species;
614  mixedObjects_.push_back(species.copy());
615  }
616  else if (type == "ThermalSinterFrictionMixedSpecies")
617  {
619  is >> species;
620  mixedObjects_.push_back(species.copy());
621  }
622  else if (type == "ThermalSinterFrictionMixedSpecies")
623  {
625  is >> species;
626  mixedObjects_.push_back(species.copy());
627  }
628  else
629  {
630  logger(WARN,
631  "Species type % not understood in restart file: You need to add this species to SpeciesHandler::readMixedObject.",
632  type);
633  std::stringstream line;
636  mixedObjects_.push_back(species.copy());
637  }
638  }
639 }
640 
650 {
651  //read in next line
652  std::stringstream line;
654 
655  //read each property
656  std::string property;
657  unsigned int particleDimension = 0;
658  Mdouble density = 0.0, stiffness = 0.0, dissipation = 0.0, slidingFrictionCoefficient = 0.0, slidingFrictionCoefficientStatic = 0.0, slidingStiffness = 0.0, slidingDissipation = 0.0;
659  line >> stiffness;
660  while (true)
661  {
662  line >> property;
663  if (property == "disp")
664  line >> dissipation;
665  else if (property == "rho")
666  line >> density;
667  else if (property == "kt")
668  line >> slidingStiffness;
669  else if (property == "dispt")
670  line >> slidingDissipation;
671  else if (property == "mu")
672  line >> slidingFrictionCoefficient;
673  else if (property == "mus")
674  line >> slidingFrictionCoefficientStatic;
675  else if (property == "dim_particle")
676  {
677  line >> particleDimension;
678  getDPMBase()->setParticleDimensions(particleDimension);
679  }
680  else if (property == "(mixed)")
681  {
682  density = 0;
683  }
684  else
685  {
686  logger(WARN, "Warning: % is not a species property", property);
687  break;
688  }
689  if (line.eof())
690  break;
691  }
692 
693  //create the correct species
694  if (slidingFrictionCoefficient == 0.0)
695  {
697  species->setDensity(density);
698  species->setStiffness(stiffness);
699  species->setDissipation(dissipation);
700  return species;
701  }
702  else
703  {
705  species->setDensity(density);
706  species->setStiffness(stiffness);
707  species->setDissipation(dissipation);
708  species->setSlidingStiffness(slidingStiffness);
709  species->setSlidingDissipation(slidingDissipation);
710  species->setSlidingFrictionCoefficient(slidingFrictionCoefficient);
711  if (slidingFrictionCoefficientStatic == 0.0)
712  slidingFrictionCoefficientStatic = slidingFrictionCoefficient;
713  species->setSlidingFrictionCoefficientStatic(slidingFrictionCoefficientStatic);
714  return species;
715  }
716 }
717 
727 unsigned int SpeciesHandler::getMixedId(const unsigned int id1, const unsigned int id2) const
728 {
729  unsigned int maxId = std::max(id1, id2);
730  return (maxId * (maxId - 1)) / 2 + std::min(id1, id2);
731 }
732 
736 const std::vector<BaseSpecies*>& SpeciesHandler::getMixedObjects() const
737 {
738  return mixedObjects_;
739 }
740 
748 BaseSpecies* SpeciesHandler::getMixedObject(const unsigned int id1, const unsigned int id2)
749 {
750  if (id1 == id2)
751  {
752  return getObject(id1);
753  }
754  else
755  {
756  const unsigned int mixedId = getMixedId(id1, id2);
757  if (mixedId>=mixedObjects_.size())
758  {
759  logger(WARN,
760  "In: Object* SpeciesHandler::getMixedObject(const unsigned int id) const. No Object exist with index %, number of objects is %",
761  std::max(id1, id2), getNumberOfObjects());
762  return nullptr;
763  }
764  else
765  {
766  return mixedObjects_[mixedId];
767  }
768  }
769 }
770 
783 {
785  //logger(INFO, "Part / Mix: % / %", objects_.size(), mixedObjects_.size());
787  S->setHandler(this);
788  for (unsigned int id = 0; id + 1 < getNumberOfObjects(); ++id)
789  {
790  mixedObjects_.push_back(S->copyMixed());
791  mixedObjects_.back()->setIndex(id);
792  mixedObjects_.back()->setId(getNumberOfObjects() - 1);
793  mixedObjects_.back()->mixAll(S, getObject(id));
794  }
798 }
799 
807 void SpeciesHandler::removeObject(unsigned const int index)
808 {
810  for (unsigned int index2 = 0; index2 < getNumberOfObjects(); ++index2)
811  {
812  mixedObjects_.erase(mixedObjects_.begin() + getMixedId(index, index2));
813  }
815 }
816 
822 void SpeciesHandler::write(std::ostream& os) const
823 {
824  os << "Species " << getNumberOfObjects() << std::endl;
825  unsigned idMixed = 0;
826  for (const ParticleSpecies* species : objects_)
827  {
828  os << *species << std::endl;
829  for (unsigned int id2 = 0; id2 < species->getIndex(); id2++)
830  {
831  os << *mixedObjects_[idMixed] << std::endl;
832  idMixed++;
833  }
834  }
835 }
836 
840 std::string SpeciesHandler::getName() const
841 {
842  return "SpeciesHandler";
843 }
844 
849 {
850  for (unsigned int i = 0; i < getSize(); i++)
851  {
852  if (getObject(i)->getUseAngularDOFs())
853  return true;
854  for (unsigned int j = 0; j + 1 < i; j++)
855  {
856  if (getMixedObject(i, j)->getUseAngularDOFs())
857  return true;
858  }
859  }
860  return false;
861 }
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")
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:50
void setParticleDimensions(unsigned int particleDimensions)
Sets the particle dimensionality.
Definition: DPMBase.cc:1408
SpeciesHandler()
Default constructor, it creates an empty SpeciesHandler.
Species< LinearViscoelasticNormalSpecies, SlidingFrictionSpecies > LinearViscoelasticSlidingFrictionSpecies
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:424
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:1329
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:538
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.