|
HG-MD
1
|
Member variable of Particle storing all tangential springs
of particle PI with contacting particles PJ.
More...
#include <CTangentialSpring.h>
Classes | |
| struct | check_spring_time |
| Construction required for the erase/remove_if stuff. More... | |
Public Member Functions | |
| vector< int > | to_be_erased (Mdouble time) |
| Function selects the tangential spring vector for particle-particle interations (also removed not used springs}. | |
| void | to_erase (Mdouble time) |
| Function selects the tangential spring vector for particle-particle interations (also removed not used springs}. | |
| CTangentialSpring * | select_particle_spring (int P, Mdouble time_, Mdouble dt) |
| Function selects the tangential spring vector for particle-particle interations (also removed not used springs}. | |
| CTangentialSpring * | select_wall_spring (int W, Mdouble time_, Mdouble dt) |
| Function selects the tangential spring vector for particle-particle interations (also removed not used springs}. | |
| void | reset () |
| Resets the tangential springs. | |
| void | print (std::ostream &os, Mdouble time_) |
| outputs all current active tangential springs | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const CTangentialSprings &p) |
| writes all springs | |
| std::istream & | operator>> (std::istream &is, CTangentialSprings &p) |
| reads all springs | |
Member variable of Particle storing all tangential springs
of particle PI with contacting particles PJ.
A tangential spring between PI and PJ can be stored in either particle depending on which particle is the first particle in MD::compute_internal_forces.
Geometrically, there can be no more than 13 possible contacts in 3D, so the vector size is limited.
| void CTangentialSprings::print | ( | std::ostream & | os, |
| Mdouble | time_ | ||
| ) | [inline] |
outputs all current active tangential springs
{
os << "Tangential Springs: N=" << size() << endl;
for (CTangentialSprings::iterator it=begin(); it!=end(); it++)
if (it->time>=time_) {
it->print(os); os << endl;
}
}
| void CTangentialSprings::reset | ( | ) | [inline] |
Resets the tangential springs.
Referenced by Chute::initialize_inflow_particle().
{
clear();
reserve(13);
}
| CTangentialSpring* CTangentialSprings::select_particle_spring | ( | int | P, |
| Mdouble | time_, | ||
| Mdouble | dt | ||
| ) | [inline] |
Function selects the tangential spring vector for particle-particle interations (also removed not used springs}.
Referenced by MD::compute_internal_forces(), and MD::compute_plastic_internal_forces().
{
//Remove_if reconstructs the vector with only elements passing the check_spring_time function
//Erase removes the end of the vector
erase(remove_if(begin(),end(),bind2nd(check_spring_time(),time_)),end());
//Loops over all Springs ant returns the correct one (if it exists)
for (CTangentialSprings::iterator it=begin(); it!=end();it++){
if (it->pParticle==P)
{
it->time=time_+dt;
return &(*it);
}
}
//if not, create it
push_back(CTangentialSpring(P,-1,time_+dt));
return &(back());
}
| CTangentialSpring* CTangentialSprings::select_wall_spring | ( | int | W, |
| Mdouble | time_, | ||
| Mdouble | dt | ||
| ) | [inline] |
Function selects the tangential spring vector for particle-particle interations (also removed not used springs}.
Referenced by MD::compute_walls().
{
//Remove_if reconstructs the vector with only elements passing the check_spring_time function
//Erase removes the end of the vector
erase(remove_if(begin(),end(),bind2nd(check_spring_time(),time_)),end());
//Loops over all Springs ant returns the correct one (if it exists)
for (CTangentialSprings::iterator it=begin(); it!=end();it++){
if (it->pWall==W)
{
it->time=time_+dt;
return &(*it);
}
}
//if not, create it
//~ cout << "created pw " << time_ << " " << W << endl;
push_back(CTangentialSpring(-1,W,time_+dt));
return &(back());
}
| vector<int> CTangentialSprings::to_be_erased | ( | Mdouble | time | ) | [inline] |
Function selects the tangential spring vector for particle-particle interations (also removed not used springs}.
{
vector<int> retval;
for (unsigned int i=0; i<size(); i++)
if (operator[](i).time<time) {
retval.push_back(i);
//cout << "to be erased " << time << " " << operator[](i).pParticle << " " << operator[](i).pWall << " " << size() << endl;
}
return retval;
}
| void CTangentialSprings::to_erase | ( | Mdouble | time | ) | [inline] |
Function selects the tangential spring vector for particle-particle interations (also removed not used springs}.
{
erase(remove_if(begin(),end(),bind2nd(check_spring_time(),time)),end());
}
| std::ostream& operator<< | ( | std::ostream & | os, |
| const CTangentialSprings & | p | ||
| ) | [friend] |
writes all springs
{
os << p.size() << " ";
for (unsigned int i=0; i<p.size(); i++) os << p[i] << " ";
return os;
}
| std::istream& operator>> | ( | std::istream & | is, |
| CTangentialSprings & | p | ||
| ) | [friend] |
reads all springs
{
//should return empty spring if read from is failed
int n; is >> n;
if (is.fail()) {
p.resize(0);
} else {
p.resize(n);
for (unsigned int i=0; i<p.size(); i++) is >> p[i];
}
return is;
}
1.7.6.1