MercuryDPM  0.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CDeltaMaxs Class Reference

Member variable of #Particle storing all history parameters $\delta_{max}$ of a particle. More...

#include <CDeltaMax.h>

+ Inheritance diagram for CDeltaMaxs:

Classes

struct  check_spring_time
 Construction required for the erase/remove_if stuff. More...
 

Public Member Functions

Mdoubleselect_particle (int P, Mdouble time_, Mdouble dt)
 Function selects the tangential spring vector for particle-particle interations (also removed not used springs}. More...
 
Mdoubleselect_wall (int W, Mdouble time_, Mdouble dt)
 Function selects the tangential spring vector for particle-wall interations. More...
 
void reset ()
 Resets the tangential springs. More...
 
void print (std::ostream &os, Mdouble time_)
 outputs all current active tangential springs More...
 

Friends

std::ostream & operator<< (std::ostream &os, const CDeltaMaxs &p)
 writes all springs More...
 
std::istream & operator>> (std::istream &is, CDeltaMaxs &p)
 reads all springs More...
 

Detailed Description

Member variable of #Particle storing all history parameters $\delta_{max}$ of a particle.

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.

Definition at line 102 of file CDeltaMax.h.

Member Function Documentation

void CDeltaMaxs::print ( std::ostream &  os,
Mdouble  time_ 
)
inline

outputs all current active tangential springs

Definition at line 158 of file CDeltaMax.h.

158  {
159  os << "Delta max's: N=" << size() << std::endl;
160  for (CDeltaMaxs::iterator it=begin(); it!=end(); it++)
161  if (it->time>=time_) {
162  it->print(os); os << std::endl;
163  }
164  }
void CDeltaMaxs::reset ( )
inline

Resets the tangential springs.

Definition at line 152 of file CDeltaMax.h.

Referenced by DeltaMaxsParticle::DeltaMaxsParticle().

152  {
153  clear();
154  reserve(13);
155  }
Mdouble* CDeltaMaxs::select_particle ( int  P,
Mdouble  time_,
Mdouble  dt 
)
inline

Function selects the tangential spring vector for particle-particle interations (also removed not used springs}.

Definition at line 111 of file CDeltaMax.h.

Referenced by MD::compute_plastic_internal_forces().

111  {
112  //Remove_if reconstructs the vector with only elements passing the check_spring_time function
113  //Erase removes the end of the vector
114  erase(remove_if(begin(),end(),bind2nd(check_spring_time(),time_)),end());
115 
116  //Loops over all Springs ant returns the correct one (if it exists)
117  for (CDeltaMaxs::iterator it=begin(); it!=end();it++){
118  if (it->pParticle==P)
119  {
120  it->time=time_+dt;
121  return &it->delta;
122  }
123  }
124 
125  //if not, create it
126  push_back(CDeltaMax(0,P,-1,time_+dt));
127  return &back().delta;
128  }
Stores the history parameter needed for a plastic force.
Definition: CDeltaMax.h:40
Mdouble* CDeltaMaxs::select_wall ( int  W,
Mdouble  time_,
Mdouble  dt 
)
inline

Function selects the tangential spring vector for particle-wall interations.

Definition at line 131 of file CDeltaMax.h.

131  {
132  //Remove_if reconstructs the vector with only elements passing the check_spring_time function
133  //Erase removes the end of the vector
134  erase(remove_if(begin(),end(),bind2nd(check_spring_time(),time_)),end());
135 
136  //Loops over all Springs ant returns the correct one (if it exists)
137  for (CDeltaMaxs::iterator it=begin(); it!=end(); it++)
138  {
139  if (it->pWall==W)
140  {
141  it->time=time_+dt;
142  return &it->delta;
143  }
144  }
145 
146  //if not, create it
147  push_back(CDeltaMax(0,-1,W,time_+dt));
148  return &back().delta;
149  }
Stores the history parameter needed for a plastic force.
Definition: CDeltaMax.h:40

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const CDeltaMaxs p 
)
friend

writes all springs

Definition at line 168 of file CDeltaMax.h.

169  {
170  os << p.size();
171  for (unsigned int i=0; i<p.size(); i++) os <<" "<< p[i];
172  return os;
173  }
std::istream& operator>> ( std::istream &  is,
CDeltaMaxs p 
)
friend

reads all springs

Definition at line 176 of file CDeltaMax.h.

177  {
178  int n; is >> n; p.resize(n);
179  for (unsigned int i=0; i<p.size(); i++) is >> p[i];
180  return is;
181  }

The documentation for this class was generated from the following file: