00001 #pragma once
00002
00003 #ifndef GRATINGLAYER_H
00004 #define GRATINGLAYER_H
00005
00006 #include <iostream>
00007 #include <math.h>
00008 #include <complex>
00009 #include <string>
00010
00011 #include "tbci/std_cplx.h"
00012 #include "tbci/vector.h"
00013 #include "tbci/matrix.h"
00014 #include "tbci/f_matrix.h"
00015 #include "tbci/lapack_stdcplx.h"
00016
00017 using std::complex;
00018 using std::string;
00019 using TBCI::F_Matrix;
00020 using TBCI::F_BandMatrix;
00021 using TBCI::Vector;
00022
00023
00024
00025
00028
00029
00031 class GratingLayer1D{
00032 private:
00033 complex <double> I;
00034 complex<double> n0;
00035 complex<double> gamma0;
00036
00037 double thickness, period, lambda, theta;
00038
00039 int nOrds;
00040
00041 int minOrd, maxOrd;
00042
00043 int nPermSegs;
00044
00045 Vector<double> transPt;
00046 Vector < complex <double> > refInd;
00047 F_Matrix< complex<double> > epsMat, invEpsMat, epsMat_inv, invEpsMat_inv, B;
00048
00049 Vector < complex <double> > gamma;
00050
00051 Vector < complex <double> > permCoeff;
00052 Vector < complex <double> > permCoeffInv;
00053
00054 F_Matrix < complex <double> > eigMat;
00055
00056
00057 Vector < complex<double> > eigVal;
00058
00059 Vector <complex <double> > alpha;
00060
00061 string polMode;
00062 int minPermCoeff;
00063 int maxPermCoeff;
00064 int nPermCoeffs;
00065
00066 public:
00068 F_Matrix < complex<double> > eigVecE;
00070 F_Matrix < complex<double> > eigVecH;
00072 F_Matrix < complex<double> > invEigVecE;
00074 F_Matrix < complex<double> > invEigVecH;
00075
00078
00080
00081 GratingLayer(int,int);
00083
00084 ~GratingLayer();
00086
00087 void setParameters(double,double,complex<double>,double,double,Vector<double>,Vector< complex<double> >,string);
00089
00090 void solve(string);
00092
00093 void writeIndex(int, string);
00095
00096
00097
00098
00099
00101 void setPolMode(string polarization);
00103 string getPolMode(void);
00105 void setThickness(double);
00107 double getThickness(void);
00108
00109 void setLambda(double); double getLambda(void);
00111 void setN0(complex<double>);
00113 complex<double> getN0(void);
00115 void setPeriod(double);
00117 double getPeriod(void);
00119 void setnPermSegs(int);
00121 int getnPermSegs(void);
00123 void setTransPt(Vector <double>);
00125 double getTransPt(int);
00127 void setAngle(double);
00129 double getAngle(void);
00131 void setRefInd(Vector< complex<double> >);
00133 complex<double> getRefInd(int);
00134
00136 int getnOrds(void);
00138 complex<double> getPermCoeff(int);
00140 complex<double> getAlpha(int);
00142 complex<double> getEigVal(int);
00144 complex<double> getEigMat(int,int);
00146 complex<double> getGamma(int);
00148
00149
00150 complex<double> getEigVecE(int vec, int comp);
00151 complex<double> getEigVecH(int vec, int comp);
00152 complex<double> getInvEigVecE(int vec, int comp);
00153 complex<double> getInvEigVecH(int vec, int comp);
00156
00157
00158
00160 void CalculatePermitivity(void);
00162 void createEigMat(void);
00164 void solveEigMat(void);
00166 void calcSMatrix(void);
00167 inline F_Matrix < complex<double> > unit(int i)
00168 {
00169 F_Matrix< complex<double> > m(i);
00170 m.setunit();
00171 return m;
00172 }
00174
00175 };
00176
00177 #endif