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 // User parts from input adapter
103 for (int i = 0; i < nObj; i++) {
104 lno_t lidx;
105 TPL_Traits<lno_t,ZOLTAN_ID_PTR>::ASSIGN(lidx, &(lids[i*nLidEnt]));
106 parts[i] = int(myparts[lidx]);
107 }
108}
109
111// ZOLTAN_NUM_GEOM_FN
112template <typename Adapter>
113static int zoltanNumGeom(void *data, int *ierr)
114{
115 const Adapter *adp = static_cast<Adapter *>(data);
116 *ierr = ZOLTAN_OK;
117 return adp->getDimension();
118}
119
121// ZOLTAN_GEOM_MULTI_FN
122template <typename Adapter>
123static void zoltanGeom(void *data, int /* nGidEnt */, int nLidEnt, int nObj,
124 ZOLTAN_ID_PTR /* gids */, ZOLTAN_ID_PTR lids,
125 int nDim, double *coords, int *ierr)
126{
127 typedef typename Adapter::lno_t lno_t;
128 const Adapter *adp = static_cast<Adapter *>(data);
129 *ierr = ZOLTAN_OK;
130
131 for (int d = 0; d < nDim; d++) {
132 const typename Adapter::scalar_t *mycoords;
133 int mystride;
134 adp->getCoordinatesView(mycoords, mystride, d);
135 for (int i = 0; i < nObj; i++) {
136 lno_t lidx;
137 TPL_Traits<lno_t,ZOLTAN_ID_PTR>::ASSIGN(lidx, &(lids[i*nLidEnt]));
138 coords[i*nDim+d] = double(mycoords[lidx*mystride]);
139 }
140 }
141}
142
144// HYPERGRAPH CALLBACKS USING A GRAPH ADAPTER
145// Building the most straightforward hypergraph from a graph and, thus,
146// avoiding use of HypergraphModel.
147// Assuming one hyperedge per vertex, containing vertex and all its nbors
149
151// ZOLTAN_HG_SIZE_CS_FN
152template <typename Adapter>
153static void zoltanHGSizeCS_withGraphAdapter(void *data,
154 int *nLists, int *nPins,
155 int *format, int *ierr
156)
157{
158 // Assuming one hyperedge per vertex consisting of vertex and its graph nbors.
159 const Adapter *adp = static_cast<Adapter *>(data);
160 *ierr = ZOLTAN_OK;
161
162 *nLists = Teuchos::as<int>(adp->getLocalNumVertices());
163 *nPins = Teuchos::as<int>(adp->getLocalNumEdges()+adp->getLocalNumVertices());
164 // number of given edges + self pin for each vertex
165 *format = ZOLTAN_COMPRESSED_EDGE;
166}
167
169// ZOLTAN_HG_CS_FN
170template <typename Adapter>
171static void zoltanHGCS_withGraphAdapter(void *data, int nGidEnt, int nLists,
172 int /* nPins */, int /* format */,
173 ZOLTAN_ID_PTR listIds, int *listIdx,
174 ZOLTAN_ID_PTR pinIds, int *ierr
175)
176{
177 // Assuming one hyperedge per vertex consisting of vertex and its graph nbors.
178 typedef typename Adapter::gno_t gno_t;
179 typedef typename Adapter::offset_t offset_t;
180 typedef typename Adapter::user_t user_t;
181 typedef typename Adapter::userCoord_t userCoord_t;
183 static_cast<GraphAdapter<user_t, userCoord_t>* >(data);
184
185 *ierr = ZOLTAN_OK;
186
187 const gno_t *ids;
188 const gno_t *adjIds;
189 const offset_t *offsets;
190
191 try {
192 adp->getIDsView(ids);
193 adp->getEdgesView(offsets, adjIds);
194 }
195 catch (std::exception &) {
196 *ierr = ZOLTAN_FATAL;
197 }
198
199 if (*ierr == ZOLTAN_OK) {
200 // copy into Zoltan's memory
201 for (int i=0; i < nLists; i++) {
202 ZOLTAN_ID_PTR idPtr = &(listIds[i*nGidEnt]);
204 listIdx[i] = Teuchos::as<int>(offsets[i]+i); // adding self pin
205 }
206 listIdx[nLists] = Teuchos::as<int>(offsets[nLists]);
207 int pinCnt = 0;
208 for (int i=0; i < nLists; i++) {
209 ZOLTAN_ID_PTR idPtr = &(pinIds[pinCnt*nGidEnt]);
211 pinCnt++;
212 for (offset_t j = offsets[i]; j < offsets[i+1]; j++) {
213 idPtr = &(pinIds[pinCnt*nGidEnt]);
215 pinCnt++;
216 }
217 }
218 }
219}
220
222// ZOLTAN_HG_SIZE_EDGE_WGTS_FN
223template <typename Adapter>
225 void *data,
226 int *nEdges,
227 int *ierr
228)
229{
230 // Assuming one hyperedge per vertex consisting of vertex and its graph nbors.
231 typedef typename Adapter::user_t user_t;
232 typedef typename Adapter::userCoord_t userCoord_t;
234 static_cast<GraphAdapter<user_t, userCoord_t>* >(data);
235 *ierr = ZOLTAN_OK;
236 *nEdges = Teuchos::as<int>(adp->getLocalNumVertices()); // one edge per vertex
237}
238
240// ZOLTAN_HG_EDGE_WGTS_FN
241template <typename Adapter>
243 void *data,
244 int nGidEnt,
245 int nLidEnt,
246 int nEdges,
247 int /* eWgtDim */,
248 ZOLTAN_ID_PTR edgeGids,
249 ZOLTAN_ID_PTR edgeLids,
250 float *edgeWgts,
251 int *ierr
252)
253{
254 // Assuming one hyperedge per vertex consisting of vertex and its graph nbors.
255 // Hyperedge weight is then sum of edge weights to nbors.
256 typedef typename Adapter::gno_t gno_t;
257 typedef typename Adapter::offset_t offset_t;
258 typedef typename Adapter::scalar_t scalar_t;
259 typedef typename Adapter::user_t user_t;
260 typedef typename Adapter::userCoord_t userCoord_t;
262 static_cast<GraphAdapter<user_t, userCoord_t>* >(data);
263
264 *ierr = ZOLTAN_OK;
265
266 const gno_t *ids;
267 const gno_t *adjIds;
268 const offset_t *offsets;
269 const scalar_t *ewgts;
270 int stride;
271 try {
272 adp->getIDsView(ids);
273 adp->getEdgesView(offsets, adjIds);
274 adp->getEdgeWeightsView(ewgts, stride, 0); // Use only first weight
275 }
276 catch (std::exception &) {
277 *ierr = ZOLTAN_FATAL;
278 }
279 if (ierr == ZOLTAN_OK) {
280 for (int i = 0; i < nEdges; i++) {
281 float sum = 0;
282 for (offset_t j = offsets[i]; j < offsets[i+1]; j++)
283 sum += ewgts[j*stride];
284 ZOLTAN_ID_PTR idPtr = &(edgeGids[i*nGidEnt]);
286 if (nLidEnt) {
287 idPtr = &(edgeLids[i*nLidEnt]);
289 }
290 edgeWgts[i] = sum;
291 }
292 }
293}
294
296// HYPERGRAPH CALLBACKS USING A MATRIX ADAPTER
297// Building the most straightforward hypergraph from a matrix and, thus,
298// avoiding use of HypergraphModel.
299// Assuming vertices are rows or columns, and pins are nonzeros.
301
303// ZOLTAN_HG_SIZE_CS_FN
304template <typename Adapter>
305static void zoltanHGSizeCS_withMatrixAdapter(void *data,
306 int *nLists, int *nPins,
307 int *format, int *ierr
308)
309{
310 *ierr = ZOLTAN_OK;
311 typedef typename Adapter::user_t user_t;
312 const MatrixAdapter<user_t>* madp = static_cast<MatrixAdapter<user_t>* >(data);
313
314 *nPins = madp->getLocalNumEntries();
315
317 if (etype == MATRIX_ROW && madp->CRSViewAvailable()) {
318 *nLists = madp->getLocalNumRows();
319 *format = ZOLTAN_COMPRESSED_VERTEX;
320 }
321 else if (etype == MATRIX_ROW && madp->CCSViewAvailable()) {
322 *nLists = madp->getLocalNumColumns();
323 *format = ZOLTAN_COMPRESSED_EDGE;
324 }
325 else if (etype == MATRIX_COLUMN && madp->CRSViewAvailable()) {
326 *nLists = madp->getLocalNumRows();
327 *format = ZOLTAN_COMPRESSED_EDGE;
328 }
329 else if (etype == MATRIX_COLUMN && madp->CCSViewAvailable()) {
330 *nLists = madp->getLocalNumColumns();
331 *format = ZOLTAN_COMPRESSED_VERTEX;
332 }
333 else {
334 // Need either CRSView or CCSView.
335 // Also, not yet implemented for matrix nonzeros;
336 // may need a hypergraph model.
337 std::cout << "For hypergraph partitioning, "
338 << "CRSView or CCSView is needed in MatrixAdapter" << std::endl;
339 *ierr = ZOLTAN_FATAL;
340 }
341}
342
344// ZOLTAN_HG_CS_FN
345template <typename Adapter>
346static void zoltanHGCS_withMatrixAdapter(void *data, int nGidEnt, int nLists,
347 int nPins, int format,
348 ZOLTAN_ID_PTR listIds, int *listIdx,
349 ZOLTAN_ID_PTR pinIds, int *ierr
350)
351{
352 *ierr = ZOLTAN_OK;
353 typedef typename Adapter::gno_t gno_t;
354 // typedef typename Adapter::lno_t lno_t;
355 typedef typename Adapter::offset_t offset_t;
356 typedef typename Adapter::user_t user_t;
357 const MatrixAdapter<user_t>* madp = static_cast<MatrixAdapter<user_t>* >(data);
358
359 const gno_t *Ids;
360 ArrayRCP<const gno_t> pIds;
361 ArrayRCP<const offset_t> offsets;
362
363 // Get the pins and list IDs.
364 if (madp->CRSViewAvailable()) {
365 try {
366 madp->getRowIDsView(Ids);
367 madp->getCRSView(offsets, pIds);
368 }
369 catch (std::exception &) {
370 *ierr = ZOLTAN_FATAL;
371 }
372 }
373 else if (madp->CCSViewAvailable()) {
374 try {
375 madp->getColumnIDsView(Ids);
376 madp->getCCSView(offsets, pIds);
377 }
378 catch (std::exception &) {
379 *ierr = ZOLTAN_FATAL;
380 }
381 }
382 else {
383 // Need either CRSView or CCSView.
384 *ierr = ZOLTAN_FATAL;
385 }
386
387 if (*ierr == ZOLTAN_OK) {
388 // copy into Zoltan's memory
389 for (int i=0; i < nLists; i++) {
390 ZOLTAN_ID_PTR idPtr = &(listIds[i*nGidEnt]);
392 listIdx[i] = Teuchos::as<int>(offsets[i]);
393 }
394 listIdx[nLists] = Teuchos::as<int>(offsets[nLists]);
395 for (int i=0; i < nPins; i++) {
396 ZOLTAN_ID_PTR idPtr = &(pinIds[i*nGidEnt]);
398 }
399 }
400}
401
403// TODO: GRAPH ADAPTER CALLBACKS
404
406// HYPERGRAPH CALLBACKS USING A MESH ADAPTER
407// Implement Boman/Chevalier's hypergraph mesh model
408// Skip explicit construction of a HypergraphModel
409// Return either (depending on available adjacencies):
410// + for each primary entity (vtx), the list of assoc adjacency entities (edges)
411// + for each adjacency entity (edge), the list of assoc primary entities (vtx)
413
415// ZOLTAN_HG_SIZE_CS_FN
416template <typename Adapter>
417static void zoltanHGSizeCS_withMeshAdapter(void *data, int *nLists, int *nPins,
418 int *format, int *ierr
419)
420{
421 *ierr = ZOLTAN_OK;
422 typedef typename Adapter::user_t user_t;
423 const MeshAdapter<user_t>* madp = static_cast<MeshAdapter<user_t>* >(data);
424 if (madp->availAdjs(madp->getPrimaryEntityType(),
425 madp->getAdjacencyEntityType()))
426 {
427 *nLists = madp->getLocalNumOf(madp->getPrimaryEntityType());
428 *nPins = madp->getLocalNumAdjs(madp->getPrimaryEntityType(),
429 madp->getAdjacencyEntityType());
430 *format = ZOLTAN_COMPRESSED_VERTEX;
431 }
432 else if (madp->availAdjs(madp->getAdjacencyEntityType(),
433 madp->getPrimaryEntityType()))
434 {
435 *nLists = madp->getLocalNumOf(madp->getAdjacencyEntityType());
436 *nPins = madp->getLocalNumAdjs(madp->getAdjacencyEntityType(),
437 madp->getPrimaryEntityType());
438 *format = ZOLTAN_COMPRESSED_EDGE;
439 }
440 else {
441 std::cout << "For hypergraph partitioning, need first adjacencies "
442 << "(availAdjs, getLocalNumAdjs, getAdjsView) "
443 << "in MeshAdapter." << std::endl;
444 *nLists = 0;
445 *nPins = 0;
446 *format = -1*ZOLTAN_COMPRESSED_VERTEX;
447 *ierr = ZOLTAN_FATAL;
448 }
449}
450
452// ZOLTAN_HG_CS_FN
453template <typename Adapter>
455 void *data, int nGidEnt, int nLists, int nPins,
456 int format, ZOLTAN_ID_PTR listIds,
457 int *listIdx, ZOLTAN_ID_PTR pinIds, int *ierr
458)
459{
460 *ierr = ZOLTAN_OK;
461 typedef typename Adapter::gno_t gno_t;
462 // typedef typename Adapter::lno_t lno_t;
463 typedef typename Adapter::user_t user_t;
464 typedef typename Adapter::offset_t offset_t;
465 const MeshAdapter<user_t>* madp = static_cast<MeshAdapter<user_t>*>(data);
466
467 // Select listType and pinType based on format specified in ZOLTAN_HG_CS_SIZE_FN
468 MeshEntityType listType, pinType;
469 if (format == ZOLTAN_COMPRESSED_VERTEX)
470 {
471 listType = madp->getPrimaryEntityType();
472 pinType = madp->getAdjacencyEntityType();
473 }
474 else if (format == ZOLTAN_COMPRESSED_EDGE)
475 {
476 listType = madp->getAdjacencyEntityType();
477 pinType = madp->getPrimaryEntityType();
478 }
479 else {
480 *ierr = ZOLTAN_FATAL;
481 }
482
483 if (*ierr == ZOLTAN_OK) {
484
485 // get list IDs
486 const gno_t *Ids;
487 try {
488 madp->getIDsViewOf(listType,Ids);
489 }
490 catch (std::exception &) {
491 *ierr = ZOLTAN_FATAL;
492 }
493
494 // get pins
495 const offset_t* offsets;
496 const gno_t* adjIds;
497 try {
498 madp->getAdjsView(listType, pinType, offsets, adjIds);
499 }
500 catch (std::exception &) {
501 *ierr = ZOLTAN_FATAL;
502 }
503
504 // copy into Zoltan's memory
505 for (int i=0; i < nLists; i++) {
506 ZOLTAN_ID_PTR idPtr = &(listIds[i*nGidEnt]);
508 listIdx[i] = Teuchos::as<int>(offsets[i]);
509 }
510 listIdx[nLists] = Teuchos::as<int>(offsets[nLists]);
511 for (int i=0; i < nPins; i++) {
512 ZOLTAN_ID_PTR idPtr = &(pinIds[i*nGidEnt]);
514 }
515 }
516}
517
519// HYPERGRAPH CALLBACKS FROM A HYPERGRAPH MODEL
521#ifdef HAVE_ZOLTAN2_HYPERGRAPH
522
524// ZOLTAN_NUM_OBJ_FN
525template <typename Adapter>
526static int zoltanHGNumObj_withModel(void *data, int *ierr) {
527 const HyperGraphModel<Adapter>* mdl =
528 static_cast<HyperGraphModel<Adapter>* >(data);
529 *ierr = ZOLTAN_OK;
530 return int(mdl->getLocalNumOwnedVertices());
531}
532
534// ZOLTAN_OBJ_LIST_FN
535template <typename Adapter>
536static void zoltanHGObjList_withModel(void *data, int nGidEnt, int nLidEnt,
537 ZOLTAN_ID_PTR gids, ZOLTAN_ID_PTR lids,
538 int wdim, float *wgts, int *ierr)
539{
540 const HyperGraphModel<Adapter>* mdl =
541 static_cast<HyperGraphModel<Adapter>* >(data);
542 typedef typename Adapter::gno_t gno_t;
543 typedef typename Adapter::lno_t lno_t;
544 typedef typename Adapter::scalar_t scalar_t;
545 typedef StridedData<lno_t, scalar_t> input_t;
546
547 *ierr = ZOLTAN_OK;
548 ArrayView<const gno_t> Ids;
549 ArrayView<input_t> model_wgts;
550 size_t num_verts = mdl->getVertexList(Ids,model_wgts);
551 ArrayView<bool> isOwner;
552 mdl->getOwnedList(isOwner);
553 int j=0;
554 for (size_t i=0;i<num_verts;i++) {
555 if (isOwner[i]) {
556 ZOLTAN_ID_PTR idPtr = &(gids[j*nGidEnt]);
558 idPtr = &(lids[j*nLidEnt]);
560 j++;
561 }
562 }
563 if (wdim) {
564 int mywdim = mdl->getNumWeightsPerVertex();
565 for (int w = 0; w < wdim; w++) {
566 j=0;
567 if (w < mywdim) {
568 for (size_t i = 0; i < num_verts; i++) {
569 if (isOwner[i]) {
570 wgts[j*wdim+w] = float(model_wgts[w][i]);
571 j++;
572 }
573 }
574 }
575 else {
576 // provide uniform weights
577 for (size_t i = 0; i < num_verts; i++) {
578 if (isOwner[i]) {
579 wgts[j*wdim+w] = 1.;
580 j++;
581 }
582 }
583 }
584 }
585 }
586}
587
589// ZOLTAN_HG_SIZE_CS_FN
590template <typename Adapter>
591static void zoltanHGSizeCS_withModel(void *data, int *nEdges, int *nPins,
592 int *format, int *ierr
593)
594{
595 *ierr = ZOLTAN_OK;
596 const HyperGraphModel<Adapter>* mdl =
597 static_cast<HyperGraphModel<Adapter>* >(data);
598 *nEdges = mdl->getLocalNumHyperEdges();
599 *nPins = mdl->getLocalNumPins();
600 if (mdl->getCentricView()==HYPEREDGE_CENTRIC)
601 *format = ZOLTAN_COMPRESSED_EDGE;
602 else
603 *format = ZOLTAN_COMPRESSED_VERTEX;
604}
605
607// ZOLTAN_HG_CS_FN
608template <typename Adapter>
609static void zoltanHGCS_withModel(void *data, int nGidEnt, int nEdges, int nPins,
610 int format, ZOLTAN_ID_PTR edgeIds,
611 int *edgeIdx, ZOLTAN_ID_PTR pinIds, int *ierr
612)
613{
614 *ierr = ZOLTAN_OK;
615 const HyperGraphModel<Adapter>* mdl =
616 static_cast<HyperGraphModel<Adapter>* >(data);
617 typedef typename Adapter::gno_t gno_t;
618 typedef typename Adapter::lno_t lno_t;
619 typedef typename Adapter::offset_t offset_t;
620 typedef typename Adapter::scalar_t scalar_t;
621 typedef StridedData<lno_t, scalar_t> input_t;
622
623 ArrayView<const gno_t> Ids;
624 ArrayView<input_t> wgts;
625 mdl->getEdgeList(Ids,wgts);
626 ArrayView<const gno_t> pinIds_;
627 ArrayView<const offset_t> offsets;
628 ArrayView<input_t> pin_wgts;
629 mdl->getPinList(pinIds_,offsets,pin_wgts);
630 for (int i=0;i<nEdges;i++) {
631 ZOLTAN_ID_PTR idPtr = &(edgeIds[i*nGidEnt]);
633 edgeIdx[i] = Teuchos::as<int>(offsets[i]);
634 }
635
636 for (int i=0;i<nPins;i++) {
637 ZOLTAN_ID_PTR idPtr = &(pinIds[i*nGidEnt]);
639 }
640}
641
642#endif // HAVE_ZOLTAN2_HYPERGRAPH
643
644}
645
646
647#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.
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.
map_t::local_ordinal_type lno_t
map_t::global_ordinal_type gno_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)