ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/types/CubicBendType.hpp
(Generate patch)

Comparing trunk/OOPSE-4/src/types/CubicBendType.hpp (file contents):
Revision 3172 by tim, Wed May 17 21:51:42 2006 UTC vs.
Revision 3173 by gezelter, Fri Jul 13 18:10:52 2007 UTC

# Line 57 | Line 57 | namespace oopse {
57     * @todo document
58     */
59    class CubicBendType : public BendType {
60 <
60 >    
61    public:
62  
63 <    CubicBendType(RealType theta, RealType k3, RealType k2, RealType k1, RealType k0)
64 <      : BendType(theta),k3_(k3), k2_(k2),  k1_(k1), k0_(k0){
65 <      }
66 <
63 >    CubicBendType(RealType theta, RealType k3, RealType k2, RealType k1,
64 >                  RealType k0) : BendType(theta), k3_(k3), k2_(k2), k1_(k1),
65 >                                 k0_(k0){
66 >    }
67 >    
68      void setForceConstant(RealType k3, RealType k2, RealType k1, RealType k0) {
69        k3_ = k3;
70        k2_ = k2;
71        k1_ = k1;
72        k0_ = k0;
73      }
74 <
75 <    void getForceConstant(RealType& k3, RealType& k2, RealType& k1, RealType& k0) {
74 >    
75 >    void getForceConstant(RealType& k3, RealType& k2, RealType& k1,
76 >                          RealType& k0) {
77        k3 = k3_;
78 <      k2  = k2_;
78 >      k2 = k2_;
79        k1 = k1_;
80        k0 = k0_;
81      }
82 <
82 >    
83      virtual void calcForce(RealType theta, RealType& V, RealType& dVdTheta) {
84        RealType delta =  theta- theta0_;
85        RealType delta2 = delta * delta;
86        RealType delta3 = delta2 * delta;
87 <
87 >      
88        V =k0_ + k1_ * delta + k2_*delta2 + k3_*delta3;
89        dVdTheta = k1_ + 2.0*k2_ * delta + 3.0 * k3_*delta2;
90      }
91 <        
91 >    
92    private:
93 <
93 >    
94      RealType k3_;
95      RealType k2_;
96      RealType k1_;
97      RealType k0_;
98 <
98 >    
99    };
100 <
100 >  
101   }//end namespace oopse
102   #endif //TYPES_CUBICBENDTYPE_HPP
103  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines