MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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"
26 #include "MueLu_Aggregates_fwd.hpp"
27 
28 #include "MueLu_LWGraph.hpp"
31 
32 namespace MueLu {
33 
34 class Level;
35 
69 template <class Scalar = DefaultScalar,
72  class Node = DefaultNode>
73 class AggregationExportFactory : public TwoLevelFactoryBase, public VisualizationHelpers<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
74 #undef MUELU_AGGREGATIONEXPORTFACTORY_SHORT
75 #include "MueLu_UseShortNames.hpp"
76 
77  public:
79 
80 
83 
85  virtual ~AggregationExportFactory();
87 
88  RCP<const ParameterList> GetValidParameterList() const;
89 
91 
92 
93  void DeclareInput(Level& fineLevel, Level& coarseLevel) const;
94 
96 
98 
101  void Build(Level& fineLevel, Level& coarseLevel) const;
102 
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
128  mutable std::vector<bool> isRoot_;
129  mutable bool doFineGraphEdges_;
130  mutable bool doCoarseGraphEdges_;
131  mutable int numNodes_;
132  mutable int numAggs_;
133  mutable int dims_;
134  mutable int myRank_;
135  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.
137  mutable int aggsOffset_; // in a global list of aggregates, the offset of local aggregate indices
138 }; // class AggregationExportFactory
139 } // namespace MueLu
140 
141 #define MUELU_AGGREGATIONEXPORTFACTORY_SHORT
142 
143 #endif /* MUELU_AGGREGATIONEXPORTFACTORY_DECL_HPP_ */
MueLu::DefaultLocalOrdinal LocalOrdinal
Tpetra::KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
typename Teuchos::ScalarTraits< SC >::coordinateType coordinate_type
void doConvexHulls(std::vector< int > &vertices, std::vector< int > &geomSizes) const
MueLu::DefaultNode Node
void writeFile_(std::ofstream &fout, std::string styleName, std::vector< int > &vertices, std::vector< int > &geomSizes) const
virtual ~AggregationExportFactory()
Destructor.
MueLu::DefaultScalar Scalar
Tpetra::Details::DefaultTypes::scalar_type DefaultScalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
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
typename Xpetra::MultiVector< coordinate_type, LO, GO, NO > CoordinateMultiVector
Teuchos::RCP< CoordinateMultiVector > coords_
void DeclareInput(Level &fineLevel, Level &coarseLevel) const
Input.
Teuchos::RCP< CoordinateMultiVector > coordsCoarse_
void doGraphEdges_(std::ofstream &fout, Teuchos::RCP< Matrix > &A, Teuchos::RCP< LWGraph > &G, bool fine, int dofs) const
void doJacksPlus_(std::vector< int > &vertices, std::vector< int > &geomSizes) const
void Build(Level &fineLevel, Level &coarseLevel) const
Build an object with this factory.