10 #ifndef MUELU_GEOINTERPFACTORY_DEF_HPP
11 #define MUELU_GEOINTERPFACTORY_DEF_HPP
18 #include <Xpetra_Map.hpp>
19 #include <Xpetra_MapFactory.hpp>
22 #include <Xpetra_MultiVectorFactory.hpp>
24 #include <Xpetra_CrsMatrixWrap.hpp>
31 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
33 GetOStream(
Runtime1) <<
"I constructed a GeoInterpFactory object... Nothing else to do here." << std::endl;
36 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
41 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
43 Input(fineLevel,
"A");
44 Input(fineLevel,
"A00");
45 Input(fineLevel,
"A10");
46 Input(fineLevel,
"A20");
48 Input(fineLevel,
"VElementList");
49 Input(fineLevel,
"PElementList");
50 Input(fineLevel,
"MElementList");
52 Input(coarseLevel,
"VElementList");
53 Input(coarseLevel,
"PElementList");
54 Input(coarseLevel,
"MElementList");
69 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
71 GetOStream(
Runtime1) <<
"Starting 'build' routine...\n";
79 return BuildP(fineLevel, coarseLevel);
82 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
86 GetOStream(
Runtime1) <<
"Starting 'BuildP' routine...\n";
98 GetOStream(
Runtime1) <<
"done getting fine level elements...\n";
99 GetOStream(
Runtime1) <<
"getting coarse level elements...\n";
107 coarseLevel.
Get(
"VElementList", coarseElementVDOFs, coarseLevel.
GetFactoryManager()->GetFactory(
"VElementList").get());
108 coarseLevel.
Get(
"PElementList", coarseElementPDOFs, coarseLevel.
GetFactoryManager()->GetFactory(
"PElementList").get());
109 coarseLevel.
Get(
"MElementList", coarseElementMDOFs, coarseLevel.
GetFactoryManager()->GetFactory(
"MElementList").get());
111 GetOStream(
Runtime1) <<
"computing various numbers...\n";
113 GO totalFineElements = fineElementMDOFs->numRows();
114 LO nFineElements = (int)sqrt(totalFineElements);
115 GO totalCoarseElements = coarseElementMDOFs->numRows();
116 LO nCoarseElements = (int)sqrt(totalCoarseElements);
119 GO nM = (2 * nCoarseElements + 1) * (2 * nCoarseElements + 1);
121 GO nP = (nCoarseElements + 1) * (nCoarseElements + 1);
124 RCP<Matrix> fineA00 = Get<RCP<Matrix> >(fineLevel,
"A00");
125 RCP<Matrix> fineA10 = Get<RCP<Matrix> >(fineLevel,
"A10");
126 RCP<Matrix> fineA20 = Get<RCP<Matrix> >(fineLevel,
"A20");
128 GetOStream(
Runtime1) <<
"creating coarse grid maps...\n";
134 GO fNV = rowMapforPV->getGlobalNumElements();
135 GO fNP = rowMapforPP->getGlobalNumElements();
136 GO fNM = rowMapforPM->getGlobalNumElements();
142 RCP<Matrix> FineA = Factory::Get<RCP<Matrix> >(fineLevel,
"A");
150 GetOStream(
Runtime1) <<
"creating coarse grid matrices...\n";
152 size_t maxEntriesPerRowV = 9,
153 maxEntriesPerRowP = 4,
154 maxEntriesPerRowM = 9;
156 RCP<Matrix> P =
rcp(
new CrsMatrixWrap(rowMapforP, maxEntriesPerRowV));
157 RCP<Matrix> PV =
rcp(
new CrsMatrixWrap(rowMapforPV, maxEntriesPerRowV));
158 RCP<Matrix> PP =
rcp(
new CrsMatrixWrap(rowMapforPP, maxEntriesPerRowP));
159 RCP<Matrix> PM =
rcp(
new CrsMatrixWrap(rowMapforPM, maxEntriesPerRowM));
218 GO fineElement[4] = {0, 1, nFineElements, nFineElements + 1};
220 GetOStream(
Runtime1) <<
"start building matrices...\n";
221 GetOStream(
Runtime1) <<
"nCoarseElements = " << nCoarseElements << std::endl;
223 for (
GO coarseElement = 0; coarseElement < totalCoarseElements; coarseElement++) {
232 if (coarseElement < nCoarseElements) {
235 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 0);
237 colPtrM[1] = (*coarseElementMDOFs)(coarseElement, 1);
239 colPtrM[2] = (*coarseElementMDOFs)(coarseElement, 4);
243 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[0], 4), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
245 colPtrV[0] = 2 * colPtrM[0];
246 colPtrV[1] = 2 * colPtrM[1];
247 colPtrV[2] = 2 * colPtrM[2];
249 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[0], 8), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
251 colPtrV[0] = 2 * colPtrM[0] + 1;
252 colPtrV[1] = 2 * colPtrM[1] + 1;
253 colPtrV[2] = 2 * colPtrM[2] + 1;
255 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[0], 9), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
258 colPtrP[0] = (*coarseElementPDOFs)(coarseElement, 0);
260 colPtrP[1] = (*coarseElementPDOFs)(coarseElement, 1);
264 PP->insertGlobalValues((*fineElementPDOFs)(fineElement[0], 1), colPtrP.
view(0, nnz), valPtrP.view(0, nnz));
267 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 4);
271 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[0], 1), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
273 colPtrV[0] = 2 * colPtrM[0];
275 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[0], 2), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
277 colPtrV[0] = 2 * colPtrM[0] + 1;
279 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[0], 3), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
282 colPtrP[0] = (*coarseElementPDOFs)(coarseElement, 1);
286 PP->insertGlobalValues((*fineElementPDOFs)(fineElement[1], 1), colPtrP.
view(0, nnz), valPtrP.view(0, nnz));
289 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 0);
291 colPtrM[1] = (*coarseElementMDOFs)(coarseElement, 1);
293 colPtrM[2] = (*coarseElementMDOFs)(coarseElement, 4);
297 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[1], 4), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
299 colPtrV[0] = 2 * colPtrM[0];
300 colPtrV[1] = 2 * colPtrM[1];
301 colPtrV[2] = 2 * colPtrM[2];
303 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[1], 8), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
305 colPtrV[0] = 2 * colPtrM[0] + 1;
306 colPtrV[1] = 2 * colPtrM[1] + 1;
307 colPtrV[2] = 2 * colPtrM[2] + 1;
309 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[1], 9), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
312 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 1);
316 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[1], 1), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
318 colPtrV[0] = 2 * colPtrM[0];
320 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[1], 2), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
322 colPtrV[0] = 2 * colPtrM[0] + 1;
324 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[1], 3), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
327 if (coarseElement == 0) {
330 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 0);
334 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[0], 0), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
336 colPtrV[0] = 2 * colPtrM[0];
338 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[0], 0), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
340 colPtrV[0] = 2 * colPtrM[0] + 1;
342 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[0], 1), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
345 colPtrP[0] = (*coarseElementPDOFs)(coarseElement, 0);
349 PP->insertGlobalValues((*fineElementPDOFs)(fineElement[0], 0), colPtrP.
view(0, nnz), valPtrP.view(0, nnz));
355 if (coarseElement % (nCoarseElements) == 0) {
358 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 0);
360 colPtrM[1] = (*coarseElementMDOFs)(coarseElement, 3);
362 colPtrM[2] = (*coarseElementMDOFs)(coarseElement, 7);
366 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[0], 7), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
368 colPtrV[0] = 2 * colPtrM[0];
369 colPtrV[1] = 2 * colPtrM[1];
370 colPtrV[2] = 2 * colPtrM[2];
372 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[0], 14), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
374 colPtrV[0] = 2 * colPtrM[0] + 1;
375 colPtrV[1] = 2 * colPtrM[1] + 1;
376 colPtrV[2] = 2 * colPtrM[2] + 1;
378 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[0], 15), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
381 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 7);
385 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[0], 3), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
387 colPtrV[0] = 2 * colPtrM[0];
389 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[0], 6), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
391 colPtrV[0] = 2 * colPtrM[0] + 1;
393 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[0], 7), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
396 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 0);
398 colPtrM[1] = (*coarseElementMDOFs)(coarseElement, 3);
400 colPtrM[2] = (*coarseElementMDOFs)(coarseElement, 7);
404 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[2], 7), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
406 colPtrV[0] = 2 * colPtrM[0];
407 colPtrV[1] = 2 * colPtrM[1];
408 colPtrV[2] = 2 * colPtrM[2];
410 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[2], 14), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
412 colPtrV[0] = 2 * colPtrM[0] + 1;
413 colPtrV[1] = 2 * colPtrM[1] + 1;
414 colPtrV[2] = 2 * colPtrM[2] + 1;
416 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[2], 15), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
419 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 3);
423 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[2], 3), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
425 colPtrV[0] = 2 * colPtrM[0];
427 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[2], 6), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
429 colPtrV[0] = 2 * colPtrM[0] + 1;
431 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[2], 7), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
434 colPtrP[0] = (*coarseElementPDOFs)(coarseElement, 0);
436 colPtrP[1] = (*coarseElementPDOFs)(coarseElement, 3);
440 PP->insertGlobalValues((*fineElementPDOFs)(fineElement[0], 3), colPtrP.
view(0, nnz), valPtrP.view(0, nnz));
443 colPtrP[0] = (*coarseElementPDOFs)(coarseElement, 3);
447 PP->insertGlobalValues((*fineElementPDOFs)(fineElement[2], 3), colPtrP.
view(0, nnz), valPtrP.view(0, nnz));
453 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 8);
457 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[3], 0), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
459 colPtrV[0] = 2 * colPtrM[0];
461 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[3], 0), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
463 colPtrV[0] = 2 * colPtrM[0] + 1;
465 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[3], 1), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
468 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 5);
472 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[3], 1), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
474 colPtrV[0] = 2 * colPtrM[0];
476 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[3], 2), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
478 colPtrV[0] = 2 * colPtrM[0] + 1;
480 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[3], 3), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
483 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 2);
487 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[3], 2), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
489 colPtrV[0] = 2 * colPtrM[0];
491 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[3], 4), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
493 colPtrV[0] = 2 * colPtrM[0] + 1;
495 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[3], 5), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
498 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 6);
502 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[3], 3), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
504 colPtrV[0] = 2 * colPtrM[0];
506 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[3], 6), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
508 colPtrV[0] = 2 * colPtrM[0] + 1;
510 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[3], 7), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
513 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 4);
515 colPtrM[1] = (*coarseElementMDOFs)(coarseElement, 6);
517 colPtrM[2] = (*coarseElementMDOFs)(coarseElement, 8);
521 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[0], 5), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
523 colPtrV[0] = 2 * colPtrM[0];
524 colPtrV[1] = 2 * colPtrM[1];
525 colPtrV[2] = 2 * colPtrM[2];
527 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[0], 10), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
529 colPtrV[0] = 2 * colPtrM[0] + 1;
530 colPtrV[1] = 2 * colPtrM[1] + 1;
531 colPtrV[2] = 2 * colPtrM[2] + 1;
533 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[0], 11), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
536 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 5);
538 colPtrM[1] = (*coarseElementMDOFs)(coarseElement, 7);
540 colPtrM[2] = (*coarseElementMDOFs)(coarseElement, 8);
544 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[0], 6), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
546 colPtrV[0] = 2 * colPtrM[0];
547 colPtrV[1] = 2 * colPtrM[1];
548 colPtrV[2] = 2 * colPtrM[2];
550 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[0], 12), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
552 colPtrV[0] = 2 * colPtrM[0] + 1;
553 colPtrV[1] = 2 * colPtrM[1] + 1;
554 colPtrV[2] = 2 * colPtrM[2] + 1;
556 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[0], 13), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
559 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 1);
561 colPtrM[1] = (*coarseElementMDOFs)(coarseElement, 2);
563 colPtrM[2] = (*coarseElementMDOFs)(coarseElement, 5);
567 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[1], 5), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
569 colPtrV[0] = 2 * colPtrM[0];
570 colPtrV[1] = 2 * colPtrM[1];
571 colPtrV[2] = 2 * colPtrM[2];
573 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[1], 10), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
575 colPtrV[0] = 2 * colPtrM[0] + 1;
576 colPtrV[1] = 2 * colPtrM[1] + 1;
577 colPtrV[2] = 2 * colPtrM[2] + 1;
579 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[1], 11), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
582 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 5);
584 colPtrM[1] = (*coarseElementMDOFs)(coarseElement, 7);
586 colPtrM[2] = (*coarseElementMDOFs)(coarseElement, 8);
590 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[1], 6), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
592 colPtrV[0] = 2 * colPtrM[0];
593 colPtrV[1] = 2 * colPtrM[1];
594 colPtrV[2] = 2 * colPtrM[2];
596 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[1], 12), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
598 colPtrV[0] = 2 * colPtrM[0] + 1;
599 colPtrV[1] = 2 * colPtrM[1] + 1;
600 colPtrV[2] = 2 * colPtrM[2] + 1;
602 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[1], 13), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
605 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 4);
607 colPtrM[1] = (*coarseElementMDOFs)(coarseElement, 6);
609 colPtrM[2] = (*coarseElementMDOFs)(coarseElement, 8);
613 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[2], 5), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
615 colPtrV[0] = 2 * colPtrM[0];
616 colPtrV[1] = 2 * colPtrM[1];
617 colPtrV[2] = 2 * colPtrM[2];
619 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[2], 10), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
621 colPtrV[0] = 2 * colPtrM[0] + 1;
622 colPtrV[1] = 2 * colPtrM[1] + 1;
623 colPtrV[2] = 2 * colPtrM[2] + 1;
625 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[2], 11), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
628 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 2);
630 colPtrM[1] = (*coarseElementMDOFs)(coarseElement, 3);
632 colPtrM[2] = (*coarseElementMDOFs)(coarseElement, 6);
636 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[2], 6), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
638 colPtrV[0] = 2 * colPtrM[0];
639 colPtrV[1] = 2 * colPtrM[1];
640 colPtrV[2] = 2 * colPtrM[2];
642 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[2], 12), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
644 colPtrV[0] = 2 * colPtrM[0] + 1;
645 colPtrV[1] = 2 * colPtrM[1] + 1;
646 colPtrV[2] = 2 * colPtrM[2] + 1;
648 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[2], 13), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
651 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 1);
653 colPtrM[1] = (*coarseElementMDOFs)(coarseElement, 2);
655 colPtrM[2] = (*coarseElementMDOFs)(coarseElement, 5);
659 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[3], 5), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
661 colPtrV[0] = 2 * colPtrM[0];
662 colPtrV[1] = 2 * colPtrM[1];
663 colPtrV[2] = 2 * colPtrM[2];
665 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[3], 10), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
667 colPtrV[0] = 2 * colPtrM[0] + 1;
668 colPtrV[1] = 2 * colPtrM[1] + 1;
669 colPtrV[2] = 2 * colPtrM[2] + 1;
671 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[3], 11), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
674 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 2);
676 colPtrM[1] = (*coarseElementMDOFs)(coarseElement, 3);
678 colPtrM[2] = (*coarseElementMDOFs)(coarseElement, 6);
682 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[3], 6), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
684 colPtrV[0] = 2 * colPtrM[0];
685 colPtrV[1] = 2 * colPtrM[1];
686 colPtrV[2] = 2 * colPtrM[2];
688 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[3], 12), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
690 colPtrV[0] = 2 * colPtrM[0] + 1;
691 colPtrV[1] = 2 * colPtrM[1] + 1;
692 colPtrV[2] = 2 * colPtrM[2] + 1;
694 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[3], 13), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
697 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 0);
698 valPtrM[0] = 0.140625;
699 colPtrM[1] = (*coarseElementMDOFs)(coarseElement, 1);
700 valPtrM[1] = -0.046875;
701 colPtrM[2] = (*coarseElementMDOFs)(coarseElement, 2);
702 valPtrM[2] = 0.015625;
703 colPtrM[3] = (*coarseElementMDOFs)(coarseElement, 3);
704 valPtrM[3] = -0.046875;
705 colPtrM[4] = (*coarseElementMDOFs)(coarseElement, 4);
706 valPtrM[4] = 0.28125;
707 colPtrM[5] = (*coarseElementMDOFs)(coarseElement, 5);
708 valPtrM[5] = -0.09375;
709 colPtrM[6] = (*coarseElementMDOFs)(coarseElement, 6);
710 valPtrM[6] = -0.09375;
711 colPtrM[7] = (*coarseElementMDOFs)(coarseElement, 7);
712 valPtrM[7] = 0.28125;
713 colPtrM[8] = (*coarseElementMDOFs)(coarseElement, 8);
717 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[0], 8), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
719 colPtrV[0] = 2 * colPtrM[0];
720 colPtrV[1] = 2 * colPtrM[1];
721 colPtrV[2] = 2 * colPtrM[2];
722 colPtrV[3] = 2 * colPtrM[3];
723 colPtrV[4] = 2 * colPtrM[4];
724 colPtrV[5] = 2 * colPtrM[5];
725 colPtrV[6] = 2 * colPtrM[6];
726 colPtrV[7] = 2 * colPtrM[7];
727 colPtrV[8] = 2 * colPtrM[8];
729 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[0], 16), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
731 colPtrV[0] = 2 * colPtrM[0] + 1;
732 colPtrV[1] = 2 * colPtrM[1] + 1;
733 colPtrV[2] = 2 * colPtrM[2] + 1;
734 colPtrV[3] = 2 * colPtrM[3] + 1;
735 colPtrV[4] = 2 * colPtrM[4] + 1;
736 colPtrV[5] = 2 * colPtrM[5] + 1;
737 colPtrV[6] = 2 * colPtrM[6] + 1;
738 colPtrV[7] = 2 * colPtrM[7] + 1;
739 colPtrV[8] = 2 * colPtrM[8] + 1;
741 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[0], 17), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
744 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 0);
745 valPtrM[0] = -0.046875;
746 colPtrM[1] = (*coarseElementMDOFs)(coarseElement, 1);
747 valPtrM[1] = 0.140625;
748 colPtrM[2] = (*coarseElementMDOFs)(coarseElement, 2);
749 valPtrM[2] = -0.046875;
750 colPtrM[3] = (*coarseElementMDOFs)(coarseElement, 3);
751 valPtrM[3] = 0.015625;
752 colPtrM[4] = (*coarseElementMDOFs)(coarseElement, 4);
753 valPtrM[4] = 0.28125;
754 colPtrM[5] = (*coarseElementMDOFs)(coarseElement, 5);
755 valPtrM[5] = 0.28125;
756 colPtrM[6] = (*coarseElementMDOFs)(coarseElement, 6);
757 valPtrM[6] = -0.09375;
758 colPtrM[7] = (*coarseElementMDOFs)(coarseElement, 7);
759 valPtrM[7] = -0.09375;
760 colPtrM[8] = (*coarseElementMDOFs)(coarseElement, 8);
764 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[1], 8), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
766 colPtrV[0] = 2 * colPtrM[0];
767 colPtrV[1] = 2 * colPtrM[1];
768 colPtrV[2] = 2 * colPtrM[2];
769 colPtrV[3] = 2 * colPtrM[3];
770 colPtrV[4] = 2 * colPtrM[4];
771 colPtrV[5] = 2 * colPtrM[5];
772 colPtrV[6] = 2 * colPtrM[6];
773 colPtrV[7] = 2 * colPtrM[7];
774 colPtrV[8] = 2 * colPtrM[8];
776 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[1], 16), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
778 colPtrV[0] = 2 * colPtrM[0] + 1;
779 colPtrV[1] = 2 * colPtrM[1] + 1;
780 colPtrV[2] = 2 * colPtrM[2] + 1;
781 colPtrV[3] = 2 * colPtrM[3] + 1;
782 colPtrV[4] = 2 * colPtrM[4] + 1;
783 colPtrV[5] = 2 * colPtrM[5] + 1;
784 colPtrV[6] = 2 * colPtrM[6] + 1;
785 colPtrV[7] = 2 * colPtrM[7] + 1;
786 colPtrV[8] = 2 * colPtrM[8] + 1;
788 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[1], 17), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
791 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 0);
792 valPtrM[0] = -0.046875;
793 colPtrM[1] = (*coarseElementMDOFs)(coarseElement, 1);
794 valPtrM[1] = 0.015625;
795 colPtrM[2] = (*coarseElementMDOFs)(coarseElement, 2);
796 valPtrM[2] = -0.046875;
797 colPtrM[3] = (*coarseElementMDOFs)(coarseElement, 3);
798 valPtrM[3] = 0.140625;
799 colPtrM[4] = (*coarseElementMDOFs)(coarseElement, 4);
800 valPtrM[4] = -0.09375;
801 colPtrM[5] = (*coarseElementMDOFs)(coarseElement, 5);
802 valPtrM[5] = -0.09375;
803 colPtrM[6] = (*coarseElementMDOFs)(coarseElement, 6);
804 valPtrM[6] = 0.28125;
805 colPtrM[7] = (*coarseElementMDOFs)(coarseElement, 7);
806 valPtrM[7] = 0.28125;
807 colPtrM[8] = (*coarseElementMDOFs)(coarseElement, 8);
811 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[2], 8), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
813 colPtrV[0] = 2 * colPtrM[0];
814 colPtrV[1] = 2 * colPtrM[1];
815 colPtrV[2] = 2 * colPtrM[2];
816 colPtrV[3] = 2 * colPtrM[3];
817 colPtrV[4] = 2 * colPtrM[4];
818 colPtrV[5] = 2 * colPtrM[5];
819 colPtrV[6] = 2 * colPtrM[6];
820 colPtrV[7] = 2 * colPtrM[7];
821 colPtrV[8] = 2 * colPtrM[8];
823 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[2], 16), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
825 colPtrV[0] = 2 * colPtrM[0] + 1;
826 colPtrV[1] = 2 * colPtrM[1] + 1;
827 colPtrV[2] = 2 * colPtrM[2] + 1;
828 colPtrV[3] = 2 * colPtrM[3] + 1;
829 colPtrV[4] = 2 * colPtrM[4] + 1;
830 colPtrV[5] = 2 * colPtrM[5] + 1;
831 colPtrV[6] = 2 * colPtrM[6] + 1;
832 colPtrV[7] = 2 * colPtrM[7] + 1;
833 colPtrV[8] = 2 * colPtrM[8] + 1;
835 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[2], 17), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
838 colPtrM[0] = (*coarseElementMDOFs)(coarseElement, 0);
839 valPtrM[0] = 0.015625;
840 colPtrM[1] = (*coarseElementMDOFs)(coarseElement, 1);
841 valPtrM[1] = -0.046875;
842 colPtrM[2] = (*coarseElementMDOFs)(coarseElement, 2);
843 valPtrM[2] = 0.140625;
844 colPtrM[3] = (*coarseElementMDOFs)(coarseElement, 3);
845 valPtrM[3] = -0.046875;
846 colPtrM[4] = (*coarseElementMDOFs)(coarseElement, 4);
847 valPtrM[4] = -0.09375;
848 colPtrM[5] = (*coarseElementMDOFs)(coarseElement, 5);
849 valPtrM[5] = 0.28125;
850 colPtrM[6] = (*coarseElementMDOFs)(coarseElement, 6);
851 valPtrM[6] = 0.28125;
852 colPtrM[7] = (*coarseElementMDOFs)(coarseElement, 7);
853 valPtrM[7] = -0.09375;
854 colPtrM[8] = (*coarseElementMDOFs)(coarseElement, 8);
858 PM->insertGlobalValues((*fineElementMDOFs)(fineElement[3], 8), colPtrM.
view(0, nnz), valPtrM.view(0, nnz));
860 colPtrV[0] = 2 * colPtrM[0];
861 colPtrV[1] = 2 * colPtrM[1];
862 colPtrV[2] = 2 * colPtrM[2];
863 colPtrV[3] = 2 * colPtrM[3];
864 colPtrV[4] = 2 * colPtrM[4];
865 colPtrV[5] = 2 * colPtrM[5];
866 colPtrV[6] = 2 * colPtrM[6];
867 colPtrV[7] = 2 * colPtrM[7];
868 colPtrV[8] = 2 * colPtrM[8];
870 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[3], 16), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
872 colPtrV[0] = 2 * colPtrM[0] + 1;
873 colPtrV[1] = 2 * colPtrM[1] + 1;
874 colPtrV[2] = 2 * colPtrM[2] + 1;
875 colPtrV[3] = 2 * colPtrM[3] + 1;
876 colPtrV[4] = 2 * colPtrM[4] + 1;
877 colPtrV[5] = 2 * colPtrM[5] + 1;
878 colPtrV[6] = 2 * colPtrM[6] + 1;
879 colPtrV[7] = 2 * colPtrM[7] + 1;
880 colPtrV[8] = 2 * colPtrM[8] + 1;
882 PV->insertGlobalValues((*fineElementVDOFs)(fineElement[3], 17), colPtrV.
view(0, nnz), valPtrM.view(0, nnz));
885 colPtrP[0] = (*coarseElementPDOFs)(coarseElement, 0);
887 colPtrP[1] = (*coarseElementPDOFs)(coarseElement, 1);
889 colPtrP[2] = (*coarseElementPDOFs)(coarseElement, 2);
891 colPtrP[3] = (*coarseElementPDOFs)(coarseElement, 3);
895 PP->insertGlobalValues((*fineElementPDOFs)(fineElement[0], 2), colPtrP.
view(0, nnz), valPtrP.view(0, nnz));
898 colPtrP[0] = (*coarseElementPDOFs)(coarseElement, 1);
900 colPtrP[1] = (*coarseElementPDOFs)(coarseElement, 2);
904 PP->insertGlobalValues((*fineElementPDOFs)(fineElement[1], 2), colPtrP.
view(0, nnz), valPtrP.view(0, nnz));
907 colPtrP[0] = (*coarseElementPDOFs)(coarseElement, 2);
911 PP->insertGlobalValues((*fineElementPDOFs)(fineElement[3], 2), colPtrP.
view(0, nnz), valPtrP.view(0, nnz));
914 colPtrP[0] = (*coarseElementPDOFs)(coarseElement, 2);
916 colPtrP[1] = (*coarseElementPDOFs)(coarseElement, 3);
920 PP->insertGlobalValues((*fineElementPDOFs)(fineElement[3], 3), colPtrP.
view(0, nnz), valPtrP.view(0, nnz));
923 if ((coarseElement + 1) % (nCoarseElements) == 0)
925 fineElement[0] = fineElement[3] + 1;
926 fineElement[1] = fineElement[0] + 1;
927 fineElement[2] = fineElement[0] + nFineElements;
928 fineElement[3] = fineElement[2] + 1;
930 fineElement[0] = fineElement[1] + 1;
931 fineElement[1] = fineElement[0] + 1;
932 fineElement[2] = fineElement[3] + 1;
933 fineElement[3] = fineElement[2] + 1;
938 for (
GO VRow = 0; VRow < fNV; VRow++) {
942 PV->getGlobalRowView(VRow, colPtr, valPtr);
945 P->insertGlobalValues(VRow, colPtr, valPtr);
949 for (
GO PRow = 0; PRow < fNP; PRow++) {
954 PP->getGlobalRowView(PRow, colPtr, valPtr);
957 for (
LO jj = 0; jj < colPtr.
size(); jj++) {
958 newColPtr[jj] += colPtr[jj];
962 P->insertGlobalValues(PRow + fNV, newColPtr.view(0, colPtr.
size()), valPtr);
966 for (
GO MRow = 0; MRow < fNM; MRow++) {
971 PM->getGlobalRowView(MRow, colPtr, valPtr);
974 for (
LO jj = 0; jj < colPtr.
size(); jj++) {
975 newColPtr[jj] += colPtr[jj];
979 P->insertGlobalValues(MRow + fNV + fNP, newColPtr.view(0, colPtr.
size()), valPtr);
983 PV->fillComplete(colMapforPV, rowMapforPV);
984 PP->fillComplete(colMapforPP, rowMapforPP);
985 PM->fillComplete(colMapforPM, rowMapforPM);
989 Set(coarseLevel,
"PV", PV);
990 Set(coarseLevel,
"PP", PP);
991 Set(coarseLevel,
"PM", PM);
992 Set(coarseLevel,
"P", P);
994 Set(coarseLevel,
"NV", nV);
995 Set(coarseLevel,
"NP", nP);
996 Set(coarseLevel,
"NM", nM);
1002 #define MUELU_GEOINTERPFACTORY_SHORT
1003 #endif // MUELU_GEOINTERPFACTORY_DEF_HPP
T & Get(const std::string &ename, const FactoryBase *factory=NoFactory::get())
Get data without decrementing associated storage counter (i.e., read-only access). Usage: Level->Get< RCP<Matrix> >("A", factory) if factory == NULL => use default factory.
void BuildP(Level &fineLevel, Level &coarseLevel) const
Abstract Build method.
void DeclareInput(Level &fineLevel, Level &coarseLevel) const
Specifies the data that this class needs, and the factories that generate that data.
void Build(Level &fineLevel, Level &coarseLevel) const
Build an object with this factory.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Class that holds all level-specific information.
virtual ~GeoInterpFactory()
Destructor.
const RCP< const FactoryManagerBase > GetFactoryManager()
returns the current factory manager
Description of what is happening (more verbose)
GeoInterpFactory()
Constructor.
static Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createUniformContigMap(UnderlyingLib lib, global_size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int >> &comm)
ArrayView< T > view(size_type lowerOffset, size_type size) const