OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
AmrSmoother.h
Go to the documentation of this file.
1 //
2 // Class AmrSmoother
3 // Interface to Ifpack2 smoothers of the Trilinos package.
4 //
5 // Copyright (c) 2017 - 2020, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
6 // All rights reserved
7 //
8 // Implemented as part of the PhD thesis
9 // "Precise Simulations of Multibunches in High Intensity Cyclotrons"
10 //
11 // This file is part of OPAL.
12 //
13 // OPAL is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
20 //
21 #ifndef AMR_SMOOTHER_H
22 #define AMR_SMOOTHER_H
23 
24 #include <string>
25 
26 #include "AmrMultiGridDefs.h"
27 
28 #include "Ifpack2_Factory.hpp"
29 
30 class AmrSmoother {
31 
32 public:
40  lo_t,
41  go_t,
42  node_t
44 
46  enum Smoother {
48  SGS, // symmetric Gauss-Seidel
49  JACOBI //,
50 // SOR
51  };
52 
53 public:
59  AmrSmoother(const Teuchos::RCP<const matrix_t>& A,
60  const Smoother& smoother,
61  lo_t nSweeps);
62 
63  ~AmrSmoother();
64 
70  void smooth(const Teuchos::RCP<vector_t>& x,
71  const Teuchos::RCP<vector_t>& b);
72 
77  static Smoother convertToEnumSmoother(const std::string& smoother);
78 
79 private:
85  void initParameter_m(const Smoother& smoother,
86  lo_t nSweeps);
87 
88 
89 private:
91  Teuchos::RCP<preconditioner_t> prec_mp;
92 
94  Teuchos::RCP<Teuchos::ParameterList> params_mp;
95 };
96 
97 #endif
long global_ordinal_t
KokkosClassic::DefaultNode::DefaultNodeType node_t
int local_ordinal_t
Tpetra::Vector< scalar_t, local_ordinal_t, global_ordinal_t, node_t > vector_t
double scalar_t
Tpetra::CrsMatrix< scalar_t, local_ordinal_t, global_ordinal_t, node_t > matrix_t
Smoother
All supported Ifpack2 smoothers.
Definition: AmrSmoother.h:46
AmrSmoother(const Teuchos::RCP< const matrix_t > &A, const Smoother &smoother, lo_t nSweeps)
Definition: AmrSmoother.cpp:28
amr::vector_t vector_t
Definition: AmrSmoother.h:38
Ifpack2::Preconditioner< scalar_t, lo_t, go_t, node_t > preconditioner_t
Definition: AmrSmoother.h:43
amr::local_ordinal_t lo_t
Definition: AmrSmoother.h:34
Teuchos::RCP< preconditioner_t > prec_mp
Preconditioner instance.
Definition: AmrSmoother.h:91
amr::global_ordinal_t go_t
Definition: AmrSmoother.h:33
amr::node_t node_t
Definition: AmrSmoother.h:36
Teuchos::RCP< Teuchos::ParameterList > params_mp
Parameters of preconditioner.
Definition: AmrSmoother.h:94
void initParameter_m(const Smoother &smoother, lo_t nSweeps)
Definition: AmrSmoother.cpp:80
void smooth(const Teuchos::RCP< vector_t > &x, const Teuchos::RCP< vector_t > &b)
Definition: AmrSmoother.cpp:54
amr::matrix_t matrix_t
Definition: AmrSmoother.h:37
amr::scalar_t scalar_t
Definition: AmrSmoother.h:35
static Smoother convertToEnumSmoother(const std::string &smoother)
Definition: AmrSmoother.cpp:64