Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

aperture.h

Go to the documentation of this file.
00001 /*
00002 Arroyo - software for the simulation of electromagnetic wave propagation
00003 through turbulence and optics.
00004 
00005 Copyright (c) 2000-2004 California Institute of Technology.  Written by
00006 Dr. Matthew Britton.  For comments or questions about this software,
00007 please contact the author at mbritton@astro.caltech.edu.
00008 
00009 This program is free software; you can redistribute it and/or modify it
00010 under the terms of the GNU General Public License as  published by the
00011 Free Software Foundation; either version 2 of the License, or (at your
00012 option) any later version.
00013 
00014 This program is provided "as is" and distributed in the hope that it
00015 will be useful, but WITHOUT ANY WARRANTY; without even the implied
00016 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  In no
00017 event shall California Institute of Technology be liable to any party
00018 for direct, indirect, special, incidental or consequential damages,
00019 including lost profits, arising out of the use of this software and its
00020 documentation, even if the California Institute of Technology has been
00021 advised of the possibility of such damage.   The California Institute of
00022 Technology has no obligation to provide maintenance, support, updates,
00023 enhancements or modifications.  See the GNU General Public License for
00024 more details.
00025 
00026 You should have received a copy of the GNU General Public License along
00027 with this program; if not, write to the Free Software
00028 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00029 */
00030 
00031 #ifndef APERTURE_H
00032 #define APERTURE_H
00033 
00034 #include <pixel_array.h>
00035 #include "optic.h"
00036 
00037 namespace Arroyo {
00038 
00039   using std::string;
00040   using std::vector;
00041   using std::ostream;
00042 
00046 
00047   class aperture :
00048     virtual public plane_optic,
00049     virtual public one_to_one_optic {
00050 
00051     protected:
00052 
00056     bool areal_weighting;
00057 
00058     public:
00059 
00062     aperture(){areal_weighting = true;};
00063 
00066     aperture(const aperture & ap);
00067 
00070     virtual ~aperture(){};
00071 
00074     aperture & operator=(const aperture & ap);
00075 
00080     virtual aperture * clone() const = 0;
00081 
00090     bool get_areal_weighting() const {return(areal_weighting);};
00091 
00100     void set_areal_weighting(bool aewtg) {areal_weighting = aewtg;};
00101 
00104     virtual void read(const char * filename) = 0;
00105 
00108     virtual void read(const iofits & iof) = 0;
00109  
00112     virtual void write(const char * filename) const = 0;
00113 
00116     virtual void write(iofits & iof) const = 0;
00117 
00120     virtual void print(ostream & os, const char * prefix="") const;
00121 
00128     virtual double convex_polygon_overlap(const vector<three_point> & polygon_vertices) const = 0;
00129 
00132     static aperture * aperture_factory(const char * filename);
00133 
00136     static aperture * aperture_factory(const iofits & iof);
00137 
00138   };
00139 
00143 
00144   class circular_aperture :
00145     public aperture {
00146 
00147     private:
00148 
00149     static const bool factory_registration;
00150 
00153     string unique_name() const {return(string("circular aperture"));};
00154 
00156     double diameter;
00157 
00164     template<class T>
00165       void private_transform(diffractive_wavefront<T> & wf) const;
00166 
00167     public:
00168 
00171     circular_aperture();
00172 
00175     circular_aperture(const circular_aperture & circ_ap);
00176 
00179     circular_aperture(const char * filename);
00180 
00183     circular_aperture(const iofits & iof);
00184 
00190     circular_aperture(double in_diameter);
00191 
00194     ~circular_aperture(){};
00195 
00198     circular_aperture & operator=(const circular_aperture & circ_ap);
00199 
00204     circular_aperture * clone() const {
00205       return(new circular_aperture(*this));
00206     };
00207 
00210     virtual void read(const char * filename);
00211 
00214     virtual void read(const iofits & iof);
00215  
00218     virtual void write(const char * filename) const;
00219 
00222     virtual void write(iofits & iof) const;
00223 
00226     void print(ostream & os, const char * prefix="") const;
00227 
00232     double get_diameter() const {return(diameter);};
00233 
00246     rectangular_region get_covering_region(const three_frame & tf) const;
00247 
00250     void transform(diffractive_wavefront<float> & wf) const;
00251 
00254     void transform(diffractive_wavefront<double> & wf) const;
00255 
00258     //void transform(geometric_ray & gray) const;
00259 
00262     //void transform(geometric_wavefront & gwf) const;
00263 
00270     double convex_polygon_overlap(const vector<three_point> & polygon_vertices) const;
00271 
00272   };
00273 
00277 
00278   class annular_aperture :
00279     public aperture {
00280 
00281     private:
00282 
00283     static const bool factory_registration;
00284 
00287     string unique_name() const {return(string("annular aperture"));};
00288 
00289     protected:
00290 
00292     double inner_diameter;
00293 
00295     double outer_diameter;
00296 
00303     template<class T>
00304       void private_transform(diffractive_wavefront<T> & wf) const;
00305 
00306     public:
00307 
00310     annular_aperture();
00311 
00314     annular_aperture(const annular_aperture & annular_ap);
00315 
00318     annular_aperture(const char * filename);
00319 
00322     annular_aperture(const iofits & iof);
00323 
00329     annular_aperture(double in_diameter, double out_diameter);
00330 
00333     ~annular_aperture(){};
00334 
00337     annular_aperture & operator=(const annular_aperture & annular_ap);
00338 
00343     annular_aperture * clone() const {
00344       return(new annular_aperture(*this));
00345     };
00346 
00349     virtual void read(const char * filename);
00350 
00353     virtual void read(const iofits & iof);
00354  
00357     virtual void write(const char * filename) const;
00358 
00361     virtual void write(iofits & iof) const;
00362 
00365     void print(ostream & os, const char * prefix="") const;
00366 
00371     double get_inner_diameter() const {return(inner_diameter);};
00372 
00377     double get_outer_diameter() const {return(outer_diameter);};
00378 
00391     rectangular_region get_covering_region(const three_frame & tf) const;
00392 
00395     virtual void transform(diffractive_wavefront<float> & wf) const;
00396 
00399     virtual void transform(diffractive_wavefront<double> & wf) const;
00400 
00403     //virtual void transform(geometric_ray & gray) const;
00404 
00407     //virtual void transform(geometric_wavefront & gwf) const;
00408 
00415     double convex_polygon_overlap(const vector<three_point> & polygon_vertices) const;
00416 
00417   };
00418 
00422 
00423   class rectangular_aperture :
00424     public aperture {
00425 
00426     private:
00427 
00428     static const bool factory_registration;
00429 
00432     string unique_name() const {return(string("rectangular aperture"));};
00433 
00434     protected:
00435 
00437     vector<double> size;
00438 
00445     template<class T>
00446       void private_transform(diffractive_wavefront<T> & wf) const;
00447 
00448     public:
00449 
00452     rectangular_aperture();
00453 
00456     rectangular_aperture(const rectangular_aperture & rectangular_ap);
00457 
00460     rectangular_aperture(const char * filename);
00461 
00464     rectangular_aperture(const iofits & iof);
00465 
00471     rectangular_aperture(double x_size, double y_size);
00472 
00475     ~rectangular_aperture(){};
00476 
00479     rectangular_aperture & operator=(const rectangular_aperture & rectangular_ap);
00480 
00485     rectangular_aperture * clone() const {
00486       return(new rectangular_aperture(*this));
00487     };
00488 
00491     virtual void read(const char * filename);
00492 
00495     virtual void read(const iofits & iof);
00496  
00499     virtual void write(const char * filename) const;
00500 
00503     virtual void write(iofits & iof) const;
00504 
00507     void print(ostream & os, const char * prefix="") const;
00508 
00513     vector<double> get_size() const {return(size);};
00514 
00527     rectangular_region get_covering_region(const three_frame & tf) const;
00528 
00531     virtual void transform(diffractive_wavefront<float> & wf) const;
00532 
00535     virtual void transform(diffractive_wavefront<double> & wf) const;
00536 
00539     //virtual void transform(geometric_ray & gray) const;
00540 
00543     //virtual void transform(geometric_wavefront & gwf) const;
00544 
00551     double convex_polygon_overlap(const vector<three_point> & polygon_vertices) const;
00552 
00553   };
00554 
00559 
00560   class spidered_annular_aperture :
00561     public annular_aperture {
00562 
00563     private:
00564 
00565     static const bool factory_registration;
00566 
00569     string unique_name() const {return(string("spidered annular aperture"));};
00570 
00571     protected:
00572 
00574     long nspiders;
00575 
00577     double spider_width;
00578 
00585     template<class T>
00586       void private_transform(diffractive_wavefront<T> & wf) const;
00587 
00588     public:
00589 
00592     spidered_annular_aperture();
00593 
00596     spidered_annular_aperture(const spidered_annular_aperture & spdrd_annular_ap);
00597 
00600     spidered_annular_aperture(const char * filename);
00601 
00604     spidered_annular_aperture(const iofits & iof);
00605 
00611     spidered_annular_aperture(double in_diameter, double out_diameter, 
00612                               int nspiders, double spider_width);
00613 
00616     ~spidered_annular_aperture(){};
00617 
00620     spidered_annular_aperture & operator=(const spidered_annular_aperture & spdrd_annular_ap);
00621 
00626     spidered_annular_aperture * clone() const {
00627       return(new spidered_annular_aperture(*this));
00628     };
00629 
00632     void read(const char * filename);
00633 
00636     void read(const iofits & iof);
00637  
00640     void write(const char * filename) const;
00641 
00644     void write(iofits & iof) const;
00645 
00648     void print(ostream & os, const char * prefix="") const;
00649 
00662     //rectangular_region get_covering_region(const three_frame & tf) const;
00663     
00666     void transform(diffractive_wavefront<float> & wf) const;
00667 
00670     void transform(diffractive_wavefront<double> & wf) const;
00671 
00674     //virtual void transform(geometric_ray & gray) const;
00675 
00678     //virtual void transform(geometric_wavefront & gwf) const;
00679 
00686     double convex_polygon_overlap(const vector<three_point> & polygon_vertices) const;
00687 
00688   };
00689 
00693 
00694   class hexagonal_aperture :
00695     public aperture {
00696 
00697     private:
00698 
00699     static const bool factory_registration;
00700 
00703     string unique_name() const {return(string("hexagonal aperture"));};
00704 
00711     template<class T>
00712       void private_transform(diffractive_wavefront<T> & wf) const;
00713 
00714     protected:
00715 
00717     double edge_length;
00718 
00719     public:
00720 
00723     hexagonal_aperture();
00724 
00727     hexagonal_aperture(const hexagonal_aperture & hexagonal_ap);
00728 
00731     hexagonal_aperture(const char * filename);
00732 
00735     hexagonal_aperture(const iofits & iof);
00736 
00742     hexagonal_aperture(double in_edge_length);
00743 
00746     ~hexagonal_aperture(){};
00747 
00750     hexagonal_aperture & operator=(const hexagonal_aperture & hexagonal_ap);
00751 
00756     hexagonal_aperture * clone() const {
00757       return(new hexagonal_aperture(*this));
00758     };
00759 
00762     virtual void read(const char * filename);
00763 
00766     virtual void read(const iofits & iof);
00767  
00770     virtual void write(const char * filename) const;
00771 
00774     virtual void write(iofits & iof) const;
00775 
00778     void print(ostream & os, const char * prefix="") const;
00779 
00784     double get_edge_length() const {return(edge_length);};
00785 
00798     rectangular_region get_covering_region(const three_frame & tf) const;
00799 
00802     virtual void transform(diffractive_wavefront<float> & wf) const;
00803 
00806     virtual void transform(diffractive_wavefront<double> & wf) const;
00807 
00810     //virtual void transform(geometric_ray & gray) const;
00811 
00814     //virtual void transform(geometric_wavefront & gwf) const;
00815 
00822     double convex_polygon_overlap(const vector<three_point> & polygon_vertices) const;
00823 
00824   };
00825 
00826 
00830 
00831   class tiled_hexagonal_aperture :
00832     public aperture {
00833 
00834     private:
00835  
00836     static const bool factory_registration;
00837 
00840     string unique_name() const {return(string("tiled hexagonal aperture"));};
00841 
00845     tiled_hexagonal_aperture(){};
00846 
00847     protected:
00848 
00850     Arroyo::pixel_array<long> tilemap;
00851 
00853     double edge_length;
00854 
00856     double gap_size;
00857 
00864     template<class T>
00865       void private_transform(diffractive_wavefront<T> & dwf) const;
00866 
00867     public:
00868 
00871     tiled_hexagonal_aperture(const tiled_hexagonal_aperture & tiled_hexagonal_ap);
00872 
00875     tiled_hexagonal_aperture(const char * filename);
00876 
00879     tiled_hexagonal_aperture(const iofits & iof);
00880 
00898     //tiled_hexagonal_aperture(int inner_ring, int outer_ring, 
00899     //double in_edge_length, double in_gap_size);
00900 
00914     tiled_hexagonal_aperture(double inner_diameter, double outer_diameter,
00915                              double in_edge_length, double in_gap_size);
00916 
00919     ~tiled_hexagonal_aperture(){};
00920 
00923     tiled_hexagonal_aperture & operator=(const tiled_hexagonal_aperture & tiled_hexagonal_ap);
00924  
00929     tiled_hexagonal_aperture * clone() const {
00930       return(new tiled_hexagonal_aperture(*this));
00931     };
00932 
00935     virtual void read(const char * filename);
00936 
00939     virtual void read(const iofits & iof);
00940  
00943     virtual void write(const char * filename) const;
00944 
00947     virtual void write(iofits & iof) const;
00948 
00951     void print(ostream & os, const char * prefix="") const;
00952 
00955     double get_edge_length() const {return(edge_length);};
00956 
00959     double get_gap_size() const {return(gap_size);};
00960 
00973     rectangular_region get_covering_region(const three_frame & tf) const;
00974 
00977     virtual void transform(diffractive_wavefront<float> & dwf) const;
00978 
00981     virtual void transform(diffractive_wavefront<double> & dwf) const;
00982 
00989     double convex_polygon_overlap(const vector<three_point> & polygon_vertices) const;
00990   };
00991 }
00992 
00993 #endif

Generated on Thu Nov 29 17:16:28 2007 for arroyo by  doxygen 1.3.9.1