Bridge++  Ver. 2.0.2
aprecond_MG.h
Go to the documentation of this file.
1 
10 #ifndef APRECOND_MG_H
11 #define APRECOND_MG_H
12 
13 #include <cstdio>
14 #include <cstdlib>
15 
16 #include <string>
17 using std::string;
18 
19 #include <vector>
20 using std::vector;
21 
23 #include "lib/IO/bridgeIO.h"
24 using Bridge::vout;
25 #include "lib/Tools/timer.h"
26 #include "lib/Fopr/afopr.h"
27 
33 
38 template<typename AFIELD, typename AFIELD2>
39 class APrecond_MG : public APrecond<AFIELD>
40 {
41  public:
42  typedef typename AFIELD::real_t real_t0; // assumes double
43  typedef typename AFIELD2::real_t real_t; // assumes float
46 
47  static const Impl IMPL = AFIELD::IMPL;
48  static const Impl IMPL2 = AFIELD2::IMPL;
49 
50  static const std::string class_name;
51 
52  private:
56 
57  AFopr<AFIELD> *m_afoprD; // double
59 
63  // const std::vector<AFIELD2> *m_testvectors;
64 
72 
74 
75  // elapsed time for each ingredient
76  double m_time_f2d;
77  double m_time_d2f;
85  double m_time_double;
88 
89  // unique_ptr<Timer> m_timer_f2d; // float to double
90  // unique_ptr<Timer> m_timer_d2f; // double to flaot
91  // unique_ptr<Timer> m_timer_residual;
92  // unique_ptr<Timer> m_timer_restrcition;
93  // unique_ptr<Timer> m_timer_coarse_solver;
94  // unique_ptr<Timer> m_timer_smoother;
95  // unique_ptr<Timer> m_timer_prolongation;
96  // unique_ptr<Timer> m_timer_mult_single_total;
97 
98  public:
99  APrecond_MG() { init(); }
100 
101  void mult(AFIELD&, const AFIELD&);
102  void mult_as_setup(AFIELD2&, const AFIELD2&);
103  void reset_flop_count();
106 
107  void set_multigrid(const MultiGrid_t *multigrid)
108  {
109  m_multigrid = multigrid;
110  }
111 
112  void set_fopr(AFopr<AFIELD> *foprD, AFopr<AFIELD2> *foprF) { m_afoprD = foprD; m_afoprF = foprF; }
113  void report_timer();
114 
116  double flop_count_coarse() const { return m_accum_flop_coarse; }
117  double flop_count_smoother() const { return m_accum_flop_smoother; }
118  double flop_count_other() const { return m_accum_flop_other; }
119  double flop_count_double() const { return m_accum_flop_double; }
120 
121  private:
122  void init();
123  void tidyup();
124  void update_flop_count();
125  void mult_single(AFIELD2&, const AFIELD2&);
126 };
127 
128 #endif // include guard
129 //============================================================END=====
APrecond_MG::m_accum_flop_prolong
double m_accum_flop_prolong
Definition: aprecond_MG.h:71
Impl
Impl
Definition: alt_impl.h:13
APrecond_MG::m_accum_flop_double
double m_accum_flop_double
Definition: aprecond_MG.h:69
bridgeIO.h
APrecond_MG::m_coarse_w
AFIELD2 m_coarse_w
Definition: aprecond_MG.h:60
AFopr
Definition: afopr.h:48
ASolver< AFIELD2 >
APrecond_MG::m_accum_flop_restrict
double m_accum_flop_restrict
Definition: aprecond_MG.h:70
APrecond_MG::m_time_mult_total
double m_time_mult_total
Definition: aprecond_MG.h:84
APrecond_MG::m_afoprF
AFopr< AFIELD2 > * m_afoprF
Definition: aprecond_MG.h:58
APrecond_MG::flop_count_coarse
double flop_count_coarse() const
Definition: aprecond_MG.h:116
APrecond_MG::m_coarse_v
AFIELD2 m_coarse_v
Definition: aprecond_MG.h:60
APrecond_MG::IMPL
static const Impl IMPL
Definition: aprecond_MG.h:47
asolver_BiCGStab.h
APrecond
Definition: aprecond.h:28
APrecond_MG::flop_count_double
double flop_count_double() const
Definition: aprecond_MG.h:119
APrecond_MG::m_accum_flop_float
double m_accum_flop_float
Definition: aprecond_MG.h:68
APrecond_MG::flop_count
double flop_count()
Definition: aprecond_MG.h:115
APrecond_MG::m_coarse_ncol
int m_coarse_ncol
Definition: aprecond_MG.h:73
asolver_FBiCGStab.h
APrecond_MG::APrecond_MG
APrecond_MG()
Definition: aprecond_MG.h:99
APrecond_MG::flop_count_other
double flop_count_other() const
Definition: aprecond_MG.h:118
APrecond_MG::m_time_double
double m_time_double
Definition: aprecond_MG.h:85
APrecond_MG::m_num_mult_called
int m_num_mult_called
number of mult call
Definition: aprecond_MG.h:86
APrecond_MG::m_num_mult_single_called
int m_num_mult_single_called
number of mult call
Definition: aprecond_MG.h:87
APrecond_MG::m_fine_debugD
AFIELD m_fine_debugD
Definition: aprecond_MG.h:62
APrecond_MG::real_t
AFIELD2::real_t real_t
Definition: aprecond_MG.h:43
APrecond_MG::mult_single
void mult_single(AFIELD2 &, const AFIELD2 &)
Definition: aprecond_MG-tmpl.h:199
APrecond_MG::m_fine_w
AFIELD2 m_fine_w
Definition: aprecond_MG.h:61
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
APrecond_MG::block_index_t
MultiGrid_t::Index_t block_index_t
Definition: aprecond_MG.h:45
AIndex_block_lex< typename AFIELD2::real_t, AFIELD2::IMPL >
MultiGrid.h
APrecond_MG::m_fine_rD
AFIELD m_fine_rD
Definition: aprecond_MG.h:62
Field::real_t
double real_t
Definition: field.h:51
APrecond_MG::m_time_d2f
double m_time_d2f
Definition: aprecond_MG.h:77
APrecond_MG::m_fine_r
AFIELD2 m_fine_r
Definition: aprecond_MG.h:61
APrecond_MG::m_accum_flop_coarse
double m_accum_flop_coarse
Definition: aprecond_MG.h:65
APrecond_MG::m_time_restriction
double m_time_restriction
Definition: aprecond_MG.h:79
APrecond_MG::flop_count_smoother
double flop_count_smoother() const
Definition: aprecond_MG.h:117
APrecond_MG::m_time_residual
double m_time_residual
Definition: aprecond_MG.h:78
APrecond_MG::set_fopr
void set_fopr(AFopr< AFIELD > *foprD, AFopr< AFIELD2 > *foprF)
Definition: aprecond_MG.h:112
timer.h
MultiGrid
Definition: MultiGrid.h:24
APrecond_MG::tidyup
void tidyup()
Definition: aprecond_MG-tmpl.h:100
APrecond_MG::m_time_coarse_solver
double m_time_coarse_solver
Definition: aprecond_MG.h:80
APrecond_MG::set_multigrid
void set_multigrid(const MultiGrid_t *multigrid)
Definition: aprecond_MG.h:107
APrecond_MG::mult
void mult(AFIELD &, const AFIELD &)
Definition: aprecond_MG-tmpl.h:108
APrecond_MG::m_fine_tmp
AFIELD2 m_fine_tmp
Definition: aprecond_MG.h:61
APrecond_MG::m_accum_flop_smoother
double m_accum_flop_smoother
Definition: aprecond_MG.h:66
APrecond_MG::m_accum_flop_other
double m_accum_flop_other
Definition: aprecond_MG.h:67
APrecond_MG::m_multigrid
const MultiGrid_t * m_multigrid
Definition: aprecond_MG.h:55
APrecond_MG::m_smoother
ASolver< AFIELD2 > * m_smoother
Definition: aprecond_MG.h:54
APrecond_MG::set_smoother
void set_smoother(ASolver< AFIELD2 > *solver)
Definition: aprecond_MG-tmpl.h:84
APrecond_MG::m_coarse_solver
ASolver< AFIELD2 > * m_coarse_solver
Definition: aprecond_MG.h:53
Test_Solver_Wilson::solver
int solver(const std::string &)
Definition: test_Solver_Wilson.cpp:134
APrecond_MG::reset_flop_count
void reset_flop_count()
Definition: aprecond_MG-tmpl.h:387
APrecond_MG::init
void init()
Definition: aprecond_MG-tmpl.h:59
APrecond_MG::m_time_prolongation
double m_time_prolongation
Definition: aprecond_MG.h:82
APrecond_MG::class_name
static const std::string class_name
Definition: aprecond_MG.h:50
APrecond_MG::report_timer
void report_timer()
Definition: aprecond_MG-tmpl.h:413
asolver_BiCGStab_Cmplx.h
APrecond_MG::set_coarse_solver
void set_coarse_solver(ASolver< AFIELD2 > *solver)
Definition: aprecond_MG-tmpl.h:69
APrecond_MG::MultiGrid_t
MultiGrid< AFIELD2, AFIELD2 > MultiGrid_t
Definition: aprecond_MG.h:44
APrecond_MG::real_t0
AFIELD::real_t real_t0
Definition: aprecond_MG.h:42
APrecond_MG::m_afoprD
AFopr< AFIELD > * m_afoprD
Definition: aprecond_MG.h:57
APrecond_MG::IMPL2
static const Impl IMPL2
Definition: aprecond_MG.h:48
APrecond_MG::m_time_smoother
double m_time_smoother
Definition: aprecond_MG.h:81
aprecond.h
APrecond_MG::m_time_mult_single_total
double m_time_mult_single_total
Definition: aprecond_MG.h:83
APrecond_MG::update_flop_count
void update_flop_count()
Definition: aprecond_MG-tmpl.h:355
APrecond_MG
Definition: aprecond_MG.h:39
APrecond_MG::mult_as_setup
void mult_as_setup(AFIELD2 &, const AFIELD2 &)
Definition: aprecond_MG-tmpl.h:344
commonParameters.h
Field
Container of Field-type object.
Definition: field.h:46
afopr.h
APrecond_MG::m_fine_vecD
AFIELD m_fine_vecD
Definition: aprecond_MG.h:62
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
APrecond_MG::m_time_f2d
double m_time_f2d
Definition: aprecond_MG.h:76
APrecond_MG::m_fine_v
AFIELD2 m_fine_v
Definition: aprecond_MG.h:61