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

Comparing trunk/OOPSE-4/src/types/PolynomialBendType.hpp (file contents):
Revision 2759 by tim, Wed May 17 21:51:42 2006 UTC vs.
Revision 3175 by gezelter, Mon Jul 16 13:33:10 2007 UTC

# Line 54 | Line 54 | namespace oopse {
54   #include "types/BendType.hpp"
55  
56   namespace oopse {
57 <
57 >  
58    /**
59     * @class PolynomialBendType PolynomialBendType.hpp "types/PolynomialBendType.hpp"
60     * @todo documentation
# Line 71 | Line 71 | namespace oopse {
71      RealType getCoefficient(int power) {
72        return polynomial_.getCoefficient(power);
73      }
74 <        
74 >    
75      void calcForce(RealType theta, RealType & V, RealType & dVdr) {
76        RealType delta = theta - theta0_;
77        V = polynomial_.evaluate(delta);
78        dVdr = polynomial_.evaluateDerivative(delta);
79 <
79 >      
80      }
81  
82      friend std::ostream& operator <<(std::ostream& os, PolynomialBendType& pbt);
83 <        
83 >    
84    private:
85 <        
85 >    
86      DoublePolynomial polynomial_;
87    };
88 <
88 >  
89    std::ostream& operator <<(std::ostream& os, PolynomialBendType& pbt) {
90      DoublePolynomial::const_iterator i;
91 <
91 >    
92      i = pbt.polynomial_.begin();
93      
94      if (i == pbt.polynomial_.end()) {
95        os << "This PolynomialBendType contains nothing" << std::endl;
96        return os;
97      }
98 <
98 >    
99      os << "This PolynomialBendType contains below terms:" << std::endl;    
100      
101      while(true){
102 <      os << i->second << "*" << "(theta - " << pbt.getTheta() << ")" << "^" << i->first;
103 <
102 >      os << i->second << "*" << "(theta - " << pbt.getTheta() << ")" <<
103 >        "^" << i->first;
104 >      
105        if (++i == pbt.polynomial_.end()) {
106 <        //if we reach the end of the polynomial pair, write out a newline and then escape the loop
106 >        // If we reach the end of the polynomial pair, write out a
107 >        // newline and then escape the loop
108          os << std::endl;
109          break;
110        } else {
111 <        //otherwise, write out a "+"
111 >        // otherwise, write out a "+"
112          os << " + ";
113        }
114 <    }
113 <    
114 >    }    
115      return os;
116 <  }
116 <
117 <
116 >  }
117   } //end namespace oopse
118   #endif //TYPES_POLYNOMIALBENDTYPE_HPP
119  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines