39 #ifdef CONSTUCTOR_OUTPUT
40 std::cerr <<
"ParticleHandler() finished" << std::endl;
49 for (std::vector<BaseParticle*>::const_iterator it=PH.
begin();it!=PH.
end();it++)
53 #ifdef CONSTUCTOR_OUTPUT
54 std::cerr <<
"ParticleHandler(const ParticleHandler &PH) finished" << std::endl;
64 for (std::vector<BaseParticle*>::const_iterator it=rhs.
begin();it!=rhs.
end();it++)
69 #ifdef CONSTUCTOR_OUTPUT
70 std::cerr <<
"ParticleHandler operator = (const ParticleHandler& rhs) finished" << std::endl;
77 #ifdef DESTRUCTOR_OUTPUT
78 std::cout <<
"WallHandler::~WallHandler() finished" << std::endl;
98 std::cerr <<
"Warning: No particles to set get_SmallestParticle()" << std::endl;
108 std::cerr <<
"Warning: No particles to set get_FastestParticle()" << std::endl;
111 Mdouble maxSpeed = -std::numeric_limits<Mdouble>::max();
112 for (std::vector<BaseParticle*>::const_iterator it=
begin();it!=
end();it++)
114 if ((*it)->get_Velocity().GetLength()>maxSpeed)
116 maxSpeed=(*it)->get_Velocity().GetLength();
127 std::cerr <<
"Warning: No getLowestPositionComponentParticle(cons int i)" << std::endl;
130 Mdouble min = std::numeric_limits<Mdouble>::max();
131 for (std::vector<BaseParticle*>::const_iterator it=
begin();it!=
end();it++)
133 if ((*it)->get_Position().getComponent(i)<min) {
134 min=(*it)->get_Position().getComponent(i);
144 std::cerr <<
"Warning: No getHighestPositionComponentParticle(cons int i)" << std::endl;
147 Mdouble max = -std::numeric_limits<Mdouble>::max();
148 for (std::vector<BaseParticle*>::const_iterator it=
begin();it!=
end();it++)
150 if ((*it)->get_Position().getComponent(i)>max) {
151 max=(*it)->get_Position().getComponent(i);
161 std::cerr <<
"Warning: No getLowestVelocityComponentParticle(cons int i)" << std::endl;
164 Mdouble min = std::numeric_limits<Mdouble>::max();
165 for (std::vector<BaseParticle*>::const_iterator it=
begin();it!=
end();it++)
167 if ((*it)->get_Velocity().getComponent(i)<min) {
168 min=(*it)->get_Velocity().getComponent(i);
178 std::cerr <<
"Warning: No getHighestVelocityComponentParticle(cons int i)" << std::endl;
181 Mdouble max = -std::numeric_limits<Mdouble>::max();
182 for (std::vector<BaseParticle*>::const_iterator it=
begin();it!=
end();it++)
184 if ((*it)->get_Velocity().getComponent(i)>max) {
185 max=(*it)->get_Velocity().getComponent(i);
196 std::cerr <<
"Warning: No particles to set getLightestParticle()" << std::endl;
200 Mdouble minMass = std::numeric_limits<Mdouble>::max();
201 for (std::vector<BaseParticle*>::const_iterator it=
begin();it!=
end();it++)
203 if ((*it)->get_Mass()<minMass)
205 minMass=(*it)->get_Mass();
216 std::cerr <<
"Warning: No particles to set get_LargestParticle()" << std::endl;
234 if(type.compare(
"BP")==0)
240 else if(type.compare(
"TSP")==0)
243 is>>tangentialSpringParticle;
246 else if(type.compare(
"DMP")==0)
249 is>>deltaMaxsParticle;
252 else if(isdigit(type[0]))
255 tangentialSpringParticle.
oldRead(is,type);
260 std::cerr<<
"Particle type: "<<type<<
" not understood in restart file"<<std::endl;
284 Mdouble maxRadius = -std::numeric_limits<Mdouble>::max();
285 for (std::vector<BaseParticle*>::const_iterator it=
begin();it!=
end();it++)
287 if ((*it)->get_InteractionRadius()>maxRadius&&P!=(*it))
289 maxRadius = (*it)->get_InteractionRadius();
297 Mdouble minRadius = std::numeric_limits<Mdouble>::max();
298 for (std::vector<BaseParticle*>::const_iterator it=
begin();it!=
end();it++)
300 if ((*it)->get_InteractionRadius()<minRadius&&P!=(*it))
302 minRadius = (*it)->get_InteractionRadius();
virtual void addObject(T *O)
Adds a new Object to the BaseHandler.
BaseParticle * getLargestParticle() const
Gets a pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler.
void checkExtremaOnDelete(BaseParticle *P)
Checks if the extrema of this ParticleHandler needs updating when a particle is deleted.
Mdouble get_InteractionRadius() const
void checkExtrema(BaseParticle *P)
Checks if the extrema of this ParticleHandler needs updating.
BaseParticle * getLowestVelocityComponentParticle(const int i) const
void copyAndAddObject(const BaseParticle &O)
Creates a copy of a Object and adds it to the BaseHandler.
std::vector< CSpecies > * species_
BaseParticle * getLastObject() const
Gets a pointer to the last Object in this BaseHandler.
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
void setHandler(ParticleHandler *handler)
BaseParticle * getLightestParticle() const
Gets a pointer to the lightest BaseParticle (by mass) in this ParticleHandler.
void readObject(std::istream &is)
Reads BaseParticle into the ParticleHandler from restart data.
BaseParticle * smallestParticle_
A pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler.
void clear()
Empties the whole ParticleHandler by removing all BaseParticle.
void oldRead(std::istream &is, std::string &x)
BaseParticle * getSmallestParticle() const
Gets a pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler.
void setSpecies(std::vector< CSpecies > *)
virtual void addObject(BaseParticle *P)
Adds a BaseParticle to the ParticleHandler.
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
ParticleHandler()
Default constructor, it simply creates an empty ParticleHandler.
BaseParticle * largestParticle_
A pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler.
~ParticleHandler()
Destructor, it simply destructs the ParticleHandler and all BaseParticle it contains.
BaseParticle * getHighestVelocityComponentParticle(const int i) const
Container to store all Object.
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Container to store all BaseParticle.
CSpecies & getSpecies(const int i)
BaseParticle * getHighestPositionComponentParticle(const int i) const
Stores properties of the particles and the contact models such as the elastic modulus.
BaseParticle * getLowestPositionComponentParticle(const int i) const
ParticleHandler operator=(const ParticleHandler &rhs)
Assignment operator.
void clear()
Empties the whole BaseHandler by removing all Object.
BaseParticle * getFastestParticle() const
Gets a pointer to the fastests BaseParticle in this ParticleHandler.