Zoltan2
Loading...
Searching...
No Matches
Zoltan2_AlgZoltanCallbacks.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Zoltan2: A package of combinatorial algorithms for scientific computing
4//
5// Copyright 2012 NTESS and the Zoltan2 contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef _ZOLTAN2_ALGZOLTANCALLBACKS_HPP_
11#define _ZOLTAN2_ALGZOLTANCALLBACKS_HPP_
12
18
19#ifdef HAVE_ZOLTAN2_HYPERGRAPH
21#endif
22
23#include <Zoltan2_Util.hpp>
24#include <Zoltan2_TPLTraits.hpp>
25#include <zoltan_cpp.h>
26
30// Callbacks based on Adapter; specializations provided where needed
31
32namespace Zoltan2 {
33
35// CALLBACKS SHARED BY MANY ADAPTERS
37
39// ZOLTAN_NUM_OBJ_FN
40template <typename Adapter>
41static int zoltanNumObj(void *data, int *ierr) {
42 const Adapter *adp = static_cast<Adapter *>(data);
43 *ierr = ZOLTAN_OK;
44 return int(adp->getLocalNumIDs());
45}
46
48// ZOLTAN_OBJ_LIST_FN
49template <typename Adapter>
50static void zoltanObjList(void *data, int nGidEnt, int nLidEnt,
51 ZOLTAN_ID_PTR gids, ZOLTAN_ID_PTR lids,
52 int wdim, float *wgts, int *ierr)
53{
54 const Adapter *adp = static_cast<Adapter *>(data);
55 typedef typename Adapter::gno_t gno_t;
56 typedef typename Adapter::lno_t lno_t;
57 *ierr = ZOLTAN_OK;
58
59 size_t mynObj = adp->getLocalNumIDs();
60
61 const gno_t *myids = NULL;
62 adp->getIDsView(myids);
63 for (size_t i = 0; i < mynObj; i++) {
64 ZOLTAN_ID_PTR idPtr = &(gids[i*nGidEnt]);
66 idPtr = &(lids[i*nLidEnt]);
68 }
69
70 if (wdim) {
71 int mywdim = adp->getNumWeightsPerID();
72 for (int w = 0; w < wdim; w++) {
73 if (w < mywdim) {
74 // copy weights from adapter
75 const typename Adapter::scalar_t *mywgts;
76 int mystride;
77 adp->getWeightsView(mywgts, mystride, w);
78 for (size_t i = 0; i < mynObj; i++)
79 wgts[i*wdim+w] = float(mywgts[i*mystride]);
80 }
81 else {
82 // provide uniform weights
83 for (size_t i = 0; i < mynObj; i++)
84 wgts[i*wdim+w] = 1.;
85 }
86 }
87 }
88}
89
91// ZOLTAN_PART_MULTI_FN
92template <typename Adapter>
93static void zoltanParts(void *data, int /* nGidEnt */, int nLidEnt, int nObj,
94 ZOLTAN_ID_PTR /* gids */, ZOLTAN_ID_PTR lids,
95 int *parts, int *ierr)
96{
97 typedef typename Adapter::lno_t lno_t;
98 const Adapter *adp = static_cast<Adapter *>(data);
99 *ierr = ZOLTAN_OK;
100 const typename Adapter::part_t *myparts;
101 adp->getPartsView(myparts);
102 size_t numIds = adp->getLocalNumIDs();
103
104 // User parts from input adapter
105 for (int i = 0; i < nObj; i++) {
106 lno_t lidx;
107 if (lids && (static_cast<size_t>(i*nLidEnt)<numIds)) {
108 TPL_Traits<lno_t,ZOLTAN_ID_PTR>::ASSIGN(lidx, &(lids[i*nLidEnt]));
109 parts[i] = int(myparts[lidx]);
110 }
111 }
112}
113
115// ZOLTAN_NUM_GEOM_FN
116template <typename Adapter>
117static int zoltanNumGeom(void *data, int *ierr)
118{
119 const Adapter *adp = static_cast<Adapter *>(data);
120 *ierr = ZOLTAN_OK;
121 return adp->getDimension();
122}
123
125// ZOLTAN_GEOM_MULTI_FN
126template <typename Adapter>
127static void zoltanGeom(void *data, int /* nGidEnt */, int nLidEnt, int nObj,
128 ZOLTAN_ID_PTR /* gids */, ZOLTAN_ID_PTR lids,
129 int nDim, double *coords, int *ierr)
130{
131 typedef typename Adapter::lno_t lno_t;
132 const Adapter *adp = static_cast<Adapter *>(data);
133 *ierr = ZOLTAN_OK;
134 size_t numIds = adp->getLocalNumIDs();
135
136 for (int d = 0; d < nDim; d++) {
137 const typename Adapter::scalar_t *mycoords;
138 int mystride;
139 adp->getCoordinatesView(mycoords, mystride, d);
140 for (int i = 0; i < nObj; i++) {
141 lno_t lidx;
142 if (lids && (static_cast<size_t>(i*nLidEnt)<numIds)) {
143 TPL_Traits<lno_t,ZOLTAN_ID_PTR>::ASSIGN(lidx, &(lids[i*nLidEnt]));
144 coords[i*nDim+d] = double(mycoords[lidx*mystride]);
145 }
146 }
147 }
148}
149
151// HYPERGRAPH CALLBACKS USING A GRAPH ADAPTER
152// Building the most straightforward hypergraph from a graph and, thus,
153// avoiding use of HypergraphModel.
154// Assuming one hyperedge per vertex, containing vertex and all its nbors
156
158// ZOLTAN_HG_SIZE_CS_FN
159template <typename Adapter>
160static void zoltanHGSizeCS_withGraphAdapter(void *data,
161 int *nLists, int *nPins,
162 int *format, int *ierr
163)
164{
165 // Assuming one hyperedge per vertex consisting of vertex and its graph nbors.
166 const Adapter *adp = static_cast<Adapter *>(data);
167 *ierr = ZOLTAN_OK;
168
169 *nLists = Teuchos::as<int>(adp->getLocalNumVertices());
170 *nPins = Teuchos::as<int>(adp->getLocalNumEdges()+adp->getLocalNumVertices());
171 // number of given edges + self pin for each vertex
172 *format = ZOLTAN_COMPRESSED_EDGE;
173}
174
176// ZOLTAN_HG_CS_FN
177template <typename Adapter>
178static void zoltanHGCS_withGraphAdapter(void *data, int nGidEnt, int nLists,
179 int /* nPins */, int /* format */,
180 ZOLTAN_ID_PTR listIds, int *listIdx,
181 ZOLTAN_ID_PTR pinIds, int *ierr
182)
183{
184 // Assuming one hyperedge per vertex consisting of vertex and its graph nbors.
185 typedef typename Adapter::gno_t gno_t;
186 typedef typename Adapter::offset_t offset_t;
187 typedef typename Adapter::user_t user_t;
188 typedef typename Adapter::userCoord_t userCoord_t;
190 static_cast<GraphAdapter<user_t, userCoord_t>* >(data);
191
192 *ierr = ZOLTAN_OK;
193
194 const gno_t *ids;
195 const gno_t *adjIds;
196 const offset_t *offsets;
197
198 try {
199 adp->getIDsView(ids);
200 adp->getEdgesView(offsets, adjIds);
201 }
202 catch (std::exception &) {
203 *ierr = ZOLTAN_FATAL;
204 }
205
206 if (*ierr == ZOLTAN_OK) {
207 // copy into Zoltan's memory
208 for (int i=0; i < nLists; i++) {
209 ZOLTAN_ID_PTR idPtr = &(listIds[i*nGidEnt]);
211 listIdx[i] = Teuchos::as<int>(offsets[i]+i); // adding self pin
212 }
213 listIdx[nLists] = Teuchos::as<int>(offsets[nLists]);
214 int pinCnt = 0;
215 for (int i=0; i < nLists; i++) {
216 ZOLTAN_ID_PTR idPtr = &(pinIds[pinCnt*nGidEnt]);
218 pinCnt++;
219 for (offset_t j = offsets[i]; j < offsets[i+1]; j++) {
220 idPtr = &(pinIds[pinCnt*nGidEnt]);
222 pinCnt++;
223 }
224 }
225 }
226}
227
229// ZOLTAN_HG_SIZE_EDGE_WGTS_FN
230template <typename Adapter>
232 void *data,
233 int *nEdges,
234 int *ierr
235)
236{
237 // Assuming one hyperedge per vertex consisting of vertex and its graph nbors.
238 typedef typename Adapter::user_t user_t;
239 typedef typename Adapter::userCoord_t userCoord_t;
241 static_cast<GraphAdapter<user_t, userCoord_t>* >(data);
242 *ierr = ZOLTAN_OK;
243 *nEdges = Teuchos::as<int>(adp->getLocalNumVertices()); // one edge per vertex
244}
245
247// ZOLTAN_HG_EDGE_WGTS_FN
248template <typename Adapter>
250 void *data,
251 int nGidEnt,
252 int nLidEnt,
253 int nEdges,
254 int /* eWgtDim */,
255 ZOLTAN_ID_PTR edgeGids,
256 ZOLTAN_ID_PTR edgeLids,
257 float *edgeWgts,
258 int *ierr
259)
260{
261 // Assuming one hyperedge per vertex consisting of vertex and its graph nbors.
262 // Hyperedge weight is then sum of edge weights to nbors.
263 typedef typename Adapter::gno_t gno_t;
264 typedef typename Adapter::offset_t offset_t;
265 typedef typename Adapter::scalar_t scalar_t;
266 typedef typename Adapter::user_t user_t;
267 typedef typename Adapter::userCoord_t userCoord_t;
269 static_cast<GraphAdapter<user_t, userCoord_t>* >(data);
270
271 *ierr = ZOLTAN_OK;
272
273 const gno_t *ids;
274 const gno_t *adjIds;
275 const offset_t *offsets;
276 const scalar_t *ewgts;
277 int stride;
278 try {
279 adp->getIDsView(ids);
280 adp->getEdgesView(offsets, adjIds);
281 adp->getEdgeWeightsView(ewgts, stride, 0); // Use only first weight
282 }
283 catch (std::exception &) {
284 *ierr = ZOLTAN_FATAL;
285 }
286 if (ierr == ZOLTAN_OK) {
287 for (int i = 0; i < nEdges; i++) {
288 float sum = 0;
289 for (offset_t j = offsets[i]; j < offsets[i+1]; j++)
290 sum += ewgts[j*stride];
291 ZOLTAN_ID_PTR idPtr = &(edgeGids[i*nGidEnt]);
293 if (nLidEnt) {
294 idPtr = &(edgeLids[i*nLidEnt]);
296 }
297 edgeWgts[i] = sum;
298 }
299 }
300}
301
303// HYPERGRAPH CALLBACKS USING A MATRIX ADAPTER
304// Building the most straightforward hypergraph from a matrix and, thus,
305// avoiding use of HypergraphModel.
306// Assuming vertices are rows or columns, and pins are nonzeros.
308
310// ZOLTAN_HG_SIZE_CS_FN
311template <typename Adapter>
312static void zoltanHGSizeCS_withMatrixAdapter(void *data,
313 int *nLists, int *nPins,
314 int *format, int *ierr
315)
316{
317 *ierr = ZOLTAN_OK;
318 typedef typename Adapter::user_t user_t;
319 const MatrixAdapter<user_t>* madp = static_cast<MatrixAdapter<user_t>* >(data);
320
321 *nPins = madp->getLocalNumEntries();
322
324 if (etype == MATRIX_ROW && madp->CRSViewAvailable()) {
325 *nLists = madp->getLocalNumRows();
326 *format = ZOLTAN_COMPRESSED_VERTEX;
327 }
328 else if (etype == MATRIX_ROW && madp->CCSViewAvailable()) {
329 *nLists = madp->getLocalNumColumns();
330 *format = ZOLTAN_COMPRESSED_EDGE;
331 }
332 else if (etype == MATRIX_COLUMN && madp->CRSViewAvailable()) {
333 *nLists = madp->getLocalNumRows();
334 *format = ZOLTAN_COMPRESSED_EDGE;
335 }
336 else if (etype == MATRIX_COLUMN && madp->CCSViewAvailable()) {
337 *nLists = madp->getLocalNumColumns();
338 *format = ZOLTAN_COMPRESSED_VERTEX;
339 }
340 else {
341 // Need either CRSView or CCSView.
342 // Also, not yet implemented for matrix nonzeros;
343 // may need a hypergraph model.
344 std::cout << "For hypergraph partitioning, "
345 << "CRSView or CCSView is needed in MatrixAdapter" << std::endl;
346 *ierr = ZOLTAN_FATAL;
347 }
348}
349
351// ZOLTAN_HG_CS_FN
352template <typename Adapter>
353static void zoltanHGCS_withMatrixAdapter(void *data, int nGidEnt, int nLists,
354 int nPins, int format,
355 ZOLTAN_ID_PTR listIds, int *listIdx,
356 ZOLTAN_ID_PTR pinIds, int *ierr
357)
358{
359 *ierr = ZOLTAN_OK;
360 typedef typename Adapter::gno_t gno_t;
361 // typedef typename Adapter::lno_t lno_t;
362 typedef typename Adapter::offset_t offset_t;
363 typedef typename Adapter::user_t user_t;
364 const MatrixAdapter<user_t>* madp = static_cast<MatrixAdapter<user_t>* >(data);
365
366 const gno_t *Ids;
367 ArrayRCP<const gno_t> pIds;
368 ArrayRCP<const offset_t> offsets;
369
370 // Get the pins and list IDs.
371 if (madp->CRSViewAvailable()) {
372 try {
373 madp->getRowIDsView(Ids);
374 madp->getCRSView(offsets, pIds);
375 }
376 catch (std::exception &) {
377 *ierr = ZOLTAN_FATAL;
378 }
379 }
380 else if (madp->CCSViewAvailable()) {
381 try {
382 madp->getColumnIDsView(Ids);
383 madp->getCCSView(offsets, pIds);
384 }
385 catch (std::exception &) {
386 *ierr = ZOLTAN_FATAL;
387 }
388 }
389 else {
390 // Need either CRSView or CCSView.
391 *ierr = ZOLTAN_FATAL;
392 }
393
394 if (*ierr == ZOLTAN_OK) {
395 // copy into Zoltan's memory
396 for (int i=0; i < nLists; i++) {
397 ZOLTAN_ID_PTR idPtr = &(listIds[i*nGidEnt]);
399 listIdx[i] = Teuchos::as<int>(offsets[i]);
400 }
401 listIdx[nLists] = Teuchos::as<int>(offsets[nLists]);
402 for (int i=0; i < nPins; i++) {
403 ZOLTAN_ID_PTR idPtr = &(pinIds[i*nGidEnt]);
405 }
406 }
407}
408
410// TODO: GRAPH ADAPTER CALLBACKS
411
413// HYPERGRAPH CALLBACKS USING A MESH ADAPTER
414// Implement Boman/Chevalier's hypergraph mesh model
415// Skip explicit construction of a HypergraphModel
416// Return either (depending on available adjacencies):
417// + for each primary entity (vtx), the list of assoc adjacency entities (edges)
418// + for each adjacency entity (edge), the list of assoc primary entities (vtx)
420
422// ZOLTAN_HG_SIZE_CS_FN
423template <typename Adapter>
424static void zoltanHGSizeCS_withMeshAdapter(void *data, int *nLists, int *nPins,
425 int *format, int *ierr
426)
427{
428 *ierr = ZOLTAN_OK;
429 typedef typename Adapter::user_t user_t;
430 const MeshAdapter<user_t>* madp = static_cast<MeshAdapter<user_t>* >(data);
431 if (madp->availAdjs(madp->getPrimaryEntityType(),
432 madp->getAdjacencyEntityType()))
433 {
434 *nLists = madp->getLocalNumOf(madp->getPrimaryEntityType());
435 *nPins = madp->getLocalNumAdjs(madp->getPrimaryEntityType(),
436 madp->getAdjacencyEntityType());
437 *format = ZOLTAN_COMPRESSED_VERTEX;
438 }
439 else if (madp->availAdjs(madp->getAdjacencyEntityType(),
440 madp->getPrimaryEntityType()))
441 {
442 *nLists = madp->getLocalNumOf(madp->getAdjacencyEntityType());
443 *nPins = madp->getLocalNumAdjs(madp->getAdjacencyEntityType(),
444 madp->getPrimaryEntityType());
445 *format = ZOLTAN_COMPRESSED_EDGE;
446 }
447 else {
448 std::cout << "For hypergraph partitioning, need first adjacencies "
449 << "(availAdjs, getLocalNumAdjs, getAdjsView) "
450 << "in MeshAdapter." << std::endl;
451 *nLists = 0;
452 *nPins = 0;
453 *format = -1*ZOLTAN_COMPRESSED_VERTEX;
454 *ierr = ZOLTAN_FATAL;
455 }
456}
457
459// ZOLTAN_HG_CS_FN
460template <typename Adapter>
462 void *data, int nGidEnt, int nLists, int nPins,
463 int format, ZOLTAN_ID_PTR listIds,
464 int *listIdx, ZOLTAN_ID_PTR pinIds, int *ierr
465)
466{
467 *ierr = ZOLTAN_OK;
468 typedef typename Adapter::gno_t gno_t;
469 // typedef typename Adapter::lno_t lno_t;
470 typedef typename Adapter::user_t user_t;
471 typedef typename Adapter::offset_t offset_t;
472 const MeshAdapter<user_t>* madp = static_cast<MeshAdapter<user_t>*>(data);
473
474 // Select listType and pinType based on format specified in ZOLTAN_HG_CS_SIZE_FN
475 MeshEntityType listType, pinType;
476 if (format == ZOLTAN_COMPRESSED_VERTEX)
477 {
478 listType = madp->getPrimaryEntityType();
479 pinType = madp->getAdjacencyEntityType();
480 }
481 else if (format == ZOLTAN_COMPRESSED_EDGE)
482 {
483 listType = madp->getAdjacencyEntityType();
484 pinType = madp->getPrimaryEntityType();
485 }
486 else {
487 *ierr = ZOLTAN_FATAL;
488 }
489
490 if (*ierr == ZOLTAN_OK) {
491
492 // get list IDs
493 const gno_t *Ids;
494 try {
495 madp->getIDsViewOf(listType,Ids);
496 }
497 catch (std::exception &) {
498 *ierr = ZOLTAN_FATAL;
499 }
500
501 // get pins
502 const offset_t* offsets;
503 const gno_t* adjIds;
504 try {
505 madp->getAdjsView(listType, pinType, offsets, adjIds);
506 }
507 catch (std::exception &) {
508 *ierr = ZOLTAN_FATAL;
509 }
510
511 // copy into Zoltan's memory
512 for (int i=0; i < nLists; i++) {
513 ZOLTAN_ID_PTR idPtr = &(listIds[i*nGidEnt]);
515 listIdx[i] = Teuchos::as<int>(offsets[i]);
516 }
517 listIdx[nLists] = Teuchos::as<int>(offsets[nLists]);
518 for (int i=0; i < nPins; i++) {
519 ZOLTAN_ID_PTR idPtr = &(pinIds[i*nGidEnt]);
521 }
522 }
523}
524
526// HYPERGRAPH CALLBACKS FROM A HYPERGRAPH MODEL
528#ifdef HAVE_ZOLTAN2_HYPERGRAPH
529
531// ZOLTAN_NUM_OBJ_FN
532template <typename Adapter>
533static int zoltanHGNumObj_withModel(void *data, int *ierr) {
534 const HyperGraphModel<Adapter>* mdl =
535 static_cast<HyperGraphModel<Adapter>* >(data);
536 *ierr = ZOLTAN_OK;
537 return int(mdl->getLocalNumOwnedVertices());
538}
539
541// ZOLTAN_OBJ_LIST_FN
542template <typename Adapter>
543static void zoltanHGObjList_withModel(void *data, int nGidEnt, int nLidEnt,
544 ZOLTAN_ID_PTR gids, ZOLTAN_ID_PTR lids,
545 int wdim, float *wgts, int *ierr)
546{
547 const HyperGraphModel<Adapter>* mdl =
548 static_cast<HyperGraphModel<Adapter>* >(data);
549 typedef typename Adapter::gno_t gno_t;
550 typedef typename Adapter::lno_t lno_t;
551 typedef typename Adapter::scalar_t scalar_t;
552 typedef StridedData<lno_t, scalar_t> input_t;
553
554 *ierr = ZOLTAN_OK;
555 ArrayView<const gno_t> Ids;
556 ArrayView<input_t> model_wgts;
557 size_t num_verts = mdl->getVertexList(Ids,model_wgts);
558 ArrayView<bool> isOwner;
559 mdl->getOwnedList(isOwner);
560 int j=0;
561 for (size_t i=0;i<num_verts;i++) {
562 if (isOwner[i]) {
563 ZOLTAN_ID_PTR idPtr = &(gids[j*nGidEnt]);
565 idPtr = &(lids[j*nLidEnt]);
567 j++;
568 }
569 }
570 if (wdim) {
571 int mywdim = mdl->getNumWeightsPerVertex();
572 for (int w = 0; w < wdim; w++) {
573 j=0;
574 if (w < mywdim) {
575 for (size_t i = 0; i < num_verts; i++) {
576 if (isOwner[i]) {
577 wgts[j*wdim+w] = float(model_wgts[w][i]);
578 j++;
579 }
580 }
581 }
582 else {
583 // provide uniform weights
584 for (size_t i = 0; i < num_verts; i++) {
585 if (isOwner[i]) {
586 wgts[j*wdim+w] = 1.;
587 j++;
588 }
589 }
590 }
591 }
592 }
593}
594
596// ZOLTAN_HG_SIZE_CS_FN
597template <typename Adapter>
598static void zoltanHGSizeCS_withModel(void *data, int *nEdges, int *nPins,
599 int *format, int *ierr
600)
601{
602 *ierr = ZOLTAN_OK;
603 const HyperGraphModel<Adapter>* mdl =
604 static_cast<HyperGraphModel<Adapter>* >(data);
605 *nEdges = mdl->getLocalNumHyperEdges();
606 *nPins = mdl->getLocalNumPins();
607 if (mdl->getCentricView()==HYPEREDGE_CENTRIC)
608 *format = ZOLTAN_COMPRESSED_EDGE;
609 else
610 *format = ZOLTAN_COMPRESSED_VERTEX;
611}
612
614// ZOLTAN_HG_CS_FN
615template <typename Adapter>
616static void zoltanHGCS_withModel(void *data, int nGidEnt, int nEdges, int nPins,
617 int format, ZOLTAN_ID_PTR edgeIds,
618 int *edgeIdx, ZOLTAN_ID_PTR pinIds, int *ierr
619)
620{
621 *ierr = ZOLTAN_OK;
622 const HyperGraphModel<Adapter>* mdl =
623 static_cast<HyperGraphModel<Adapter>* >(data);
624 typedef typename Adapter::gno_t gno_t;
625 typedef typename Adapter::lno_t lno_t;
626 typedef typename Adapter::offset_t offset_t;
627 typedef typename Adapter::scalar_t scalar_t;
628 typedef StridedData<lno_t, scalar_t> input_t;
629
630 ArrayView<const gno_t> Ids;
631 ArrayView<input_t> wgts;
632 mdl->getEdgeList(Ids,wgts);
633 ArrayView<const gno_t> pinIds_;
634 ArrayView<const offset_t> offsets;
635 ArrayView<input_t> pin_wgts;
636 mdl->getPinList(pinIds_,offsets,pin_wgts);
637 for (int i=0;i<nEdges;i++) {
638 ZOLTAN_ID_PTR idPtr = &(edgeIds[i*nGidEnt]);
640 edgeIdx[i] = Teuchos::as<int>(offsets[i]);
641 }
642
643 for (int i=0;i<nPins;i++) {
644 ZOLTAN_ID_PTR idPtr = &(pinIds[i*nGidEnt]);
646 }
647}
648
649#endif // HAVE_ZOLTAN2_HYPERGRAPH
650
651}
652
653
654#endif
Zoltan2::BasicUserTypes< zscalar_t, zlno_t, zgno_t > user_t
Definition Metric.cpp:39
Defines the GraphAdapter interface.
Defines the HyperGraphModel interface.
Defines the IdentifierAdapter interface.
Defines the MatrixAdapter interface.
Defines the MeshAdapter interface.
Traits class to handle conversions between gno_t/lno_t and TPL data types (e.g., ParMETIS's idx_t,...
A gathering of useful namespace methods.
Defines the VectorAdapter interface.
GraphAdapter defines the interface for graph-based user data.
virtual size_t getLocalNumVertices() const =0
Returns the number of vertices on this process.
virtual void getEdgeWeightsView(const scalar_t *&weights, int &stride, int=0) const
Provide a pointer to the edge weights, if any.
virtual void getEdgesView(const offset_t *&offsets, const gno_t *&adjIds) const =0
Gets adjacency lists for all vertices in a compressed sparse row (CSR) format.
void getIDsView(const gno_t *&Ids) const override
Provide a pointer to this process' identifiers.
HyperGraphModel defines the interface required for hyper graph models.
size_t getLocalNumHyperEdges() const
Returns the number of hyper edges on this process. These are all hyper edges that have an adjacency t...
MatrixAdapter defines the adapter interface for matrices.
virtual size_t getLocalNumEntries() const =0
Returns the number of nonzeros on this process.
virtual void getColumnIDsView(const gno_t *&colIds) const
Sets pointer to this process' columns' global IDs.
virtual void getCCSView(ArrayRCP< const offset_t > &offsets, ArrayRCP< const gno_t > &rowIds) const
Sets pointers to this process' matrix entries using compressed sparse column (CCS) format....
virtual size_t getLocalNumColumns() const =0
Returns the number of columns on this process.
virtual bool CCSViewAvailable() const
Indicates whether the MatrixAdapter implements a view of the matrix in compressed sparse column (CCS)...
virtual void getRowIDsView(const gno_t *&rowIds) const
Sets pointer to this process' rows' global IDs.
virtual bool CRSViewAvailable() const
Indicates whether the MatrixAdapter implements a view of the matrix in compressed sparse row (CRS) fo...
enum MatrixEntityType getPrimaryEntityType() const
Returns the entity to be partitioned, ordered, colored, etc. Valid values are MATRIX_ROW,...
virtual size_t getLocalNumRows() const =0
Returns the number of rows on this process.
virtual void getCRSView(ArrayRCP< const offset_t > &offsets, ArrayRCP< const gno_t > &colIds) const
Sets pointers to this process' matrix entries using compressed sparse row (CRS) format....
MeshAdapter defines the interface for mesh input.
virtual bool availAdjs(MeshEntityType source, MeshEntityType target) const
Returns whether a first adjacency combination is available.
enum MeshEntityType getAdjacencyEntityType() const
Returns the entity that describes adjacencies between the entities to be partitioned,...
virtual size_t getLocalNumOf(MeshEntityType etype) const =0
Returns the global number of mesh entities of MeshEntityType.
virtual size_t getLocalNumAdjs(MeshEntityType source, MeshEntityType target) const
Returns the number of first adjacencies on this process.
virtual void getIDsViewOf(MeshEntityType etype, gno_t const *&Ids) const =0
Provide a pointer to this process' identifiers.
virtual void getAdjsView(MeshEntityType source, MeshEntityType target, const offset_t *&offsets, const gno_t *&adjacencyIds) const
Sets pointers to this process' mesh first adjacencies.
enum MeshEntityType getPrimaryEntityType() const
Returns the entity to be partitioned, ordered, colored, etc.
The StridedData class manages lists of weights or coordinates.
map_t::local_ordinal_type lno_t
Created by mbenlioglu on Aug 31, 2020.
static void zoltanHGEdgeWts_withGraphAdapter(void *data, int nGidEnt, int nLidEnt, int nEdges, int, ZOLTAN_ID_PTR edgeGids, ZOLTAN_ID_PTR edgeLids, float *edgeWgts, int *ierr)
static void zoltanObjList(void *data, int nGidEnt, int nLidEnt, ZOLTAN_ID_PTR gids, ZOLTAN_ID_PTR lids, int wdim, float *wgts, int *ierr)
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 void zoltanHGSizeCS_withMatrixAdapter(void *data, int *nLists, int *nPins, int *format, int *ierr)
static void zoltanHGSizeCS_withGraphAdapter(void *data, int *nLists, int *nPins, int *format, int *ierr)
static int zoltanNumObj(void *data, int *ierr)
static void zoltanHGCS_withGraphAdapter(void *data, int nGidEnt, int nLists, int, int, ZOLTAN_ID_PTR listIds, int *listIdx, ZOLTAN_ID_PTR pinIds, int *ierr)
static int zoltanNumGeom(void *data, int *ierr)
static void zoltanParts(void *data, int, int nLidEnt, int nObj, ZOLTAN_ID_PTR, ZOLTAN_ID_PTR lids, int *parts, int *ierr)
MeshEntityType
Enumerate entity types for meshes: Regions, Faces, Edges, or Vertices.
static void zoltanHGSizeCS_withMeshAdapter(void *data, int *nLists, int *nPins, int *format, int *ierr)
static void zoltanGeom(void *data, int, int nLidEnt, int nObj, ZOLTAN_ID_PTR, ZOLTAN_ID_PTR lids, int nDim, double *coords, int *ierr)
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 zoltanHGSizeEdgeWts_withGraphAdapter(void *data, int *nEdges, int *ierr)
static void ASSIGN(first_t &a, second_t b)