| 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_ENTITYSET_DECL_HPP |
| 11 |
#define _FROSCH_ENTITYSET_DECL_HPP |
| 12 |
|
| 13 |
#include <FROSch_InterfaceEntity_def.hpp> |
| 14 |
|
| 15 |
#include <FROSch_Tools_def.hpp> |
| 16 |
|
| 17 |
|
| 18 |
namespace FROSch { |
| 19 |
|
| 20 |
using namespace Teuchos; |
| 21 |
using namespace Xpetra; |
| 22 |
|
| 23 |
template <class SC, |
| 24 |
class LO, |
| 25 |
class GO, |
| 26 |
class NO> |
| 27 |
class EntitySet { |
| 28 |
|
| 29 |
protected: |
| 30 |
|
| 31 |
using XMap = Map<LO,GO,NO>; |
| 32 |
using XMapPtr = RCP<XMap>; |
| 33 |
using ConstXMapPtr = RCP<const XMap>; |
| 34 |
|
| 35 |
using XMatrix = Matrix<SC,LO,GO,NO>; |
| 36 |
using XMatrixPtr = RCP<XMatrix>; |
| 37 |
using ConstXMatrixPtr = RCP<const XMatrix>; |
| 38 |
|
| 39 |
using XMultiVector = MultiVector<SC,LO,GO,NO>; |
| 40 |
using XMultiVectorPtr = RCP<XMultiVector>; |
| 41 |
using ConstXMultiVectorPtr = RCP<const XMultiVector>; |
| 42 |
|
| 43 |
using EntitySetPtr = RCP<EntitySet<SC,LO,GO,NO> >; |
| 44 |
|
| 45 |
using InterfaceEntityPtr = RCP<InterfaceEntity<SC,LO,GO,NO> >; |
| 46 |
using InterfaceEntityPtrVec = Array<InterfaceEntityPtr>; |
| 47 |
using InterfaceEntityPtrVecPtr = ArrayRCP<InterfaceEntityPtr>; |
| 48 |
|
| 49 |
using UN = unsigned; |
| 50 |
|
| 51 |
using GOVec = Array<GO>; |
| 52 |
using GOVecView = ArrayView<GO>; |
| 53 |
|
| 54 |
using SCVec = Array<SC>; |
| 55 |
using SCVecPtr = ArrayRCP<SC>; |
| 56 |
|
| 57 |
public: |
| 58 |
|
| 59 |
EntitySet(EntityType type); |
| 60 |
|
| 61 |
EntitySet(const EntitySet &entitySet); |
| 62 |
|
| 63 |
~EntitySet(); |
| 64 |
|
| 65 |
int addEntity(InterfaceEntityPtr entity); |
| 66 |
|
| 67 |
int addEntitySet(EntitySetPtr entitySet); |
| 68 |
|
| 69 |
EntitySetPtr deepCopy(); |
| 70 |
|
| 71 |
int buildEntityMap(ConstXMapPtr localToGlobalNodesMap); |
| 72 |
|
| 73 |
int findAncestorsInSet(EntitySetPtr entitySet); |
| 74 |
|
| 75 |
EntitySetPtr findRoots(); |
| 76 |
|
| 77 |
EntitySetPtr findLeafs(); |
| 78 |
|
| 79 |
int clearAncestors(); |
| 80 |
|
| 81 |
int clearOffspring(); |
| 82 |
|
| 83 |
int clearRoots(); |
| 84 |
|
| 85 |
int clearLeafs(); |
| 86 |
|
| 87 |
int computeDistancesToRoots(UN dimension, |
| 88 |
ConstXMultiVectorPtr &nodeList = null, |
| 89 |
DistanceFunction distanceFunction = ConstantDistanceFunction); |
| 90 |
|
| 91 |
int divideUnconnectedEntities(ConstXMatrixPtr matrix, |
| 92 |
int pID); |
| 93 |
|
| 94 |
int flagNodes(); |
| 95 |
|
| 96 |
int flagShortEntities(); |
| 97 |
|
| 98 |
int flagStraightEntities(UN dimension, |
| 99 |
ConstXMultiVectorPtr &nodeList); |
| 100 |
|
| 101 |
EntitySetPtr sortOutEntities(EntityFlag flag); |
| 102 |
|
| 103 |
int removeEntity(UN iD); |
| 104 |
|
| 105 |
int removeNodesWithDofs(GOVecView dirichletBoundaryDofs); |
| 106 |
|
| 107 |
int removeEmptyEntities(); |
| 108 |
|
| 109 |
int sortUnique(); |
| 110 |
|
| 111 |
bool checkForVertices(); |
| 112 |
|
| 113 |
bool checkForShortEdges(); |
| 114 |
|
| 115 |
bool checkForStraightEdges(UN dimension, |
| 116 |
ConstXMultiVectorPtr &nodeList); |
| 117 |
|
| 118 |
bool checkForEmptyEntities(); |
| 119 |
|
| 120 |
///////////////// |
| 121 |
// Set Methods // |
| 122 |
///////////////// |
| 123 |
|
| 124 |
int setUniqueIDToFirstGlobalNodeID(); |
| 125 |
|
| 126 |
int setRootID(); |
| 127 |
|
| 128 |
int setLeafID(); |
| 129 |
|
| 130 |
int resetEntityType(EntityType type); |
| 131 |
|
| 132 |
///////////////// |
| 133 |
// Get Methods // |
| 134 |
///////////////// |
| 135 |
|
| 136 |
EntityType getEntityType() const; |
| 137 |
|
| 138 |
UN getNumEntities() const; |
| 139 |
|
| 140 |
const InterfaceEntityPtrVec & getEntityVector() const; |
| 141 |
|
| 142 |
const InterfaceEntityPtr getEntity(UN iD) const; |
| 143 |
|
| 144 |
const XMapPtr getEntityMap() const; |
| 145 |
|
| 146 |
const SCVecPtr getDirection(UN dimension, |
| 147 |
ConstXMultiVectorPtr &nodeList, |
| 148 |
UN iD) const; |
| 149 |
|
| 150 |
protected: |
| 151 |
|
| 152 |
/////////////// |
| 153 |
// Variables // |
| 154 |
/////////////// |
| 155 |
|
| 156 |
EntityType Type_ = DefaultType; |
| 157 |
|
| 158 |
InterfaceEntityPtrVec EntityVector_ = InterfaceEntityPtrVec(0); |
| 159 |
|
| 160 |
bool EntityMapIsUpToDate_ = false; |
| 161 |
|
| 162 |
XMapPtr EntityMap_; |
| 163 |
}; |
| 164 |
|
| 165 |
} |
| 166 |
|
| 167 |
#endif |