#ifndef LAYER_H #define LAYER_H #include #include using namespace std; void crossProduct(vector>* a, vector>* b, vector>* c); complex Norm(vector>* E); void Normalize(vector>* E); vector > transpose(vector >* matrix); void orthogonalize(vector>* E_0, vector>* E0, vector>* d); class layersample { public: double k; //wavenumber. vector> n; //refractive index. vector z; //z postions. vector> s; //propagation direction. Keep it for output. vector> sz; //propagation direction. Keep it for output. vector> d; //direction of propagation of the plane wave. vector> Pt; //transimission. vector> Pr; //reflection. //Calulate the index of the field component associated with a layer. // l is the layer index. c is the component(x, y, z). d is the direction(0for transmission, 1 for reflection). size_t ii(size_t l, size_t c, size_t d); //Generate the linear system corresponding to this layered sample and plane wave. void generate_linsys(size_t LAYERS, vector>& M, vector>& b, vector>& E, vector>* P, bool CPU_op); //Build matrix and get E. void solve(vector>* E, bool CPU_op); }; #endif