Isorropia: Partitioning, Load Balancing and more
Isorropia_EpetraLibrary.hpp
Go to the documentation of this file.
00001 //@HEADER
00002 //************************************************************************
00003 //
00004 //              Isorropia: Partitioning and Load Balancing Package
00005 //                Copyright (2006) Sandia Corporation
00006 //
00007 //Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 //license for use of this work by or on behalf of the U.S. Government.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 //************************************************************************
00038 //@HEADER
00039 
00040 #ifndef _Isorropia_EpetraLibrary_hpp_
00041 #define _Isorropia_EpetraLibrary_hpp_
00042 
00043 #include <Isorropia_ConfigDefs.hpp>
00044 #include <Teuchos_RCP.hpp>
00045 #include <Teuchos_ParameterList.hpp>
00046 
00047 #include <Isorropia_EpetraCostDescriber.hpp>
00048 
00049 #ifdef HAVE_EPETRA
00050 class Epetra_Map;
00051 class Epetra_BlockMap;
00052 class Epetra_Import;
00053 class Epetra_Vector;
00054 class Epetra_MultiVector;
00055 class Epetra_CrsGraph;
00056 class Epetra_CrsMatrix;
00057 class Epetra_RowMatrix;
00058 class Epetra_LinearProblem;
00059 
00060 namespace Isorropia {
00061 
00062 namespace Epetra {
00063   class CostDescriber;
00064 
00070 class Library {
00071 public:
00072 
00073   Library(Teuchos::RCP<const Epetra_CrsGraph> input_graph, int itype = unspecified_input_);
00074   Library(Teuchos::RCP<const Epetra_CrsGraph> input_graph, Teuchos::RCP<const Epetra_MultiVector> input_coords,
00075           int itype = unspecified_input_);
00076   Library(Teuchos::RCP<const Epetra_CrsGraph> input_graph,
00077     Teuchos::RCP<CostDescriber> costs, int itype = unspecified_input_);
00078   Library(Teuchos::RCP<const Epetra_CrsGraph> input_graph, Teuchos::RCP<CostDescriber> costs, 
00079     Teuchos::RCP<const Epetra_MultiVector> input_coords, Teuchos::RCP<const Epetra_MultiVector> weights,
00080           int itype = unspecified_input_);
00081   Library(Teuchos::RCP<const Epetra_RowMatrix> input_matrix, int itype = unspecified_input_);
00082   Library(Teuchos::RCP<const Epetra_RowMatrix> input_matrix, Teuchos::RCP<const Epetra_MultiVector> input_coords,
00083           int itype = unspecified_input_);
00084   Library(Teuchos::RCP<const Epetra_RowMatrix> input_matrix,
00085     Teuchos::RCP<CostDescriber> costs, int itype = unspecified_input_);
00086   Library(Teuchos::RCP<const Epetra_RowMatrix> input_matrix, Teuchos::RCP<CostDescriber> costs, 
00087     Teuchos::RCP<const Epetra_MultiVector> input_coords, Teuchos::RCP<const Epetra_MultiVector> weights,
00088           int itype = unspecified_input_);
00089   Library(Teuchos::RCP<const Epetra_MultiVector> input_coords, int itype = unspecified_input_);
00090   Library(Teuchos::RCP<const Epetra_MultiVector> input_coords,
00091           Teuchos::RCP<const Epetra_MultiVector> weights, int itype = unspecified_input_);
00092   Library(Teuchos::RCP<const Epetra_BlockMap> input_map, int itype = unspecified_input_);
00093 
00094   virtual ~Library();
00095 
00096   virtual int
00097   repartition(Teuchos::ParameterList& paramlist,
00098         std::vector<int>& myNewElements,
00099         int& exportsSize,
00100         std::vector<int>& imports) = 0;
00101 
00102   virtual int
00103   color(Teuchos::ParameterList& paramlist,
00104   std::vector<int>& colorAssignment) = 0 ;
00105 
00106   virtual int
00107   order(Teuchos::ParameterList& paramlist,
00108   std::vector<int>& orderAssignment) = 0 ;
00109 
00115   static const int hgraph_input_ = 1;
00116 
00121   static const int hgraph2d_finegrain_input_ = 2;
00122 
00128   static const int graph_input_ = 3;
00129 
00136   static const int geometric_input_ = 4;
00137 
00143   static const int hgraph_graph_input_ = 5;
00144 
00150   static const int hgraph_geometric_input_ = 6;
00151 
00157   static const int graph_geometric_input_ = 7;
00158 
00164   static const int hgraph_graph_geometric_input_ = 8;
00165 
00166 
00171   static const int simple_input_ = 9;
00172 
00173 
00178   static const int unspecified_input_ = 10;
00179 
00180   int input_type_;
00181 
00182   int numPartSizes;
00183   int *partGIDs;
00184   float *partSizes;
00185 
00186 protected:
00187 
00188   Teuchos::RCP<const Epetra_BlockMap> input_map_;
00189   Teuchos::RCP<const Epetra_CrsGraph> input_graph_;
00190   Teuchos::RCP<const Epetra_RowMatrix> input_matrix_;
00191   Teuchos::RCP<const Epetra_MultiVector> input_coords_;
00192   Teuchos::RCP<Isorropia::Epetra::CostDescriber> costs_;
00193   Teuchos::RCP<const Epetra_MultiVector> weights_;
00194 
00195   virtual int precompute();
00196 
00197   virtual int postcompute() = 0;
00198 
00199 };//class Library
00200 
00201 }//namespace Epetra
00202 }//namespace Isorropia
00203 
00204 #endif //HAVE_EPETRA
00205 
00206 #endif
00207