#ifndef WAVEGUIDE_H #define WAVEGUIDE_H /* * WMM - Wave-matching method for mode analysis of dielectric waveguides * https://wmm.computational-photonics.eu/ */ /* * waveg.h * waveguide definition */ /* Rect: rectangular section on the waveguide cross section plane */ class Rect { public: // lower left point double x0; double y0; // upper right point double x1; double y1; // initialize Rect(); Rect(double xa, double ya, double xb, double yb); // output void write(FILE *dat); // input void read(FILE *dat); }; /* waveguide geometry + permittivity profile; vacuum wavelength ... */ class Waveguide { public: // number of inner layers perpendicular to direction x int nx; // number of inner layers perpendicular to direction y int ny; // x boundary positions Dvector hx; // y boundary positions Dvector hy; // get rectangle index (l, m) corresponding to position (x,y) void rectidx(double x, double y, int& l, int& m) const; // get rectangle boundaries corresponding to index (l,m) Rect rectbounds(int l, int m) const; // get rectangle boundaries corresponding to position (x,y) Rect rectbounds(double x, double y) const; // test neighbourhood of two rectangles int testconnect(int l0, int m0, int l1, int m1) const; // test matching of boundary positions with another waveguide int bdmatch(Waveguide w) const; // vacuum wavelength double lambda; // refractive index profile Dmatrix n; // permittivity on rectangle l, m double eps(int l, int m) const; // permittivity at position x, y double eps(double x, double y) const; // lower bound for effective mode indices, default value double defaultneffmin() const; // upper bound for effective mode indices, default value double defaultneffmax() const; // the entire cross section plane Rect xyplane; // translate: hx -> hx+dx, hy -> hy+dy void translate(double dx, double dy); // check mirror symmetry of the waveguide w.r.t. central x-z-plane, return value m // m == 0: no symmetry // m >= 1: symmetric structure with respect to slice m int checksymmetry_pmy() const; // check mirror symmetry of the waveguide w.r.t. central y-z-plane, return value l // l == 0: no symmetry // l >= 1: symmetric structure with respect to layer l int checksymmetry_pmx() const; // output void write(FILE *dat); // input void read(FILE *dat); // initialize Waveguide(); Waveguide(int vnx, int vny); Waveguide(int vnx, Dvector vhx, int vny, Dvector vhy, double l, Dmatrix n); // free allocated memory void strip(); }; #endif // WAVEGUIDE_H