Hex: src/preconditioners/GMGPreconditioner.h Source File

| Hex 2.2 Hydrogen-electron collision solver

GMGPreconditioner.h
Go to the documentation of this file.
1 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
2 // //
3 // / / / / __ \ \ / / //
4 // / /__ / / / _ \ \ \/ / //
5 // / ___ / | |/_/ / /\ \ //
6 // / / / / \_\ / / \ \ //
7 // //
8 // //
9 // Copyright (c) 2016, Jakub Benda, Charles University in Prague //
10 // //
11 // MIT License: //
12 // //
13 // Permission is hereby granted, free of charge, to any person obtaining a //
14 // copy of this software and associated documentation files (the "Software"), //
15 // to deal in the Software without restriction, including without limitation //
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense, //
17 // and/or sell copies of the Software, and to permit persons to whom the //
18 // Software is furnished to do so, subject to the following conditions: //
19 // //
20 // The above copyright notice and this permission notice shall be included //
21 // in all copies or substantial portions of the Software. //
22 // //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS //
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, //
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE //
26 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, //
27 // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF //
28 // OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. //
29 // //
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31
32 #ifndef HEX_GMGPRECONDITIONER_H
33 #define HEX_GMGPRECONDITIONER_H
34
35 // --------------------------------------------------------------------------------- //
36
37 #include "NoPreconditioner.h"
38
39 // --------------------------------------------------------------------------------- //
40
41 class GMGPreconditioner : public NoPreconditioner
42 {
43 public:
44
45 // run-time selection mechanism
46 preconditionerRunTimeSelectionDefinitions(GMGPreconditioner, "GMG")
47
48 // constructor
49 GMGPreconditioner
50 (
51 CommandLine const & cmd,
52 InputFile const & inp,
53 Parallel const & par,
54 AngularBasis const & ang,
55 Bspline const & bspline_x_inner,
56 Bspline const & bspline_x_full,
57 Bspline const & bspline_y_inner,
58 Bspline const & bspline_y_full
59 );
60
61 // sub-grid contructor
62 GMGPreconditioner
63 (
64 CommandLine const & cmd,
65 InputFile const & inp,
66 Parallel const & par,
67 AngularBasis const & ang,
68 Bspline const & bspline_x_inner,
69 Bspline const & bspline_x_full,
70 Bspline const & bspline_y_inner,
71 Bspline const & bspline_y_full,
72 int level
73 );
74
75 // destructor
76 virtual ~GMGPreconditioner ();
77
78 // preconditioner description
79 virtual std::string description () const;
80
81 // reuse parent definitions
82 using NoPreconditioner::rhs;
83 using NoPreconditioner::multiply;
84 using NoPreconditioner::finish;
85
86 // declare own definitions
87 virtual void setup ();
88 virtual void update (Real E);
89 virtual void precondition (BlockArray<Complex> const & r, BlockArray<Complex> & z) const;
90
91 private:
92
93 int level_;
94
95 Bspline const & bspline_inner_fine_;
96 Bspline const & bspline_full_fine_;
97
98 Bspline bspline_inner_coarse_;
99 Bspline bspline_full_coarse_;
100
101 RowMatrix<Complex> restrictor_inner_, restrictor_outer_;
102 RowMatrix<Complex> prolongator_inner_, prolongator_outer_;
103
104 cArrays D;
105
106 PreconditionerBase * subgrid_;
107 };
108
109 // --------------------------------------------------------------------------------- //
110
111 #endif
GMGPreconditioner::bspline_x_full
InputFile const Parallel const AngularBasis const Bspline const Bspline const & bspline_x_full
Definition: GMGPreconditioner.h:52
GMGPreconditioner::inp
InputFile const & inp
Definition: GMGPreconditioner.h:52
GMGPreconditioner::par
InputFile const Parallel const & par
Definition: GMGPreconditioner.h:52
GMGPreconditioner::ang
InputFile const Parallel const AngularBasis const & ang
Definition: GMGPreconditioner.h:52
GMGPreconditioner::precondition
virtual void precondition(BlockArray< Complex > const &r, BlockArray< Complex > &z) const
Precondition the equation.
Definition: GMGPreconditioner.cpp:226
NoPreconditioner
Solution driver without actual preconditioner.
Definition: NoPreconditioner.h:55
Bspline
B-spline environment.
Definition: bspline.h:57
GMGPreconditioner::update
virtual void update(Real E)
Update the preconditioner for the next energy.
Definition: GMGPreconditioner.cpp:189
AngularBasis
Angular basis.
Definition: ang.h:44
GMGPreconditioner::preconditionerRunTimeSelectionDefinitions
preconditionerRunTimeSelectionDefinitions(GMGPreconditioner, "GMG") GMGPreconditioner(CommandLine const &cmd
CommandLine
Command line parameters.
Definition: io.h:57
NoPreconditioner::finish
virtual void finish()
Clean up memory etc.
Definition: NoPreconditioner.cpp:1515
NoPreconditioner::rhs
virtual void rhs(BlockArray< Complex > &chi, int ienergy, int instate) const
Calculate the right-hand side.
Definition: NoPreconditioner.cpp:821
InputFile
Input parameters.
Definition: io.h:321
Parallel
MPI info.
Definition: parallel.h:50
GMGPreconditioner::description
virtual std::string description() const
Description of the preconditioner.
Definition: GMGPreconditioner.cpp:40
GMGPreconditioner::bspline_y_full
InputFile const Parallel const AngularBasis const Bspline const Bspline const Bspline const Bspline const & bspline_y_full
Definition: GMGPreconditioner.h:52
GMGPreconditioner
Definition: GMGPreconditioner.h:41
GMGPreconditioner::GMGPreconditioner
GMGPreconditioner(CommandLine const &cmd, InputFile const &inp, Parallel const &par, AngularBasis const &ang, Bspline const &bspline_x_inner, Bspline const &bspline_x_full, Bspline const &bspline_y_inner, Bspline const &bspline_y_full, int level)
Definition: GMGPreconditioner.cpp:60
NoPreconditioner::multiply
virtual void multiply(BlockArray< Complex > const &p, BlockArray< Complex > &q, MatrixSelection::Selection tri=MatrixSelection::Both) const
Multiply by the matrix equation.
Definition: NoPreconditioner.cpp:1233
PreconditionerBase
Preconditioner template.
Definition: preconditioners.h:62
GMGPreconditioner::bspline_x_inner
InputFile const Parallel const AngularBasis const Bspline const & bspline_x_inner
Definition: GMGPreconditioner.h:52
GMGPreconditioner::~GMGPreconditioner
virtual ~GMGPreconditioner()
Definition: GMGPreconditioner.cpp:139
NoPreconditioner.h
GMGPreconditioner::setup
virtual void setup()
Initialize the preconditioner.
Definition: GMGPreconditioner.cpp:144
GMGPreconditioner::bspline_y_inner
InputFile const Parallel const AngularBasis const Bspline const Bspline const Bspline const & bspline_y_inner
Definition: GMGPreconditioner.h:52