Hex: src/preconditioners/CoupledPreconditioner.h Source File

| Hex 2.2 Hydrogen-electron collision solver

CoupledPreconditioner.h
Go to the documentation of this file.
1 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
2 // //
3 // / / / / __ \ \ / / //
4 // / /__ / / / _ \ \ \/ / //
5 // / ___ / | |/_/ / /\ \ //
6 // / / / / \_\ / / \ \ //
7 // //
8 // //
9 // Copyright (c) 2017, 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_ECS_COUPLED_PRECONDITIONER_H
33 #define HEX_ECS_COUPLED_PRECONDITIONER_H
34
35 // --------------------------------------------------------------------------------- //
36
37 #include "NoPreconditioner.h"
38
39 // --------------------------------------------------------------------------------- //
40
41 class CoupledPreconditioner : public NoPreconditioner
42 {
43 public:
44
45 // run-time selection mechanism
46 preconditionerRunTimeSelectionDefinitions(CoupledPreconditioner, "coupled")
47
48 // default constructor needed by the RTS mechanism
49 CoupledPreconditioner () {}
50
51 // constructor
52 CoupledPreconditioner
53 (
54 CommandLine const & cmd,
55 InputFile const & inp,
56 Parallel const & par,
57 AngularBasis const & ang,
58 Bspline const & bspline_inner,
59 Bspline const & bspline_full,
60 Bspline const & bspline_panel_x,
61 Bspline const & bspline_panel_y
62 ) : NoPreconditioner
63 (
64 cmd, inp, par, ang,
65 bspline_inner,
66 bspline_full,
67 bspline_panel_x,
68 bspline_panel_y
69 )
70 {}
71
72 // preconditioner description
73 virtual std::string description () const;
74
75 // reuse parent definitions
76 using NoPreconditioner::setup;
77 using NoPreconditioner::rhs;
78 using NoPreconditioner::multiply;
79
80 // declare own definitions
81 virtual void update (Real E);
82 virtual void precondition (BlockArray<Complex> const & r, BlockArray<Complex> & z) const;
83 virtual void finish ();
84
85 protected:
86
87 // LU factorization data.
88 LUftData data_;
89
90 // LU factorization.
91 std::shared_ptr<LUft> lu_;
92
93 // Workspace used for the solution.
94 mutable cArray X, Y;
95 };
96
97 // --------------------------------------------------------------------------------- //
98
99 #endif // HEX_ECS_COUPLED_PRECONDITIONER_H
CoupledPreconditioner::X
cArray X
Definition: CoupledPreconditioner.h:94
CoupledPreconditioner::description
virtual std::string description() const
Description of the preconditioner.
Definition: CoupledPreconditioner.cpp:40
CoupledPreconditioner::Y
cArray Y
Definition: CoupledPreconditioner.h:94
NoPreconditioner
Solution driver without actual preconditioner.
Definition: NoPreconditioner.h:55
Bspline
B-spline environment.
Definition: bspline.h:57
CoupledPreconditioner::preconditionerRunTimeSelectionDefinitions
preconditionerRunTimeSelectionDefinitions(CoupledPreconditioner, "coupled") CoupledPreconditioner()
Definition: CoupledPreconditioner.h:46
CoupledPreconditioner::finish
virtual void finish()
Clean up memory etc.
Definition: CoupledPreconditioner.cpp:214
AngularBasis
Angular basis.
Definition: ang.h:44
CoupledPreconditioner::update
virtual void update(Real E)
Update the preconditioner for the next energy.
Definition: CoupledPreconditioner.cpp:47
CommandLine
Command line parameters.
Definition: io.h:57
CoupledPreconditioner::data_
LUftData data_
Definition: CoupledPreconditioner.h:88
CoupledPreconditioner::lu_
std::shared_ptr< LUft > lu_
Definition: CoupledPreconditioner.h:91
NoPreconditioner::rhs
virtual void rhs(BlockArray< Complex > &chi, int ienergy, int instate) const
Calculate the right-hand side.
Definition: NoPreconditioner.cpp:821
CoupledPreconditioner::CoupledPreconditioner
CoupledPreconditioner(CommandLine const &cmd, InputFile const &inp, Parallel const &par, AngularBasis const &ang, Bspline const &bspline_inner, Bspline const &bspline_full, Bspline const &bspline_panel_x, Bspline const &bspline_panel_y)
Definition: CoupledPreconditioner.h:53
InputFile
Input parameters.
Definition: io.h:321
Parallel
MPI info.
Definition: parallel.h:50
NoPreconditioner::NoPreconditioner
NoPreconditioner(CommandLine const &cmd, InputFile const &inp, Parallel const &par, AngularBasis const &ang, Bspline const &bspline_inner, Bspline const &bspline_full, Bspline const &bspline_panel_x, Bspline const &bspline_panel_y)
Definition: NoPreconditioner.cpp:56
CoupledPreconditioner::precondition
virtual void precondition(BlockArray< Complex > const &r, BlockArray< Complex > &z) const
Precondition the equation.
Definition: CoupledPreconditioner.cpp:194
LUftData
Definition: luft.h:46
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
NoPreconditioner::setup
virtual void setup()
Initialize the preconditioner.
Definition: NoPreconditioner.cpp:101
NoPreconditioner.h
CoupledPreconditioner
Definition: CoupledPreconditioner.h:41