All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Xpetra_MapExtractor.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 /*
00047  * Xpetra_MapExtractor.hpp
00048  *
00049  *  Created on: 08.08.2011
00050  *      Author: tobias
00051  */
00052 
00053 // WARNING: This code is experimental. Backwards compatibility should not be expected.
00054 
00055 #ifndef XPETRA_MAPEXTRACTOR_HPP_
00056 #define XPETRA_MAPEXTRACTOR_HPP_
00057 
00058 #include <map>
00059 
00060 #include <iostream>
00061 
00062 #include <Teuchos_RCP.hpp>
00063 #include <Teuchos_Describable.hpp>
00064 #include <Xpetra_Import.hpp>
00065 #include <Xpetra_Map.hpp>
00066 #ifdef HAVE_XPETRA_EPETRA
00067 #include <Xpetra_EpetraMap.hpp>
00068 #include <Xpetra_EpetraImport.hpp>
00069 #include <Xpetra_EpetraVector.hpp>
00070 #include <Xpetra_EpetraMultiVector.hpp>
00071 #endif
00072 
00073 #ifdef HAVE_XPETRA_TPETRA
00074 #include <Xpetra_TpetraMap.hpp>
00075 #include <Xpetra_TpetraImport.hpp>
00076 #include <Xpetra_TpetraVector.hpp>
00077 #include <Xpetra_TpetraMultiVector.hpp>
00078 #endif
00079 
00080 #include <Xpetra_ImportFactory.hpp>
00081 
00082 
00083 namespace Xpetra
00084 {
00085   template <class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = Kokkos::DefaultNode::DefaultNodeType>
00086   class MapExtractor : public Teuchos::Describable
00087   {
00088     typedef Xpetra::Map<LocalOrdinal,GlobalOrdinal, Node> MapClass;
00089     typedef Xpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> VectorClass;
00090     typedef Xpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> MultiVectorClass;
00091     typedef Xpetra::Import<LocalOrdinal,GlobalOrdinal,Node> ImportClass;
00092 
00093   public:
00094 
00097     virtual void ExtractVector(Teuchos::RCP<const VectorClass>& full, size_t block, Teuchos::RCP<VectorClass>& partial) const = 0;
00098     virtual void ExtractVector(Teuchos::RCP<      VectorClass>& full, size_t block, Teuchos::RCP<VectorClass>& partial) const = 0;
00099     virtual Teuchos::RCP<VectorClass> ExtractVector(Teuchos::RCP<const VectorClass>& full, size_t block) const = 0;
00100     virtual Teuchos::RCP<VectorClass> ExtractVector(Teuchos::RCP<      VectorClass>& full, size_t block) const = 0;
00101 
00102     virtual void ExtractVector(Teuchos::RCP<const MultiVectorClass>& full, size_t block, Teuchos::RCP<MultiVectorClass>& partial) const = 0;
00103     virtual void ExtractVector(Teuchos::RCP<      MultiVectorClass>& full, size_t block, Teuchos::RCP<MultiVectorClass>& partial) const = 0;
00104     virtual Teuchos::RCP<MultiVectorClass> ExtractVector(Teuchos::RCP<const MultiVectorClass>& full, size_t block) const = 0;
00105     virtual Teuchos::RCP<MultiVectorClass> ExtractVector(Teuchos::RCP<      MultiVectorClass>& full, size_t block) const = 0;
00107 
00108     //virtual Teuchos::RCP<Xpetra::Vector<LocalOrdinal,GlobalOrdinal,Node> >ExtractVector(Teuchos::RCP<const Xpetra::Vector<LocalOrdinal,GlobalOrdinal,Node> > full, int block) const {};
00109 
00112     virtual void InsertVector(Teuchos::RCP<const VectorClass>& partial, size_t block, Teuchos::RCP<VectorClass>& full) const = 0;
00113     virtual void InsertVector(Teuchos::RCP<      VectorClass>& partial, size_t block, Teuchos::RCP<VectorClass>& full) const = 0;
00114 
00115     virtual void InsertVector(Teuchos::RCP<const MultiVectorClass>& partial, size_t block, Teuchos::RCP<MultiVectorClass>& full) const = 0;
00116     virtual void InsertVector(Teuchos::RCP<      MultiVectorClass>& partial, size_t block, Teuchos::RCP<MultiVectorClass>& full) const = 0;
00117 
00119 
00120     virtual Teuchos::RCP<VectorClass> getVector(size_t i) const = 0;
00121     virtual Teuchos::RCP<MultiVectorClass> getVector(size_t i, size_t numvec) const = 0;
00122 
00125 
00127     virtual size_t NumMaps() const = 0;
00128 
00130     virtual const Teuchos::RCP<const MapClass> getMap(size_t i) const = 0;
00131 
00133     virtual const Teuchos::RCP<const MapClass> getFullMap() const = 0;
00134 
00136     virtual size_t getMapIndexForGID(GlobalOrdinal gid) const = 0;
00137 
00139 
00140   private:
00141     virtual bool CheckConsistency() const = 0;
00142   };
00143 }
00144 
00145 
00146 #endif /* XPETRA_MAPEXTRACTOR_HPP_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines