Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Examples  

SundanceVector.h

Go to the documentation of this file.
00001 #ifndef SUNDANCEVECTOR_H
00002 #define SUNDANCEVECTOR_H
00003 
00004 #include "TSFDefs.h"
00005 #include "TSFVectorType.h"
00006 #include "TSFVectorBase.h"
00007 #include "TSFVector.h"
00008 #include "AbstractFunctionSpace.h"
00009 #include <string>
00010 
00011 namespace Sundance
00012 {
00013   using namespace TSF;
00014 
00015   using std::string;
00016 
00017   /** TSF wrapper for a discrete expression  */
00018 
00019   class SundanceVector : public TSFVectorBase
00020     {
00021     public:
00022       SundanceVector(const Expr& expr);
00023 
00024       /** change sign */
00025       virtual void negate() {vectorRep().negate();}
00026 
00027       /** reflexive vector addition (self = self + other) */
00028       virtual void add(const TSFVector& other) ;
00029 
00030       /** reflexive vector subtraction (self = self - other) */
00031       virtual void subtract(const TSFVector& other);
00032 
00033       /** reflexive daxpy (self = self + a * other) */
00034       virtual void daxpy(const TSFVector& other, const TSFReal& a);
00035 
00036       /** reflexive element-by-element multiplication */
00037       virtual void eMult(const TSFVector& other);
00038 
00039       /** reflexive multiplication by a scalar */
00040       virtual void scalarMult(const TSFReal& scalar) {vectorRep().scalarMult(scalar);}
00041 
00042       /** dot product */
00043       virtual TSFReal dot(const TSFVector& other) const ;
00044 
00045       /**  2-norm squared (vector dotted with self) */
00046       virtual TSFReal norm2Squared() const {return vectorRep().norm2();}
00047 
00048       /** 2-norm */
00049       virtual TSFReal norm2() const {return vectorRep().norm2();}
00050 
00051       /** 1-norm */
00052       virtual TSFReal norm1() const {return vectorRep().norm1();}
00053 
00054       /** inf-norm */
00055       virtual TSFReal normInf() const {return vectorRep().normInf();}
00056 
00057       /** set all elements to zero */
00058       virtual void zero() {vectorRep().zero();}
00059 
00060       /** sum all elements */
00061       virtual TSFReal sumElements() const {return vectorRep().sumElements();}
00062       //@}
00063 
00064       /** \name maintenance methods */
00065       //@{
00066       /** virtual copy ctor */
00067       virtual TSFVectorBase* deepCopy() const ;
00068 
00069       /** print, called by stream output */
00070       virtual void print(ostream& os) const ;
00071 
00072       /** respresent as string */
00073       virtual string toString() const ;
00074       //@}
00075 
00076       /** get ghost values from other procs */
00077       virtual void synchronizeGhostValues() const
00078         {getVectorRep().synchronizeGhostValues();}
00079 
00080       /** mark off-processor values as invalid */
00081       virtual void invalidateGhostValues() {getVectorRep().invalidateGhostValues();}
00082 
00083 
00084     private:
00085       const TSFVector& getVectorRep() const ;
00086 
00087       TSFVector& getVectorRep() ;
00088 
00089       Expr expr_;
00090     }

Contact:
Kevin Long (krlong@ca.sandia.gov)


Documentation generated by