COMPASS  5.0.0
End-to-end AO simulation tool using GPU acceleration
sutra_tscreen.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_TSCREEN_H_
43 #define _SUTRA_TSCREEN_H_
44 
45 #include <sutra_phase.h>
46 #include <sutra_utils.h>
47 
49  public:
50  int device; // The device #
51  SutraPhase *d_tscreen; // The phase screen
53  *d_tscreen_o; // Additional space of the same size as the phase screen
54  CarmaObj<float> *d_mat_a; // A matrix for extrusion
55  CarmaObj<float> *d_mat_b; // B matrix for extrusion
56  CarmaObj<unsigned int> *d_istencilx; // stencil for column extrusion
57  CarmaObj<unsigned int> *d_istencily; // stencil for row extrusion
58  CarmaObj<float> *d_z; // tmp array for extrusion process
59  CarmaObj<float> *d_noise; // tmp array containing random numbers
60  CarmaObj<float> *d_ytmp; // contains the extrude update (row or column)
61  long screen_size; // size of phase screens
62  float r0; // layer r0 (pixel units)
63  float amplitude; // amplitude for extrusion (r0^-5/6)
64  float altitude;
65  float windspeed;
66  float winddir;
67  float deltax; // number of rows to extrude per iteration
68  float deltay; // number of lines to extrude per iteration
69  // internal
70  float accumx;
71  float accumy;
72  cudaChannelFormatDesc
73  channel_desc; // Channel descriptor for texture memory access
74 
76  *d_tscreen_c; // Additional space for von karman screen generation
77  float norm_vk;
78  bool vk_on;
80 
81  public:
82  SutraTurbuScreen(CarmaContext *context, long size, long size2, float amplitude,
83  float altitude, float windspeed, float winddir, float deltax,
84  float deltay, int device);
85  // SutraTurbuScreen(const SutraTurbuScreen &tscreen);
87 
88  int init_screen(float *h_A, float *h_B, unsigned int *h_istencilx,
89  unsigned int *h_istencily, int seed);
90  int extrude(int dir);
91  int init_vk(int seed, int pupd);
92  int generate_vk(float l0, int nalias);
94  int set_seed(int seed);
95  int set_deltax(float deltax);
96  int set_deltay(float deltay);
97  int set_istencilx(unsigned int* istencil);
98  int set_istencily(unsigned int* istencil);
99 };
100 
101 int gene_vonkarman(cuFloatComplex *d_odata, float *d_idata, float k0,
102  int nalias, int nx, int ny, int block_size);
103 int norm_pscreen(float *d_odata, float *d_idata, int nx, int ny,
104  float norm_fact, CarmaDevice *device);
105 
106 #endif // _SUTRA_TSCREEN_H_
SutraTurbuScreen::refresh_screen
int refresh_screen()
SutraTurbuScreen::d_z
CarmaObj< float > * d_z
Definition: sutra_tscreen.h:58
SutraTurbuScreen::d_ytmp
CarmaObj< float > * d_ytmp
Definition: sutra_tscreen.h:60
SutraTurbuScreen::set_deltax
int set_deltax(float deltax)
CarmaDevice
Definition: carma_context.h:57
SutraTurbuScreen::amplitude
float amplitude
Definition: sutra_tscreen.h:63
gene_vonkarman
int gene_vonkarman(cuFloatComplex *d_odata, float *d_idata, float k0, int nalias, int nx, int ny, int block_size)
SutraTurbuScreen::init_vk
int init_vk(int seed, int pupd)
SutraTurbuScreen::d_tscreen
SutraPhase * d_tscreen
Definition: sutra_tscreen.h:51
SutraTurbuScreen::vk_on
bool vk_on
Definition: sutra_tscreen.h:78
SutraTurbuScreen::init_screen
int init_screen(float *h_A, float *h_B, unsigned int *h_istencilx, unsigned int *h_istencily, int seed)
SutraTurbuScreen::channel_desc
cudaChannelFormatDesc channel_desc
Definition: sutra_tscreen.h:73
norm_pscreen
int norm_pscreen(float *d_odata, float *d_idata, int nx, int ny, float norm_fact, CarmaDevice *device)
SutraTurbuScreen::d_tscreen_c
CarmaObj< cuFloatComplex > * d_tscreen_c
Definition: sutra_tscreen.h:76
SutraTurbuScreen::accumx
float accumx
Definition: sutra_tscreen.h:70
SutraTurbuScreen::d_tscreen_o
CarmaObj< float > * d_tscreen_o
Definition: sutra_tscreen.h:53
SutraTurbuScreen::set_istencilx
int set_istencilx(unsigned int *istencil)
SutraTurbuScreen
this class provides the turbulent screen features to COMPASS
Definition: sutra_tscreen.h:48
SutraTurbuScreen::d_istencilx
CarmaObj< unsigned int > * d_istencilx
Definition: sutra_tscreen.h:56
SutraTurbuScreen::r0
float r0
Definition: sutra_tscreen.h:62
SutraTurbuScreen::generate_vk
int generate_vk(float l0, int nalias)
SutraTurbuScreen::SutraTurbuScreen
SutraTurbuScreen(CarmaContext *context, long size, long size2, float amplitude, float altitude, float windspeed, float winddir, float deltax, float deltay, int device)
SutraTurbuScreen::d_noise
CarmaObj< float > * d_noise
Definition: sutra_tscreen.h:59
SutraTurbuScreen::altitude
float altitude
Definition: sutra_tscreen.h:64
SutraTurbuScreen::device
int device
Definition: sutra_tscreen.h:50
CarmaObj< float >
CarmaContext
this class provides the context in which CarmaObj are created
Definition: carma_context.h:104
SutraTurbuScreen::norm_vk
float norm_vk
Definition: sutra_tscreen.h:77
SutraTurbuScreen::set_deltay
int set_deltay(float deltay)
SutraTurbuScreen::d_mat_b
CarmaObj< float > * d_mat_b
Definition: sutra_tscreen.h:55
SutraTurbuScreen::current_context
CarmaContext * current_context
Definition: sutra_tscreen.h:79
SutraTurbuScreen::set_istencily
int set_istencily(unsigned int *istencil)
SutraTurbuScreen::set_seed
int set_seed(int seed)
SutraTurbuScreen::winddir
float winddir
Definition: sutra_tscreen.h:66
sutra_utils.h
SutraTurbuScreen::deltax
float deltax
Definition: sutra_tscreen.h:67
SutraTurbuScreen::d_mat_a
CarmaObj< float > * d_mat_a
Definition: sutra_tscreen.h:54
SutraTurbuScreen::screen_size
long screen_size
Definition: sutra_tscreen.h:61
SutraTurbuScreen::d_istencily
CarmaObj< unsigned int > * d_istencily
Definition: sutra_tscreen.h:57
SutraTurbuScreen::windspeed
float windspeed
Definition: sutra_tscreen.h:65
SutraTurbuScreen::accumy
float accumy
Definition: sutra_tscreen.h:71
SutraPhase
this class provides the phase features to COMPASS
Definition: sutra_phase.h:56
SutraTurbuScreen::extrude
int extrude(int dir)
sutra_phase.h
SutraTurbuScreen::deltay
float deltay
Definition: sutra_tscreen.h:68
SutraTurbuScreen::~SutraTurbuScreen
~SutraTurbuScreen()