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 
42 {
43  public:
44 
45  // run-time selection mechanism
47 
48  // default constructor needed by the RTS mechanism
50 
51  // constructor
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
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
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.
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
cArray X
Definition: CoupledPreconditioner.h:94
virtual std::string description() const
Description of the preconditioner.
Definition: CoupledPreconditioner.cpp:40
cArray Y
Definition: CoupledPreconditioner.h:94
Solution driver without actual preconditioner.
Definition: NoPreconditioner.h:55
B-spline environment.
Definition: bspline.h:57
preconditionerRunTimeSelectionDefinitions(CoupledPreconditioner, "coupled") CoupledPreconditioner()
Definition: CoupledPreconditioner.h:46
virtual void finish()
Clean up memory etc.
Definition: CoupledPreconditioner.cpp:214
Angular basis.
Definition: ang.h:44
virtual void update(Real E)
Update the preconditioner for the next energy.
Definition: CoupledPreconditioner.cpp:47
Command line parameters.
Definition: io.h:57
LUftData data_
Definition: CoupledPreconditioner.h:88
std::shared_ptr< LUft > lu_
Definition: CoupledPreconditioner.h:91
virtual void rhs(BlockArray< Complex > &chi, int ienergy, int instate) const
Calculate the right-hand side.
Definition: NoPreconditioner.cpp:821
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
Input parameters.
Definition: io.h:321
MPI info.
Definition: parallel.h:50
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
virtual void precondition(BlockArray< Complex > const &r, BlockArray< Complex > &z) const
Precondition the equation.
Definition: CoupledPreconditioner.cpp:194
Definition: luft.h:46
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
virtual void setup()
Initialize the preconditioner.
Definition: NoPreconditioner.cpp:101
Definition: CoupledPreconditioner.h:41