|
Tpetra Matrix/Vector Services Version of the Day
|
00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // Tpetra: Templated Linear Algebra Services Package 00005 // Copyright (2008) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 // @HEADER 00028 00029 #ifndef TPETRA_VECTOR_DECL_HPP 00030 #define TPETRA_VECTOR_DECL_HPP 00031 00032 #include "Tpetra_ConfigDefs.hpp" 00033 #include "Tpetra_MultiVector_decl.hpp" 00034 00035 namespace Tpetra { 00036 00038 00043 template<class Scalar, class LocalOrdinal=int, class GlobalOrdinal=LocalOrdinal, class Node=Kokkos::DefaultNode::DefaultNodeType> 00044 class Vector : public MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> { 00045 00046 // need this so that MultiVector::operator() can call Vector's private constructor 00047 friend class MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>; 00048 00049 public: 00050 00052 00053 00055 explicit Vector(const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > &map, bool zeroOut=true); 00056 00058 Vector(const Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &source); 00059 00061 Vector(const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > &map, const Teuchos::ArrayView<const Scalar> &A); 00062 00064 virtual ~Vector(); 00065 00067 00069 00070 00072 00074 void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value); 00075 00077 00079 void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value); 00080 00082 00084 void replaceLocalValue(LocalOrdinal myRow, const Scalar &value); 00085 00087 00089 void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value); 00090 00092 00094 00095 00096 using MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::get1dCopy; // overloading, not hiding 00098 void get1dCopy(Teuchos::ArrayView<Scalar> A) const; 00099 00101 00103 00104 00105 using MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::dot; // overloading, not hiding 00107 Scalar dot(const Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &a) const; 00108 00109 using MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::norm1; // overloading, not hiding 00111 typename Teuchos::ScalarTraits<Scalar>::magnitudeType norm1() const; 00112 00113 using MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::norm2; // overloading, not hiding 00115 typename Teuchos::ScalarTraits<Scalar>::magnitudeType norm2() const; 00116 00117 using MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::normInf; // overloading, not hiding 00119 typename Teuchos::ScalarTraits<Scalar>::magnitudeType normInf() const; 00120 00121 using MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::normWeighted; // overloading, not hiding 00123 typename Teuchos::ScalarTraits<Scalar>::magnitudeType normWeighted(const Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &weights) const; 00124 00125 using MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::meanValue; // overloading, not hiding 00127 Scalar meanValue() const; 00128 00130 00132 00133 00135 std::string description() const; 00136 00138 void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const; 00139 00141 00142 protected: 00143 00144 typedef Kokkos::MultiVector<Scalar,Node> KMV; 00145 typedef Kokkos::DefaultArithmetic<KMV> MVT; 00146 00148 Vector(const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > &map, Teuchos::ArrayRCP<Scalar> data); 00149 00150 }; // class Vector 00151 00156 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node> 00157 Teuchos::RCP< Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > 00158 createVector(const Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> > &map); 00159 00160 } // namespace Tpetra 00161 00162 #endif // TPETRA_VECTOR_DECL_HPP
1.7.4