// @HEADER // ***************************************************************************** // MueLu: A package for multigrid based preconditioning // // Copyright 2012 NTESS and the MueLu contributors. // SPDX-License-Identifier: BSD-3-Clause // ***************************************************************************** // @HEADER #ifndef MUELU_IPCFACTORY_DECL_HPP #define MUELU_IPCFACTORY_DECL_HPP #include #include #include "MueLu_ConfigDefs.hpp" #include "MueLu_IntrepidPCoarsenFactory_fwd.hpp" #include "MueLu_Level_fwd.hpp" #include "MueLu_ParameterListAcceptor.hpp" #include "MueLu_PerfUtils_fwd.hpp" #include "MueLu_PFactory.hpp" #include "MueLu_Utilities_fwd.hpp" #include "Intrepid2_Basis.hpp" #include "Kokkos_DynRankView.hpp" #include namespace MueLu { /*! @class IntrepidPCoarsenFactory class. @ingroup MueLuTransferClasses @brief Factory for building transfer operators based on coarsening in polynomial degree, following the Intrepid basis functions ## Input/output of IntrepidPCoarsenFactory ## ### User parameters of IntrepidPCoarsenFactory ### Parameter | type | default | master.xml | validated | requested | description ----------|------|---------|:----------:|:---------:|:---------:|------------ | pcoarsen: schedule | string | "" | * | * | | String describing the higher order coarsening scheme to use | | pcoarsen: element | string | "" | * | * | | String describing the class of element to use for higher order coarsening | | pcoarsen: hi basis | string | "" | * | * | | String describing higher-order basis function used | | pcoarsen: lo basis | string | "" | * | * | | String describing lower-order basis function to be used for coarse grid | | pcoarsen: element to node map | RCP > | null | * | * | | A FieldContainer with the element-to-node map in local ids compatible with the matrix column map | | A | Factory | null | * | * | | Generating factory of the matrix A used during the prolongator smoothing process | The * in the @c master.xml column denotes that the parameter is defined in the @c master.xml file.
The * in the @c validated column means that the parameter is declared in the list of valid input parameters (see IntrepidPCoarsen::GetValidParameters).
The * in the @c requested column states that the data is requested as input with all dependencies (see IntrepidPCoarsen::DeclareInput). ### Variables provided by IntrepidPCoarsen ### After IntrepidPCoarsen::Build the following data is available (if requested) Parameter | generated by | description ----------|--------------|------------ | P | IntrepidPCoarsenFactory | Smoothed prolongator NOTE: The prolongator generated by this routine strips Dirichlet unknowns out of the coarse grid. This means that the prolongator cannot transfer *solutions* between grids, only updates (because the update at a Dirichlet node is zero). This is a subtle distinction, but an important one for testing purposes. FIXME: There may be implications for the correctness of the nullspace transfer from fine to coarse that I need to understand. */ template class IntrepidPCoarsenFactory : public PFactory { #undef MUELU_INTREPIDPCOARSENFACTORY_SHORT #include "MueLu_UseShortNames.hpp" public: typedef Kokkos::DynRankView LOFieldContainer; typedef Kokkos::DynRankView SCFieldContainer; typedef Intrepid2::Basis Basis; // Hardwired on purpose //! @name Constructors/Destructors. //@{ /*! @brief Constructor. User can supply a factory for generating the tentative prolongator. */ IntrepidPCoarsenFactory() {} //! Destructor. virtual ~IntrepidPCoarsenFactory() {} RCP GetValidParameterList() const; //@} //! Input //@{ void DeclareInput(Level &fineLevel, Level &coarseLevel) const; //@} //! @name Build methods. //@{ /*! @brief Build method. Builds IPC prolongator and returns it in coarseLevel. */ void Build(Level &fineLevel, Level &coarseLevel) const; void BuildP(Level &fineLevel, Level &coarseLevel) const; // Build() //@} private: //! @name Internal Utilities //@{ // NOTE: This is hardwired to double on purpose. void GenerateLinearCoarsening_pn_kirby_to_p1(const LOFieldContainer &hi_elemToNode, const std::vector &hi_nodeIsOwned, const SCFieldContainer &hi_DofCoords, const std::vector &lo_node_in_hi, const Basis &lo_Basis, const std::vector &hi_to_lo_map, const Teuchos::RCP &lo_colMap, const Teuchos::RCP &lo_domainMap, const Teuchos::RCP &hi_map, Teuchos::RCP &P) const; //@} // NOTE: This is hardwired to double on purpose. void GenerateLinearCoarsening_pn_kirby_to_pm(const LOFieldContainer &hi_elemToNode, const std::vector &hi_nodeIsOwned, const SCFieldContainer &hi_DofCoords, const LOFieldContainer &lo_elemToHiRepresentativeNode, const Basis &lo_basis, const std::vector &hi_to_lo_map, const Teuchos::RCP &lo_colMap, const Teuchos::RCP &lo_domainMap, const Teuchos::RCP &hi_map, Teuchos::RCP &P) const; }; // class IntrepidPCoarsenFactory /* Utility functions for use with Intrepid */ namespace MueLuIntrepid { template Teuchos::RCP > BasisFactory(const std::string &name, int °ree); template void IntrepidGetLoNodeInHi(const Teuchos::RCP > &hi_basis, const Teuchos::RCP > &lo_basis, std::vector &lo_node_in_hi, Kokkos::DynRankView &hi_DofCoords); template void GenerateLoNodeInHiViaGIDs(const std::vector > &candidates, const LOFieldContainer &hi_elemToNode, RCP > &hi_columnMap, LOFieldContainer &lo_elemToHiRepresentativeNode); template void BuildLoElemToNode(const LOFieldContainer &hi_elemToNode, const std::vector &hi_nodeIsOwned, const std::vector &lo_node_in_hi, const Teuchos::ArrayRCP &hi_isDirichlet, LOFieldContainer &lo_elemToNode, std::vector &lo_nodeIsOwned, std::vector &hi_to_lo_map, int &lo_numOwnedNodes); template void BuildLoElemToNodeViaRepresentatives(const LOFieldContainer &hi_elemToNode, const std::vector &hi_nodeIsOwned, const LOFieldContainer &lo_elemToHiRepresentativeNode, LOFieldContainer &lo_elemToNode, std::vector &lo_nodeIsOwned, std::vector &hi_to_lo_map, int &lo_numOwnedNodes); template void GenerateColMapFromImport(const Xpetra::Import &hi_importer, const std::vector &hi_to_lo_map, const Xpetra::Map &lo_domainMap, const size_t &lo_columnMapLength, RCP > &lo_columnMap); template void GenerateRepresentativeBasisNodes(const Basis &basis, const SCFieldContainer &ReferenceNodeLocations, const double threshold, std::vector > &representative_node_candidates); // ! Given an element to (global) node map and a basis, determine one global ordinal per geometric entity (vertex, edge, face, // ! interior). On exit, seeds container is of dimension (spaceDim+1), and contains a sorted vector of local ordinals // ! belonging to entities of that dimension. Only locally-owned degrees of freedom (as determined by rowMap and columnMap) // ! will be stored in seeds. template void FindGeometricSeedOrdinals(Teuchos::RCP basis, const LOFieldContainer &elementToNodeMap, std::vector > &seeds, const Xpetra::Map &rowMap, const Xpetra::Map &columnMap); } // namespace MueLuIntrepid } // namespace MueLu #define MUELU_INTREPIDPCOARSENFACTORY_SHORT #endif // MUELU_INTREPIDPCOARSENFACTORY_DECL_HPP