Zoltan2
Zoltan2_AlgZoltanCallbacks.hpp
Go to the documentation of this file.
1 // @HEADER
2 //
3 // ***********************************************************************
4 //
5 // Zoltan2: A package of combinatorial algorithms for scientific computing
6 // Copyright 2012 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Karen Devine (kddevin@sandia.gov)
39 // Erik Boman (egboman@sandia.gov)
40 // Siva Rajamanickam (srajama@sandia.gov)
41 //
42 // ***********************************************************************
43 //
44 // @HEADER
45 #ifndef _ZOLTAN2_ALGZOLTANCALLBACKS_HPP_
46 #define _ZOLTAN2_ALGZOLTANCALLBACKS_HPP_
47 
48 #include <Zoltan2_MeshAdapter.hpp>
50 #include <Zoltan2_GraphAdapter.hpp>
53 
55 
56 #include <Zoltan2_Util.hpp>
57 #include <Zoltan2_TPLTraits.hpp>
58 #include <zoltan_cpp.h>
59 
63 // Callbacks based on Adapter; specializations provided where needed
64 
65 namespace Zoltan2 {
66 
68 // CALLBACKS SHARED BY MANY ADAPTERS
70 
72 // ZOLTAN_NUM_OBJ_FN
73 template <typename Adapter>
74 static int zoltanNumObj(void *data, int *ierr) {
75  const Adapter *adp = static_cast<Adapter *>(data);
76  *ierr = ZOLTAN_OK;
77  return int(adp->getLocalNumIDs());
78 }
79 
81 // ZOLTAN_OBJ_LIST_FN
82 template <typename Adapter>
83 static void zoltanObjList(void *data, int nGidEnt, int nLidEnt,
84  ZOLTAN_ID_PTR gids, ZOLTAN_ID_PTR lids,
85  int wdim, float *wgts, int *ierr)
86 {
87  const Adapter *adp = static_cast<Adapter *>(data);
88  typedef typename Adapter::gno_t gno_t;
89  typedef typename Adapter::lno_t lno_t;
90  *ierr = ZOLTAN_OK;
91 
92  size_t mynObj = adp->getLocalNumIDs();
93 
94  const gno_t *myids = NULL;
95  adp->getIDsView(myids);
96  for (size_t i = 0; i < mynObj; i++) {
97  ZOLTAN_ID_PTR idPtr = &(gids[i*nGidEnt]);
99  idPtr = &(lids[i*nLidEnt]);
101  }
102 
103  if (wdim) {
104  int mywdim = adp->getNumWeightsPerID();
105  for (int w = 0; w < wdim; w++) {
106  if (w < mywdim) {
107  // copy weights from adapter
108  const typename Adapter::scalar_t *mywgts;
109  int mystride;
110  adp->getWeightsView(mywgts, mystride, w);
111  for (size_t i = 0; i < mynObj; i++)
112  wgts[i*wdim+w] = float(mywgts[i*mystride]);
113  }
114  else {
115  // provide uniform weights
116  for (size_t i = 0; i < mynObj; i++)
117  wgts[i*wdim+w] = 1.;
118  }
119  }
120  }
121 }
122 
124 // ZOLTAN_PART_MULTI_FN
125 template <typename Adapter>
126 static void zoltanParts(void *data, int nGidEnt, int nLidEnt, int nObj,
127  ZOLTAN_ID_PTR gids, ZOLTAN_ID_PTR lids,
128  int *parts, int *ierr)
129 {
130  typedef typename Adapter::lno_t lno_t;
131  const Adapter *adp = static_cast<Adapter *>(data);
132  *ierr = ZOLTAN_OK;
133  const typename Adapter::part_t *myparts;
134  adp->getPartsView(myparts);
135  // User parts from input adapter
136  for (int i = 0; i < nObj; i++) {
137  lno_t lidx;
138  TPL_Traits<lno_t,ZOLTAN_ID_PTR>::ASSIGN(lidx, &(lids[i*nLidEnt]));
139  parts[i] = int(myparts[lidx]);
140  }
141 }
142 
144 // ZOLTAN_NUM_GEOM_FN
145 template <typename Adapter>
146 static int zoltanNumGeom(void *data, int *ierr)
147 {
148  const Adapter *adp = static_cast<Adapter *>(data);
149  *ierr = ZOLTAN_OK;
150  return adp->getDimension();
151 }
152 
154 // ZOLTAN_GEOM_MULTI_FN
155 template <typename Adapter>
156 static void zoltanGeom(void *data, int nGidEnt, int nLidEnt, int nObj,
157  ZOLTAN_ID_PTR gids, ZOLTAN_ID_PTR lids,
158  int nDim, double *coords, int *ierr)
159 {
160  typedef typename Adapter::lno_t lno_t;
161  const Adapter *adp = static_cast<Adapter *>(data);
162  *ierr = ZOLTAN_OK;
163 
164  for (int d = 0; d < nDim; d++) {
165  const typename Adapter::scalar_t *mycoords;
166  int mystride;
167  adp->getCoordinatesView(mycoords, mystride, d);
168  for (int i = 0; i < nObj; i++) {
169  lno_t lidx;
170  TPL_Traits<lno_t,ZOLTAN_ID_PTR>::ASSIGN(lidx, &(lids[i*nLidEnt]));
171  coords[i*nDim+d] = double(mycoords[lidx*mystride]);
172  }
173  }
174 }
175 
177 // HYPERGRAPH CALLBACKS USING A MATRIX ADAPTER
178 // Building the most straightforward hypergraph from a matrix and, thus,
179 // avoiding use of HypergraphModel.
180 // Assuming vertices are rows or columns, and pins are nonzeros.
182 
184 // ZOLTAN_HG_SIZE_CS_FN
185 template <typename Adapter>
186 static void zoltanHGSizeCS_withMatrixAdapter(void *data, int *nLists, int *nPins,
187  int *format, int *ierr
188 )
189 {
190  *ierr = ZOLTAN_OK;
191  typedef typename Adapter::user_t user_t;
192  const MatrixAdapter<user_t>* madp = static_cast<MatrixAdapter<user_t>* >(data);
193 
194  *nPins = madp->getLocalNumEntries();
195 
196  MatrixEntityType etype = madp->getPrimaryEntityType();
197  if (etype == MATRIX_ROW && madp->CRSViewAvailable()) {
198  *nLists = madp->getLocalNumRows();
199  *format = ZOLTAN_COMPRESSED_VERTEX;
200  }
201  else if (etype == MATRIX_ROW && madp->CCSViewAvailable()) {
202  *nLists = madp->getLocalNumColumns();
203  *format = ZOLTAN_COMPRESSED_EDGE;
204  }
205  else if (etype == MATRIX_COLUMN && madp->CRSViewAvailable()) {
206  *nLists = madp->getLocalNumRows();
207  *format = ZOLTAN_COMPRESSED_EDGE;
208  }
209  else if (etype == MATRIX_COLUMN && madp->CCSViewAvailable()) {
210  *nLists = madp->getLocalNumColumns();
211  *format = ZOLTAN_COMPRESSED_VERTEX;
212  }
213  else {
214  // Need either CRSView or CCSView.
215  // Also, not yet implemented for matrix nonzeros;
216  // may need a hypergraph model.
217  std::cout << "For hypergraph partitioning, "
218  << "CRSView or CCSView is needed in MatrixAdapter" << std::endl;
219  *ierr = ZOLTAN_FATAL;
220  }
221 }
222 
224 // ZOLTAN_HG_CS_FN
225 template <typename Adapter>
226 static void zoltanHGCS_withMatrixAdapter(void *data, int nGidEnt, int nLists,
227  int nPins, int format,
228  ZOLTAN_ID_PTR listIds, int *listIdx,
229  ZOLTAN_ID_PTR pinIds, int *ierr
230 )
231 {
232  *ierr = ZOLTAN_OK;
233  typedef typename Adapter::gno_t gno_t;
234  typedef typename Adapter::lno_t lno_t;
235  typedef typename Adapter::user_t user_t;
236  const MatrixAdapter<user_t>* madp = static_cast<MatrixAdapter<user_t>* >(data);
237 
238  const gno_t *Ids;
239  const gno_t *pIds;
240  const lno_t *offsets;
241 
242  // Get the pins and list IDs.
243  if (madp->CRSViewAvailable()) {
244  try {
245  madp->getRowIDsView(Ids);
246  madp->getCRSView(offsets, pIds);
247  }
248  catch (std::exception &e) {
249  *ierr = ZOLTAN_FATAL;
250  }
251  }
252  else if (madp->CCSViewAvailable()) {
253  try {
254  madp->getColumnIDsView(Ids);
255  madp->getCCSView(offsets, pIds);
256  }
257  catch (std::exception &e) {
258  *ierr = ZOLTAN_FATAL;
259  }
260  }
261  else {
262  // Need either CRSView or CCSView.
263  *ierr = ZOLTAN_FATAL;
264  }
265 
266  if (*ierr == ZOLTAN_OK) {
267  // copy into Zoltan's memory
268  for (int i=0; i < nLists; i++) {
269  ZOLTAN_ID_PTR idPtr = &(listIds[i*nGidEnt]);
271  listIdx[i] = Teuchos::as<int>(offsets[i]);
272  }
273  listIdx[nLists] = Teuchos::as<int>(offsets[nLists]);
274  for (int i=0; i < nPins; i++) {
275  ZOLTAN_ID_PTR idPtr = &(pinIds[i*nGidEnt]);
277  }
278  }
279 }
280 
282 // TODO: GRAPH ADAPTER CALLBACKS
283 
284 
286 // HYPERGRAPH CALLBACKS USING A MESH ADAPTER
287 // Implement Boman/Chevalier's hypergraph mesh model
288 // Skip explicit construction of a HypergraphModel
289 // Return either (depending on available adjacencies):
290 // + for each primary entity (vtx), the list of assoc adjacency entities (edges)
291 // + for each adjacency entity (edge), the list of assoc primary entities (vtx)
293 
295 // ZOLTAN_HG_SIZE_CS_FN
296 template <typename Adapter>
297 static void zoltanHGSizeCS_withMeshAdapter(void *data, int *nLists, int *nPins,
298  int *format, int *ierr
299 )
300 {
301  *ierr = ZOLTAN_OK;
302  typedef typename Adapter::user_t user_t;
303  const MeshAdapter<user_t>* madp = static_cast<MeshAdapter<user_t>* >(data);
304  if (madp->availAdjs(madp->getPrimaryEntityType(),
305  madp->getAdjacencyEntityType()))
306  {
307  *nLists = madp->getLocalNumOf(madp->getPrimaryEntityType());
308  *nPins = madp->getLocalNumAdjs(madp->getPrimaryEntityType(),
309  madp->getAdjacencyEntityType());
310  *format = ZOLTAN_COMPRESSED_VERTEX;
311  }
312  else if (madp->availAdjs(madp->getAdjacencyEntityType(),
313  madp->getPrimaryEntityType()))
314  {
315  *nLists = madp->getLocalNumOf(madp->getAdjacencyEntityType());
316  *nPins = madp->getLocalNumAdjs(madp->getAdjacencyEntityType(),
317  madp->getPrimaryEntityType());
318  *format = ZOLTAN_COMPRESSED_EDGE;
319  }
320  else {
321  std::cout << "For hypergraph partitioning, need first adjacencies "
322  << "(availAdjs, getLocalNumAdjs, getAdjsView) "
323  << "in MeshAdapter." << std::endl;
324  *nLists = 0;
325  *nPins = 0;
326  *format = -1*ZOLTAN_COMPRESSED_VERTEX;
327  *ierr = ZOLTAN_FATAL;
328  }
329 }
330 
332 // ZOLTAN_HG_CS_FN
333 template <typename Adapter>
335  void *data, int nGidEnt, int nLists, int nPins,
336  int format, ZOLTAN_ID_PTR listIds,
337  int *listIdx, ZOLTAN_ID_PTR pinIds, int *ierr
338 )
339 {
340  *ierr = ZOLTAN_OK;
341  typedef typename Adapter::gno_t gno_t;
342  typedef typename Adapter::lno_t lno_t;
343  typedef typename Adapter::user_t user_t;
344  const MeshAdapter<user_t>* madp = static_cast<MeshAdapter<user_t>*>(data);
345 
346  // Select listType and pinType based on format specified in ZOLTAN_HG_CS_SIZE_FN
347  MeshEntityType listType, pinType;
348  if (format == ZOLTAN_COMPRESSED_VERTEX)
349  {
350  listType = madp->getPrimaryEntityType();
351  pinType = madp->getAdjacencyEntityType();
352  }
353  else if (format == ZOLTAN_COMPRESSED_EDGE)
354  {
355  listType = madp->getAdjacencyEntityType();
356  pinType = madp->getPrimaryEntityType();
357  }
358  else {
359  *ierr = ZOLTAN_FATAL;
360  }
361 
362  if (*ierr == ZOLTAN_OK) {
363 
364  // get list IDs
365  const gno_t *Ids;
366  try {
367  madp->getIDsViewOf(listType,Ids);
368  }
369  catch (std::exception &e) {
370  *ierr = ZOLTAN_FATAL;
371  }
372 
373  // get pins
374  const lno_t* offsets;
375  const gno_t* adjIds;
376  try {
377  madp->getAdjsView(listType, pinType, offsets, adjIds);
378  }
379  catch (std::exception &e) {
380  *ierr = ZOLTAN_FATAL;
381  }
382 
383  // copy into Zoltan's memory
384  for (int i=0; i < nLists; i++) {
385  ZOLTAN_ID_PTR idPtr = &(listIds[i*nGidEnt]);
387  listIdx[i] = Teuchos::as<int>(offsets[i]);
388  }
389  listIdx[nLists] = Teuchos::as<int>(offsets[nLists]);
390  for (int i=0; i < nPins; i++) {
391  ZOLTAN_ID_PTR idPtr = &(pinIds[i*nGidEnt]);
392  TPL_Traits<ZOLTAN_ID_PTR,gno_t>::ASSIGN(idPtr, adjIds[i]);
393  }
394  }
395 }
396 
398 // HYPERGRAPH CALLBACKS FROM A HYPERGRAPH MODEL
400 
402 // ZOLTAN_NUM_OBJ_FN
403 template <typename Adapter>
404 static int zoltanHGNumObj_withModel(void *data, int *ierr) {
405  const HyperGraphModel<Adapter>* mdl =
406  static_cast<HyperGraphModel<Adapter>* >(data);
407  *ierr = ZOLTAN_OK;
408  return int(mdl->getLocalNumOwnedVertices());
409 }
410 
412 // ZOLTAN_OBJ_LIST_FN
413 template <typename Adapter>
414 static void zoltanHGObjList_withModel(void *data, int nGidEnt, int nLidEnt,
415  ZOLTAN_ID_PTR gids, ZOLTAN_ID_PTR lids,
416  int wdim, float *wgts, int *ierr)
417 {
418  const HyperGraphModel<Adapter>* mdl =
419  static_cast<HyperGraphModel<Adapter>* >(data);
420  typedef typename Adapter::gno_t gno_t;
421  typedef typename Adapter::lno_t lno_t;
422  typedef typename Adapter::scalar_t scalar_t;
423  typedef StridedData<lno_t, scalar_t> input_t;
424 
425  *ierr = ZOLTAN_OK;
426  ArrayView<const gno_t> Ids;
427  ArrayView<input_t> model_wgts;
428  size_t num_verts = mdl->getVertexList(Ids,model_wgts);
429  ArrayView<bool> isOwner;
430  mdl->getOwnedList(isOwner);
431  int j=0;
432  for (size_t i=0;i<num_verts;i++) {
433  if (isOwner[i]) {
434  ZOLTAN_ID_PTR idPtr = &(gids[j*nGidEnt]);
436  idPtr = &(lids[j*nLidEnt]);
438  j++;
439  }
440  }
441  if (wdim) {
442  int mywdim = mdl->getNumWeightsPerVertex();
443  for (int w = 0; w < wdim; w++) {
444  j=0;
445  if (w < mywdim) {
446  for (size_t i = 0; i < num_verts; i++) {
447  if (isOwner[i]) {
448  wgts[j*wdim+w] = float(model_wgts[w][i]);
449  j++;
450  }
451  }
452  }
453  else {
454  // provide uniform weights
455  for (size_t i = 0; i < num_verts; i++) {
456  if (isOwner[i]) {
457  wgts[j*wdim+w] = 1.;
458  j++;
459  }
460  }
461  }
462  }
463  }
464 }
465 
467 // ZOLTAN_HG_SIZE_CS_FN
468 template <typename Adapter>
469 static void zoltanHGSizeCS_withModel(void *data, int *nEdges, int *nPins,
470  int *format, int *ierr
471 )
472 {
473  *ierr = ZOLTAN_OK;
474  const HyperGraphModel<Adapter>* mdl =
475  static_cast<HyperGraphModel<Adapter>* >(data);
476  *nEdges = mdl->getLocalNumHyperEdges();
477  *nPins = mdl->getLocalNumPins();
478  if (mdl->getCentricView()==HYPEREDGE_CENTRIC)
479  *format = ZOLTAN_COMPRESSED_EDGE;
480  else
481  *format = ZOLTAN_COMPRESSED_VERTEX;
482 }
483 
485 // ZOLTAN_HG_CS_FN
486 template <typename Adapter>
487 static void zoltanHGCS_withModel(void *data, int nGidEnt, int nEdges, int nPins,
488  int format, ZOLTAN_ID_PTR edgeIds,
489  int *edgeIdx, ZOLTAN_ID_PTR pinIds, int *ierr
490 )
491 {
492  *ierr = ZOLTAN_OK;
493  const HyperGraphModel<Adapter>* mdl =
494  static_cast<HyperGraphModel<Adapter>* >(data);
495  typedef typename Adapter::gno_t gno_t;
496  typedef typename Adapter::lno_t lno_t;
497  typedef typename Adapter::scalar_t scalar_t;
498  typedef StridedData<lno_t, scalar_t> input_t;
499 
500  ArrayView<const gno_t> Ids;
501  ArrayView<input_t> wgts;
502  mdl->getEdgeList(Ids,wgts);
503  ArrayView<const gno_t> pinIds_;
504  ArrayView<const lno_t> offsets;
505  ArrayView<input_t> pin_wgts;
506  mdl->getPinList(pinIds_,offsets,pin_wgts);
507  for (int i=0;i<nEdges;i++) {
508  ZOLTAN_ID_PTR idPtr = &(edgeIds[i*nGidEnt]);
510  edgeIdx[i] = Teuchos::as<int>(offsets[i]);
511  }
512 
513  for (int i=0;i<nPins;i++) {
514  ZOLTAN_ID_PTR idPtr = &(pinIds[i*nGidEnt]);
515  TPL_Traits<ZOLTAN_ID_PTR,gno_t>::ASSIGN(idPtr, pinIds_[i]);
516  }
517 }
518 
519 }
520 
521 
522 #endif
static void zoltanHGCS_withModel(void *data, int nGidEnt, int nEdges, int nPins, int format, ZOLTAN_ID_PTR edgeIds, int *edgeIdx, ZOLTAN_ID_PTR pinIds, int *ierr)
size_t getEdgeList(ArrayView< const gno_t > &Ids, ArrayView< input_t > &wgts) const
Sets pointers to this process&#39; hyperedge Ids and their weights.
static int zoltanNumGeom(void *data, int *ierr)
MatrixAdapter defines the adapter interface for matrices.
virtual void getColumnIDsView(const gno_t *&colIds) const
Sets pointer to this process&#39; columns&#39; global IDs.
Defines the MeshAdapter interface.
MeshAdapter defines the interface for mesh input.
virtual size_t getLocalNumOf(MeshEntityType etype) const =0
Returns the global number of mesh entities of MeshEntityType.
virtual bool availAdjs(MeshEntityType source, MeshEntityType target) const
Returns whether a first adjacency combination is available.
size_t getLocalNumOwnedVertices() const
Returns the number vertices on this process that are owned.
Defines the IdentifierAdapter interface.
Defines the VectorAdapter interface.
enum MeshEntityType getAdjacencyEntityType() const
Returns the entity that describes adjacencies between the entities to be partitioned, ordered, colored, etc. That is, a primaryEntityType that contains an adjacencyEntityType are adjacent.
static void zoltanObjList(void *data, int nGidEnt, int nLidEnt, ZOLTAN_ID_PTR gids, ZOLTAN_ID_PTR lids, int wdim, float *wgts, int *ierr)
virtual void getRowIDsView(const gno_t *&rowIds) const
Sets pointer to this process&#39; rows&#39; global IDs.
virtual size_t getLocalNumAdjs(MeshEntityType source, MeshEntityType target) const
Returns the number of first adjacencies on this process.
size_t getVertexList(ArrayView< const gno_t > &Ids, ArrayView< input_t > &wgts) const
Sets pointers to this process&#39; vertex Ids and their weights.
static void zoltanHGCS_withMeshAdapter(void *data, int nGidEnt, int nLists, int nPins, int format, ZOLTAN_ID_PTR listIds, int *listIdx, ZOLTAN_ID_PTR pinIds, int *ierr)
static int zoltanNumObj(void *data, int *ierr)
virtual size_t getLocalNumColumns() const =0
Returns the number of columns on this process.
virtual void getIDsViewOf(MeshEntityType etype, gno_t const *&Ids) const =0
Provide a pointer to this process&#39; identifiers.
static void zoltanHGCS_withMatrixAdapter(void *data, int nGidEnt, int nLists, int nPins, int format, ZOLTAN_ID_PTR listIds, int *listIdx, ZOLTAN_ID_PTR pinIds, int *ierr)
static void zoltanHGSizeCS_withModel(void *data, int *nEdges, int *nPins, int *format, int *ierr)
virtual void getCCSView(const lno_t *&offsets, const gno_t *&rowIds) const
Sets pointers to this process&#39; matrix entries using compressed sparse column (CCS) format...
virtual bool CCSViewAvailable() const
Indicates whether the MatrixAdapter implements a view of the matrix in compressed sparse column (CCS)...
static void zoltanGeom(void *data, int nGidEnt, int nLidEnt, int nObj, ZOLTAN_ID_PTR gids, ZOLTAN_ID_PTR lids, int nDim, double *coords, int *ierr)
virtual void getAdjsView(MeshEntityType source, MeshEntityType target, const lno_t *&offsets, const gno_t *&adjacencyIds) const
Sets pointers to this process&#39; mesh first adjacencies.
size_t getLocalNumPins() const
Returns the local number of pins.
virtual bool CRSViewAvailable() const
Indicates whether the MatrixAdapter implements a view of the matrix in compressed sparse row (CRS) fo...
size_t getOwnedList(ArrayView< bool > &isOwner) const
Sets pointer to the ownership of this processes vertices.
The StridedData class manages lists of weights or coordinates.
int getNumWeightsPerVertex() const
Returns the number (0 or greater) of weights per vertex.
static void ASSIGN(first_t &a, second_t b)
static int zoltanHGNumObj_withModel(void *data, int *ierr)
Traits class to handle conversions between gno_t/lno_t and TPL data types (e.g., ParMETIS&#39;s idx_t...
static void zoltanParts(void *data, int nGidEnt, int nLidEnt, int nObj, ZOLTAN_ID_PTR gids, ZOLTAN_ID_PTR lids, int *parts, int *ierr)
virtual void getCRSView(const lno_t *&offsets, const gno_t *&colIds) const
Sets pointers to this process&#39; matrix entries using compressed sparse row (CRS) format. All matrix adapters must implement either getCRSView or getCCSView, but implementation of both is not required.
size_t getPinList(ArrayView< const gno_t > &pinIds, ArrayView< const lno_t > &offsets, ArrayView< input_t > &wgts) const
Sets pointers to this process&#39; pins global Ids based on the centric view given by getCentricView() ...
static void zoltanHGSizeCS_withMeshAdapter(void *data, int *nLists, int *nPins, int *format, int *ierr)
static void zoltanHGObjList_withModel(void *data, int nGidEnt, int nLidEnt, ZOLTAN_ID_PTR gids, ZOLTAN_ID_PTR lids, int wdim, float *wgts, int *ierr)
enum MeshEntityType getPrimaryEntityType() const
Returns the entity to be partitioned, ordered, colored, etc.
Defines the HyperGraphModel interface.
MeshEntityType
Enumerate entity types for meshes: Regions, Faces, Edges, or Vertices.
Defines the MatrixAdapter interface.
size_t getLocalNumHyperEdges() const
Returns the number of hyper edges on this process. These are all hyper edges that have an adjacency t...
Defines the GraphAdapter interface.
static void zoltanHGSizeCS_withMatrixAdapter(void *data, int *nLists, int *nPins, int *format, int *ierr)
virtual size_t getLocalNumRows() const =0
Returns the number of rows on this process.
virtual size_t getLocalNumEntries() const =0
Returns the number of nonzeros on this process.
A gathering of useful namespace methods.
HyperGraphModel defines the interface required for hyper graph models.
enum MatrixEntityType getPrimaryEntityType() const
Returns the entity to be partitioned, ordered, colored, etc. Valid values are MATRIX_ROW, MATRIX_COLUMN, MATRIX_NONZERO.
CentricView getCentricView() const
Returns the centric view of the hypergraph.