Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef PLAYA_EPETRAVECTOR_HPP
00043 #define PLAYA_EPETRAVECTOR_HPP
00044
00045 #include "PlayaDefs.hpp"
00046 #include "PlayaPrintable.hpp"
00047 #include "PlayaVectorDecl.hpp"
00048 #include "PlayaLoadableVector.hpp"
00049 #include "PlayaSingleChunkVector.hpp"
00050 #include "Epetra_FEVector.h"
00051 #include "Epetra_Vector.h"
00052 #include "PlayaEpetraVectorSpace.hpp"
00053
00054
00055 namespace Playa
00056 {
00057 using Teuchos::RCP;
00058
00059
00060
00061 class EpetraVector : public SingleChunkVector<double>,
00062 public LoadableVector<double>,
00063 public Printable,
00064 public Teuchos::Describable
00065 {
00066 public:
00067
00068
00069 EpetraVector(const VectorSpace<double>& vs);
00070
00071
00072
00073 EpetraVector(const VectorSpace<double>& vs,
00074 const RCP<Epetra_Vector>& vec);
00075
00076
00077
00078
00079
00080 RCP< const VectorSpaceBase<double> > space() const {return vecSpace_.ptr();}
00081
00082
00083
00084
00085
00086 virtual const double& operator[](int globalIndex) const
00087 {return getElement(globalIndex);}
00088
00089
00090 virtual double& operator[](int globalIndex) ;
00091
00092
00093
00094
00095
00096 void setElement(int globalIndex, const double& value);
00097
00098
00099 void addToElement(int globalIndex, const double& value);
00100
00101
00102 void setElements(int numElems, const int* globalIndices,
00103 const double* values);
00104
00105
00106
00107 void addToElements(int numElems, const int* globalIndices,
00108 const double* values);
00109
00110
00111 void finalizeAssembly();
00112
00113
00114
00115
00116
00117 const double& getElement(int globalIndex) const ;
00118
00119
00120 void getElements(const int* globalIndices, int numElems,
00121 Teuchos::Array<double>& elems) const ;
00122
00123
00124
00125
00126
00127 void print(std::ostream& os) const ;
00128
00129
00130
00131
00132 const RCP<Epetra_Vector>& epetraVec() const
00133 {return epetraVec_;}
00134
00135
00136 RCP<Epetra_Vector>& epetraVec() {return epetraVec_;}
00137
00138
00139 static const Epetra_Vector& getConcrete(const Playa::Vector<double>& tsfVec);
00140
00141 static Epetra_Vector& getConcrete(Playa::Vector<double>& tsfVec);
00142
00143 static Epetra_Vector* getConcretePtr(Playa::Vector<double>& tsfVec);
00144
00145
00146
00147 virtual void update(const double& alpha, const VectorBase<double>* other,
00148 const double& gamma);
00149
00150
00151
00152 virtual void update(
00153 const double& alpha, const VectorBase<double>* x,
00154 const double& beta, const VectorBase<double>* y,
00155 const double& gamma) ;
00156
00157
00158 virtual double dot(const VectorBase<double>* other) const ;
00159
00160
00161 virtual double norm2() const ;
00162 protected:
00163
00164
00165
00166
00167 virtual const double* dataPtr() const {return &(epetraVec_->operator[](0));}
00168
00169 virtual double* dataPtr() {return &(epetraVec_->operator[](0));}
00170
00171
00172 virtual int chunkSize() const {return numLocalElements_;}
00173
00174
00175 private:
00176
00177 VectorSpace<double> vecSpace_;
00178
00179 RCP<Epetra_Vector> epetraVec_;
00180
00181 int numLocalElements_;
00182
00183 };
00184
00185 }
00186
00187
00188 #endif