00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // Teuchos: Common Tools Package 00005 // Copyright (2004) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 // @HEADER 00028 00029 #ifndef TEUCHOS_POLYNOMIAL_DECL_HPP 00030 #define TEUCHOS_POLYNOMIAL_DECL_HPP 00031 00032 #include "Teuchos_Describable.hpp" 00033 #include "Teuchos_RCP.hpp" 00034 #include "Teuchos_PolynomialTraits.hpp" 00035 00036 namespace Teuchos { 00037 00039 00055 template <typename CoeffT> 00056 class Polynomial : virtual public Teuchos::Describable { 00057 public: 00058 00060 typedef CoeffT coeff_type; 00061 00063 typedef typename Teuchos::PolynomialTraits<coeff_type>::scalar_type scalar_type; 00064 00066 00072 Polynomial(unsigned int deg, const CoeffT& cloneCoeff, 00073 unsigned int reserve = 0); 00074 00076 00083 Polynomial(unsigned int deg, unsigned int reserve = 0); 00084 00086 ~Polynomial(); 00087 00089 unsigned int degree() const { return d; } 00090 00092 void setDegree(unsigned int deg); 00093 00095 Teuchos::RCP<CoeffT> 00096 getCoefficient(unsigned int i); 00097 00099 Teuchos::RCP<const CoeffT> 00100 getCoefficient(unsigned int i) const; 00101 00103 void setCoefficient(unsigned int i, const CoeffT& v); 00104 00106 00112 void setCoefficientPtr(unsigned int i, 00113 const Teuchos::RCP<CoeffT>& c_ptr); 00114 00116 00124 void evaluate(typename Teuchos::Polynomial<CoeffT>::scalar_type t, 00125 CoeffT* x, CoeffT* xdot = NULL) const; 00126 00127 private: 00128 00130 Polynomial(const Polynomial&); 00131 00133 Polynomial& operator=(const Polynomial&); 00134 00135 protected: 00136 00138 unsigned int d; 00139 00141 unsigned int sz; 00142 00144 00147 std::vector< Teuchos::RCP<CoeffT> > coeff; 00148 00149 }; // class Polynomial 00150 00151 } // end namespace Teuchos 00152 00153 #endif // TEUCHOS_POLYNOMIAL_DECL_HPP