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
00043
00044
00045
00046 #include "Xpetra_EpetraVector.hpp"
00047
00048
00049
00050 namespace Xpetra {
00051
00052 template<class EpetraGlobalOrdinal>
00053 EpetraVectorT<EpetraGlobalOrdinal>::EpetraVectorT(const Teuchos::RCP<const Map<int,GlobalOrdinal> > &map, bool zeroOut) : EpetraMultiVectorT<GlobalOrdinal>(map,1,zeroOut) { }
00054
00055 template<class EpetraGlobalOrdinal>
00056 void EpetraVectorT<EpetraGlobalOrdinal>::replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value) { XPETRA_MONITOR("EpetraVectorT::replaceGlobalValue"); this->EpetraMultiVectorT<GlobalOrdinal>::getEpetra_MultiVector()->ReplaceGlobalValue(globalRow, 0, value); }
00057
00058 template<class EpetraGlobalOrdinal>
00059 void EpetraVectorT<EpetraGlobalOrdinal>::sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value) { XPETRA_MONITOR("EpetraVectorT::sumIntoGlobalValue");this->EpetraMultiVectorT<GlobalOrdinal>::getEpetra_MultiVector()->SumIntoGlobalValue(globalRow, 0, value); }
00060
00061 template<class EpetraGlobalOrdinal>
00062 void EpetraVectorT<EpetraGlobalOrdinal>::replaceLocalValue(LocalOrdinal myRow, const Scalar &value) { XPETRA_MONITOR("EpetraVectorT::replaceLocalValue");this->EpetraMultiVectorT<GlobalOrdinal>::getEpetra_MultiVector()->ReplaceMyValue(myRow, 0, value); }
00063
00064 template<class EpetraGlobalOrdinal>
00065 void EpetraVectorT<EpetraGlobalOrdinal>::sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value) { XPETRA_MONITOR("EpetraVectorT::sumIntoLocalValue");this->EpetraMultiVectorT<GlobalOrdinal>::getEpetra_MultiVector()->SumIntoMyValue(myRow, 0, value); }
00066
00067 template<class EpetraGlobalOrdinal>
00068 double EpetraVectorT<EpetraGlobalOrdinal>::dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &a) const {
00069 XPETRA_MONITOR("EpetraVectorT::dot");
00070
00071 XPETRA_DYNAMIC_CAST(const EpetraVectorT, a, tA, "This Xpetra::EpetraVectorT method only accept Xpetra::EpetraVectorT as input arguments.");
00072
00073
00074
00075 double r;
00076 this->EpetraMultiVectorT<GlobalOrdinal>::getEpetra_MultiVector()->Epetra_MultiVector::Dot(*tA.getEpetra_MultiVector(), &r);
00077 return r;
00078 }
00079
00080 template<class EpetraGlobalOrdinal>
00081 Teuchos::ScalarTraits<double>::magnitudeType EpetraVectorT<EpetraGlobalOrdinal>::norm1() const { XPETRA_MONITOR("EpetraVectorT::norm1"); double r; this->EpetraMultiVectorT<GlobalOrdinal>::getEpetra_MultiVector()->Norm1(&r); return r; }
00082
00083 template<class EpetraGlobalOrdinal>
00084 Teuchos::ScalarTraits<double>::magnitudeType EpetraVectorT<EpetraGlobalOrdinal>::norm2() const { XPETRA_MONITOR("EpetraVectorT::norm2"); double r; this->EpetraMultiVectorT<GlobalOrdinal>::getEpetra_MultiVector()->Norm2(&r); return r; }
00085
00086 template<class EpetraGlobalOrdinal>
00087 Teuchos::ScalarTraits<double>::magnitudeType EpetraVectorT<EpetraGlobalOrdinal>::normInf() const { XPETRA_MONITOR("EpetraVectorT::normInf"); double r; this->EpetraMultiVectorT<GlobalOrdinal>::getEpetra_MultiVector()->NormInf(&r); return r; }
00088
00089 template<class EpetraGlobalOrdinal>
00090 Teuchos::ScalarTraits<double>::magnitudeType
00091 EpetraVectorT<EpetraGlobalOrdinal>::normWeighted (const Vector<double,int,GlobalOrdinal, KokkosClassic::DefaultNode::DefaultNodeType>& weights) const
00092 {
00093 XPETRA_MONITOR("EpetraVectorT::normWeighted");
00094 XPETRA_DYNAMIC_CAST(const EpetraVectorT, weights, tWeights, "This Xpetra::EpetraVectorT method only accept Xpetra::EpetraVectorT as input arguments.");
00095 double r;
00096 this->EpetraMultiVectorT<GlobalOrdinal>::getEpetra_MultiVector()->NormWeighted(*tWeights.getEpetra_MultiVector(), &r); return r;
00097 }
00098
00099 template<class EpetraGlobalOrdinal>
00100 double EpetraVectorT<EpetraGlobalOrdinal>::meanValue() const {
00101 XPETRA_MONITOR("EpetraVectorT::meanValue");
00102 double r;
00103 this->EpetraMultiVectorT<GlobalOrdinal>::getEpetra_MultiVector()->MeanValue(&r);
00104 return r;
00105 }
00106
00107 template<class EpetraGlobalOrdinal>
00108 std::string EpetraVectorT<EpetraGlobalOrdinal>::description() const {
00109 XPETRA_MONITOR("EpetraVectorT::description");
00110
00111 std::ostringstream oss;
00112 oss << Teuchos::Describable::description();
00113 oss << "{length="<<this->getGlobalLength()
00114 << "}";
00115 return oss.str();
00116 }
00117
00118 template<class EpetraGlobalOrdinal>
00119 void EpetraVectorT<EpetraGlobalOrdinal>::describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const {
00120 XPETRA_MONITOR("EpetraVectorT::describe");
00121
00122 if (verbLevel > Teuchos::VERB_NONE) {
00123 getEpetra_Vector()->Print (out);
00124 }
00125 }
00126
00127 template<class EpetraGlobalOrdinal>
00128 EpetraVectorT<EpetraGlobalOrdinal>::EpetraVectorT(const RCP<Epetra_MultiVector> &mv, size_t j)
00129 : EpetraMultiVectorT<GlobalOrdinal>(rcp((*mv)(j), false)),
00130 internalRefToBaseMV_(mv)
00131 {
00132
00133
00134
00135 }
00136
00137
00138 template<class GlobalOrdinal>
00139 Epetra_Vector & toEpetra(Vector<double, int, GlobalOrdinal> &x) {
00140 XPETRA_DYNAMIC_CAST( EpetraVectorT<GlobalOrdinal>, x, tX, "toEpetra");
00141 return *tX.getEpetra_Vector();
00142 }
00143
00144 template<class GlobalOrdinal>
00145 const Epetra_Vector & toEpetra(const Vector<double, int, GlobalOrdinal> &x) {
00146 XPETRA_DYNAMIC_CAST(const EpetraVectorT<GlobalOrdinal>, x, tX, "toEpetra");
00147 return *tX.getEpetra_Vector();
00148 }
00149
00150
00151 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
00152 template class EpetraVectorT<int>;
00153 template Epetra_Vector & toEpetra<int>(Vector<double, int, int> &);
00154 template const Epetra_Vector & toEpetra<int>(const Vector<double, int, int> &);
00155 #endif
00156
00157 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
00158 template class EpetraVectorT<long long>;
00159 template Epetra_Vector & toEpetra<long long>(Vector<double, int, long long> &);
00160 template const Epetra_Vector & toEpetra<long long>(const Vector<double, int, long long> &);
00161 #endif
00162
00163 }