Debian Codegraph @

packages/shylu/shylu_dd/frosch/src/InterfaceSets/FROSch_DDInterface_decl.hpp

raw
1 // @HEADER
2 // *****************************************************************************
3 // ShyLU: Scalable Hybrid LU Preconditioner and Solver
4 //
5 // Copyright 2011 NTESS and the ShyLU contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9
10 #ifndef _FROSCH_DDINTERFACE_DECL_HPP
11 #define _FROSCH_DDINTERFACE_DECL_HPP
12
13 //#define INTERFACE_OUTPUT
14
15 #include <Xpetra_Operator_fwd.hpp>
16 #include <Xpetra_MapFactory_fwd.hpp>
17 #include <Xpetra_ExportFactory_fwd.hpp>
18 #include <Xpetra_CrsGraphFactory.hpp>
19
20 #include <FROSch_EntitySet_def.hpp>
21 #include <FROSch_InterfaceEntity_decl.hpp>
22
23 #include <FROSch_ExtractSubmatrices_def.hpp>
24
25
26 namespace FROSch {
27
28 using namespace Teuchos;
29 using namespace Xpetra;
30
31 enum CommunicationStrategy {CommCrsMatrix,CommCrsGraph,CreateOneToOneMap};
32
33 template <class SC = double,
34 class LO = int,
35 class GO = DefaultGlobalOrdinal,
36 class NO = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
37 class DDInterface {
38
39 protected:
40
41 using CommPtr = RCP<const Comm<int> >;
42
43 using XMap = Map<LO,GO,NO>;
44 using XMapPtr = RCP<XMap>;
45 using ConstXMapPtr = RCP<const XMap>;
46 using XMapPtrVecPtr = ArrayRCP<XMapPtr>;
47 using ConstXMapPtrVecPtr = ArrayRCP<ConstXMapPtr>;
48
49 using XMatrix = Matrix<SC,LO,GO,NO>;
50 using XMatrixPtr = RCP<XMatrix>;
51 using ConstXMatrixPtr = RCP<const XMatrix>;
52
53 using XCrsGraph = CrsGraph<LO,GO,NO>;
54 using XCrsGraphPtr = RCP<XCrsGraph>;
55
56 using XMultiVector = MultiVector<SC,LO,GO,NO>;
57 using XMultiVectorPtr = RCP<XMultiVector>;
58 using ConstXMultiVectorPtr = RCP<const XMultiVector>;
59
60 using XImport = Import<LO,GO,NO>;
61 using XImportPtr = RCP<XImport>;
62
63 using XExport = Export<LO,GO,NO>;
64 using XExportPtr = RCP<XExport>;
65
66 using EntitySetPtr = RCP<EntitySet<SC,LO,GO,NO> >;
67 using EntitySetConstPtr = const EntitySetPtr;
68 using EntitySetPtrVecPtr = ArrayRCP<EntitySetPtr>;
69 using EntitySetPtrConstVecPtr = const EntitySetPtrVecPtr;
70
71 using EntityFlagVecPtr = ArrayRCP<EntityFlag>;
72
73 using InterfaceEntityPtr = RCP<InterfaceEntity<SC,LO,GO,NO> >;
74 using InterfaceEntityPtrVecPtr = ArrayRCP<InterfaceEntityPtr>;
75
76 using UN = unsigned;
77 using ConstUN = const UN;
78 using UNVecPtr = ArrayRCP<UN>;
79
80 using IntVec = Array<int>;
81 using IntVecVec = Array<IntVec>;
82 using IntVecVecPtr = ArrayRCP<IntVec>;
83
84 using LOVec = Array<LO>;
85 using LOVecPtr = ArrayRCP<LO>;
86
87 using GOVec = Array<GO>;
88 using ConstGOVecView = ArrayView<const GO>;
89 using GOVecPtr = ArrayRCP<GO>;
90 using GOVecView = ArrayView<GO>;
91 using GOVecVec = Array<GOVec>;
92 using GOVecVecPtr = ArrayRCP<GOVec>;
93
94 using SCVec = Array<SC>;
95 using SCVecPtr = ArrayRCP<SC>;
96
97 public:
98
99 DDInterface(UN dimension,
100 UN dofsPerNode,
101 ConstXMapPtr localToGlobalMap,
102 Verbosity verbosity = All,
103 UN levelID = 1,
104 CommunicationStrategy commStrategy = CommCrsGraph);
105
106 ~DDInterface();
107
108 int resetGlobalDofs(ConstXMapPtrVecPtr dofsMaps);
109
110 int removeDirichletNodes(GOVecView dirichletBoundaryDofs);
111
112 int divideUnconnectedEntities(ConstXMatrixPtr matrix);
113
114 int flagEntities(ConstXMultiVectorPtr nodeList = null);
115
116 int removeEmptyEntities();
117
118 int sortVerticesEdgesFaces(ConstXMultiVectorPtr nodeList = null);
119
120 int buildEntityMaps(bool buildVerticesMap = true,
121 bool buildShortEdgesMap = true,
122 bool buildStraightEdgesMap = true,
123 bool buildEdgesMap = true,
124 bool buildFacesMap = true,
125 bool buildRootsMap = false,
126 bool buildLeafsMap = false);
127
128 int buildEntityHierarchy();
129
130 int computeDistancesToRoots(UN dimension,
131 ConstXMultiVectorPtr &nodeList = null,
132 DistanceFunction distanceFunction = ConstantDistanceFunction);
133
134 //! This function extracts those entities which are to be used to build a connectivity graph on the subdomain
135 //! level. By default, we identify all entities with multiplicity 2. Afterwards, the corresponding entities can
136 //! be obtained using the function getConnectivityEntities().
137 //! If short or straight edges should be omitted, the function flagEntities() has to be called in advance.
138 int identifyConnectivityEntities(UNVecPtr multiplicities = null,
139 EntityFlagVecPtr flags = null);
140
141 UN getDimension() const;
142
143 UN getDofsPerNode() const;
144
145 LO getNumMyNodes() const;
146
147 //
148 // Remove the references below?
149 //
150
151 EntitySetConstPtr & getVertices() const;
152
153 EntitySetConstPtr & getShortEdges() const;
154
155 EntitySetConstPtr & getStraightEdges() const;
156
157 EntitySetConstPtr & getEdges() const;
158
159 EntitySetConstPtr & getFaces() const;
160
161 EntitySetConstPtr & getInterface() const;
162
163 EntitySetConstPtr & getInterior() const;
164
165 EntitySetConstPtr & getRoots() const;
166
167 EntitySetConstPtr & getLeafs() const;
168
169 EntitySetPtrConstVecPtr & getEntitySetVector() const;
170
171 GOVec getNumEnt() const;
172 //! This function returns those entities which are to be used to build a connectivity graph on the subdomain
173 //! level. They have to identified first using the function identifyConnectivityEntities().
174 EntitySetConstPtr & getConnectivityEntities() const;
175
176 ConstXMapPtr getNodesMap() const;
177
178
179 protected:
180
181 int communicateLocalComponents(IntVecVecPtr &componentsSubdomains,
182 IntVecVec &componentsSubdomainsUnique);
183
184 int identifyLocalComponents(IntVecVecPtr &componentsSubdomains,
185 IntVecVec &componentsSubdomainsUnique);
186
187
188 CommPtr MpiComm_;
189
190 UN Dimension_ = 3;
191 UN DofsPerNode_ = 1;
192 LO NumMyNodes_ = 0;
193
194 EntitySetPtr Vertices_ = EntitySetPtr(new EntitySet<SC,LO,GO,NO>(VertexType));
195 EntitySetPtr ShortEdges_ = EntitySetPtr(new EntitySet<SC,LO,GO,NO>(EdgeType));
196 EntitySetPtr StraightEdges_ = EntitySetPtr(new EntitySet<SC,LO,GO,NO>(EdgeType));
197 EntitySetPtr Edges_ = EntitySetPtr(new EntitySet<SC,LO,GO,NO>(EdgeType));
198 EntitySetPtr Faces_ = EntitySetPtr(new EntitySet<SC,LO,GO,NO>(FaceType));
199 EntitySetPtr Interface_ = EntitySetPtr(new EntitySet<SC,LO,GO,NO>(InterfaceType));
200 EntitySetPtr Interior_ = EntitySetPtr(new EntitySet<SC,LO,GO,NO>(InteriorType));
201 EntitySetPtr Roots_ = EntitySetPtr(new EntitySet<SC,LO,GO,NO>(DefaultType));
202 EntitySetPtr Leafs_ = EntitySetPtr(new EntitySet<SC,LO,GO,NO>(DefaultType));
203 EntitySetPtr ConnectivityEntities_ = EntitySetPtr(new EntitySet<SC,LO,GO,NO>(DefaultType));
204 EntitySetPtrVecPtr EntitySetVector_;
205
206 ConstXMapPtr NodesMap_;
207 ConstXMapPtr UniqueNodesMap_;
208
209 CommunicationStrategy CommStrategy_ = CommCrsGraph;
210
211 bool Verbose_ = false;
212
213 Verbosity Verbosity_ = All;
214
215 ConstUN LevelID_ = 1;
216 GOVec NumEntity_;
217 };
218
219 }
220
221 #endif