Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Tpetra_Export_decl.hpp
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Tpetra: Templated Linear Algebra Services Package
5 // Copyright (2008) Sandia Corporation
6 //
7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8 // the U.S. Government retains certain rights in this software.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ************************************************************************
40 // @HEADER
41 
42 #ifndef TPETRA_EXPORT_DECL_HPP
43 #define TPETRA_EXPORT_DECL_HPP
44 
45 #include "Tpetra_Details_Transfer.hpp"
46 #include "Tpetra_Export_fwd.hpp"
47 #include "Tpetra_Import_fwd.hpp"
48 #include "Teuchos_ArrayView.hpp"
49 #include "Teuchos_RCP.hpp"
50 
51 #ifndef DOXYGEN_SHOULD_SKIP_THIS
52 namespace Teuchos {
53 template<class T> class Array; // forward declaration
54 class ParameterList; // forward declaration
55 } // namespace Teuchos
56 #endif // DOXYGEN_SHOULD_SKIP_THIS
57 
58 namespace Tpetra {
114  template<class LocalOrdinal,
115  class GlobalOrdinal,
116  class Node>
117  class Export:
118  public ::Tpetra::Details::Transfer<LocalOrdinal, GlobalOrdinal, Node>
119  {
120  private:
121  friend class Import<LocalOrdinal,GlobalOrdinal,Node>;
122  using base_type =
124  public:
127 
129 
130 
138  Export (const Teuchos::RCP<const map_type>& source,
139  const Teuchos::RCP<const map_type>& target);
140 
151  Export (const Teuchos::RCP<const map_type>& source,
152  const Teuchos::RCP<const map_type>& target,
153  const Teuchos::RCP<Teuchos::FancyOStream>& out);
154 
167  Export (const Teuchos::RCP<const map_type>& source,
168  const Teuchos::RCP<const map_type>& target,
169  const Teuchos::RCP<Teuchos::ParameterList>& plist);
170 
186  Export (const Teuchos::RCP<const map_type>& source,
187  const Teuchos::RCP<const map_type>& target,
188  const Teuchos::RCP<Teuchos::FancyOStream>& out,
189  const Teuchos::RCP<Teuchos::ParameterList>& plist);
190 
196 
204 
208 
210  virtual ~Export () = default;
211 
213 
215 
238  virtual void
239  describe (Teuchos::FancyOStream& out,
240  const Teuchos::EVerbosityLevel verbLevel =
241  Teuchos::Describable::verbLevel_default) const;
242 
258  virtual void print (std::ostream& os) const;
260  private:
262 
263  void setupSamePermuteExport(Teuchos::Array<GlobalOrdinal> & exportGIDs);
265 
267  void setupRemote(Teuchos::Array<GlobalOrdinal> & exportGIDs);
269  }; // class Export
270 
283  template <class LocalOrdinal, class GlobalOrdinal, class Node>
284  Teuchos::RCP<const Export<LocalOrdinal, GlobalOrdinal, Node> >
285  createExport (const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >& src,
286  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >& tgt)
287  {
288  if (src == tgt) {
289  return Teuchos::null;
290  }
291 #ifdef HAVE_TPETRA_DEBUG
292  TEUCHOS_TEST_FOR_EXCEPTION
293  (src == Teuchos::null || tgt == Teuchos::null, std::runtime_error,
294  "Tpetra::createExport: Neither source nor target map may be null.");
295 #endif // HAVE_TPETRA_DEBUG
296  using export_type = Export<LocalOrdinal, GlobalOrdinal, Node>;
297  return Teuchos::rcp (new export_type (src, tgt));
298  }
299 
300 } // namespace Tpetra
301 
302 #endif // TPETRA_EXPORT_DECL_HPP
Communication plan for data redistribution from a uniquely-owned to a (possibly) multiply-owned distr...
Common base class of Import and Export.
virtual void print(std::ostream &os) const
Print the Export&#39;s data to the given output stream.
Export< LocalOrdinal, GlobalOrdinal, Node > & operator=(const Export< LocalOrdinal, GlobalOrdinal, Node > &rhs)=default
Assignment operator.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Describe this object in a human-readable way to the given output stream.
virtual ~Export()=default
Destructor.
Export(const Teuchos::RCP< const map_type > &source, const Teuchos::RCP< const map_type > &target)
Construct a Export object from the source and target Map.
Forward declaration of Tpetra::Export.
Forward declaration of Tpetra::Import.
Communication plan for data redistribution from a (possibly) multiply-owned to a uniquely-owned distr...
Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > createExport(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &src, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &tgt)
Nonmember &quot;constructor&quot; for Export objects.
A parallel distribution of indices over processes.