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 #ifndef ISORROPIA_EPETRA_ZOLTAN_QUERYOBJECT_H
00029 #define ISORROPIA_EPETRA_ZOLTAN_QUERYOBJECT_H
00030
00031 #include "Isorropia_ConfigDefs.hpp"
00032
00033 #include <Teuchos_RCP.hpp>
00034
00035 #include <zoltan_cpp.h>
00036
00037 #include <set>
00038 #include <map>
00039
00040 class Epetra_BlockMap;
00041 class Epetra_CrsGraph;
00042 class Epetra_RowMatrix;
00043 class Epetra_MultiVector;
00044
00045 namespace Isorropia {
00046
00047 namespace Epetra {
00048
00049 class CostDescriber;
00050
00058 namespace ZoltanLib {
00059
00069 class QueryObject
00070 {
00071
00075 const bool haveGraph_;
00076
00080 Teuchos::RCP<const Epetra_CrsGraph> graph_;
00081
00086 Teuchos::RCP<const Epetra_RowMatrix> matrix_;
00087
00093 Teuchos::RCP<const Epetra_MultiVector> coords_;
00094
00097 const Epetra_BlockMap *rowMap_;
00098
00101 const Epetra_BlockMap *colMap_;
00102
00107 Teuchos::RCP<const Isorropia::Epetra::CostDescriber> costs_;
00108
00114 Teuchos::RCP<const Epetra_MultiVector> weights_;
00115
00116 std::map<int,int> procmap_;
00117 std::set<int> graph_self_edges_;
00118
00119 int myProc_;
00120 int base_;
00121
00122 void fill_procmap();
00123
00130 int My_Number_Objects(int *ierr);
00131
00135 void My_Object_List (int num_gid_entries, int num_lid_entries,
00136 ZOLTAN_ID_PTR global_ids, ZOLTAN_ID_PTR local_ids,
00137 int weight_dim, float * object_weights, int * ierr );
00138
00143 void My_Number_Edges_Multi (int num_gid_entries, int num_lid_entries,
00144 int num_obj, ZOLTAN_ID_PTR global_ids, ZOLTAN_ID_PTR local_ids,
00145 int *num_edges, int * ierr );
00146
00151 void My_Edge_List_Multi(int num_gid_entries, int num_lid_entries,
00152 int num_obj, ZOLTAN_ID_PTR global_ids, ZOLTAN_ID_PTR local_ids,
00153 int *num_edges, ZOLTAN_ID_PTR neighbor_global_ids, int * neighbor_procs,
00154 int weight_dim, float * edge_weights, int * ierr );
00155
00159 void My_HG_Size_CS (int* num_lists, int* num_pins, int* format,
00160 int * ierr );
00164 void My_HG_CS (int num_gid_entries, int num_row_or_col, int num_pins,
00165 int format, ZOLTAN_ID_PTR vtxedge_GID, int* vtxedge_ptr, ZOLTAN_ID_PTR pin_GID,
00166 int * ierr );
00167
00172 void My_HG_Size_Edge_Weights(int* num_edges, int* ierr);
00173
00178 void My_HG_Edge_Weights(int num_gid_entries, int num_lid_entries, int num_edges, int edge_weight_dim,
00179 ZOLTAN_ID_PTR edge_GID, ZOLTAN_ID_PTR edge_LID, float* edge_weights, int* ierr);
00180
00185 int My_Number_Geom(int *ierr);
00186
00190 void My_Geom_Multi(int num_gid_entries, int num_lid_entries,
00191 int num_obj, ZOLTAN_ID_PTR gids, ZOLTAN_ID_PTR lids, int num_dim,
00192 double *geom_vec, int *ierr);
00193
00194 public:
00195
00198 QueryObject( Teuchos::RCP<const Epetra_CrsGraph> graph,
00199 Teuchos::RCP<const Isorropia::Epetra::CostDescriber> costs,
00200 int inputType);
00201
00202
00205 QueryObject( Teuchos::RCP<const Epetra_RowMatrix> matrix,
00206 Teuchos::RCP<const Isorropia::Epetra::CostDescriber> costs,
00207 int inputType);
00208
00211 QueryObject( Teuchos::RCP<const Epetra_MultiVector> coords,
00212 Teuchos::RCP<const Epetra_MultiVector> weights);
00213
00216 virtual ~QueryObject();
00217
00223 static const int hgraph_input_ = 1;
00224
00229 static const int hgraph2d_finegrain_input_ = 2;
00230
00236 static const int graph_input_ = 3;
00237
00244 static const int geometric_input_ = 4;
00245
00249 static const int unspecified_input_ = 5;
00250
00251
00257 int input_type_;
00258
00261 const Epetra_BlockMap &RowMap(void){ return *rowMap_;};
00262
00266 bool haveVertexWeights();
00267
00271 bool haveGraphEdgeWeights();
00272
00276 bool haveHypergraphEdgeWeights();
00277
00278
00279
00282 static int Number_Objects(void *data, int *ierr);
00283
00286 static void Object_List ( void * data, int num_gid_entries, int num_lid_entries,
00287 ZOLTAN_ID_PTR global_ids, ZOLTAN_ID_PTR local_ids,
00288 int weight_dim, float * object_weights, int * ierr );
00289
00290
00291
00294 static void Number_Edges_Multi ( void * data, int num_gid_entries, int num_lid_entries,
00295 int num_obj, ZOLTAN_ID_PTR global_ids, ZOLTAN_ID_PTR local_ids,
00296 int *num_edges, int * ierr );
00297
00300 static void Edge_List_Multi( void * data, int num_gid_entries, int num_lid_entries,
00301 int num_obj, ZOLTAN_ID_PTR global_ids, ZOLTAN_ID_PTR local_ids,
00302 int *num_edges, ZOLTAN_ID_PTR neighbor_global_ids, int * neighbor_procs,
00303 int weight_dim, float * edge_weights, int * ierr );
00304
00305
00306
00309 static void HG_Size_CS ( void * data, int* num_lists, int* num_pins, int* format,
00310 int * ierr );
00313 static void HG_CS ( void * data, int num_gid_entries, int num_row_or_col, int num_pins,
00314 int format, ZOLTAN_ID_PTR vtxedge_GID, int* vtxedge_ptr, ZOLTAN_ID_PTR pin_GID,
00315 int * ierr );
00318 static void HG_Size_Edge_Weights(void * data, int* num_edges, int* ierr);
00319
00322 static void HG_Edge_Weights(void * data,
00323 int num_gid_entries, int num_lid_entries, int num_edges, int edge_weight_dim,
00324 ZOLTAN_ID_PTR edge_GID, ZOLTAN_ID_PTR edge_LID, float* edge_weights, int* ierr);
00325
00328 static int Number_Geom(void *data, int *ierr);
00329
00332 static void Geom_Multi(void *data, int num_gid_entries, int num_lid_entries,
00333 int num_obj, ZOLTAN_ID_PTR gids, ZOLTAN_ID_PTR lids, int num_dim,
00334 double *geom_vec, int *ierr);
00335
00336 };
00337
00338 }
00339 }
00340 }
00341
00342 #endif //ISORROPIA_EPETRA_ZOLTAN_QUERYOBJECT_H