tminres
|
00001 // tminres is free software; you can redistribute it and/or modify it under the 00002 // terms of the GNU Lesser General Public License (as published by the Free 00003 // Software Foundation) version 2.1 dated February 1999. 00004 // 00005 // Authors: 00006 // - Umberto Villa, Emory University - uvilla@emory.edu 00007 // - Michael Saunders, Stanford University 00008 // - Santiago Akle, Stanford University 00009 00016 #ifndef EPETRAVECTORADAPTER_HPP_ 00017 #define EPETRAVECTORADAPTER_HPP_ 00018 00019 #include <Epetra_MultiVector.h> 00020 #include <iostream> 00021 00023 00027 class EpetraVectorAdapter 00028 { 00029 public: 00031 00034 EpetraVectorAdapter(Epetra_MultiVector & v_); 00035 00037 00040 EpetraVectorAdapter(Epetra_MultiVector * v_, bool owned = true); 00041 00043 /* 00044 * if owned == true, dellacate the memory pointed by v. 00045 */ 00046 virtual ~EpetraVectorAdapter(); 00047 00049 EpetraVectorAdapter & operator=(const double & val); 00051 EpetraVectorAdapter & operator=(const EpetraVectorAdapter & RHS); 00053 void Scale(const double & val); 00055 void Randomize(int seed); 00057 EpetraVectorAdapter * Clone(); 00058 00060 Epetra_MultiVector & EpetraVector(); 00062 const Epetra_MultiVector & EpetraVector() const; 00063 00065 void Print(std::ostream & os) const; 00066 00068 friend void add(const EpetraVectorAdapter & v1, const double & c2, const EpetraVectorAdapter & v2, EpetraVectorAdapter & result); 00070 friend void add(const double & c1, const EpetraVectorAdapter & v1, const double & c2, const EpetraVectorAdapter & v2, EpetraVectorAdapter & result); 00072 friend void add(const double & alpha, const EpetraVectorAdapter & v1, const EpetraVectorAdapter & v2, EpetraVectorAdapter & result); 00074 friend void add(const EpetraVectorAdapter & v1, const EpetraVectorAdapter & v2, const EpetraVectorAdapter & v3, EpetraVectorAdapter & result); 00076 friend void subtract(const EpetraVectorAdapter & v1, const EpetraVectorAdapter & v2, EpetraVectorAdapter & result); 00078 friend double InnerProduct(const EpetraVectorAdapter & v1, const EpetraVectorAdapter & v2); 00079 00080 private: 00081 Epetra_MultiVector * v; 00082 bool ownEpetraVector; 00083 double * vals; 00084 int localSize; 00085 00086 00087 }; 00088 00089 #endif /* EPETRAVECTORADAPTER_HPP_ */