26 #ifndef MIXEDSPECIES_H
27 #define MIXEDSPECIES_H
39 template<
class NormalForceSpecies,
class FrictionForceSpecies = EmptyFrictionSpecies,
class AdhesiveForceSpecies = EmptyAdhesiveSpecies>
62 void read(std::istream& is);
65 void write(std::ostream& os)
const;
91 template<
class NormalForceSpecies,
class FrictionForceSpecies,
class AdhesiveForceSpecies>
95 #ifdef DEBUG_CONSTRUCTOR
96 std::cout <<
"MixedSpecies::MixedSpecies() finished" << std::endl;
100 template<
class NormalForceSpecies,
class FrictionForceSpecies,
class AdhesiveForceSpecies>
104 #ifdef DEBUG_CONSTRUCTOR
105 std::cout <<
"MixedSpecies::MixedSpecies(const MixedSpecies &p) finished" << std::endl;
109 template<
class NormalForceSpecies,
class FrictionForceSpecies,
class AdhesiveForceSpecies>
113 #ifdef DEBUG_CONSTRUCTOR
114 std::cout <<
"MixedSpecies::MixedSpecies(const MixedSpecies &p) finished" << std::endl;
118 template<
class NormalForceSpecies,
class FrictionForceSpecies,
class AdhesiveForceSpecies>
121 #ifdef DEBUG_DESTRUCTOR
122 std::cout <<
"MixedSpecies::~MixedSpecies() finished" << std::endl;
127 template<
class NormalForceSpecies,
class FrictionForceSpecies,
class AdhesiveForceSpecies>
141 template<
class NormalForceSpecies,
class FrictionForceSpecies,
class AdhesiveForceSpecies>
148 NormalForceSpecies::write(os);
149 FrictionForceSpecies::write(os);
150 AdhesiveForceSpecies::write(os);
157 template<
class NormalForceSpecies,
class FrictionForceSpecies,
class AdhesiveForceSpecies>
163 unsigned int id, index;
165 is >> dummy >> index;
168 NormalForceSpecies::read(is);
169 FrictionForceSpecies::read(is);
170 AdhesiveForceSpecies::read(is);
187 template<
class NormalForceSpecies,
class FrictionForceSpecies,
class AdhesiveForceSpecies>
190 return NormalForceSpecies::getBaseName()
191 + FrictionForceSpecies::getBaseName()
192 + AdhesiveForceSpecies::getBaseName() +
"MixedSpecies";
203 template<
class NormalForceSpecies,
class FrictionForceSpecies,
class AdhesiveForceSpecies>
215 template<
class NormalForceSpecies,
class FrictionForceSpecies,
class AdhesiveForceSpecies>
218 return FrictionForceSpecies::getUseAngularDOFs();
227 template<
class NormalForceSpecies,
class FrictionForceSpecies,
class AdhesiveForceSpecies>
230 if (dynamic_cast<NormalForceSpecies*> (T) ==NULL||
231 dynamic_cast<FrictionForceSpecies*> (T) ==NULL||
232 dynamic_cast<AdhesiveForceSpecies*> (T) ==NULL) {
233 std::cerr <<
"Warning: cannot mix two species of different type; the mixed species is an empty species of the same type as the second species instead" << std::endl;
236 NormalForceSpecies::mix(dynamic_cast<NormalForceSpecies*> (S), dynamic_cast<NormalForceSpecies*> (T));
237 FrictionForceSpecies::mix(dynamic_cast<FrictionForceSpecies*> (S), dynamic_cast<FrictionForceSpecies*> (T));
238 AdhesiveForceSpecies::mix(dynamic_cast<AdhesiveForceSpecies*> (S), dynamic_cast<AdhesiveForceSpecies*> (T));
243 template<
class NormalForceSpecies,
class FrictionForceSpecies,
class AdhesiveForceSpecies>
246 return AdhesiveForceSpecies::getInteractionDistance();
void setIndex(const unsigned int index)
Allows one to assign an index to an object in the handler/container.
unsigned int getId() const
Returns the unique identifier of any particular object.
unsigned int getIndex() const
Returns the index of the object in the handler.
BaseSpecies is the class from which all other species are derived.
Defines a contact force orthogonal to the contact normal.
Defines a contact force parallel to the contact normal.
void mixAll(BaseSpecies *const S, BaseSpecies *const T)
sets the MixedSpecies properties by mixing the properties of two particle species ...
Stores information about interactions between two interactable objects; often particles but could be ...
Defines a short-range (non-contact) force parallel to the contact normal, usually adhesive...
MixedSpecies()
The default constructor.
void setId(const unsigned int id)
Assigns a unique identifier to each object in the handler (container) which remains constant even aft...
Mdouble getInteractionDistance() const
Returns the particle distance below which adhesive forces can occur (needed for contact detection) ...
MixedSpecies< NormalForceSpecies, FrictionForceSpecies, AdhesiveForceSpecies > * copy() const
Creates a deep copy of the MixedSpecies from which it is called.
void read(std::istream &is)
Reads the species properties from an input stream.
Contains contact force properties for contacts between particles with two different species...
Defines the basic properties that a interactable object can have.
std::string getName() const
Returns the name of the MixedSpecies as it is used in the restart file.
Contains material and contact force properties.
BaseInteraction * getNewInteraction(BaseInteractable *P, BaseInteractable *I, Mdouble timeStamp) const
When a contact between two particles is determined, an Interaction object is created, as the type of Interaction depends on the MixedSpecies type.
virtual ~MixedSpecies()
The default destructor.
void write(std::ostream &os) const
Writes the MixedSpecies properties to an output stream.
Contains information about the contact between two interactables, BaseInteraction::P_ and BaseInterac...
bool getUseAngularDOFs() const
Returns true if torques have to be calculated.