00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _Isorropia_EpetraCostDescriber_hpp_
00031 #define _Isorropia_EpetraCostDescriber_hpp_
00032
00033 #include <Isorropia_ConfigDefs.hpp>
00034 #include <Isorropia_CostDescriber.hpp>
00035 #include <Teuchos_RCP.hpp>
00036 #include <Teuchos_ParameterList.hpp>
00037
00038 #include <map>
00039 #include <list>
00040 #include <set>
00041 #include <iostream>
00042
00043 #ifdef HAVE_EPETRA
00044 class Epetra_Vector;
00045 class Epetra_CrsMatrix;
00046
00047 namespace Isorropia {
00048
00086 class Operator;
00087
00088 namespace Epetra {
00089
00107
00108
00109 namespace ZoltanLib{
00110 class QueryObject;
00111 }
00112 class InternalPartitioner;
00113 class ZoltanLibClass;
00114
00115 class CostDescriber : public Isorropia::CostDescriber {
00116
00117
00118
00119
00120 friend class Isorropia::Operator;
00121 friend class Isorropia::Epetra::ZoltanLib::QueryObject;
00122 friend class Isorropia::Epetra::InternalPartitioner;
00123 friend class Isorropia::Epetra::ZoltanLibClass;
00124
00125 public:
00127 CostDescriber();
00128
00130 ~CostDescriber();
00131
00134 friend std::ostream& operator <<(std::ostream &, const Isorropia::Epetra::CostDescriber &cd);
00135
00141 void setVertexWeights(Teuchos::RCP<const Epetra_Vector> vwts);
00142
00154 void setGraphEdgeWeights(Teuchos::RCP<const Epetra_CrsMatrix> gewts);
00155
00165 void setHypergraphEdgeWeights(Teuchos::RCP<const Epetra_Vector> hgewts);
00166
00183 void setHypergraphEdgeWeights(int numHGedges, const int *hgGIDs, const float *hgEwgts);
00184
00188 void setHypergraphEdgeWeights(int numHGedges, const int *hgGIDs, const double *hgEwgts);
00189
00198 void getCosts(std::map<int, float > &vertexWeights,
00199 std::map<int, std::map<int, float > > &graphEdgeWeights,
00200 std::map<int, float > &hypergraphEdgeWeights) const;
00201
00204 void show_cd(std::ostream &) const;
00205
00206 private:
00207
00210 void setParameters(const Teuchos::ParameterList& paramlist);
00211
00214 bool haveVertexWeights() const;
00217 int getNumVertices() const;
00220 void getVertexWeights(int numVertices,
00221 int* global_ids, float* weights) const;
00224 bool haveGraphEdgeWeights() const;
00227 int getNumGraphEdges(int vertex_global_id) const;
00228
00233 int getGraphEdgeVertices(std::set<int> &gids) const;
00234
00235
00238 void getGraphEdgeWeights(int vertex_global_id,
00239 int num_neighbors,
00240 int* neighbor_global_ids,
00241 float* weights) const;
00244 bool haveHypergraphEdgeWeights() const;
00247 int getNumHypergraphEdgeWeights() const;
00250 void getHypergraphEdgeWeights(int numEdges,
00251 int* global_ids,
00252 float* weights) const;
00253
00259 int getHypergraphEdgeWeights(std::map<int, float> &wgtMap) const;
00260
00261
00267 int getVertexWeights(std::map<int, float> &wgtMap) const;
00268
00269
00270
00278 int getGraphEdgeWeights(int vertex_global_id, std::map<int, float> &wgtMap) const;
00279
00280
00281
00285 bool haveGlobalVertexWeights() const;
00286
00290 void setNumGlobalVertexWeights(int num);
00291
00295 bool haveGlobalGraphEdgeWeights() const;
00296
00300 void setNumGlobalGraphEdgeWeights(int num);
00301
00305 bool haveGlobalHypergraphEdgeWeights() const;
00306
00310 void setNumGlobalHypergraphEdgeWeights(int num);
00311
00314 void allocate_hg_edge_weights_(int n);
00315
00318 void free_hg_edge_weights_();
00319
00320 Teuchos::RCP<const Epetra_Vector> vertex_weights_;
00321 Teuchos::RCP<const Epetra_CrsMatrix> graph_edge_weights_;
00322 std::set<int> graph_self_edges_;
00323
00324 Teuchos::ParameterList paramlist_;
00325
00326 int *hg_edge_gids_;
00327 float *hg_edge_weights_;
00328 int num_hg_edge_weights_;
00329
00330 int numGlobalVertexWeights_;
00331 int numGlobalGraphEdgeWeights_;
00332 int numGlobalHypergraphEdgeWeights_;
00333
00346 int getEdges(int vertexGID, int len, int *nborGID, float *weights) const;
00347
00348
00349 };
00350
00351 }
00352 }
00353
00354 #endif //HAVE_EPETRA
00355
00356 #endif
00357