COMPASS  5.0.0
End-to-end AO simulation tool using GPU acceleration
cured.h
1 #include <math.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 
5 /* struct containing the parameters necessary for computations on the parts */
6 typedef struct {
7  int linenumX, linenumY; /* geometries of the aperture part */
8  int numofelems,
9  numofresults; /* number of active elements and actuators respectively */
10  int *lineX_start; /* start of the X chains */
11  int *lineX_length; /* length of the X chains */
12  int *lineX_starta; /* start of the common chain with the previous chain (X) */
13  int *lineX_startb; /* start of the common chain with the next chain (X) */
14  int *lineX_enda; /* end of the common chain with the previous chain (X) */
15  int *lineX_endb; /* end of the common chain with the next chain (X) */
16  int *
17  actX_start; /* start of valid actuator positions, seen from X direction */
18  int *actX_length; /* length of valid actuator positions, seen from X direction
19  */
20  int *lineY_start; /* start of the Y chains */
21  int *lineY_length; /* length of the Y chains */
22  int *lineY_starta; /* start of the common chain with the previous chain (Y) */
23  int *lineY_startb; /* start of the common chain with the next chain (Y) */
24  int *lineY_enda; /* end of the common chain with the previous chain (Y) */
25  int *lineY_endb; /* end of the common chain with the next chain (Y) */
26  int *I_sub; /* aperture mask (as integer field of zeros and ones) */
27  int *empty; /* number of empty lines (x_start, x_end, y_start, y_end) */
28  int *connect_length; /* length of connecting parts */
29  int *connect_pos; /* positions of the actuators used for the connection */
30  float *act_weight; /* weighting for the actuators */
31  int *actconnect; /* gives the index in the aperture for the local actuator */
32 } p_par;
33 
34 typedef struct {
35  float *linesX; /* values of x chains */
36  float *linesY; /* values of y chains */
37  float **linestart; /* array of starts of y chains */
38  float **extrastart; /* array of starts of x extra arrays (for alternative
39  interpolation) */
40  float *extraX; /* values of averaged gradients for alternative interpolation
41  (X) */
42  float *extraY; /* values of averaged gradients for alternative interpolation
43  (Y) */
44  float *meantX; /* mean values of X chains */
45  float *meantY; /* mean values of Y chains */
46  float
47  *meanaX; /* mean values of X chains on common part with previous chain */
48  float
49  *meanaY; /* mean values of Y chains on common part with previous chain */
50  float *meanbX; /* mean values of X chains on common part with next chain */
51  float *meanbY; /* mean values of Y chains on common part with next chain */
52  float *avgaX; /* average values of gradients on common part with previous
53  chain (X) */
54  float *avgaY; /* average values of gradients on common part with previous
55  chain (Y) */
56  float *avgbX; /* average values of gradients on common part with next chain
57  (X) */
58  float *avgbY; /* average values of gradients on common part with next chain
59  (Y) */
60  float *trendX; /* values of trend steps (X) */
61  float *trendY; /* values of trend steps (Y) */
62 } p_arrays;
63 
64 typedef struct {
65  int numofelems; /* active subapertures */
66  int numofresults; /* active actuators */
67  int linenum; /* subapertures across the pupil */
68  int ndivs; /* subdivision level in CuReD */
69  int *I_sub; /* mask of active subapertures */
70  int *I_fried; /* mask of actuators according to the Fried geometry */
71  int *I_act; /* mask of active actuators ( = I_fried) */
72  float *dataX; /* array holding measurements (X), needed to have a fixed adress
73  for prepro step */
74  float *dataY; /* array holding measurements (Y) */
75 
76 } sysCure;
77 
78 typedef struct {
81  int *S_connect;
82  float *shift;
83  float *actweight;
84  float *result;
85  float **S_p_iter;
86  float **Sx_p;
87  float **Sy_p;
88  float **result_p;
89  float **connect;
90 } parCure;
91 
92 /* system setup - needs yao_params.txt for the system description */
93 /* creates the system struct sysCure */
94 
95 sysCure *cureSystem(int linenum, int numofelems, int numofresults, int *I_sub,
96  int ndivs);
97 
98 /* creating structs needed too run CuReD */
99 parCure *cureInit(sysCure *sys);
100 
101 /* call of CuReD */
102 int cured(sysCure *sys, parCure *par, float *data, float *result_vec,
103  float *ttX = NULL, float *ttY = NULL);
104 
105 void curefree(sysCure *sys, parCure *par);
sysCure::I_fried
int * I_fried
Definition: cured.h:70
p_arrays::extraY
float * extraY
Definition: cured.h:42
p_par::lineX_enda
int * lineX_enda
Definition: cured.h:14
parCure::Sx_p
float ** Sx_p
Definition: cured.h:86
p_arrays::meanbY
float * meanbY
Definition: cured.h:51
p_arrays::linesX
float * linesX
Definition: cured.h:35
sysCure
Definition: cured.h:64
p_arrays::extrastart
float ** extrastart
Definition: cured.h:38
p_arrays::meantX
float * meantX
Definition: cured.h:44
parCure::result_p
float ** result_p
Definition: cured.h:88
p_par::lineX_start
int * lineX_start
Definition: cured.h:10
parCure::S_connect
int * S_connect
Definition: cured.h:81
p_par::lineX_starta
int * lineX_starta
Definition: cured.h:12
p_par::numofelems
int numofelems
Definition: cured.h:8
sysCure::dataY
float * dataY
Definition: cured.h:74
p_arrays::trendY
float * trendY
Definition: cured.h:61
p_par::I_sub
int * I_sub
Definition: cured.h:26
p_par::lineY_startb
int * lineY_startb
Definition: cured.h:23
parCure::shift
float * shift
Definition: cured.h:82
parCure
Definition: cured.h:78
sysCure::numofresults
int numofresults
Definition: cured.h:66
p_arrays::linesY
float * linesY
Definition: cured.h:36
p_arrays::extraX
float * extraX
Definition: cured.h:40
p_par::connect_pos
int * connect_pos
Definition: cured.h:29
parCure::parts
p_par * parts
Definition: cured.h:79
p_par::lineY_start
int * lineY_start
Definition: cured.h:20
p_arrays::trendX
float * trendX
Definition: cured.h:60
p_arrays::avgbX
float * avgbX
Definition: cured.h:56
sysCure::I_sub
int * I_sub
Definition: cured.h:69
sysCure::ndivs
int ndivs
Definition: cured.h:68
p_par::connect_length
int * connect_length
Definition: cured.h:28
parCure::S_p_iter
float ** S_p_iter
Definition: cured.h:85
p_par::linenumY
int linenumY
Definition: cured.h:7
sysCure::I_act
int * I_act
Definition: cured.h:71
p_arrays
Definition: cured.h:34
p_par::actX_start
int * actX_start
Definition: cured.h:17
sysCure::dataX
float * dataX
Definition: cured.h:72
p_par::lineY_length
int * lineY_length
Definition: cured.h:21
p_arrays::linestart
float ** linestart
Definition: cured.h:37
p_par::numofresults
int numofresults
Definition: cured.h:9
p_arrays::avgaX
float * avgaX
Definition: cured.h:52
parCure::result
float * result
Definition: cured.h:84
sysCure::numofelems
int numofelems
Definition: cured.h:65
p_par::empty
int * empty
Definition: cured.h:27
p_par::lineX_startb
int * lineX_startb
Definition: cured.h:13
p_par::lineY_enda
int * lineY_enda
Definition: cured.h:24
p_arrays::meanbX
float * meanbX
Definition: cured.h:50
p_arrays::meanaX
float * meanaX
Definition: cured.h:47
p_arrays::meanaY
float * meanaY
Definition: cured.h:49
parCure::Sy_p
float ** Sy_p
Definition: cured.h:87
parCure::actweight
float * actweight
Definition: cured.h:83
p_par::actconnect
int * actconnect
Definition: cured.h:31
p_arrays::avgaY
float * avgaY
Definition: cured.h:54
p_par::lineY_starta
int * lineY_starta
Definition: cured.h:22
p_par::lineX_endb
int * lineX_endb
Definition: cured.h:15
p_par
Definition: cured.h:6
p_arrays::meantY
float * meantY
Definition: cured.h:45
p_arrays::avgbY
float * avgbY
Definition: cured.h:58
p_par::lineX_length
int * lineX_length
Definition: cured.h:11
sysCure::linenum
int linenum
Definition: cured.h:67
p_par::actX_length
int * actX_length
Definition: cured.h:18
parCure::arrays
p_arrays * arrays
Definition: cured.h:80
p_par::act_weight
float * act_weight
Definition: cured.h:30
parCure::connect
float ** connect
Definition: cured.h:89
p_par::lineY_endb
int * lineY_endb
Definition: cured.h:25