ESyS-Particle  4.0.1
HertzianViscoElasticInteraction.h
00001 
00002 //                                                         //
00003 // Copyright (c) 2003-2011 by The University of Queensland //
00004 // Earth Systems Science Computational Centre (ESSCC)      //
00005 // http://www.uq.edu.au/esscc                              //
00006 //                                                         //
00007 // Primary Business: Brisbane, Queensland, Australia       //
00008 // Licensed under the Open Software License version 3.0    //
00009 // http://www.opensource.org/licenses/osl-3.0.php          //
00010 //                                                         //
00012 
00013 #ifndef __HERTZIANVISCOELASTICINTERACTION_H
00014 #define __HERTZIANVISCOELASTICINTERACTION_H
00015 
00016 #include "Model/IGParam.h"
00017 #include "Model/Interaction.h"
00018 #include "Model/Particle.h"
00019 
00020 
00024 class CHertzianViscoElasticIGP : public AIGParam
00025 {
00026 public:
00027   double m_A;
00028   double m_E;
00029   double m_nu; // poisson ratio
00030 
00031   CHertzianViscoElasticIGP();
00032   CHertzianViscoElasticIGP(const std::string&,double,double,double);
00033   
00034   virtual std::string getTypeString() const {return "HertzianViscoElastic";}
00035 };
00036 
00044 class CHertzianViscoElasticInteraction : public APairInteraction
00045 {
00046 public:
00047 
00048   typedef
00049     double (CHertzianViscoElasticInteraction::* ScalarFieldFunction)() const;
00050   typedef
00051     Vec3 (CHertzianViscoElasticInteraction::* VectorFieldFunction)() const;
00052   typedef 
00053     pair<bool,double>
00054     (CHertzianViscoElasticInteraction::* CheckedScalarFieldFunction)() const;
00055 
00056   static ScalarFieldFunction getScalarFieldFunction(const string&);
00057   static VectorFieldFunction getVectorFieldFunction(const string&);
00058   static CheckedScalarFieldFunction getCheckedScalarFieldFunction(
00059     const string&
00060   );
00061 
00062 private:
00063   double m_A;
00064   double m_E;
00065   double m_nu; 
00066   Vec3   m_force; // caching force for E_pot
00067   double m_dn; // caching displacement for E_pot
00068   Vec3   m_cpos; // center position
00069 
00070 public:
00071   typedef CHertzianViscoElasticIGP ParameterType;
00072 
00073   CHertzianViscoElasticInteraction(
00074     CParticle*,
00075     CParticle*,
00076     const CHertzianViscoElasticIGP&
00077   );
00078   virtual ~CHertzianViscoElasticInteraction(){};
00079 
00080   virtual Vec3 getPos() const {return m_cpos;};
00081   double getPotentialEnergy() const;
00082 
00083   virtual void calcForces();
00084   Vec3 getForce() const;
00085 };
00086 #endif //__HERTZIANVISCOELASTICINTERACTION_H