casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
BeamCalcAntenna.h
Go to the documentation of this file.
00001 #ifndef SYNTHESIS_ANTENNA_H
00002 #define SYNTHESIS_ANTENNA_H
00003 
00004 namespace casa
00005 {
00006 #include <synthesis/TransformMachines/BeamCalc.h>
00007   
00008 #define MAXGEOM 2000
00009   /*
00010    * calcAntenna parameters
00011    */
00012   typedef struct
00013   {
00014     Double sub_h;               /* height of subreflector (on axis) */
00015     Double feed[3];             /* position of the feed */
00016     Double feeddir[3];          /* unit vector pointing along feed */
00017     Double pfeeddir[3];         /* same as above after pathology applied */
00018     Double radius;              /* antenna radius (m) */
00019     Double K;
00020     Double deltar;
00021     Double zedge;               /* height at the edge of the dish */
00022     Double bestparabola;        /* best fit parabola quadratic coef */
00023     Double ftaper;              /* taper of feed */
00024     Double thmax;               /* maximum angle of feed */
00025     Double fa2pi;
00026     Double legwidth;
00027     Double legfoot, legfootz;
00028     Double legapex;
00029     Double legthick;
00030     Double hole_radius;
00031     Double freq, lambda;
00032     Double dir[3];
00033     Double hhat[3], vhat[3];   /* unit vectors orthogonal to dir */
00034     Double z[MAXGEOM];
00035     Double m[MAXGEOM];
00036     Double k[3];
00037     Int ngeom;
00038     char name[16];
00039     Int gridsize;
00040   } calcAntenna;
00041   
00042   typedef struct
00043   {
00044     Double subrot[3][3];        /* 3x3 matrix rotating x,y,z or nx,ny,nz */
00045     Double feedrot[3][3];       /* 3x3 matrix rotating x,y,z or nx,ny,nz */
00046     Double subshift[3];         /* 3 length vector */
00047     Double feedshift[3];        /* 3 length vector */
00048     Double subrotpoint[3];      /* 3 vector describing point to rotate sub. */
00049     Double az_offset;           /* azimuth pointing offset (radians) */
00050     Double el_offset;           /* elevation pointing offset (radians) */
00051     Double phase_offset;        /* DC offset in phase (radians) */
00052     Double focus;               /* meters out of focus toward subreflector */
00053   } Pathology;
00054   
00055   typedef struct
00056   {
00057     Double aper[6];             /* aperture x, y, z, nx, ny, nz */
00058     Double dish[6];             /* dish x, y, z, nx, ny, nz */
00059     Double sub[6];              /* subreflector x, y, z, nx, ny, nz */
00060     Double feed[3];             /* feed x, y, z */
00061   } Ray;
00062   
00063   calcAntenna *newAntenna(Double sub_h, Double feed_x, Double feed_y, Double feed_z,
00064                       Double ftaper, Double thmax, const char *geomfile);
00065   void deleteAntenna(calcAntenna *a);
00066   void Antennasetfreq(calcAntenna *a, Double freq);
00067   void Antennasetdir(calcAntenna *a, const Double *dir);
00068   void alignfeed(calcAntenna *a, const Pathology *p);
00069   void getfeedbasis(const calcAntenna *a, Double B[3][3]);
00070   void Efield(const calcAntenna *a, 
00071               const casa::Complex *pol, 
00072               casa::Complex *E);
00073   Int Antennasetfeedpattern(calcAntenna *a, const char *filename, Double scale);
00074   calcAntenna *newAntennafromApertureCalcParams(struct ApertureCalcParams *ap);
00075   void applyPathology(Pathology *P, calcAntenna *a);
00076   Int dishvalue(const calcAntenna *a, Double r, Double *z, Double *m);
00077   Int subfromdish(const calcAntenna *a, Double x, Double y, Double *subpoint);
00078   Int dishfromsub(const calcAntenna *a, Double x, Double y, Double *dishpoint);
00079   
00080   Ray *newRay(const Double *sub);
00081   void deleteRay(Ray *ray);
00082   Pathology *newPathology();
00083   Pathology *newPathologyfromApertureCalcParams(struct ApertureCalcParams *ap);
00084   void deletePathology(Pathology *P);
00085   Double dAdOmega(const calcAntenna *a, const Ray *ray1, const Ray *ray2, 
00086                   const Ray *ray3, const Pathology *p);
00087   Double dOmega(const calcAntenna *a, const Ray *ray1, const Ray *ray2, 
00088                 const Ray *ray3, const Pathology *p);
00089   Double Raylen(const Ray *ray);
00090   Double feedfunc(const calcAntenna *a, Double theta);
00091   void Pathologize(Double *sub, const Pathology *p);
00092   void intersectdish(const calcAntenna *a, const Double *sub, const Double *unitdir, 
00093                      Double *dish, Int niter);
00094   void intersectaperture(const calcAntenna *a, const Double *dish, 
00095                          const Double *unitdir, Double *aper);
00096   Ray *trace(const calcAntenna *a, Double x, Double y, const Pathology *p);
00097   Double feedgain(const calcAntenna *a, const Ray *ray, const Pathology *p);
00098   
00099   void tracepol(casa::Complex *E0, const Ray *ray, casa::Complex *E1);
00100   
00101   Int legplanewaveblock(const calcAntenna *a, Double x, Double y);
00102   Int legplanewaveblock2(const calcAntenna *a, const Ray *ray);
00103   Int legsphericalwaveblock(const calcAntenna *a, const Ray *ray);
00104 };
00105 #endif