| 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_COARSESPACE_DECL_HPP |
| 11 |
#define _FROSCH_COARSESPACE_DECL_HPP |
| 12 |
|
| 13 |
//#include <Xpetra_Operator_fwd.hpp> |
| 14 |
#include <Xpetra_MapFactory_fwd.hpp> |
| 15 |
#include <Xpetra_Access.hpp> |
| 16 |
|
| 17 |
#include<KokkosKernels_Utils.hpp> |
| 18 |
|
| 19 |
#include <FROSch_Tools_def.hpp> |
| 20 |
|
| 21 |
|
| 22 |
namespace FROSch { |
| 23 |
|
| 24 |
using namespace Teuchos; |
| 25 |
using namespace Xpetra; |
| 26 |
|
| 27 |
template <class SC = double, |
| 28 |
class LO = int, |
| 29 |
class GO = DefaultGlobalOrdinal, |
| 30 |
class NO = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType> |
| 31 |
class CoarseSpace { |
| 32 |
|
| 33 |
protected: |
| 34 |
|
| 35 |
using CommPtr = RCP<const Comm<int> >; |
| 36 |
|
| 37 |
using XMap = Map<LO,GO,NO>; |
| 38 |
using XMapPtr = RCP<XMap>; |
| 39 |
using ConstXMapPtr = RCP<const XMap>; |
| 40 |
using XMapPtrVec = Array<XMapPtr>; |
| 41 |
using ConstXMapPtrVec = Array<ConstXMapPtr>; |
| 42 |
|
| 43 |
using XMatrix = Matrix<SC,LO,GO,NO>; |
| 44 |
using XMatrixPtr = RCP<XMatrix>; |
| 45 |
|
| 46 |
using XMultiVector = MultiVector<SC,LO,GO,NO>; |
| 47 |
using XMultiVectorPtr = RCP<XMultiVector>; |
| 48 |
using ConstXMultiVectorPtr = RCP<const XMultiVector>; |
| 49 |
using ConstXMultiVectorPtrVec = Array<ConstXMultiVectorPtr>; |
| 50 |
|
| 51 |
using ParameterListPtr = RCP<ParameterList>; |
| 52 |
|
| 53 |
using UN = unsigned; |
| 54 |
using UNVec = Array<UN>; |
| 55 |
using ConstUNVecView = ArrayView<const UN>; |
| 56 |
|
| 57 |
using LOVec = Array<LO>; |
| 58 |
using LOVecPtr = ArrayRCP<LO>; |
| 59 |
using ConstLOVecView = ArrayView<const LO>; |
| 60 |
using LOVecPtr2D = ArrayRCP<LOVecPtr>; |
| 61 |
|
| 62 |
using GOVec = Array<GO>; |
| 63 |
|
| 64 |
using SCVec = Array<SC>; |
| 65 |
using ConstSCVecPtr = ArrayRCP<const SC>; |
| 66 |
|
| 67 |
public: |
| 68 |
|
| 69 |
CoarseSpace(CommPtr mpiComm, |
| 70 |
CommPtr serialComm); |
| 71 |
|
| 72 |
int addSubspace(ConstXMapPtr subspaceBasisMap, |
| 73 |
ConstXMapPtr subspaceBasisMapUnique = null, |
| 74 |
ConstXMultiVectorPtr subspaceBasis = null, |
| 75 |
UN offset = 0); |
| 76 |
|
| 77 |
int assembleCoarseSpace(); |
| 78 |
|
| 79 |
int buildGlobalBasisMatrix(ConstXMapPtr rowMap, |
| 80 |
ConstXMapPtr rangeMap, |
| 81 |
ConstXMapPtr repeatedMap, |
| 82 |
SC tresholdDropping); |
| 83 |
|
| 84 |
int clearCoarseSpace(); |
| 85 |
|
| 86 |
int zeroOutBasisVectors(ConstLOVecView zeros); |
| 87 |
|
| 88 |
bool hasUnassembledMaps() const; |
| 89 |
|
| 90 |
bool hasBasisMap() const; |
| 91 |
|
| 92 |
ConstXMapPtr getBasisMap() const; |
| 93 |
|
| 94 |
bool hasBasisMapUnique() const; |
| 95 |
|
| 96 |
ConstXMapPtr getBasisMapUnique() const; |
| 97 |
|
| 98 |
bool hasAssembledBasis() const; |
| 99 |
|
| 100 |
ConstXMultiVectorPtr getAssembledBasis() const; |
| 101 |
|
| 102 |
ConstUNVecView getLocalSubspaceSizes() const; |
| 103 |
|
| 104 |
bool hasGlobalBasisMatrix() const; |
| 105 |
|
| 106 |
XMatrixPtr getGlobalBasisMatrix() const; |
| 107 |
|
| 108 |
protected: |
| 109 |
|
| 110 |
CommPtr MpiComm_; |
| 111 |
CommPtr SerialComm_; |
| 112 |
|
| 113 |
ConstXMapPtrVec UnassembledBasesMaps_ = ConstXMapPtrVec(0); |
| 114 |
ConstXMapPtrVec UnassembledBasesMapsUnique_ = ConstXMapPtrVec(0); |
| 115 |
|
| 116 |
ConstXMultiVectorPtrVec UnassembledSubspaceBases_ = ConstXMultiVectorPtrVec(0); |
| 117 |
|
| 118 |
LOVec Offsets_ = LOVec(0); |
| 119 |
|
| 120 |
ConstXMapPtr AssembledBasisMap_; |
| 121 |
ConstXMapPtr AssembledBasisMapUnique_; |
| 122 |
|
| 123 |
XMultiVectorPtr AssembledBasis_; |
| 124 |
|
| 125 |
UNVec LocalSubspacesSizes_ = UNVec(0); |
| 126 |
|
| 127 |
XMatrixPtr GlobalBasisMatrix_; |
| 128 |
}; |
| 129 |
|
| 130 |
} |
| 131 |
|
| 132 |
#endif |