Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 {
119  template<class LocalOrdinal,
120  class GlobalOrdinal,
121  class Node>
122  class Export:
123  public ::Tpetra::Details::Transfer<LocalOrdinal, GlobalOrdinal, Node>
124  {
125  private:
126  friend class Import<LocalOrdinal,GlobalOrdinal,Node>;
127  using base_type =
129  public:
132 
134 
135 
143  Export (const Teuchos::RCP<const map_type>& source,
144  const Teuchos::RCP<const map_type>& target);
145 
156  Export (const Teuchos::RCP<const map_type>& source,
157  const Teuchos::RCP<const map_type>& target,
158  const Teuchos::RCP<Teuchos::FancyOStream>& out);
159 
172  Export (const Teuchos::RCP<const map_type>& source,
173  const Teuchos::RCP<const map_type>& target,
174  const Teuchos::RCP<Teuchos::ParameterList>& plist);
175 
191  Export (const Teuchos::RCP<const map_type>& source,
192  const Teuchos::RCP<const map_type>& target,
193  const Teuchos::RCP<Teuchos::FancyOStream>& out,
194  const Teuchos::RCP<Teuchos::ParameterList>& plist);
195 
201 
209 
213 
215  virtual ~Export () = default;
216 
218 
220 
243  virtual void
244  describe (Teuchos::FancyOStream& out,
245  const Teuchos::EVerbosityLevel verbLevel =
246  Teuchos::Describable::verbLevel_default) const;
247 
263  virtual void print (std::ostream& os) const;
265  private:
267 
268  void setupSamePermuteExport(Teuchos::Array<GlobalOrdinal> & exportGIDs);
270 
272  void setupRemote(Teuchos::Array<GlobalOrdinal> & exportGIDs);
274  }; // class Export
275 
288  template <class LocalOrdinal, class GlobalOrdinal, class Node>
289  Teuchos::RCP<const Export<LocalOrdinal, GlobalOrdinal, Node> >
290  createExport (const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >& src,
291  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >& tgt)
292  {
293  if (src == tgt) {
294  return Teuchos::null;
295  }
296 #ifdef HAVE_TPETRA_DEBUG
297  TEUCHOS_TEST_FOR_EXCEPTION
298  (src == Teuchos::null || tgt == Teuchos::null, std::runtime_error,
299  "Tpetra::createExport: Neither source nor target map may be null.");
300 #endif // HAVE_TPETRA_DEBUG
301  using export_type = Export<LocalOrdinal, GlobalOrdinal, Node>;
302  return Teuchos::rcp (new export_type (src, tgt));
303  }
304 
305 } // namespace Tpetra
306 
307 #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.