Isorropia_Redistributor.hpp

00001 //@HEADER
00002 /*
00003 ************************************************************************
00004 
00005               Isorropia: Partitioning and Load Balancing Package
00006                 Copyright (2006) Sandia Corporation
00007 
00008 Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00009 license for use of this work by or on behalf of the U.S. Government.
00010 
00011 This library is free software; you can redistribute it and/or modify
00012 it under the terms of the GNU Lesser General Public License as
00013 published by the Free Software Foundation; either version 2.1 of the
00014 License, or (at your option) any later version.
00015 
00016 This library is distributed in the hope that it will be useful, but
00017 WITHOUT ANY WARRANTY; without even the implied warranty of
00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 Lesser General Public License for more details.
00020 
00021 You should have received a copy of the GNU Lesser General Public
00022 License along with this library; if not, write to the Free Software
00023 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 USA
00025 Questions? Contact Alan Williams (william@sandia.gov)
00026                 or Erik Boman    (egboman@sandia.gov)
00027 
00028 ************************************************************************
00029 */
00030 //@HEADER
00031 
00032 #ifndef _Isorropia_Redistributor_hpp_
00033 #define _Isorropia_Redistributor_hpp_
00034 
00035 #include <Isorropia_configdefs.hpp>
00036 #include <Teuchos_RefCountPtr.hpp>
00037 #include <Teuchos_ParameterList.hpp>
00038 
00039 #ifdef HAVE_EPETRA
00040 class Epetra_Map;
00041 class Epetra_BlockMap;
00042 class Epetra_Import;
00043 class Epetra_Vector;
00044 class Epetra_MultiVector;
00045 class Epetra_CrsGraph;
00046 class Epetra_CrsMatrix;
00047 class Epetra_RowMatrix;
00048 class Epetra_LinearProblem;
00049 class Epetra_SrcDistObject;
00050 class Epetra_DistObject;
00051 
00055 namespace Isorropia {
00056   class Partitioner;
00057 
00062 class Redistributor {
00063 public:
00068   Redistributor(Teuchos::RefCountPtr<Partitioner> partitioner);
00069 
00072   virtual ~Redistributor();
00073 
00078   void redistribute(const Epetra_SrcDistObject& src,
00079         Epetra_DistObject& target);
00080 
00088   Teuchos::RefCountPtr<Epetra_CrsGraph>
00089      redistribute(const Epetra_CrsGraph& input_graph);
00090 
00098   Teuchos::RefCountPtr<Epetra_CrsMatrix>
00099      redistribute(const Epetra_CrsMatrix& input_matrix);
00100 
00104   Teuchos::RefCountPtr<Epetra_CrsMatrix>
00105      redistribute(const Epetra_RowMatrix& input_matrix);
00106 
00110   Teuchos::RefCountPtr<Epetra_MultiVector>
00111      redistribute(const Epetra_MultiVector& input_vector);
00112 
00113 private:
00114   void create_importer(const Epetra_BlockMap& src_map);
00115 
00116   Teuchos::RefCountPtr<Partitioner> partitioner_;
00117   Teuchos::RefCountPtr<Epetra_Import> importer_;
00118   Teuchos::RefCountPtr<Epetra_Map> target_map_;
00119 
00120   bool created_importer_;
00121 
00122 }; //class Redistributor
00123 
00124 }//namespace Isorropia
00125 
00126 #endif //HAVE_EPETRA
00127 
00128 #endif
00129