00001 #pragma once
00002
00004
00005
00006 #ifndef GRATINGLAYER2D_H
00007 #define GRATINGLAYER2D_H
00008
00009 #include <math.h>
00010 #include <complex>
00011 #include <fstream>
00012 #include <string>
00013
00014 #include "tbci/std_cplx.h"
00015 #include "tbci/vector.h"
00016 #include "tbci/matrix.h"
00017 #include "tbci/f_matrix.h"
00018 #include "tbci/solver/lu_solver.h"
00019 #include "tbci/lapack_stdcplx.h"
00020
00021
00022 using std::complex;
00023 using std::ofstream;
00024 using std::string;
00025
00026 using TBCI::F_Matrix;
00027 using TBCI::Matrix;
00028 using TBCI::Vector;
00029 using TBCI::lu_invert;
00030
00032
00037 class GratingLayer2D
00038 {
00039 private:
00040 double mu;
00041
00042
00043
00044 bool memorysave;
00045
00047 Matrix< complex<double> > refInd;
00049 double periodX;
00051 double periodY;
00053 double thickness;
00054 int nPixelsX, nPixelsY;
00055 complex<double> n1;
00057 Vector<double> transPtX;
00059 Vector<double> transPtY;
00060
00062 double lambda;
00064 double theta;
00066 double phi;
00068 double k0;
00069
00070
00071
00072
00073 int nOrds, nOrdsSq, nPermCoeffs, maxPermCoeff;
00074 Matrix< complex<double> > epsilon, invEpsilon, invEpsilonMatrix, invEpsilonMatrix_inv;
00075 Vector< complex<double> > alpha, beta;
00076
00077
00078
00079
00080
00081 Matrix< complex<double> > eps, invEps, tInvEps, bInvEps, btEps, tbEps;
00082
00083 Matrix < complex<double> > invEps_TbEps, invEps_BtEps;
00084 Vector < complex<double> > eigVal, gamma;
00085 Matrix< complex<double> > eigMatE, F, G, FG;
00086
00087 public:
00088 void calcEig(void);
00089
00090
00091 Matrix < complex<double> > eigVecE, eigVecH, invEigVecE, invEigVecH;
00092
00093 GratingLayer2D();
00094
00095 virtual ~GratingLayer2D();
00096
00098 const GratingLayer2D &operator=(GratingLayer2D &);
00099
00101 void minimiseMemory();
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111 void setParameters(int, double, double, double, double, double, double, complex<double>);
00112
00114 void setTransPt(Vector<double>, Vector<double>);
00116 Vector<double> getTransPtX();
00118 Vector<double> getTransPtY();
00120 double getTransPtX(int);
00122 double getTransPtY(int);
00124 void reset(Vector<double>, Vector<double>, Matrix< complex<double> >);
00125 void memsave(bool b){memorysave=b;}
00126 bool memsave(void){return memorysave;}
00127
00128
00129 double getSizeX(void); void setSizeX(double);
00130
00131 double getSizeY(void); void setSizeY(double);
00132
00133 double getThickness(void); void setThickness(double);
00134
00135 double getLambda(void); void setLambda(double);
00136
00137 double getTheta(void); void setTheta(double);
00138
00139 double getPhi(void); void setPhi(double);
00140
00141 complex<double>getN1(void); void setN1(complex<double>);
00143 complex<double>getRefInd(int, int);
00145 Matrix< complex<double> >getRefInd(void);
00147 void setRefInd(Matrix< complex<double> >);
00148
00149 int getnPixelsX(void);
00150
00151 int getnPixelsY(void);
00153
00156 int getnOrds(void);
00158 void setnOrds(int);
00159
00160
00161
00162
00163
00164 complex<double> getEigMatE(int, int);
00165 complex<double> getEigVecE(int, int);
00166 complex<double> getEigVecH(int, int);
00167 complex<double> getInvEigVecE(int, int);
00168 complex<double> getInvEigVecH(int, int);
00169 complex<double> getG(int, int);
00170
00171 complex<double> getEigVal(int);
00172 complex<double> getAlpha(int);
00173 complex<double> getBeta(int);
00174 complex<double> getGamma(int);
00175
00176
00177 void calcAlphaBeta(void);
00178
00179
00180
00181
00182 virtual void calcPermCoeffs(void);
00183 void calcEpsilon(void);
00184 void calcTBEpsilon(void);
00185 void calcBTEpsilon(void);
00186
00187
00188
00189 void setEigMat(void);
00190
00191
00192
00193 void solveEigMat(void);
00194
00195 void solveHomogeneous(void);
00196
00197
00198
00199
00200 virtual void solve(void);
00201
00202 };
00203
00204
00205 #endif