Debian Codegraph @

packages/muelu/research/max/AdditiveMG/Smooth_Prolongation.hpp

raw
1 // @HEADER
2 // *****************************************************************************
3 // MueLu: A package for multigrid based preconditioning
4 //
5 // Copyright 2012 NTESS and the MueLu contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9
10 // Tpetra provides distributed sparse linear algebra
11 #include <Tpetra_CrsMatrix.hpp>
12 #include <Tpetra_Vector.hpp>
13 #include <Tpetra_Import_decl.hpp>
14 #include <Tpetra_Export_decl.hpp>
15
16 // MueLu main header: include most common header files in one line
17 #include <MueLu.hpp>
18 #include <MueLu_TpetraOperator.hpp>
19 #include <MueLu_CreateTpetraPreconditioner.hpp>
20 #include <MueLu_Utilities.hpp>
21
22 #include <Xpetra_VectorFactory.hpp>
23 #include <Xpetra_MultiVectorFactory.hpp>
24 #include <Xpetra_ExportFactory.hpp>
25 #include <Xpetra_MatrixFactory.hpp>
26
27 #include <Ifpack2_AdditiveSchwarz_decl.hpp>
28
29 namespace MueLu {
30
31 // Define default types
32 typedef double scalar_type;
33 typedef int local_ordinal_type;
34 typedef int global_ordinal_type;
35 typedef Tpetra::KokkosClassic::DefaultNode::DefaultNodeType node_type;
36
37 typedef Tpetra::Operator<scalar_type, local_ordinal_type, global_ordinal_type, node_type> operator_type;
38
39 typedef Tpetra::CrsMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> crs_matrix_type;
40 typedef Tpetra::RowMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> row_matrix_type;
41 typedef Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type> multivector_type;
42 typedef Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type> driver_map_type;
43
44 typedef MueLu::TpetraOperator<scalar_type, local_ordinal_type, global_ordinal_type, node_type> muelu_tpetra_operator_type;
45 typedef MueLu::Utilities<scalar_type, local_ordinal_type, global_ordinal_type, node_type> MueLuUtilities;
46
47 typedef Xpetra::Matrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> xpetra_matrix;
48
49 typedef Ifpack2::Preconditioner<scalar_type, local_ordinal_type, global_ordinal_type, node_type> precond_type;
50
51 struct DomainPartitioning {
52 global_ordinal_type nx = 0;
53 global_ordinal_type ny = 0;
54 global_ordinal_type nz = 0;
55
56 global_ordinal_type bricksize_x = 0;
57 global_ordinal_type bricksize_y = 0;
58 global_ordinal_type bricksize_z = 0;
59 };
60
61 class AdditiveVariant : public operator_type {
62 public:
63 AdditiveVariant(RCP<crs_matrix_type>, RCP<multivector_type>, DomainPartitioning);
64
65 void apply(const multivector_type &, multivector_type &, Teuchos::ETransp, scalar_type, scalar_type) const;
66
67 bool hasTransposeApply() const { return false; }
68
69 RCP<const driver_map_type> getDomainMap() const { return DomainMap_; };
70
71 RCP<const driver_map_type> getRangeMap() const { return RangeMap_; };
72
73 private:
74 DomainPartitioning domain_;
75
76 RCP<const Teuchos::Comm<int> > GlobalComm_;
77
78 RCP<multivector_type> coords_;
79
80 RCP<const driver_map_type> DomainMap_;
81
82 RCP<const driver_map_type> RangeMap_;
83
84 // MueLu Preconditioner to store the smoother at the fine level
85 RCP<muelu_tpetra_operator_type> B_fine_ = Teuchos::null;
86
87 // RCP<Ifpack2::AdditiveSchwarz< row_matrix_type, precond_type > > B_DD_;
88
89 // MueLu Preconditioner to store
90 RCP<muelu_tpetra_operator_type> B_coarse_ = Teuchos::null;
91
92 void AdditiveFineSmoother(RCP<crs_matrix_type>);
93
94 void AdditiveCoarseSolver(RCP<crs_matrix_type>);
95 };
96
97 } // namespace MueLu