Isorropia: Partitioning, Load Balancing and more
Isorropia_EpetraRedistributor.hpp
Go to the documentation of this file.
1 //@HEADER
2 //************************************************************************
3 //
4 // Isorropia: Partitioning and Load Balancing Package
5 // Copyright (2006) Sandia Corporation
6 //
7 //Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 //license for use of this work by or on behalf of the U.S. Government.
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 //************************************************************************
38 //@HEADER
39 
40 #ifndef _Isorropia_EpetraRedistributor_hpp_
41 #define _Isorropia_EpetraRedistributor_hpp_
42 
44 #include <Isorropia_ConfigDefs.hpp>
45 #include <Teuchos_RCP.hpp>
46 #include <Teuchos_ParameterList.hpp>
47 
48 #ifdef HAVE_EPETRA
49 class Epetra_Map;
50 class Epetra_BlockMap;
51 class Epetra_Import;
52 class Epetra_Vector;
53 class Epetra_MultiVector;
54 class Epetra_CrsGraph;
55 class Epetra_CrsMatrix;
56 class Epetra_RowMatrix;
57 class Epetra_LinearProblem;
58 class Epetra_SrcDistObject;
59 class Epetra_DistObject;
60 
61 namespace Isorropia {
62 
63 namespace Epetra {
64  class Partitioner;
65 
73 public:
74 
82  Redistributor(Teuchos::RCP<Isorropia::Epetra::Partitioner> partitioner);
83 
91  Redistributor(Teuchos::RCP<Epetra_Map> target_map);
92 
101 
109  Redistributor(Epetra_Map *target_map);
110 
114  virtual ~Redistributor();
115 
121  void redistribute(const Epetra_SrcDistObject& src,
122  Epetra_DistObject& target);
123 
140  Teuchos::RCP<Epetra_CrsGraph>
141  redistribute(const Epetra_CrsGraph& input_graph, bool callFillComplete= true);
142 
160  void redistribute(const Epetra_CrsGraph& input_graph, Epetra_CrsGraph * &outputGraphPtr, bool callFillComplete= true);
161 
178  Teuchos::RCP<Epetra_CrsMatrix>
179  redistribute(const Epetra_CrsMatrix& input_matrix, bool callFillComplete= true);
180 
198  void redistribute(const Epetra_CrsMatrix& inputMatrix, Epetra_CrsMatrix * &outputMatrix, bool callFillComplete= true);
199 
216  Teuchos::RCP<Epetra_CrsMatrix>
217  redistribute(const Epetra_RowMatrix& input_matrix, bool callFillComplete= true);
218 
219 
236  void
237  redistribute(const Epetra_RowMatrix& inputMatrix, Epetra_CrsMatrix * &outputMatrix, bool callFillComplete= true);
238 
249  Teuchos::RCP<Epetra_Vector>
250  redistribute(const Epetra_Vector& input_vector);
251 
262  void
263  redistribute(const Epetra_Vector& inputVector, Epetra_Vector * &outputVector);
264 
276  Teuchos::RCP<Epetra_MultiVector>
277  redistribute(const Epetra_MultiVector& input_vector);
278 
279 
291  void
292  redistribute(const Epetra_MultiVector& inputVector, Epetra_MultiVector * &outputVector);
293 
303  void
304  redistribute_reverse(const Epetra_Vector& input_vector, Epetra_Vector& output_vector);
305 
314  void
315  redistribute_reverse(const Epetra_MultiVector& input_vector, Epetra_MultiVector& output_vector);
316 
317  Epetra_Import &get_importer() { return *importer_;}
318 
319 private:
324  void create_importer(const Epetra_BlockMap& src_map);
325 
326  Teuchos::RCP<Isorropia::Epetra::Partitioner> partitioner_;
327  Teuchos::RCP<Epetra_Import> importer_;
328  Teuchos::RCP<Epetra_Map> target_map_;
329 
330 }; //class Redistributor
331 
332 }//namespace Epetra
333 
334 }//namespace Isorropia
335 
336 #endif //HAVE_EPETRA
337 
338 #endif
339 
Teuchos::RCP< Epetra_Map > target_map_
Definition: Isorropia_EpetraRedistributor.hpp:328
Abstract base class for classes which are constructed with a Partitioner instance, and define methods to redistribute their objects.
Definition: Isorropia_Redistributor.hpp:52
virtual ~Redistributor()
Destructor.
Epetra_Import & get_importer()
Definition: Isorropia_EpetraRedistributor.hpp:317
Redistributor(Teuchos::RCP< Isorropia::Epetra::Partitioner > partitioner)
This constructor calls the Isorropia::Epetra::Partitioner::partition method on the partitioner if it ...
void create_importer(const Epetra_BlockMap &src_map)
Create an importer object to be used in the redistribution.
Class which is constructed with a Partitioner instance, and provides several methods for redistributi...
Definition: Isorropia_EpetraRedistributor.hpp:72
Teuchos::RCP< Epetra_Import > importer_
Definition: Isorropia_EpetraRedistributor.hpp:327
void redistribute_reverse(const Epetra_Vector &input_vector, Epetra_Vector &output_vector)
Reverse redistribute an Epetra_Vector.
void redistribute(const Epetra_SrcDistObject &src, Epetra_DistObject &target)
Method to redistribute a Epetra_SrcDistObject into a Epetra_DistObject.
Teuchos::RCP< Isorropia::Epetra::Partitioner > partitioner_
Definition: Isorropia_EpetraRedistributor.hpp:326
An implementation of the Partitioner interface that operates on Epetra matrices and linear systems...
Definition: Isorropia_EpetraPartitioner.hpp:122