00001 #pragma once
00002
00004
00005
00007
00008
00009
00010
00011
00012
00014 #ifndef GRATING2D_H
00015 #define GRATING2D_H
00016
00017 #include "GratingLayer2D.h"
00018 #include <vector>
00019
00020 using std::complex;
00021 using std::string;
00022 using std::vector;
00023 using TBCI::F_BandMatrix;
00024 using TBCI::Vector;
00025 using TBCI::lu_invert;
00026
00029
00036 class Grating2D{
00037
00038 private:
00040
00043 bool memorysave;
00044
00045
00046
00047
00048
00049 Matrix< complex<double> > R, T, Q12, Q2, tau, T_tilde, R_tilde, G, W21, W23;
00050
00051
00052 int nOrds, nOrdsSq;
00054 int nLayers;
00055
00056 double periodX, periodY;
00057
00059 double lambda;
00061 double theta;
00063 double phi;
00065 double k1;
00067 double k3;
00068
00069 complex<double> n1;
00070
00071 complex<double> n3;
00072
00073
00074 Vector< complex<double> > alpha_1, alpha_3, beta_1, beta_3, gamma_1, gamma_3;
00075
00076
00077 complex<double> mu;
00078
00079
00080
00081 protected:
00082
00083 Vector< complex<double> > incid;
00084 Vector< complex<double> > trans;
00085 Vector< complex<double> > ref;
00086 Matrix< complex<double> > efficiencyR, efficiencyT;
00087 public:
00088 vector <GratingLayer2D> layer;
00089
00095
00096 Grating2D(int);
00097 ~Grating2D();
00099 const Grating2D &operator=(Grating2D &);
00101 void setParameters(int, double, double, Vector<double>, double, double, double, complex<double>, complex<double>);
00103 void setTransPt(Vector<double>, Vector<double>);
00105 void setTransPt(void);
00107 void setRefInd(vector< Matrix< complex<double> > >);
00109 void setIncid(Matrix< complex<double> >, Matrix< complex<double> >);
00111 Matrix< complex<double> > getIncid(string);
00113 void solve(void);
00115 void setSMatrix(void);
00116 complex<double> getReflection(string, int, int);
00117 complex<double> getTransmission(string, int, int);
00118 complex<double> getIncid(string, int, int);
00120 complex<double> calcTransField(double, double, double, string);
00121 void calcEfficiencyR(void);
00122 void calcEfficiencyT(void);
00124 void writeField(string, string, string, double , int, int);
00125
00127 void writeParameters(string);
00129 bool getMemsave(void);
00131 void setMemsave(bool);
00133 void minimiseMemory(void);
00145
00146
00147 double getSizeX(void); void setSizeX(double);
00148 double getSizeY(void); void setSizeY(double);
00150 int getnLayers(void);
00152 void setnLayers(int);
00154 double getLambda(void); void setLambda(double);
00156 double getTheta(void); void setTheta(double);
00158 double getPhi(void); void setPhi(double);
00160 complex<double>getN1(void); void setN1(complex<double>);
00162 complex<double>getN3(void); void setN3(complex<double>);
00164 int getnOrds(void);
00166 void setnOrds(int);
00168 complex<double> getR(int, int);
00170 complex<double> getT(int, int);
00172 complex<double> getAlphaT(int);
00174 complex<double> getBetaT(int);
00176 complex<double> getAlphaR(int);
00178 complex<double> getBetaR(int);
00183
00184
00185 void calcAlphaBetaGamma(void);
00187
00189 void calcBoundaryW(void);
00190
00192 double delta(int, int);
00194 };
00195
00196 #endif