17 #ifndef MUELU_AGGREGATIONEXPORTFACTORY_DEF_HPP_
18 #define MUELU_AGGREGATIONEXPORTFACTORY_DEF_HPP_
21 #include <Xpetra_CrsMatrixWrap.hpp>
23 #include <Xpetra_MultiVectorFactory.hpp>
26 #include "MueLu_Aggregates.hpp"
29 #include "MueLu_AmalgamationFactory.hpp"
30 #include "MueLu_AmalgamationInfo.hpp"
42 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
44 : doFineGraphEdges_(false)
45 , doCoarseGraphEdges_(false)
52 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
55 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
59 std::string output_msg =
60 "Output filename template (%TIMESTEP is replaced by \'Output file: time step\' variable,"
61 "%ITER is replaced by \'Output file: iter\' variable, %LEVELID is replaced level id, %PROCID is replaced by processor id)";
62 std::string output_def =
"aggs_level%LEVELID_proc%PROCID.out";
73 validParamList->
set<std::string>(
"Output filename", output_def, output_msg);
74 validParamList->
set<
int>(
"Output file: time step", 0,
"time step variable for output file name");
75 validParamList->
set<
int>(
"Output file: iter", 0,
"nonlinear iteration variable for output file name");
78 validParamList->
set<std::string>(
"aggregation: output filename",
"",
"filename for VTK-style visualization output");
79 validParamList->
set<
int>(
"aggregation: output file: time step", 0,
"time step variable for output file name");
80 validParamList->
set<
int>(
"aggregation: output file: iter", 0,
"nonlinear iteration variable for output file name");
81 validParamList->
set<std::string>(
"aggregation: output file: agg style",
"Point Cloud",
"style of aggregate visualization for VTK output");
82 validParamList->
set<
bool>(
"aggregation: output file: fine graph edges",
false,
"Whether to draw all fine node connections along with the aggregates.");
83 validParamList->
set<
bool>(
"aggregation: output file: coarse graph edges",
false,
"Whether to draw all coarse node connections along with the aggregates.");
84 validParamList->
set<
bool>(
"aggregation: output file: build colormap",
false,
"Whether to output a random colormap for ParaView in a separate XML file.");
85 validParamList->
set<
bool>(
"aggregation: output file: aggregate qualities",
false,
"Whether to plot the aggregate quality.");
86 validParamList->
set<
bool>(
"aggregation: output file: material",
false,
"Whether to plot the material.");
87 return validParamList;
90 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
92 Input(fineLevel,
"Aggregates");
93 Input(fineLevel,
"DofsPerNode");
94 Input(fineLevel,
"UnAmalgamationInfo");
98 if (pL.
isParameter(
"aggregation: output filename") && pL.
get<std::string>(
"aggregation: output filename").length()) {
99 Input(fineLevel,
"Coordinates");
100 Input(fineLevel,
"A");
101 Input(fineLevel,
"Graph");
102 if (pL.
get<
bool>(
"aggregation: output file: coarse graph edges")) {
103 Input(coarseLevel,
"Coordinates");
104 Input(coarseLevel,
"A");
105 Input(coarseLevel,
"Graph");
109 if (pL.
get<
bool>(
"aggregation: output file: aggregate qualities")) {
110 Input(coarseLevel,
"AggregateQualities");
113 if (pL.
get<
bool>(
"aggregation: output file: material")) {
114 Input(fineLevel,
"Material");
118 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
126 int numProcs = comm->getSize();
127 int myRank = comm->getRank();
128 string masterFilename = pL.
get<std::string>(
"aggregation: output filename");
129 string pvtuFilename =
"";
130 string localFilename = pL.get<std::string>(
"Output filename");
131 string filenameToWrite;
133 doCoarseGraphEdges_ = pL.get<
bool>(
"aggregation: output file: coarse graph edges");
134 doFineGraphEdges_ = pL.get<
bool>(
"aggregation: output file: fine graph edges");
135 doAggQuality_ = pL.get<
bool>(
"aggregation: output file: aggregate qualities");
136 doMaterial_ = pL.get<
bool>(
"aggregation: output file: material");
137 if (masterFilename.length()) {
139 filenameToWrite = masterFilename;
140 if (filenameToWrite.rfind(
".vtu") == string::npos)
141 filenameToWrite.append(
".vtu");
142 if (numProcs > 1 && filenameToWrite.rfind(
"%PROCID") == string::npos)
143 filenameToWrite.insert(filenameToWrite.rfind(
".vtu"),
"-proc%PROCID");
145 filenameToWrite = localFilename;
146 LocalOrdinal DofsPerNode = Get<LocalOrdinal>(fineLevel,
"DofsPerNode");
150 if (doCoarseGraphEdges_)
151 Ac = Get<RCP<Matrix>>(coarseLevel,
"A");
155 qualities_ = Get<Teuchos::RCP<MultiVector>>(coarseLevel,
"AggregateQualities");
157 material_ = Get<Teuchos::RCP<MultiVector>>(fineLevel,
"Material");
160 if (doFineGraphEdges_)
161 fineGraph = Get<RCP<LWGraph>>(fineLevel,
"Graph");
162 if (doCoarseGraphEdges_)
163 coarseGraph = Get<RCP<LWGraph>>(coarseLevel,
"Graph");
166 coords = Get<RCP<CoordinateMultiVector>>(fineLevel,
"Coordinates");
168 if (doCoarseGraphEdges_)
169 coordsCoarse = Get<RCP<CoordinateMultiVector>>(coarseLevel,
"Coordinates");
170 dims_ = coords->getNumVectors();
172 if (aggregates->AggregatesCrossProcessors()) {
176 coords = ghostedCoords;
177 coords_ = ghostedCoords;
179 if (doCoarseGraphEdges_) {
182 ghostedCoords->doImport(*coordsCoarse, *coordImporter,
Xpetra::INSERT);
183 coordsCoarse = ghostedCoords;
184 coordsCoarse_ = ghostedCoords;
188 GetOStream(
Runtime0) <<
"AggregationExportFactory: DofsPerNode: " << DofsPerNode << std::endl;
191 vertex2AggId_ = vertex2AggId;
194 std::vector<GlobalOrdinal> numAggsGlobal(numProcs, 0);
195 std::vector<GlobalOrdinal> numAggsLocal(numProcs, 0);
196 std::vector<GlobalOrdinal> minGlobalAggId(numProcs, 0);
198 numAggsLocal[myRank] = aggregates->GetNumAggregates();
199 Teuchos::reduceAll(*comm,
Teuchos::REDUCE_SUM, numProcs, &numAggsLocal[0], &numAggsGlobal[0]);
200 for (
int i = 1; i < Teuchos::as<int>(numAggsGlobal.size()); ++i) {
201 numAggsGlobal[i] += numAggsGlobal[i - 1];
202 minGlobalAggId[i] = numAggsGlobal[i - 1];
207 aggsOffset_ = minGlobalAggId[myRank];
210 amalgInfo->UnamalgamateAggregates(*aggregates, aggStart, aggToRowMap);
211 int timeStep = pL.
get<
int>(
"Output file: time step");
212 int iter = pL.get<
int>(
"Output file: iter");
218 string masterStem =
"";
220 masterStem = filenameToWrite.substr(0, filenameToWrite.rfind(
".vtu"));
221 masterStem = this->
replaceAll(masterStem,
"%PROCID",
"");
223 pvtuFilename = masterStem +
"-master.pvtu";
224 string baseFname = filenameToWrite;
226 GetOStream(
Runtime0) <<
"AggregationExportFactory: outputfile \"" << filenameToWrite <<
"\"" << std::endl;
227 ofstream fout(filenameToWrite.c_str());
228 GO numAggs = aggregates->GetNumAggregates();
230 GO indexBase = aggregates->GetMap()->getIndexBase();
231 GO offset = amalgInfo->GlobalOffset();
232 vector<GlobalOrdinal> nodeIds;
233 for (
int i = 0; i < numAggs; ++i) {
234 fout <<
"Agg " << minGlobalAggId[myRank] + i <<
" Proc " << myRank <<
":";
237 for (
int k = aggStart[i]; k < aggStart[i + 1]; ++k) {
238 nodeIds.push_back((aggToRowMap[k] - offset - indexBase) / DofsPerNode + indexBase);
242 std::sort(nodeIds.begin(), nodeIds.end());
243 typename std::vector<GlobalOrdinal>::iterator endLocation = std::unique(nodeIds.begin(), nodeIds.end());
244 nodeIds.erase(endLocation, nodeIds.end());
247 for (
typename std::vector<GlobalOrdinal>::iterator printIt = nodeIds.begin(); printIt != nodeIds.end(); printIt++)
248 fout <<
" " << *printIt;
257 numNodes_ = coords->getLocalLength();
259 aggSizes_ = aggregates->ComputeAggregateSizesArrayRCP();
261 string aggStyle =
"Point Cloud";
263 aggStyle = pL.get<
string>(
"aggregation: output file: agg style");
264 }
catch (std::exception& e) {
266 vector<int> vertices;
267 vector<int> geomSizes;
269 nodeMap_ = Amat->getMap();
271 isRoot_.push_back(aggregates->IsRoot(i));
275 if (myRank == 0 && (numProcs != 1 || doCoarseGraphEdges_ || doFineGraphEdges_)) {
276 ofstream pvtu(pvtuFilename.c_str());
277 writePVTU_(pvtu, baseFname, numProcs);
280 if (aggStyle ==
"Point Cloud")
281 this->doPointCloud(vertices, geomSizes, numAggs_, numNodes_);
282 else if (aggStyle ==
"Jacks") {
283 auto vertex2AggIds = vertex2AggId_->getDataNonConst(0);
284 this->doJacks(vertices, geomSizes, numAggs_, numNodes_, isRoot_, vertex2AggIds);
285 }
else if (aggStyle ==
"Jacks++")
286 doJacksPlus_(vertices, geomSizes);
287 else if (aggStyle ==
"Convex Hulls")
288 doConvexHulls(vertices, geomSizes);
290 GetOStream(
Warnings0) <<
" Unrecognized agg style.\n Possible values are Point Cloud, Jacks, Jacks++, and Convex Hulls.\n Defaulting to Point Cloud." << std::endl;
291 aggStyle =
"Point Cloud";
292 this->doPointCloud(vertices, geomSizes, numAggs_, numNodes_);
294 writeFile_(fout, aggStyle, vertices, geomSizes);
295 if (doCoarseGraphEdges_) {
296 string fname = filenameToWrite;
297 string cEdgeFile = fname.insert(fname.rfind(
".vtu"),
"-coarsegraph");
298 std::ofstream edgeStream(cEdgeFile.c_str());
299 doGraphEdges_(edgeStream, Ac, coarseGraph,
false, DofsPerNode);
301 if (doFineGraphEdges_) {
302 string fname = filenameToWrite;
303 string fEdgeFile = fname.insert(fname.rfind(
".vtu"),
"-finegraph");
304 std::ofstream edgeStream(fEdgeFile.c_str());
305 doGraphEdges_(edgeStream, Amat, fineGraph,
true, DofsPerNode);
307 if (myRank == 0 && pL.get<
bool>(
"aggregation: output file: build colormap")) {
314 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
319 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
325 auto vertex2AggIds = vertex2AggId_->getDataNonConst(0);
328 this->doConvexHulls2D(vertices, geomSizes, numAggs_, numNodes_, isRoot_, vertex2AggIds, xCoords, yCoords);
330 zCoords = coords_->getData(2);
331 this->doConvexHulls3D(vertices, geomSizes, numAggs_, numNodes_, isRoot_, vertex2AggIds, xCoords, yCoords, zCoords);
335 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
340 vector<pair<int, int>> vert1;
341 vector<pair<int, int>> vert2;
347 zCoords = coords_->getData(2);
353 cz = coordsCoarse_->getData(2);
355 if (A->isGloballyIndexed()) {
359 A->getGlobalRowView(globRow, indices, values);
360 auto neighbors = G->getNeighborVertices((
LocalOrdinal)globRow);
363 while (gEdge !=
int(neighbors.length)) {
365 if (neighbors(gEdge) == indices[aEdge]) {
367 vert1.push_back(pair<int, int>(
int(globRow), neighbors(gEdge)));
372 vert2.push_back(pair<int, int>(
int(globRow), neighbors(gEdge)));
377 vert1.push_back(pair<int, int>(
int(globRow), neighbors(gEdge)));
386 A->getLocalRowView(locRow, indices, values);
387 auto neighbors = G->getNeighborVertices(locRow);
391 while (gEdge !=
int(neighbors.length)) {
393 if (neighbors(gEdge) == indices[aEdge]) {
394 vert1.push_back(pair<int, int>(locRow, neighbors(gEdge)));
398 vert2.push_back(pair<int, int>(locRow, neighbors(gEdge)));
402 vert1.push_back(pair<int, int>(locRow, neighbors(gEdge)));
408 for (
size_t i = 0; i < vert1.size(); i++) {
409 if (vert1[i].first > vert1[i].second) {
410 int temp = vert1[i].first;
411 vert1[i].first = vert1[i].second;
412 vert1[i].second = temp;
415 for (
size_t i = 0; i < vert2.size(); i++) {
416 if (vert2[i].first > vert2[i].second) {
417 int temp = vert2[i].first;
418 vert2[i].first = vert2[i].second;
419 vert2[i].second = temp;
422 sort(vert1.begin(), vert1.end());
423 vector<pair<int, int>>::iterator newEnd = unique(vert1.begin(), vert1.end());
424 vert1.erase(newEnd, vert1.end());
425 sort(vert2.begin(), vert2.end());
426 newEnd = unique(vert2.begin(), vert2.end());
427 vert2.erase(newEnd, vert2.end());
429 points1.reserve(2 * vert1.size());
430 for (
size_t i = 0; i < vert1.size(); i++) {
431 points1.push_back(vert1[i].first);
432 points1.push_back(vert1[i].second);
435 points2.reserve(2 * vert2.size());
436 for (
size_t i = 0; i < vert2.size(); i++) {
437 points2.push_back(vert2[i].first);
438 points2.push_back(vert2[i].second);
440 vector<int> unique1 = this->makeUnique(points1);
441 vector<int> unique2 = this->makeUnique(points2);
442 fout <<
"<VTKFile type=\"UnstructuredGrid\" byte_order=\"LittleEndian\">" << endl;
443 fout <<
" <UnstructuredGrid>" << endl;
444 fout <<
" <Piece NumberOfPoints=\"" << unique1.size() + unique2.size() <<
"\" NumberOfCells=\"" << vert1.size() + vert2.size() <<
"\">" << endl;
445 fout <<
" <PointData Scalars=\"Node Aggregate Processor\">" << endl;
446 fout <<
" <DataArray type=\"Int32\" Name=\"Node\" format=\"ascii\">" << endl;
449 for (
size_t i = 0; i < unique1.size(); i++) {
450 fout << CONTRAST_1_ <<
" ";
455 for (
size_t i = 0; i < unique2.size(); i++) {
456 fout << CONTRAST_2_ <<
" ";
457 if ((i + 2 * vert1.size()) % 25 == 24)
462 fout <<
" </DataArray>" << endl;
463 fout <<
" <DataArray type=\"Int32\" Name=\"Aggregate\" format=\"ascii\">" << endl;
465 for (
size_t i = 0; i < unique1.size(); i++) {
466 fout << CONTRAST_1_ <<
" ";
471 for (
size_t i = 0; i < unique2.size(); i++) {
472 fout << CONTRAST_2_ <<
" ";
473 if ((i + 2 * vert2.size()) % 25 == 24)
478 fout <<
" </DataArray>" << endl;
479 fout <<
" <DataArray type=\"Int32\" Name=\"Processor\" format=\"ascii\">" << endl;
481 for (
size_t i = 0; i < unique1.size() + unique2.size(); i++) {
482 fout << myRank_ <<
" ";
488 fout <<
" </DataArray>" << endl;
489 fout <<
" </PointData>" << endl;
490 fout <<
" <Points>" << endl;
491 fout <<
" <DataArray type=\"Float64\" NumberOfComponents=\"3\" format=\"ascii\">" << endl;
493 for (
size_t i = 0; i < unique1.size(); i++) {
495 fout << xCoords[unique1[i]] <<
" " << yCoords[unique1[i]] <<
" ";
497 fout << zCoords[unique1[i]] <<
" ";
504 fout << cx[unique1[i]] <<
" " << cy[unique1[i]] <<
" ";
506 fout << cz[unique1[i]] <<
" ";
514 for (
size_t i = 0; i < unique2.size(); i++) {
516 fout << xCoords[unique2[i]] <<
" " << yCoords[unique2[i]] <<
" ";
518 fout << zCoords[unique2[i]] <<
" ";
525 fout << cx[unique2[i]] <<
" " << cy[unique2[i]] <<
" ";
527 fout << cz[unique2[i]] <<
" ";
530 if ((i + unique1.size()) % 2)
536 fout <<
" </DataArray>" << endl;
537 fout <<
" </Points>" << endl;
538 fout <<
" <Cells>" << endl;
539 fout <<
" <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">" << endl;
541 for (
size_t i = 0; i < points1.size(); i++) {
542 fout << points1[i] <<
" ";
547 for (
size_t i = 0; i < points2.size(); i++) {
548 fout << points2[i] + unique1.size() <<
" ";
549 if ((i + points1.size()) % 10 == 9)
554 fout <<
" </DataArray>" << endl;
555 fout <<
" <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">" << endl;
558 for (
size_t i = 0; i < vert1.size() + vert2.size(); i++) {
560 fout << offset <<
" ";
566 fout <<
" </DataArray>" << endl;
567 fout <<
" <DataArray type=\"Int32\" Name=\"types\" format=\"ascii\">" << endl;
569 for (
size_t i = 0; i < vert1.size() + vert2.size(); i++) {
576 fout <<
" </DataArray>" << endl;
577 fout <<
" </Cells>" << endl;
578 fout <<
" </Piece>" << endl;
579 fout <<
" </UnstructuredGrid>" << endl;
580 fout <<
"</VTKFile>" << endl;
583 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
591 zCoords = coords_->getData(2);
593 auto vertex2AggIds = vertex2AggId_->getDataNonConst(0);
597 qualities = qualities_->getData(0);
601 size_t dim = material_->getNumVectors();
603 for (
size_t k = 0; k < dim; k++)
604 material[k] = material_->getData(k);
607 vector<int> uniqueFine = this->makeUnique(vertices);
609 fout <<
"<!--" << styleName <<
" Aggregates Visualization-->" << endl;
610 fout <<
"<VTKFile type=\"UnstructuredGrid\" byte_order=\"LittleEndian\">" << endl;
611 fout <<
" <UnstructuredGrid>" << endl;
612 fout <<
" <Piece NumberOfPoints=\"" << uniqueFine.size() <<
"\" NumberOfCells=\"" << geomSizes.size() <<
"\">" << endl;
613 fout <<
" <PointData Scalars=\"Node Aggregate Processor\">" << endl;
614 fout <<
" <DataArray type=\"Int32\" Name=\"Node\" format=\"ascii\">" << endl;
618 for (
size_t i = 0; i < uniqueFine.size(); i++) {
620 fout << uniqueFine[i] <<
" ";
622 fout << nodeMap_->getGlobalElement(uniqueFine[i]) <<
" ";
628 fout <<
" </DataArray>" << endl;
629 fout <<
" <DataArray type=\"Int32\" Name=\"Aggregate\" format=\"ascii\">" << endl;
631 for (
size_t i = 0; i < uniqueFine.size(); i++) {
632 if (vertex2AggIds[uniqueFine[i]] == -1)
633 fout << vertex2AggIds[uniqueFine[i]] <<
" ";
635 fout << aggsOffset_ + vertex2AggIds[uniqueFine[i]] <<
" ";
641 fout <<
" </DataArray>" << endl;
642 fout <<
" <DataArray type=\"Int32\" Name=\"Processor\" format=\"ascii\">" << endl;
644 for (
size_t i = 0; i < uniqueFine.size(); i++) {
645 fout << myRank_ <<
" ";
651 fout <<
" </DataArray>" << endl;
653 fout <<
" <DataArray type=\"Float64\" Name=\"Quality\" format=\"ascii\">" << endl;
655 for (
size_t i = 0; i < uniqueFine.size(); i++) {
656 fout << qualities[vertex2AggIds[uniqueFine[i]]] <<
" ";
662 fout <<
" </DataArray>" << endl;
666 size_t dim = material_->getNumVectors();
667 fout <<
" <DataArray type=\"Float64\" NumberOfComponents=\"" << dim <<
"\" Name=\"Material\" format=\"ascii\">" << endl;
669 for (
size_t i = 0; i < uniqueFine.size(); i++) {
670 for (
size_t k = 0; k < dim; k++) {
671 fout << material[k][vertex2AggIds[uniqueFine[i]]] <<
" ";
677 fout <<
" </DataArray>" << endl;
679 fout <<
" </PointData>" << endl;
680 fout <<
" <Points>" << endl;
681 fout <<
" <DataArray type=\"Float64\" NumberOfComponents=\"3\" format=\"ascii\">" << endl;
683 for (
size_t i = 0; i < uniqueFine.size(); i++) {
684 fout << xCoords[uniqueFine[i]] <<
" " << yCoords[uniqueFine[i]] <<
" ";
688 fout << zCoords[uniqueFine[i]] <<
" ";
694 fout <<
" </DataArray>" << endl;
695 fout <<
" </Points>" << endl;
696 fout <<
" <Cells>" << endl;
697 fout <<
" <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">" << endl;
699 for (
size_t i = 0; i < vertices.size(); i++) {
700 fout << vertices[i] <<
" ";
706 fout <<
" </DataArray>" << endl;
707 fout <<
" <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">" << endl;
710 for (
size_t i = 0; i < geomSizes.size(); i++) {
711 accum += geomSizes[i];
712 fout << accum <<
" ";
718 fout <<
" </DataArray>" << endl;
719 fout <<
" <DataArray type=\"Int32\" Name=\"types\" format=\"ascii\">" << endl;
721 for (
size_t i = 0; i < geomSizes.size(); i++) {
722 switch (geomSizes[i]) {
740 fout <<
" </DataArray>" << endl;
741 fout <<
" </Cells>" << endl;
742 fout <<
" </Piece>" << endl;
743 fout <<
" </UnstructuredGrid>" << endl;
744 fout <<
"</VTKFile>" << endl;
747 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
751 ofstream color(
"random-colormap.xml");
752 color <<
"<ColorMap name=\"MueLu-Random\" space=\"RGB\">" << endl;
755 color <<
" <Point x=\"" << CONTRAST_1_ <<
"\" o=\"1\" r=\"1\" g=\"0\" b=\"0\"/>" << endl;
756 color <<
" <Point x=\"" << CONTRAST_2_ <<
"\" o=\"1\" r=\"1\" g=\"0.6\" b=\"0\"/>" << endl;
757 color <<
" <Point x=\"" << CONTRAST_3_ <<
"\" o=\"1\" r=\"1\" g=\"1\" b=\"0\"/>" << endl;
759 for (
int i = 0; i < 5000; i += 4) {
760 color <<
" <Point x=\"" << i <<
"\" o=\"1\" r=\"" << (rand() % 50) / 256.0 <<
"\" g=\"" << (rand() % 256) / 256.0 <<
"\" b=\"" << (rand() % 256) / 256.0 <<
"\"/>" << endl;
762 color <<
"</ColorMap>" << endl;
764 }
catch (std::exception& e) {
765 GetOStream(
Warnings0) <<
" Error while building colormap file: " << e.what() << endl;
769 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
775 pvtu <<
"<VTKFile type=\"PUnstructuredGrid\" byte_order=\"LittleEndian\">" << endl;
776 pvtu <<
" <PUnstructuredGrid GhostLevel=\"0\">" << endl;
777 pvtu <<
" <PPointData Scalars=\"Node Aggregate Processor\">" << endl;
778 pvtu <<
" <PDataArray type=\"Int32\" Name=\"Node\"/>" << endl;
779 pvtu <<
" <PDataArray type=\"Int32\" Name=\"Aggregate\"/>" << endl;
780 pvtu <<
" <PDataArray type=\"Int32\" Name=\"Processor\"/>" << endl;
781 pvtu <<
" </PPointData>" << endl;
782 pvtu <<
" <PPoints>" << endl;
783 pvtu <<
" <PDataArray type=\"Float64\" NumberOfComponents=\"3\"/>" << endl;
784 pvtu <<
" </PPoints>" << endl;
785 for (
int i = 0; i < numProcs; i++) {
787 pvtu <<
" <Piece Source=\"" << this->
replaceAll(baseFname,
"%PROCID",
toString(i)) <<
"\"/>" << endl;
790 if (doFineGraphEdges_) {
791 for (
int i = 0; i < numProcs; i++) {
793 pvtu <<
" <Piece Source=\"" << fn.insert(fn.rfind(
".vtu"),
"-finegraph") <<
"\"/>" << endl;
796 if (doCoarseGraphEdges_) {
797 for (
int i = 0; i < numProcs; i++) {
799 pvtu <<
" <Piece Source=\"" << fn.insert(fn.rfind(
".vtu"),
"-coarsegraph") <<
"\"/>" << endl;
802 pvtu <<
" </PUnstructuredGrid>" << endl;
803 pvtu <<
"</VTKFile>" << endl;
Important warning messages (one line)
MueLu::DefaultLocalOrdinal LocalOrdinal
std::string toString(const T &what)
Little helper function to convert non-string types to strings.
static Teuchos::RCP< MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &map, size_t NumVectors, bool zeroOut=true)
T & get(const std::string &name, T def_value)
Timer to be used in factories. Similar to Monitor but with additional timers.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
One-liner description of what is happening.
void doConvexHulls(std::vector< int > &vertices, std::vector< int > &geomSizes) const
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
void writeFile_(std::ofstream &fout, std::string styleName, std::vector< int > &vertices, std::vector< int > &geomSizes) const
void sort(View &view, const size_t &size)
void resize(const size_type n, const T &val=T())
bool isParameter(const std::string &name) const
virtual ~AggregationExportFactory()
Destructor.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
MueLu::DefaultGlobalOrdinal GlobalOrdinal
Class that holds all level-specific information.
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
void writePVTU_(std::ofstream &pvtu, std::string baseFname, int numProcs) const
void DeclareInput(Level &fineLevel, Level &coarseLevel) const
Input.
void doGraphEdges_(std::ofstream &fout, Teuchos::RCP< Matrix > &A, Teuchos::RCP< LWGraph > &G, bool fine, int dofs) const
int GetLevelID() const
Return level number.
Exception throws to report errors in the internal logical of the program.
void doJacksPlus_(std::vector< int > &vertices, std::vector< int > &geomSizes) const
AggregationExportFactory()
Constructor.
void Build(Level &fineLevel, Level &coarseLevel) const
Build an object with this factory.
void replaceAll(std::string &str, const std::string &from, const std::string &to)
static RCP< Import< LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &source, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &target, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
void buildColormap_() const