|
Isorropia: Partitioning, Load Balancing and more Version 3.0
|
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 00026 ************************************************************************ 00027 */ 00028 //@HEADER 00029 00030 #ifndef _Isorropia_TpetraOperator_hpp_ 00031 #define _Isorropia_TpetraOperator_hpp_ 00032 00033 #include <Isorropia_ConfigDefs.hpp> 00034 #include <Teuchos_RCP.hpp> 00035 #include <Teuchos_ParameterList.hpp> 00036 00037 #include <Isorropia_Operator.hpp> 00038 00039 #ifdef HAVE_ISORROPIA_TPETRA 00040 #include <Isorropia_TpetraLibrary.hpp> 00041 #include <Isorropia_TpetraCostDescriber.hpp> 00042 #include <Tpetra_CrsGraph_decl.hpp> 00043 00044 namespace Isorropia { 00045 00046 namespace Tpetra { 00047 00048 00054 template <class Node=Kokkos::DefaultNode::DefaultNodeType> 00055 class Operator : virtual public Isorropia::Operator 00056 { 00057 public: 00058 00074 Operator(Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph, 00075 const Teuchos::ParameterList& paramlist, int base); 00076 00077 00078 00080 virtual ~Operator(); 00081 00085 void setParameters(const Teuchos::ParameterList& paramlist); 00086 00087 virtual void compute(bool force_compute) = 0 ; 00088 00091 bool alreadyComputed() const 00092 { 00093 return operation_already_computed_; 00094 } 00095 00096 int numProperties() const { 00097 return (numberOfProperties_); 00098 } 00099 00100 int numLocalProperties() const { 00101 return (localNumberOfProperties_); 00102 } 00103 00107 virtual const int& operator[](int myElem) const; 00108 00111 virtual int numElemsWithProperty(int property) const; 00112 00116 virtual void elemsWithProperty(int property, 00117 int* elementList, 00118 int len) const; 00119 00120 virtual int extractPropertiesCopy(int len, 00121 int& size, 00122 int* array) const ; 00123 00124 virtual int extractPropertiesView(int& size, 00125 const int*& array) const; 00126 00127 private: 00128 00129 void paramsToUpper(Teuchos::ParameterList &, int &changed, bool rmUnderscore=true); 00130 void stringToUpper(std::string &s, int &changed, bool rmUnderscore=false); 00131 int numberOfProperties_; 00132 int localNumberOfProperties_; 00133 std::vector<int> numberElemsByProperties_; 00134 00135 protected: 00136 Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph_; 00137 Teuchos::RCP<const ::Tpetra::Map<int,int,Node> > input_map_; 00138 00139 Teuchos::RCP<const ::Tpetra::RowMatrix<double,int,int,Node> > input_matrix_; 00140 Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords_; 00141 Teuchos::RCP<Isorropia::Tpetra::CostDescriber<Node> > costs_; 00142 Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > weights_; 00143 00144 00145 Teuchos::ParameterList paramlist_; 00146 00147 int exportsSize_; 00148 std::vector<int> imports_; 00149 std::vector<int> properties_; 00150 00151 bool operation_already_computed_; 00152 00153 int global_num_vertex_weights_; 00154 int global_num_graph_edge_weights_; 00155 int global_num_hg_edge_weights_; 00156 00157 Teuchos::RCP<Library<Node> > lib_; 00158 00159 int base_; 00160 00161 void computeNumberOfProperties(); 00162 };//class Operator 00163 00164 }//namespace Epetra 00165 }//namespace Isorropia 00166 00167 #endif //HAVE_EPETRA 00168 00169 #endif 00170