MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_MatrixFreeTentativeP_decl.hpp
Go to the documentation of this file.
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#ifndef MUELU_MATRIXFREETENTATIVEP_DECL_HPP
11#define MUELU_MATRIXFREETENTATIVEP_DECL_HPP
12
13#include "MueLu_ConfigDefs.hpp"
14
16
17#include <Tpetra_KokkosCompat_ClassicNodeAPI_Wrapper.hpp>
18
19#include <Teuchos_BLAS_types.hpp>
20#include "Teuchos_ScalarTraits.hpp"
21
23#include "Xpetra_Map_fwd.hpp"
24#include "Xpetra_MultiVector_fwd.hpp"
25#include "Xpetra_Operator_fwd.hpp"
26
27namespace MueLu {
28
33// template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
34// class MatrixFreeTentativeP;
35
36template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
37class MatrixFreeTentativeP : public Xpetra::Operator<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
38 public:
41 typedef typename Node::execution_space execution_space;
42 typedef Kokkos::RangePolicy<local_ordinal_type, execution_space> range_type;
43 typedef Kokkos::MDRangePolicy<local_ordinal_type, execution_space, Kokkos::Rank<2>> md_range_type;
44 typedef Node node_type;
45 typedef typename Teuchos::ScalarTraits<Scalar>::coordinateType real_type;
46
47 private:
48#undef MUELU_MATRIXFREETENTATIVEP_SHORT
50
51 public:
53
54
56 MatrixFreeTentativeP(Teuchos::RCP<const Map> coarse_map, Teuchos::RCP<const Map> fine_map, Teuchos::RCP<const Aggregates> aggregates)
57 : fine_map_(fine_map)
58 , coarse_map_(coarse_map)
59 , aggregates_(aggregates) {}
60
64
65 // compute the apply operator, Y = alpha*R*X + beta*Y
66 void apply(const MultiVector &X, MultiVector &Y, Teuchos::ETransp mode = Teuchos::NO_TRANS, Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(), Scalar beta = Teuchos::ScalarTraits<Scalar>::zero()) const override;
67
68 // compute the residual
69 void residual(const MultiVector &X, const MultiVector &B, MultiVector &R) const override;
70
71 // get the range map
72 const Teuchos::RCP<const Map> getRangeMap() const override {
73 return fine_map_;
74 }
75
76 // get the domain map
77 const Teuchos::RCP<const Map> getDomainMap() const override {
78 return coarse_map_;
79 }
80
81 // get the aggregates
82 Teuchos::RCP<const Aggregates> getAggregates() const {
83 return aggregates_;
84 }
85
86 private:
87 // the fine map
88 const Teuchos::RCP<const Map> fine_map_;
89
90 // the coarse map
91 const Teuchos::RCP<const Map> coarse_map_;
92
93 // the aggregates required for the grid transfer
94 const Teuchos::RCP<const Aggregates> aggregates_;
95};
96
97} // namespace MueLu
98
99#define MUELU_MATRIXFREETENTATIVEP_SHORT
100#endif // MUELU_MATRIXFREETENTATIVEP_DECL_HPP
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
MueLu::DefaultNode Node
Matrix-free tentative restrictor operator.
Teuchos::RCP< const Aggregates > getAggregates() const
const Teuchos::RCP< const Map > fine_map_
const Teuchos::RCP< const Map > getRangeMap() const override
void residual(const MultiVector &X, const MultiVector &B, MultiVector &R) const override
Kokkos::MDRangePolicy< local_ordinal_type, execution_space, Kokkos::Rank< 2 > > md_range_type
const Teuchos::RCP< const Map > coarse_map_
~MatrixFreeTentativeP()=default
Destructor.
const Teuchos::RCP< const Map > getDomainMap() const override
MatrixFreeTentativeP(Teuchos::RCP< const Map > coarse_map, Teuchos::RCP< const Map > fine_map, Teuchos::RCP< const Aggregates > aggregates)
Constructor.
Kokkos::RangePolicy< local_ordinal_type, execution_space > range_type
Teuchos::ScalarTraits< Scalar >::coordinateType real_type
const Teuchos::RCP< const Aggregates > aggregates_
void apply(const MultiVector &X, MultiVector &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const override
Namespace for MueLu classes and methods.