XGCa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
gyro_avg_mat.hpp
Go to the documentation of this file.
1 #ifndef GYRO_AVG_MAT_HPP
2 #define GYRO_AVG_MAT_HPP
3 
4 #include "space_settings.hpp"
5 #include "matrix.hpp"
6 #include "task_group.hpp"
7 #include "host_array.hpp"
8 #include "grid.hpp"
10 
11 template<class Device>
13  public: // for testing
15 
16  int nrho;
17  double rhomax;
18  double inv_drho;
19 
20  // Access individual matrices (may not be necessary eventually)
21  Matrix<Device> operator [](int i) const {return matrices(i);}
22  Matrix<Device>& operator [](int i) {return matrices(i);}
23 
24  public:
25 
26  GyroAverageMatrices(){} // For testing
27 
28  // Construct the gyromatrices used on this MPI rank
29  GyroAverageMatrices(const Grid<DeviceType>& grid, const DomainDecomposition<DeviceType>& pol_decomp, const MagneticField<DeviceType>& magnetic_field, bool is_field_following, int n_larmor_pts, int nrho_in, double rhomax_in);
30 
31  // Create a mirror with a different device type
32  template<class Device2>
34  GPTLstart("GET_POT_GRAD_GYROMAT_SETUP");
36  const std::string label ("v_outer");
38  for(int i=0; i<matrices.size(); i++){
39  m.matrices(i) = matrices(i).template mirror<Device2>();
40  }
41 
42  m.nrho = nrho;
43  m.rhomax = rhomax;
44  m.inv_drho = inv_drho;
45 
46  GPTLstop("GET_POT_GRAD_GYROMAT_SETUP");
47 
48  return m;
49  }
50 
51  // Could be a constructor of a new GyroMatrix class (which could be a derived Matrix class)
52  void init_one_gyro_avg_mat(const Grid<DeviceType>& grid, const MagneticField<DeviceType>& magnetic_field, Matrix<Device>& matrix, int iphi, int irho, bool is_field_following, int n_larmor_pts);
53 };
54 
55 #endif
static int GPTLstart(const char *name)
Definition: timer_macro.hpp:9
Definition: gyro_avg_mat.hpp:12
Definition: magnetic_field.hpp:12
GyroAverageMatrices< Device2 > mirror() const
Definition: gyro_avg_mat.hpp:33
int nrho
Definition: gyro_avg_mat.hpp:16
double inv_drho
Definition: gyro_avg_mat.hpp:18
Definition: matrix.hpp:13
HostArray< Matrix< Device > > matrices
Definition: gyro_avg_mat.hpp:14
Matrix< Device > operator[](int i) const
Definition: gyro_avg_mat.hpp:21
GyroAverageMatrices()
Definition: gyro_avg_mat.hpp:26
Definition: magnetic_field.F90:1
size_t size() const
Definition: host_array.hpp:78
Definition: host_array.hpp:11
double rhomax
Definition: gyro_avg_mat.hpp:17
static int GPTLstop(const char *name)
Definition: timer_macro.hpp:10
void init_one_gyro_avg_mat(const Grid< DeviceType > &grid, const MagneticField< DeviceType > &magnetic_field, Matrix< Device > &matrix, int iphi, int irho, bool is_field_following, int n_larmor_pts)
Definition: gyro_avg_mat.cpp:36