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 //                    Jeremie Gaidamour (jngaida@sandia.gov)
00040 //                    Jonathan Hu       (jhu@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   Epetra_Vector & toEpetra(Vector<double, int, int> &);
00067 
00068   const Epetra_Vector & toEpetra(const Vector<double, int, int> &);
00069   //
00070 
00071   class EpetraVector
00072     : public virtual Vector<double,int,int>, public EpetraMultiVector
00073   {
00074 
00075     typedef double Scalar;
00076     typedef int LocalOrdinal;
00077     typedef int GlobalOrdinal;
00078     typedef Kokkos::DefaultNode::DefaultNodeType Node;
00079 
00080   public:
00081 
00082     using EpetraMultiVector::dot;          // overloading, not hiding
00083     using EpetraMultiVector::norm1;        // overloading, not hiding
00084     using EpetraMultiVector::norm2;        // overloading, not hiding
00085     using EpetraMultiVector::normInf;      // overloading, not hiding
00086     using EpetraMultiVector::normWeighted; // overloading, not hiding
00087     using EpetraMultiVector::meanValue;    // overloading, not hiding
00088     using EpetraMultiVector::replaceGlobalValue;    // overloading, not hiding
00089     using EpetraMultiVector::sumIntoGlobalValue;    // overloading, not hiding
00090     using EpetraMultiVector::replaceLocalValue;    // overloading, not hiding
00091     using EpetraMultiVector::sumIntoLocalValue;    // overloading, not hiding
00092 
00094 
00095 
00097     explicit EpetraVector(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, bool zeroOut=true);
00098 
00100     EpetraVector(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source);
00101 
00103     virtual ~EpetraVector() { }
00104 
00106 
00108 
00109 
00111     void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value);
00112 
00114     void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value);
00115 
00117     void replaceLocalValue(LocalOrdinal myRow, const Scalar &value);
00118 
00120     void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value);
00121 
00123 
00125 
00126 
00128     Scalar dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &a) const;
00129 
00131     Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const;
00132 
00134     Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const;
00135 
00137     Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const;
00138 
00140     Teuchos::ScalarTraits< Scalar >::magnitudeType normWeighted(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &weights) const;
00141 
00143     Scalar meanValue() const;
00144 
00146 
00148 
00149 
00151     std::string description() const;
00152 
00154     void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const;
00155 
00157 
00159 
00160 
00162     EpetraVector(const Teuchos::RCP<Epetra_Vector> &vec) : EpetraMultiVector(vec) { } // TODO: removed const of Epetra::Vector
00163 
00165     Epetra_Vector * getEpetra_Vector() const {  return (*this->EpetraMultiVector::getEpetra_MultiVector())(0); }
00166     //RCP<Epetra_Vector> getEpetra_Vector() const { return this->EpetraMultiVector::getEpetra_MultiVector()->getVectorNonConst(0); }
00167 
00169     
00170   }; // EpetraVector class
00171 
00172 } // Xpetra namespace
00173 
00174 #endif // XPETRA_EPETRAVECTOR_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines