HG-MD  1
Classes | Public Member Functions | Friends
CDeltaMaxs Class Reference

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

#include <CDeltaMax.h>

List of all members.

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}.
Mdoubleselect_wall (int W, Mdouble time_, Mdouble dt)
 Function selects the tangential spring vector for particle-wall interations.
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 CDeltaMaxs &p)
 writes all springs
std::istream & operator>> (std::istream &is, CDeltaMaxs &p)
 reads all springs

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.


Member Function Documentation

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

outputs all current active tangential springs

                                                  {
                os << "Delta max's: N=" << size() << endl;
                for (CDeltaMaxs::iterator it=begin(); it!=end(); it++)
                        if (it->time>=time_) {
                                        it->print(os); os << endl; 
                        }
        }
void CDeltaMaxs::reset ( ) [inline]

Resets the tangential springs.

                     {
                clear();
                reserve(13);
        }
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}.

Referenced by 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 (CDeltaMaxs::iterator it=begin(); it!=end();it++){
                        if (it->pParticle==P)
                        {
                                it->time=time_+dt; 
                                return &it->delta;
                        }
                }
                
                //if not, create it
                push_back(CDeltaMax(0,P,-1,time_+dt));  
                return &back().delta;
        }
Mdouble* CDeltaMaxs::select_wall ( int  W,
Mdouble  time_,
Mdouble  dt 
) [inline]

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

                                                               {
                //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 (CDeltaMaxs::iterator it=begin(); it!=end(); it++)
                {
                        if (it->pWall==W)
                        {
                                it->time=time_+dt; 
                                return &it->delta;
                        }
                }
                
                //if not, create it
                push_back(CDeltaMax(0,-1,W,time_+dt));          
                return &back().delta;
        }

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const CDeltaMaxs 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,
CDeltaMaxs p 
) [friend]

reads all springs

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

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines