// @HEADER // ***************************************************************************** // ShyLU: Scalable Hybrid LU Preconditioner and Solver // // Copyright 2011 NTESS and the ShyLU contributors. // SPDX-License-Identifier: BSD-3-Clause // ***************************************************************************** // @HEADER #ifndef _FROSCH_INTERFACEENTITY_DECL_HPP #define _FROSCH_INTERFACEENTITY_DECL_HPP #include #include #include namespace FROSch { using namespace Teuchos; using namespace Xpetra; template class EntitySet; enum EntityType {DefaultType,VertexType,EdgeType,FaceType,InteriorType,InterfaceType}; enum EntityFlag {DefaultFlag,StraightFlag,ShortFlag,NodeFlag}; enum DistanceFunction {ConstantDistanceFunction,InverseEuclideanDistanceFunction}; template struct Node { LO NodeIDGamma_; LO NodeIDLocal_; GO NodeIDGlobal_; ArrayRCP DofsGamma_; ArrayRCP DofsLocal_; ArrayRCP DofsGlobal_; bool operator< (const Node &n) const; bool operator== (const Node &n) const; }; template class InterfaceEntity { protected: using XMatrix = Xpetra::Matrix; using XMatrixPtr = RCP; using ConstXMatrixPtr = RCP; using XVector = Xpetra::Vector; using XVectorPtr = RCP; using XMultiVector = Xpetra::MultiVector; using XMultiVectorPtr = RCP; using ConstXMultiVectorPtr = RCP; using EntitySetPtr = RCP >; using InterfaceEntityPtr = RCP >; using NodeVec = Array >; using NodePtr = RCP >; using NodePtrVec = Array; using UN = unsigned; using IntVec = Array; using LOVecPtr = ArrayRCP; using GOVec = Array; using GOVecPtr = ArrayRCP; using SCVecPtr = ArrayRCP; using SCVecPtrVec = Array; public: InterfaceEntity(EntityType type, UN dofsPerNode, UN multiplicity, const int *subdomains, EntityFlag flag = DefaultFlag); ~InterfaceEntity(); int addNode(LO nodeIDGamma, LO nodeIDLocal, GO nodeIDGlobal, UN nDofs, const LOVecPtr dofsGamma, const LOVecPtr dofsLocal, const GOVecPtr dofsGlobal); int addNode(const NodePtr &node); int addNode(const Node &node); int resetGlobalDofs(UN iD, UN nDofs, UN *dofIDs, GO *dofsGlobal); int removeNode(UN iD); int sortByGlobalID(); int setUniqueID(GO uniqueID); int setLocalID(LO localID); int setRootID(LO rootID); int setLeafID(LO leafID); int setUniqueIDToFirstGlobalID(); int resetEntityType(EntityType type); int resetEntityFlag(EntityFlag flag); int findAncestorsInSet(EntitySetPtr entitySet); int clearAncestors(); int addOffspring(InterfaceEntityPtr interfaceEntity); int clearOffspring(); EntitySetPtr findRoots(); int clearRoots(); int computeDistancesToRoots(UN dimension, ConstXMultiVectorPtr &nodeList = null, DistanceFunction distanceFunction = ConstantDistanceFunction); InterfaceEntityPtr divideEntity(ConstXMatrixPtr matrix, int pID); ///////////////// // Get Methods // ///////////////// EntityType getEntityType() const; EntityFlag getEntityFlag() const; UN getDofsPerNode() const; UN getMultiplicity() const; GO getUniqueID() const; LO getLocalID() const; LO getRootID() const; LO getLeafID() const; const Node& getNode(UN iDNode) const; LO getGammaNodeID(UN iDNode) const; LO getLocalNodeID(UN iDNode) const; GO getGlobalNodeID(UN iDNode) const; LO getGammaDofID(UN iDNode, UN iDDof) const; LO getLocalDofID(UN iDNode, UN iDDof) const; GO getGlobalDofID(UN iDNode, UN iDDof) const; const IntVec & getSubdomainsVector() const; UN getNumNodes() const; const EntitySetPtr getAncestors() const; const EntitySetPtr getOffspring() const; const EntitySetPtr getRoots() const; SC getDistanceToRoot(UN iDNode, UN iDRoot) const; protected: EntityType Type_ = DefaultType; EntityFlag Flag_ = DefaultFlag; NodeVec NodeVector_ = NodeVec(0); IntVec SubdomainsVector_ = IntVec(0); EntitySetPtr Ancestors_; EntitySetPtr Offspring_; EntitySetPtr Roots_; SCVecPtrVec DistancesVector_ = SCVecPtrVec(0); // AH 08/08/2019 TODO: make a MultiVector out of this UN DofsPerNode_ = 1; UN Multiplicity_ = 1; GO UniqueID_ = -1; LO LocalID_ = -1; LO RootID_ = -1; LO LeafID_ = -1; }; template bool compareInterfaceEntities(RCP > iEa, RCP > iEb); template bool equalInterfaceEntities(RCP > iEa, RCP > iEb); } #endif