COMPASS  5.4.4
End-to-end AO simulation tool using GPU acceleration
sutra_controller_mv.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 // This file is part of COMPASS <https://anr-compass.github.io/compass/>
3 //
4 // Copyright (C) 2011-2023 COMPASS Team <https://github.com/ANR-COMPASS>
5 // All rights reserved.
6 
7 // -----------------------------------------------------------------------------
8 
16 
17 #ifndef _SUTRA_CONTROLLER_MV_H_
18 #define _SUTRA_CONTROLLER_MV_H_
19 
20 #include <carma_cublas.h>
21 #include <carma_host_obj.h>
22 #include <sutra_centroider.h>
23 #include <sutra_controller.h>
24 #include <sutra_dm.h>
25 #include <sutra_utils.h>
26 #include <sutra_wfs.h>
27 
28 template <typename Tcomp, typename Tout>
29 class sutra_controller_mv : public SutraController<Tcomp, Tout> {
30  public:
34 
35  // Cphim & Cmm features
41  // svd computations
44  // CarmaObj<Tcomp> *d_U;
45 
46  // loop components
47  CarmaObj<Tcomp> *d_cenbuff; // centroids circular buffer
48  CarmaObj<Tcomp> *d_compbuff; // Buffer for computations
50  CarmaObj<Tcomp> *d_olmeas; // Open-loop measurements for POLC
51  CarmaObj<Tcomp> *d_err; // current error
52 
53  cublasHandle_t cublas_handle;
54 
55  public:
57  long nactu, float delay, SutraDms *dms, int *idx_dms,
58  int ndm, int *idx_centro, int ncentro);
61 
62  string get_type();
63 
64  int svdec_imat();
65  int build_cmat(const char *dmtype, char *method);
66  int build_cmat(Tcomp cond);
67  int frame_delay();
68  int comp_com();
69  int set_modal_gains(Tcomp *mgain);
70  int set_cmat(Tcomp *cmat);
71  int set_imat(Tcomp *imat);
72  // Florian features
73  int load_noisemat(Tcomp *noise);
74  int do_covmat(SutraDm *ydm, char *method, int *indx_pup, long dim,
75  Tcomp *xpos, Tcomp *ypos, long Nkl, Tcomp norm, Tcomp ampli);
76  int do_geomat(CarmaObj<Tcomp> *d_geocov, CarmaObj<Tcomp> *d_IF, long n_pts,
77  Tcomp ampli);
78  int piston_filt(CarmaObj<Tcomp> *d_statcov);
79  int piston_filt_cphim(CarmaObj<Tcomp> *d_cphim, Tcomp *F);
80  int filter_cphim(Tcomp *F, Tcomp *Nact);
81  int filter_cmat(Tcomp cond);
82  int invgen(CarmaObj<Tcomp> *d_mat, Tcomp cond, int job);
84  Tcomp cond);
86  Tcomp cond);
87  // int
88  // do_statmat(T *statcov,long dim, T *xpos, T *ypos, T norm,
89  // CarmaDevice *device);
90  int DDiago(CarmaObj<Tcomp> *d_statcov, CarmaObj<Tcomp> *d_geocov);
91  int load_covmat(Tcomp *covmat);
92  int load_klbasis(Tcomp *klbasis);
93  int compute_Cmm(SutraAtmos *atmos, SutraSensors *sensors, double *L0,
94  double *cn2, double *alphaX, double *alphaY, double diamTel,
95  double cobs);
96  int compute_Cphim(SutraAtmos *atmos, SutraSensors *sensors, SutraDms *dms,
97  double *L0, double *cn2, double *alphaX, double *alphaY,
98  double *X, double *Y, double *xactu, double *yactu,
99  double diamTel, double *k2, long *NlayerDm,
100  long *indLayerDm, double FoV, double *pitch,
101  double *alt_dm);
102 };
103 
104 #endif // _SUTRA_CONTROLLER_MV_H_
this file provides the cublas features to CarmaObj
this class provides the context in which CarmaObj are created
Definition: carma_context.h:79
this class provides the atmos features to COMPASS
Definition: sutra_atmos.h:25
this class provides the controller features to COMPASS
this class provides the dm features to COMPASS
Definition: sutra_dm.h:48
this class provides the sensors features to COMPASS
Definition: sutra_sensors.h:34
this class provides the controller_mv features to COMPASS
CarmaObj< Tcomp > * d_cenbuff
int filter_cmat(Tcomp cond)
int piston_filt_cphim(CarmaObj< Tcomp > *d_cphim, Tcomp *F)
int load_covmat(Tcomp *covmat)
int do_covmat(SutraDm *ydm, char *method, int *indx_pup, long dim, Tcomp *xpos, Tcomp *ypos, long Nkl, Tcomp norm, Tcomp ampli)
CarmaObj< Tcomp > * d_KLbasis
CarmaHostObj< Tcomp > * h_eigenvals
CarmaHostObj< Tcomp > * h_Cmmeigenvals
int invgen(CarmaObj< Tcomp > *d_mat, CarmaHostObj< Tcomp > *h_eigen, Tcomp cond)
int invgen(CarmaObj< Tcomp > *d_mat, Tcomp cond, int job)
int filter_cphim(Tcomp *F, Tcomp *Nact)
int build_cmat(const char *dmtype, char *method)
CarmaObj< Tcomp > * d_olmeas
CarmaObj< Tcomp > * d_imat
int invgen_cpu(CarmaObj< Tcomp > *d_mat, CarmaHostObj< Tcomp > *h_eigen, Tcomp cond)
int build_cmat(Tcomp cond)
int do_geomat(CarmaObj< Tcomp > *d_geocov, CarmaObj< Tcomp > *d_IF, long n_pts, Tcomp ampli)
sutra_controller_mv(CarmaContext *context, long nslope, long nactu, float delay, SutraDms *dms, int *idx_dms, int ndm, int *idx_centro, int ncentro)
int compute_Cmm(SutraAtmos *atmos, SutraSensors *sensors, double *L0, double *cn2, double *alphaX, double *alphaY, double diamTel, double cobs)
sutra_controller_mv(const sutra_controller_mv &controller)
CarmaObj< Tcomp > * d_err
CarmaObj< Tcomp > * d_compbuff2
cublasHandle_t cublas_handle
CarmaObj< Tcomp > * d_cmat
CarmaObj< Tcomp > * d_Cmm
int compute_Cphim(SutraAtmos *atmos, SutraSensors *sensors, SutraDms *dms, double *L0, double *cn2, double *alphaX, double *alphaY, double *X, double *Y, double *xactu, double *yactu, double diamTel, double *k2, long *NlayerDm, long *indLayerDm, double FoV, double *pitch, double *alt_dm)
int set_cmat(Tcomp *cmat)
CarmaObj< Tcomp > * d_compbuff
CarmaObj< Tcomp > * d_noisemat
int comp_com()
!!! YOU MUST set d_centroids before calling it!!!!
CarmaObj< Tcomp > * d_Cphim
CarmaObj< Tcomp > * d_covmat
int set_imat(Tcomp *imat)
int load_klbasis(Tcomp *klbasis)
CarmaObj< Tcomp > * d_gain
int load_noisemat(Tcomp *noise)
int set_modal_gains(Tcomp *mgain)
int piston_filt(CarmaObj< Tcomp > *d_statcov)
int DDiago(CarmaObj< Tcomp > *d_statcov, CarmaObj< Tcomp > *d_geocov)