COMPASS  5.4.4
End-to-end AO simulation tool using GPU acceleration
sutra_lgs.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_LGS_H_
18 #define _SUTRA_LGS_H_
19 
20 #include <carma.h>
21 #include <carma_obj.h>
22 #include <sutra_utils.h>
23 
24 using std::map;
25 using std::pair;
26 using std::vector;
27 
28 class SutraLGS {
29  public:
30  int device;
31  long nvalid;
32  long npix;
33  long nmaxhr;
34  float hg;
35  float h0;
36  float deltah;
37  float pixsize;
38  long nprof;
39 
40  cufftHandle *ftlgskern_plan;
50 
52  /*
53  cudaArray *d_spotarray;
54  cudaChannelFormatDesc channel_desc;
55  cudaMemcpy3DParms copyParams;
56  */
57 
58  public:
61  map<vector<int>, cufftHandle *> ftlgskern_plans, long nvalid,
62  long npix, long nmaxhr);
64 
65  int lgs_init(int nprof, float hg, float h0, float deltah, float pixsie,
66  float *doffaxis, float *prof1d, float *profcum, float *beam,
67  cuFloatComplex *ftbeam, float *azimuth);
68  int load_prof(float *prof1d, float *profcum, float hg, float h0,
69  float deltah);
72  int load_kernels(float *h_lgskern, CarmaDevice *device);
73 };
74 
75 // General utilities
76 int interp_prof(cuFloatComplex *profout, float *prof1d, float *profcum,
77  int npix, float *doffaxis, float hg, float pixsize, float h0,
78  float deltah, int hmax, int Ntot, CarmaDevice *device);
79 int times_ftbeam(cuFloatComplex *profout, cuFloatComplex *fbeam, int N,
80  int Ntot, CarmaDevice *device);
81 int roll_beam_exp(float *imout, cuFloatComplex *iprof, float *beam, int N,
82  int Ntot, CarmaDevice *device);
83 int lgs_rotate(cuFloatComplex *odata, float *idata, int width, int height,
84  float *theta, float center, int Ntot, CarmaDevice *device);
85 // int rotate3d(cuFloatComplex *d_odata, cudaMemcpy3DParms copyParams,
86 // cudaArray *d_array, cudaChannelFormatDesc channel_desc, int width,
87 // int height, float *theta, float center, int Ntot,
88 // CarmaDevice *device);
89 
90 #endif // _SUTRA_LGS_H_
this class provides the context in which CarmaObj are created
Definition: carma_context.h:79
this class provides the lgs features to COMPASS
Definition: sutra_lgs.h:28
float hg
Definition: sutra_lgs.h:34
int device
Definition: sutra_lgs.h:30
CarmaContext * current_context
Definition: sutra_lgs.h:51
CarmaObj< float > * d_doffaxis
Definition: sutra_lgs.h:41
int lgs_init(int nprof, float hg, float h0, float deltah, float pixsie, float *doffaxis, float *prof1d, float *profcum, float *beam, cuFloatComplex *ftbeam, float *azimuth)
float h0
Definition: sutra_lgs.h:35
CarmaObj< float > * d_azimuth
Definition: sutra_lgs.h:42
long nmaxhr
Definition: sutra_lgs.h:33
CarmaObj< float > * d_prof1d
Definition: sutra_lgs.h:43
int lgs_makespot(CarmaDevice *device, int nin)
CarmaObj< float > * d_lgskern
Definition: sutra_lgs.h:48
float pixsize
Definition: sutra_lgs.h:37
float deltah
Definition: sutra_lgs.h:36
CarmaObj< cuFloatComplex > * d_ftlgskern
Definition: sutra_lgs.h:49
int load_prof(float *prof1d, float *profcum, float hg, float h0, float deltah)
long nvalid
Definition: sutra_lgs.h:31
CarmaObj< cuFloatComplex > * d_ftbeam
Definition: sutra_lgs.h:47
SutraLGS(CarmaContext *context, CarmaObj< float > *d_lgskern, CarmaObj< cuFloatComplex > *d_ftlgskern, map< vector< int >, cufftHandle * > ftlgskern_plans, long nvalid, long npix, long nmaxhr)
CarmaObj< cuFloatComplex > * d_prof2d
Definition: sutra_lgs.h:45
CarmaObj< float > * d_beam
Definition: sutra_lgs.h:46
cufftHandle * ftlgskern_plan
Definition: sutra_lgs.h:40
int lgs_update(CarmaDevice *device)
long nprof
Definition: sutra_lgs.h:38
long npix
Definition: sutra_lgs.h:32
int load_kernels(float *h_lgskern, CarmaDevice *device)
CarmaObj< float > * d_profcum
Definition: sutra_lgs.h:44
int interp_prof(cuFloatComplex *profout, float *prof1d, float *profcum, int npix, float *doffaxis, float hg, float pixsize, float h0, float deltah, int hmax, int Ntot, CarmaDevice *device)
int times_ftbeam(cuFloatComplex *profout, cuFloatComplex *fbeam, int N, int Ntot, CarmaDevice *device)
int roll_beam_exp(float *imout, cuFloatComplex *iprof, float *beam, int N, int Ntot, CarmaDevice *device)
int lgs_rotate(cuFloatComplex *odata, float *idata, int width, int height, float *theta, float center, int Ntot, CarmaDevice *device)