MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_AggregationExportFactory_decl.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// MueLu: A package for multigrid based preconditioning
4//
5// Copyright 2012 NTESS and the MueLu contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10/*
11 * MueLu_AggregationExportFactory_decl.hpp
12 *
13 * Created on: Feb 10, 2012
14 * Author: wiesner
15 */
16
17#ifndef MUELU_AGGREGATIONEXPORTFACTORY_DECL_HPP_
18#define MUELU_AGGREGATIONEXPORTFACTORY_DECL_HPP_
19
20#include <Xpetra_Matrix_fwd.hpp>
21
22#include "MueLu_ConfigDefs.hpp"
24#include "MueLu_VisualizationHelpers.hpp"
27
28#include "MueLu_LWGraph.hpp"
31
32namespace MueLu {
33
34class Level;
35
69template <class Scalar = DefaultScalar,
72 class Node = DefaultNode>
73class AggregationExportFactory : public TwoLevelFactoryBase, public VisualizationHelpers<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
74#undef MUELU_AGGREGATIONEXPORTFACTORY_SHORT
76
77 public:
79
80
83
87
88 RCP<const ParameterList> GetValidParameterList() const;
89
91
92
93 void DeclareInput(Level& fineLevel, Level& coarseLevel) const;
94
96
98
99
101 void Build(Level& fineLevel, Level& coarseLevel) const;
102
103 using coordinate_type = typename Teuchos::ScalarTraits<SC>::coordinateType;
104 using CoordinateMultiVector = typename Xpetra::MultiVector<coordinate_type, LO, GO, NO>;
105
107
108 private:
109 // Break different viz styles into separate functions for organization:
110 void doJacksPlus_(std::vector<int>& vertices, std::vector<int>& geomSizes) const;
111 void doConvexHulls(std::vector<int>& vertices, std::vector<int>& geomSizes) const;
112 void doGraphEdges_(std::ofstream& fout, Teuchos::RCP<Matrix>& A, Teuchos::RCP<LWGraph>& G, bool fine, int dofs) const; // add geometry to display node connections from a matrix. Connections in graph but not matrix have different color.
113
114 // write VTK data
115 void writeFile_(std::ofstream& fout, std::string styleName, std::vector<int>& vertices, std::vector<int>& geomSizes) const;
116 void buildColormap_() const;
117 void writePVTU_(std::ofstream& pvtu, std::string baseFname, int numProcs) const;
118
119 static const int CONTRAST_1_ = -1;
120 static const int CONTRAST_2_ = -2;
121 static const int CONTRAST_3_ = -3;
122
123 // Data that the different styles need to have available when building geometry
124 mutable Teuchos::RCP<CoordinateMultiVector> coords_; // fine local coordinates
125 mutable Teuchos::RCP<CoordinateMultiVector> coordsCoarse_; // coarse local coordinates
126 mutable Teuchos::RCP<LocalOrdinalMultiVector> vertex2AggId_;
127 mutable Teuchos::RCP<MultiVector> qualities_;
128 mutable Teuchos::RCP<MultiVector> material_;
129 mutable Teuchos::ArrayRCP<LocalOrdinal> aggSizes_;
130 mutable std::vector<bool> isRoot_;
131 mutable bool doAggQuality_;
132 mutable bool doMaterial_;
133 mutable bool doFineGraphEdges_;
135 mutable int numNodes_;
136 mutable int numAggs_;
137 mutable int dims_;
138 mutable int myRank_;
139 mutable Teuchos::RCP<const Map> nodeMap_; // map used in A and Coordinates to map local ordinals to global ordinals. Need the whole map especially if it's not contiguous.
140 mutable Teuchos::RCP<const Map> nodeMapCoarse_; // Map for Ac
141 mutable int aggsOffset_; // in a global list of aggregates, the offset of local aggregate indices
142}; // class AggregationExportFactory
143} // namespace MueLu
144
145#define MUELU_AGGREGATIONEXPORTFACTORY_SHORT
146
147#endif /* MUELU_AGGREGATIONEXPORTFACTORY_DECL_HPP_ */
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
MueLu::DefaultNode Node
Factory to export aggregation info or visualize aggregates using VTK.
Teuchos::RCP< CoordinateMultiVector > coords_
void doJacksPlus_(std::vector< int > &vertices, std::vector< int > &geomSizes) const
void writePVTU_(std::ofstream &pvtu, std::string baseFname, int numProcs) const
void doConvexHulls(std::vector< int > &vertices, std::vector< int > &geomSizes) const
Teuchos::RCP< CoordinateMultiVector > coordsCoarse_
virtual ~AggregationExportFactory()
Destructor.
void doGraphEdges_(std::ofstream &fout, Teuchos::RCP< Matrix > &A, Teuchos::RCP< LWGraph > &G, bool fine, int dofs) const
void writeFile_(std::ofstream &fout, std::string styleName, std::vector< int > &vertices, std::vector< int > &geomSizes) const
void Build(Level &fineLevel, Level &coarseLevel) const
Build an object with this factory.
typename Teuchos::ScalarTraits< SC >::coordinateType coordinate_type
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
void DeclareInput(Level &fineLevel, Level &coarseLevel) const
Input.
Teuchos::RCP< LocalOrdinalMultiVector > vertex2AggId_
typename Xpetra::MultiVector< coordinate_type, LO, GO, NO > CoordinateMultiVector
Class that holds all level-specific information.
Base class for factories that use two levels (fineLevel and coarseLevel).
Base class providing routines to visualize aggregates and coarsening information.
Namespace for MueLu classes and methods.
Tpetra::KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
Tpetra::Details::DefaultTypes::scalar_type DefaultScalar