Xpetra_MapExtractor.hpp
Go to the documentation of this file.
1 // @HEADER
2 //
3 // ***********************************************************************
4 //
5 // Xpetra: A linear algebra interface package
6 // Copyright 2012 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact
39 // Jeremie Gaidamour (jngaida@sandia.gov)
40 // Jonathan Hu (jhu@sandia.gov)
41 // Ray Tuminaro (rstumin@sandia.gov)
42 //
43 // ***********************************************************************
44 //
45 // @HEADER
46 /*
47  * Xpetra_MapExtractor.hpp
48  *
49  * Created on: 08.08.2011
50  * Author: tobias
51  */
52 
53 // WARNING: This code is experimental. Backwards compatibility should not be expected.
54 
55 #ifndef XPETRA_MAPEXTRACTOR_HPP_
56 #define XPETRA_MAPEXTRACTOR_HPP_
57 
58 #include <map>
59 
60 #include <iostream>
61 
62 #include <Teuchos_RCP.hpp>
63 #include <Teuchos_Describable.hpp>
64 #include <Xpetra_Import.hpp>
65 #include <Xpetra_Map.hpp>
66 #ifdef HAVE_XPETRA_EPETRA
67 #include <Xpetra_EpetraMap.hpp>
68 #include <Xpetra_EpetraImport.hpp>
69 #include <Xpetra_EpetraVector.hpp>
71 #endif
72 
73 #ifdef HAVE_XPETRA_TPETRA
74 #include <Xpetra_TpetraMap.hpp>
75 #include <Xpetra_TpetraImport.hpp>
76 #include <Xpetra_TpetraVector.hpp>
78 #endif
79 
80 #include <Xpetra_ImportFactory.hpp>
81 
82 
83 namespace Xpetra
84 {
85  template <class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = Kokkos::DefaultNode::DefaultNodeType>
86  class MapExtractor : public Teuchos::Describable
87  {
92 
93  public:
94 
97  virtual void ExtractVector(Teuchos::RCP<const VectorClass>& full, size_t block, Teuchos::RCP<VectorClass>& partial) const = 0;
98  virtual void ExtractVector(Teuchos::RCP< VectorClass>& full, size_t block, Teuchos::RCP<VectorClass>& partial) const = 0;
99  virtual Teuchos::RCP<VectorClass> ExtractVector(Teuchos::RCP<const VectorClass>& full, size_t block) const = 0;
100  virtual Teuchos::RCP<VectorClass> ExtractVector(Teuchos::RCP< VectorClass>& full, size_t block) const = 0;
101 
102  virtual void ExtractVector(Teuchos::RCP<const MultiVectorClass>& full, size_t block, Teuchos::RCP<MultiVectorClass>& partial) const = 0;
103  virtual void ExtractVector(Teuchos::RCP< MultiVectorClass>& full, size_t block, Teuchos::RCP<MultiVectorClass>& partial) const = 0;
104  virtual Teuchos::RCP<MultiVectorClass> ExtractVector(Teuchos::RCP<const MultiVectorClass>& full, size_t block) const = 0;
105  virtual Teuchos::RCP<MultiVectorClass> ExtractVector(Teuchos::RCP< MultiVectorClass>& full, size_t block) const = 0;
107 
108  //virtual Teuchos::RCP<Xpetra::Vector<LocalOrdinal,GlobalOrdinal,Node> >ExtractVector(Teuchos::RCP<const Xpetra::Vector<LocalOrdinal,GlobalOrdinal,Node> > full, int block) const {};
109 
112  virtual void InsertVector(Teuchos::RCP<const VectorClass>& partial, size_t block, Teuchos::RCP<VectorClass>& full) const = 0;
113  virtual void InsertVector(Teuchos::RCP< VectorClass>& partial, size_t block, Teuchos::RCP<VectorClass>& full) const = 0;
114 
115  virtual void InsertVector(Teuchos::RCP<const MultiVectorClass>& partial, size_t block, Teuchos::RCP<MultiVectorClass>& full) const = 0;
116  virtual void InsertVector(Teuchos::RCP< MultiVectorClass>& partial, size_t block, Teuchos::RCP<MultiVectorClass>& full) const = 0;
117 
119 
120  virtual Teuchos::RCP<VectorClass> getVector(size_t i) const = 0;
121  virtual Teuchos::RCP<MultiVectorClass> getVector(size_t i, size_t numvec) const = 0;
122 
125 
127  virtual size_t NumMaps() const = 0;
128 
130  virtual const Teuchos::RCP<const MapClass> getMap(size_t i) const = 0;
131 
133  virtual const Teuchos::RCP<const MapClass> getFullMap() const = 0;
134 
136  virtual size_t getMapIndexForGID(GlobalOrdinal gid) const = 0;
137 
139 
140  private:
141  virtual bool CheckConsistency() const = 0;
142  };
143 }
144 
145 
146 #endif /* XPETRA_MAPEXTRACTOR_HPP_ */
virtual const Teuchos::RCP< const MapClass > getFullMap() const =0
the full map
virtual bool CheckConsistency() const =0
virtual void ExtractVector(Teuchos::RCP< const VectorClass > &full, size_t block, Teuchos::RCP< VectorClass > &partial) const =0
Xpetra namespace
virtual size_t NumMaps() const =0
number of partial maps
Xpetra::Import< LocalOrdinal, GlobalOrdinal, Node > ImportClass
virtual const Teuchos::RCP< const MapClass > getMap(size_t i) const =0
get the map
virtual Teuchos::RCP< VectorClass > getVector(size_t i) const =0
virtual size_t getMapIndexForGID(GlobalOrdinal gid) const =0
returns map index in map extractor which contains GID or -1 otherwise
Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > MultiVectorClass
virtual void InsertVector(Teuchos::RCP< const VectorClass > &partial, size_t block, Teuchos::RCP< VectorClass > &full) const =0
Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > VectorClass
Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > MapClass