NOX_Playa_Vector.hpp

00001 // $Id$ 
00002 // $Source$ 
00003 
00004 //@HEADER
00005 //   
00006 //@HEADER
00007 
00010 #ifndef NOX_Playa_VECTOR_H
00011 #define NOX_Playa_VECTOR_H
00012 
00013 #include "NOX_Abstract_Vector.H" // base class
00014 #include "NOX_Common.H" // for #include<vector> 
00015 #include "PlayaVectorDecl.hpp" // definitions for Playa Vectors
00016 #include "PlayaVectorSpaceDecl.hpp"
00017 
00018 namespace NOX 
00019 {
00020 
00021 
00022 namespace NOXPlaya 
00023 {
00024 using Teuchos::RCP;
00025   
00031 class Vector : public NOX::Abstract::Vector 
00032 {
00033 
00034 public: 
00035 
00037   Vector(const NOX::NOXPlaya::Vector& source, 
00038     NOX::CopyType type = DeepCopy);
00039 
00041   Vector(const Playa::Vector<double>& source, 
00042     NOX::CopyType type = DeepCopy);
00043 
00045   Vector(const NOX::NOXPlaya::Vector& source, 
00046     int numdigits, 
00047     NOX::CopyType type = DeepCopy);
00048 
00050   Vector(const Playa::Vector<double>& source, 
00051     int numdigits,
00052     NOX::CopyType type = DeepCopy);
00053 
00054   /* There's no need to write an explicit dtor for this class, because
00055    * the Playa vector cleans up its own memory. I've commented out 
00056    * this method for now, but it should probably just be deleted. 
00057    * - KL 12 July 2004 */ 
00059   //~Vector();
00060 
00062   Playa::Vector<double>& getPlayaVector();
00063 
00065   const Playa::Vector<double>& getPlayaVector() const;
00066 
00068   int getPrecision() const;
00069 
00071 
00073   NOX::Abstract::Vector& init(double value);
00074 
00076   NOX::Abstract::Vector& operator=(const NOX::NOXPlaya::Vector& y);
00078   NOX::Abstract::Vector& operator=(const NOX::Abstract::Vector& y);
00079 
00080   /* Element access should not be implemented in this class; it should
00081    * be done through the LoadableVector and AccessibleVector 
00082    * interfaces of Playa.
00083    * -KL 12 July 2004  */
00084   // Store value in the i-th element of a vector 
00085   //void setElement(int i, const double& value);
00086 
00087   // Return the i-th element (const version).
00088   //const double& getElement(int i) const;
00089   
00091   NOX::Abstract::Vector& abs(const NOX::NOXPlaya::Vector& y);
00093   NOX::Abstract::Vector& abs(const NOX::Abstract::Vector& y);
00094   
00096   NOX::Abstract::Vector& reciprocal(const NOX::NOXPlaya::Vector& y);
00098   NOX::Abstract::Vector& reciprocal(const NOX::Abstract::Vector& y);
00099   
00101   
00103   
00104   // derived
00105   NOX::Abstract::Vector& scale(double gamma);
00106   
00107   // derived
00108   NOX::Abstract::Vector& scale(const NOX::NOXPlaya::Vector& a);
00109   NOX::Abstract::Vector& scale(const NOX::Abstract::Vector& a);
00110   
00111   // derived
00112   NOX::Abstract::Vector& update(double alpha, const NOX::NOXPlaya::Vector& a, double gamma = 0.0);
00113   NOX::Abstract::Vector& update(double alpha, const NOX::Abstract::Vector& a, double gamma = 0.0);
00114   
00115   // derived
00116   NOX::Abstract::Vector& update(double alpha, const NOX::NOXPlaya::Vector& a, 
00117     double beta, const NOX::NOXPlaya::Vector& b,
00118     double gamma = 0.0);
00119   NOX::Abstract::Vector& update(double alpha, const NOX::Abstract::Vector& a, 
00120     double beta, const NOX::Abstract::Vector& b,
00121     double gamma = 0.0);
00122   
00124   
00126   
00127   // derived
00128 #ifdef TRILINOS_6
00129   NOX::Abstract::Vector* clone(NOX::CopyType type = NOX::DeepCopy) const;
00130 #else
00131   RCP<NOX::Abstract::Vector> clone(NOX::CopyType type = NOX::DeepCopy) const ;
00132 #endif
00133   
00135   
00137   
00138   // derived
00139   double norm(NOX::Abstract::Vector::NormType type = NOX::Abstract::Vector::TwoNorm) const;
00140   
00141   // derived
00142   double norm(const NOX::NOXPlaya::Vector& weights) const;
00143   double norm(const NOX::Abstract::Vector& weights) const;
00144   
00146   
00148   
00149   // derived
00150   double dot(const NOX::NOXPlaya::Vector& y) const;
00151   double dot(const NOX::Abstract::Vector& y) const;
00152   double innerProduct(const NOX::Abstract::Vector& y) const;
00153   
00155   
00156   // derived
00159   int length() const;
00160 
00162 
00167   ostream& leftshift(std::ostream& stream) const;
00168 
00169   // derived
00170   void print() const;
00171 
00172 private:
00173 
00175   int precision;
00176 
00178   Playa::Vector<double> x;
00179 };
00180 
00181 } // namespace Playa
00182 } // namespace NOX
00183 
00184 
00185 namespace std{
00187 ostream& operator<<(std::ostream& stream, const NOX::NOXPlaya::Vector& v);
00188 }
00189 
00190 #endif

doxygen