All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Xpetra_EpetraVector.hpp
Go to the documentation of this file.
00001 // @HEADER
00002 //
00003 // ***********************************************************************
00004 //
00005 //             Xpetra: A linear algebra interface package
00006 //                  Copyright 2012 Sandia Corporation
00007 //
00008 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00009 // the U.S. Government retains certain rights in this software.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are
00013 // met:
00014 //
00015 // 1. Redistributions of source code must retain the above copyright
00016 // notice, this list of conditions and the following disclaimer.
00017 //
00018 // 2. Redistributions in binary form must reproduce the above copyright
00019 // notice, this list of conditions and the following disclaimer in the
00020 // documentation and/or other materials provided with the distribution.
00021 //
00022 // 3. Neither the name of the Corporation nor the names of the
00023 // contributors may be used to endorse or promote products derived from
00024 // this software without specific prior written permission.
00025 //
00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 //
00038 // Questions? Contact
00039 //                    Jonathan Hu       (jhu@sandia.gov)
00040 //                    Andrey Prokopenko (aprokop@sandia.gov)
00041 //                    Ray Tuminaro      (rstumin@sandia.gov)
00042 //
00043 // ***********************************************************************
00044 //
00045 // @HEADER
00046 #ifndef XPETRA_EPETRAVECTOR_HPP
00047 #define XPETRA_EPETRAVECTOR_HPP
00048 
00049 /* this file is automatically generated - do not edit (see script/epetra.py) */
00050 
00051 #include "Xpetra_EpetraConfigDefs.hpp"
00052 
00053 #include "Xpetra_Vector.hpp"
00054 #include "Xpetra_EpetraMultiVector.hpp"
00055 #include "Xpetra_EpetraMap.hpp" //TMP
00056 #include "Xpetra_Utils.hpp"
00057 #include "Xpetra_EpetraImport.hpp"
00058 #include "Xpetra_EpetraExport.hpp"
00059 #include "Xpetra_Exceptions.hpp"
00060 
00061 #include <Epetra_Vector.h>
00062 
00063 namespace Xpetra {
00064 
00065   // TODO: move that elsewhere
00066   template<class GlobalOrdinal>
00067   Epetra_Vector & toEpetra(Vector<double, int, GlobalOrdinal> &);
00068 
00069   template<class GlobalOrdinal>
00070   const Epetra_Vector & toEpetra(const Vector<double, int, GlobalOrdinal> &);
00071   //
00072 
00073   template<class EpetraGlobalOrdinal>
00074   class EpetraVectorT
00075     : public virtual Vector<double,int,EpetraGlobalOrdinal>, public EpetraMultiVectorT<EpetraGlobalOrdinal>
00076   {
00077 
00078     typedef double Scalar;
00079     typedef int LocalOrdinal;
00080     typedef EpetraGlobalOrdinal GlobalOrdinal;
00081     typedef KokkosClassic::DefaultNode::DefaultNodeType Node;
00082 
00083   public:
00084 
00085     using EpetraMultiVectorT<GlobalOrdinal>::dot;          // overloading, not hiding
00086     using EpetraMultiVectorT<GlobalOrdinal>::norm1;        // overloading, not hiding
00087     using EpetraMultiVectorT<GlobalOrdinal>::norm2;        // overloading, not hiding
00088     using EpetraMultiVectorT<GlobalOrdinal>::normInf;      // overloading, not hiding
00089     using EpetraMultiVectorT<GlobalOrdinal>::normWeighted; // overloading, not hiding
00090     using EpetraMultiVectorT<GlobalOrdinal>::meanValue;    // overloading, not hiding
00091     using EpetraMultiVectorT<GlobalOrdinal>::replaceGlobalValue;    // overloading, not hiding
00092     using EpetraMultiVectorT<GlobalOrdinal>::sumIntoGlobalValue;    // overloading, not hiding
00093     using EpetraMultiVectorT<GlobalOrdinal>::replaceLocalValue;    // overloading, not hiding
00094     using EpetraMultiVectorT<GlobalOrdinal>::sumIntoLocalValue;    // overloading, not hiding
00095 
00097 
00098 
00100     explicit EpetraVectorT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, bool zeroOut=true);
00101 
00102     // Commenting out since no definition provided in cpp.
00104     // EpetraVectorT(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source);
00105 
00107     virtual ~EpetraVectorT() { }
00108 
00110 
00112 
00113 
00115     void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value);
00116 
00118     void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value);
00119 
00121     void replaceLocalValue(LocalOrdinal myRow, const Scalar &value);
00122 
00124     void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value);
00125 
00127 
00129 
00130 
00132     Scalar dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &a) const;
00133 
00135     Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const;
00136 
00138     Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const;
00139 
00141     Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const;
00142 
00144     Teuchos::ScalarTraits< Scalar >::magnitudeType normWeighted(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &weights) const;
00145 
00147     Scalar meanValue() const;
00148 
00150 
00152 
00153 
00155     std::string description() const;
00156 
00158     void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const;
00159 
00161 
00163 
00164 
00166     EpetraVectorT(const Teuchos::RCP<Epetra_Vector> &vec) : EpetraMultiVectorT<GlobalOrdinal>(vec) { } // TODO: removed const of Epetra::Vector
00167 
00169     Epetra_Vector * getEpetra_Vector() const { return (*this->EpetraMultiVectorT<GlobalOrdinal>::getEpetra_MultiVector())(0); }
00170     //RCP<Epetra_Vector> getEpetra_Vector() const { return this->EpetraMultiVectorT<GlobalOrdinal>::getEpetra_MultiVector()->getVectorNonConst(0); }
00171 
00175     EpetraVectorT(const RCP<Epetra_MultiVector> &mv, size_t j);
00176 
00178 
00179   private:
00180 
00181     // This private member is only used by the constructor EpetraVectorT(const RCP<EpetraMultiVectorT<GlobalOrdinal> > &mv, size_t j). The actual private member holding the Epetra vector (vec_) is in the base class (Xpetra:EpetraMultiVectorT)
00182     const RCP<const Epetra_MultiVector> internalRefToBaseMV_;
00183 
00184   }; // EpetraVectorT class
00185 
00186 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
00187   typedef EpetraVectorT<int> EpetraVector;
00188 #endif
00189 
00190 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
00191   typedef EpetraVectorT<long long> EpetraVector64;
00192 #endif
00193 
00194 } // Xpetra namespace
00195 
00196 #endif // XPETRA_EPETRAVECTOR_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines