COMPASS  5.0.0
End-to-end AO simulation tool using GPU acceleration
sutra_wfs_pyr_pyrhr.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-2019 COMPASS Team <https://github.com/ANR-COMPASS>
5 // All rights reserved.
6 // Distributed under GNU - LGPL
7 //
8 // COMPASS is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser
9 // General Public License as published by the Free Software Foundation, either version 3 of the License,
10 // or any later version.
11 //
12 // COMPASS: End-to-end AO simulation tool using GPU acceleration
13 // The COMPASS platform was designed to meet the need of high-performance for the simulation of AO systems.
14 //
15 // The final product includes a software package for simulating all the critical subcomponents of AO,
16 // particularly in the context of the ELT and a real-time core based on several control approaches,
17 // with performances consistent with its integration into an instrument. Taking advantage of the specific
18 // hardware architecture of the GPU, the COMPASS tool allows to achieve adequate execution speeds to
19 // conduct large simulation campaigns called to the ELT.
20 //
21 // The COMPASS platform can be used to carry a wide variety of simulations to both testspecific components
22 // of AO of the E-ELT (such as wavefront analysis device with a pyramid or elongated Laser star), and
23 // various systems configurations such as multi-conjugate AO.
24 //
25 // COMPASS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
26 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27 // See the GNU Lesser General Public License for more details.
28 //
29 // You should have received a copy of the GNU Lesser General Public License along with COMPASS.
30 // If not, see <https://www.gnu.org/licenses/lgpl-3.0.txt>.
31 // -----------------------------------------------------------------------------
32 
41 
42 #ifndef _SUTRA_WFS_PYR_PYRHR_H_
43 #define _SUTRA_WFS_PYR_PYRHR_H_
44 
45 #include <sutra_lgs.h>
46 #include <sutra_phase.h>
47 #include <sutra_target.h>
48 #include <sutra_telemetry.h>
49 #include <sutra_telescope.h>
50 #include <sutra_wfs.h>
51 #include <map>
52 #include <vector>
53 
54 using std::string;
55 class SutraWfs_PyrHR : public SutraWfs {
56  public:
57  long npupils;
69 
70 
71  public:
76  long nvalid, long npupils, long npix, long nphase,
77  long nrebin, long nfft, long ntot, long npup, float pdiam,
78  float nphotons, float nphot4imat, int lgs, bool fakecam,
79  int max_flux_per_pix, int max_pix_value, bool roket,
80  int device);
85  long nvalid, long npupils, long npix, long nphase,
86  long nrebin, long nfft, long ntot, long npup, float pdiam,
87  float nphotons, float nphot4imat, int lgs, bool fakecam,
88  int max_flux_per_pix, int max_pix_value, bool roket,
89  int nbdevices, int *devices);
91 
92  int load_arrays(cuFloatComplex *halfxy, float *cx, float *cy, float *weights,
93  float *sincar, float *submask, int *validsubsx,
94  int *validsubsy, int *phasemap, float *fluxPerSub);
95  int set_submask(float *submask);
96  int set_phalfxy(cuFloatComplex *phalfxy);
97 
98  int fill_binimage(int async = 0);
99  int comp_image(bool noise = true);
100  void comp_modulation(int cpt);
101 
102  int copy_valid_pix(float *img, int *validx, int *validy, int im_dim);
103  int set_pyr_modulation_points(float *cx, float *cy, int npts);
104  int set_pyr_modulation_points(float *cx, float *cy, float *weights, int npts);
105  int set_pyr_mod_weights(float *weights, int npts);
106 
107  int define_mpi_rank(int rank, int size) { return EXIT_SUCCESS; }
108  int allocate_buffers(map<vector<int>, cufftHandle *> campli_plans,
109  map<vector<int>, cufftHandle *> fttotim_plans) {
110  return EXIT_SUCCESS;
111  }
112  int comp_nphot(float ittime, float optthroughput, float diam, float cobs,
113  float zerop, float gsmag);
114 
115  private:
116  int comp_generic();
117  std::vector<CarmaObj<cuFloatComplex> *> d_camplipup_ngpu;
118  std::vector<CarmaObj<cuFloatComplex> *> d_camplifoc_ngpu;
119  std::vector<CarmaObj<cuFloatComplex> *> d_phalfxy_ngpu;
120  std::vector<CarmaObj<cuFloatComplex> *> d_fttotim_ngpu;
121  std::vector<CarmaObj<float> *> d_pyrfocalplane_ngpu;
122  std::vector<CarmaObj<float> *> d_screen_ngpu;
123  std::vector<CarmaObj<float> *> d_hrimg_ngpu;
124  std::vector<CarmaObj<float> *> d_submask_ngpu;
125 };
126 
127 #endif // _SUTRA_WFS_PYR_PYRHR_H_
SutraWfs_PyrHR::set_pyr_mod_weights
int set_pyr_mod_weights(float *weights, int npts)
SutraWfs_PyrHR::d_phalfxy
CarmaObj< cuFloatComplex > * d_phalfxy
Definition: sutra_wfs_pyr_pyrhr.h:63
SutraWfs_PyrHR::load_arrays
int load_arrays(cuFloatComplex *halfxy, float *cx, float *cy, float *weights, float *sincar, float *submask, int *validsubsx, int *validsubsy, int *phasemap, float *fluxPerSub)
SutraWfs::max_flux_per_pix
int max_flux_per_pix
Definition: sutra_wfs.h:84
SutraWfs_PyrHR::set_pyr_modulation_points
int set_pyr_modulation_points(float *cx, float *cy, int npts)
SutraWfs::d_fttotim
CarmaObj< cuFloatComplex > * d_fttotim
Definition: sutra_wfs.h:92
SutraWfs::max_pix_value
int max_pix_value
Definition: sutra_wfs.h:85
sutra_target.h
SutraWfs::fakecam
bool fakecam
Definition: sutra_wfs.h:83
SutraWfs_PyrHR::pyr_cy
CarmaHostObj< float > * pyr_cy
Definition: sutra_wfs_pyr_pyrhr.h:67
SutraWfs_PyrHR::d_pyrfocalplane
CarmaObj< float > * d_pyrfocalplane
Definition: sutra_wfs_pyr_pyrhr.h:62
SutraWfs_PyrHR::compute_pyrfocalplane
bool compute_pyrfocalplane
Definition: sutra_wfs_pyr_pyrhr.h:58
SutraWfs::nphase
long nphase
Definition: sutra_wfs.h:71
SutraWfs::roket
bool roket
Definition: sutra_wfs.h:80
SutraWfs_PyrHR::comp_image
int comp_image(bool noise=true)
sutra_telescope.h
SutraWfs_PyrHR::~SutraWfs_PyrHR
~SutraWfs_PyrHR()
SutraWfs_PyrHR::set_submask
int set_submask(float *submask)
SutraWfs::nxsub
long nxsub
Definition: sutra_wfs.h:64
SutraWfs_PyrHR::npupils
long npupils
Definition: sutra_wfs_pyr_pyrhr.h:57
SutraWfs
this class provides the wfs features to COMPASS
Definition: sutra_wfs.h:60
SutraWfs_PyrHR::set_phalfxy
int set_phalfxy(cuFloatComplex *phalfxy)
sutra_wfs.h
SutraWfs_PyrHR::d_poffsets
CarmaObj< cuFloatComplex > * d_poffsets
Definition: sutra_wfs_pyr_pyrhr.h:64
sutra_lgs.h
SutraWfs::npix
long npix
Definition: sutra_wfs.h:66
SutraWfs_PyrHR::fill_binimage
int fill_binimage(int async=0)
SutraWfs::nfft
long nfft
Definition: sutra_wfs.h:68
SutraWfs_PyrHR::d_hrimg
CarmaObj< float > * d_hrimg
Definition: sutra_wfs_pyr_pyrhr.h:59
SutraTelescope
this class provides the telescope features to COMPASS
Definition: sutra_telescope.h:53
CarmaObj< float >
SutraWfs_PyrHR::allocate_buffers
int allocate_buffers(map< vector< int >, cufftHandle * > campli_plans, map< vector< int >, cufftHandle * > fttotim_plans)
Definition: sutra_wfs_pyr_pyrhr.h:108
CarmaContext
this class provides the context in which CarmaObj are created
Definition: carma_context.h:104
SutraWfs_PyrHR::pyr_cx
CarmaHostObj< float > * pyr_cx
Definition: sutra_wfs_pyr_pyrhr.h:66
SutraWfs_PyrHR::d_submask
CarmaObj< float > * d_submask
Definition: sutra_wfs_pyr_pyrhr.h:60
SutraWfs::noise
float noise
Definition: sutra_wfs.h:77
sutra_telemetry.h
SutraWfs::ntot
long ntot
Definition: sutra_wfs.h:69
SutraWfs::npup
long npup
Definition: sutra_wfs.h:70
SutraWfs::rank
int rank
Definition: sutra_wfs.h:126
SutraWfs::device
int device
Definition: sutra_wfs.h:62
CarmaHostObj< float >
SutraWfs::nvalid
long nvalid
Definition: sutra_wfs.h:65
SutraWfs_PyrHR::set_pyr_modulation_points
int set_pyr_modulation_points(float *cx, float *cy, float *weights, int npts)
SutraWfs::d_camplifoc
CarmaObj< cuFloatComplex > * d_camplifoc
Definition: sutra_wfs.h:91
SutraWfs_PyrHR
this class provides the wfs_pyr_pyrhr features to COMPASS
Definition: sutra_wfs_pyr_pyrhr.h:55
SutraWfs_PyrHR::d_modu_gather
CarmaObj< float > * d_modu_gather
Definition: sutra_wfs_pyr_pyrhr.h:65
SutraWfs_PyrHR::pyr_mod_weights
CarmaHostObj< float > * pyr_mod_weights
Definition: sutra_wfs_pyr_pyrhr.h:68
SutraWfs_PyrHR::comp_nphot
int comp_nphot(float ittime, float optthroughput, float diam, float cobs, float zerop, float gsmag)
SutraWfs_PyrHR::comp_modulation
void comp_modulation(int cpt)
SutraWfs::lgs
bool lgs
Definition: sutra_wfs.h:78
SutraWfs::d_camplipup
CarmaObj< cuFloatComplex > * d_camplipup
Definition: sutra_wfs.h:90
SutraWfs_PyrHR::copy_valid_pix
int copy_valid_pix(float *img, int *validx, int *validy, int im_dim)
SutraWfs::nrebin
long nrebin
Definition: sutra_wfs.h:67
SutraWfs_PyrHR::define_mpi_rank
int define_mpi_rank(int rank, int size)
Definition: sutra_wfs_pyr_pyrhr.h:107
SutraWfs::nphot4imat
float nphot4imat
Definition: sutra_wfs.h:76
SutraWfs_PyrHR::SutraWfs_PyrHR
SutraWfs_PyrHR(CarmaContext *context, SutraTelescope *d_tel, CarmaObj< cuFloatComplex > *d_camplipup, CarmaObj< cuFloatComplex > *d_camplifoc, CarmaObj< cuFloatComplex > *d_fttotim, long nxsub, long nvalid, long npupils, long npix, long nphase, long nrebin, long nfft, long ntot, long npup, float pdiam, float nphotons, float nphot4imat, int lgs, bool fakecam, int max_flux_per_pix, int max_pix_value, bool roket, int device)
SutraWfs_PyrHR::SutraWfs_PyrHR
SutraWfs_PyrHR(CarmaContext *context, SutraTelescope *d_tel, CarmaObj< cuFloatComplex > *d_camplipup, CarmaObj< cuFloatComplex > *d_camplifoc, CarmaObj< cuFloatComplex > *d_fttotim, long nxsub, long nvalid, long npupils, long npix, long nphase, long nrebin, long nfft, long ntot, long npup, float pdiam, float nphotons, float nphot4imat, int lgs, bool fakecam, int max_flux_per_pix, int max_pix_value, bool roket, int nbdevices, int *devices)
sutra_phase.h
SutraWfs_PyrHR::d_psum
CarmaObj< float > * d_psum
Definition: sutra_wfs_pyr_pyrhr.h:61