// @HEADER // ***************************************************************************** // ShyLU: Scalable Hybrid LU Preconditioner and Solver // // Copyright 2011 NTESS and the ShyLU contributors. // SPDX-License-Identifier: BSD-3-Clause // ***************************************************************************** // @HEADER #ifndef _FROSCH_DDINTERFACE_DECL_HPP #define _FROSCH_DDINTERFACE_DECL_HPP //#define INTERFACE_OUTPUT #include #include #include #include #include #include #include namespace FROSch { using namespace Teuchos; using namespace Xpetra; enum CommunicationStrategy {CommCrsMatrix,CommCrsGraph,CreateOneToOneMap}; template class DDInterface { protected: using CommPtr = RCP >; using XMap = Map; using XMapPtr = RCP; using ConstXMapPtr = RCP; using XMapPtrVecPtr = ArrayRCP; using ConstXMapPtrVecPtr = ArrayRCP; using XMatrix = Matrix; using XMatrixPtr = RCP; using ConstXMatrixPtr = RCP; using XCrsGraph = CrsGraph; using XCrsGraphPtr = RCP; using XMultiVector = MultiVector; using XMultiVectorPtr = RCP; using ConstXMultiVectorPtr = RCP; using XImport = Import; using XImportPtr = RCP; using XExport = Export; using XExportPtr = RCP; using EntitySetPtr = RCP >; using EntitySetConstPtr = const EntitySetPtr; using EntitySetPtrVecPtr = ArrayRCP; using EntitySetPtrConstVecPtr = const EntitySetPtrVecPtr; using EntityFlagVecPtr = ArrayRCP; using InterfaceEntityPtr = RCP >; using InterfaceEntityPtrVecPtr = ArrayRCP; using UN = unsigned; using ConstUN = const UN; using UNVecPtr = ArrayRCP; using IntVec = Array; using IntVecVec = Array; using IntVecVecPtr = ArrayRCP; using LOVec = Array; using LOVecPtr = ArrayRCP; using GOVec = Array; using ConstGOVecView = ArrayView; using GOVecPtr = ArrayRCP; using GOVecView = ArrayView; using GOVecVec = Array; using GOVecVecPtr = ArrayRCP; using SCVec = Array; using SCVecPtr = ArrayRCP; public: DDInterface(UN dimension, UN dofsPerNode, ConstXMapPtr localToGlobalMap, Verbosity verbosity = All, UN levelID = 1, CommunicationStrategy commStrategy = CommCrsGraph); ~DDInterface(); int resetGlobalDofs(ConstXMapPtrVecPtr dofsMaps); int removeDirichletNodes(GOVecView dirichletBoundaryDofs); int divideUnconnectedEntities(ConstXMatrixPtr matrix); int flagEntities(ConstXMultiVectorPtr nodeList = null); int removeEmptyEntities(); int sortVerticesEdgesFaces(ConstXMultiVectorPtr nodeList = null); int buildEntityMaps(bool buildVerticesMap = true, bool buildShortEdgesMap = true, bool buildStraightEdgesMap = true, bool buildEdgesMap = true, bool buildFacesMap = true, bool buildRootsMap = false, bool buildLeafsMap = false); int buildEntityHierarchy(); int computeDistancesToRoots(UN dimension, ConstXMultiVectorPtr &nodeList = null, DistanceFunction distanceFunction = ConstantDistanceFunction); //! This function extracts those entities which are to be used to build a connectivity graph on the subdomain //! level. By default, we identify all entities with multiplicity 2. Afterwards, the corresponding entities can //! be obtained using the function getConnectivityEntities(). //! If short or straight edges should be omitted, the function flagEntities() has to be called in advance. int identifyConnectivityEntities(UNVecPtr multiplicities = null, EntityFlagVecPtr flags = null); UN getDimension() const; UN getDofsPerNode() const; LO getNumMyNodes() const; // // Remove the references below? // EntitySetConstPtr & getVertices() const; EntitySetConstPtr & getShortEdges() const; EntitySetConstPtr & getStraightEdges() const; EntitySetConstPtr & getEdges() const; EntitySetConstPtr & getFaces() const; EntitySetConstPtr & getInterface() const; EntitySetConstPtr & getInterior() const; EntitySetConstPtr & getRoots() const; EntitySetConstPtr & getLeafs() const; EntitySetPtrConstVecPtr & getEntitySetVector() const; GOVec getNumEnt() const; //! This function returns those entities which are to be used to build a connectivity graph on the subdomain //! level. They have to identified first using the function identifyConnectivityEntities(). EntitySetConstPtr & getConnectivityEntities() const; ConstXMapPtr getNodesMap() const; protected: int communicateLocalComponents(IntVecVecPtr &componentsSubdomains, IntVecVec &componentsSubdomainsUnique); int identifyLocalComponents(IntVecVecPtr &componentsSubdomains, IntVecVec &componentsSubdomainsUnique); CommPtr MpiComm_; UN Dimension_ = 3; UN DofsPerNode_ = 1; LO NumMyNodes_ = 0; EntitySetPtr Vertices_ = EntitySetPtr(new EntitySet(VertexType)); EntitySetPtr ShortEdges_ = EntitySetPtr(new EntitySet(EdgeType)); EntitySetPtr StraightEdges_ = EntitySetPtr(new EntitySet(EdgeType)); EntitySetPtr Edges_ = EntitySetPtr(new EntitySet(EdgeType)); EntitySetPtr Faces_ = EntitySetPtr(new EntitySet(FaceType)); EntitySetPtr Interface_ = EntitySetPtr(new EntitySet(InterfaceType)); EntitySetPtr Interior_ = EntitySetPtr(new EntitySet(InteriorType)); EntitySetPtr Roots_ = EntitySetPtr(new EntitySet(DefaultType)); EntitySetPtr Leafs_ = EntitySetPtr(new EntitySet(DefaultType)); EntitySetPtr ConnectivityEntities_ = EntitySetPtr(new EntitySet(DefaultType)); EntitySetPtrVecPtr EntitySetVector_; ConstXMapPtr NodesMap_; ConstXMapPtr UniqueNodesMap_; CommunicationStrategy CommStrategy_ = CommCrsGraph; bool Verbose_ = false; Verbosity Verbosity_ = All; ConstUN LevelID_ = 1; GOVec NumEntity_; }; } #endif