#ifndef BUNDLE_H #define BUNDLE_H /* * METRIC --- Mode expansion modeling in integrated optics / photonics * http://metric.computational-photonics.eu/ */ /* * bundle.h * vectorial BEP & QUEP, wave bundles */ /* container for field levels at specific points */ class Probe { public: // location double x; double y; double z; // id characters char id; // the local permittivity double eps; // the local e.m. field Complex ex; Complex ey; Complex ez; Complex hx; Complex hy; Complex hz; // cp: one of EX, EY, EZ, HX, HY, HZ, SX, SY, SZ Complex field(Fcomp cp) const; // foa: one of MOD, ORG, SQR, REP, IMP double field(Fcomp cp, Afo foa) const; // the field "strength", id: one of mE, mH, qE, qH, mW double field(FSid id) const; // initialize Probe(); Probe(double cx, double cy, double cz, char ic); }; /* an array of probes */ class ProbeArray { public: // number of probes included int num; // initialize ProbeArray(); // destroy ~ProbeArray(); // copy constructor ProbeArray(const ProbeArray& va); // assignment ProbeArray& operator=(const ProbeArray& s); // free allocated memory void clear(); // subscripting Probe& operator() (int i); Probe operator() (int i) const; // add a probe void add(Probe m); private: Probe *pvec; }; /* types of views: XZ: axis x (vertical) versus axis z (horizontal) at position y YZ: axis y (vertical) versus axis z (horizontal) at position x XY: axis x (vertical) versus axis y (horizontal) at position z */ enum Vtype {XZ, YZ, XY}; /* containers for discretized fields, plot routines */ class View { public: // the underlying rectangular permittivity distribution, // adapted to the type of view in case of type YZ, XY SegWgStruct st; // discretized field information on a regular rectangular grid Cmatrix ex; Cmatrix ey; Cmatrix ez; Cmatrix hx; Cmatrix hy; Cmatrix hz; // axis orientation, x, y, z // <-> plot axis horizontal, vertical, position Vtype type; // axis coordinates, characters char va_chr; char ha_chr; // plot: vertical axis: va_N+1 points from va_beg to va_end double va_beg; double va_end; int va_N; // plot: horizontal axis: ha_N+1 points from ha_beg to ha_end double ha_beg; double ha_end; int ha_N; // third axis: position double pos; // transform v, h, pos to x, y, z coordinates void trf(double v, double h, double& x, double& y, double& z) const; // plot id characters char pid0; char pid1; // initialize: supply discretization information, setup matrices View(); View(Vtype t, SegWgStruct s, double v_beg, double v_end, int v_N, double h_beg, double h_end, int h_N, double p, char ext0, char ext1); // --------------------------------------------------------------- // visualization: output to MATLAB .m files // ext0, ext1: filename id characters for the m.file // image plot corresponding to field component cp // cp: one of EX, EY, EZ, HX, HY, HZ, SX, SY, SZ // foa: ORG, MOD, SQR, REP, IMP (ORG = REP) void plot(Fcomp cp, Afo foa) const; // image plot of the field "strength", id: one of mE, mH, qE, qH, mW void plot(FSid id) const; // electromagnetic energy density image void plot() const; // animation of the light propagation // the frames show images of component cp // at ntfr equidistant times over one time period void movie(Fcomp cp, int ntfr) const; // export full field data ("everything") into a viewer MATLAB file void viewer() const; }; /* an array of containers for discretized fields */ class ViewArray { public: // number of views included int num; // initialize ViewArray(); // destroy ~ViewArray(); // copy constructor ViewArray(const ViewArray& va); // assignment ViewArray& operator=(const ViewArray& s); // free allocated memory void clear(); // subscripting View& operator() (int i); View operator() (int i) const; // add a view void add(View m); private: View *vvec; }; /* registration of modal output power */ class Port { public: // initialize Port(); Port(CBorder b, Polarization p, int o, char d); Port(SBorder b, Polarization p, int o, char d); // border of the computational window CBorder bdrQ; SBorder bdrB; // polarzation Polarization pol; // mode order int ord; // indentifier char id; // upon completion of Bundle::solve(): // Pout is the guided modal power carried across border bdr // by the mode of polarization pol, order ord double Pout; }; /* an array of containers for registration of guided modal output power */ class PortArray { public: // number of ports included int num; // initialize PortArray(); // destroy ~PortArray(); // copy constructor PortArray(const PortArray& pa); // assignment PortArray& operator=(const PortArray& s); // free allocated memory void clear(); // subscripting Port& operator() (int i); Port operator() (int i) const; // add a port void add(Port m); private: Port *pvec; }; /* Gaussian beams of vBEP / vQUEP solutions */ class Bundle { public: // the structure under investigation SegWgStruct str; // incidence across computational window interface CBorder entryQ; SBorder entryB; // incoming mode: polarization Polarization pol; // mode order int ord; // primary angle of incidence /^o double theta0; // beam half-width (1/e, field) at focus point /mum double bhw; // beam focus coordinates double y0; double z0; // effective index of incoming mode double Nin; // vacuum wavenumber double k0; // lateral spectral discretization of the beam double ky0; // primary lateral wavenumber int Nky; // number of discrete angles double Dky; // angular window double Wky; // spectral half-width // vBEP / vQUEP computational parameters Interval cwx; // vertical computational window int nmx; // number of expansion terms per slice Interval cwz; // horizontal computational window int nmz; // number of expansion terms per layer // stepwise vBEP, vQUEP: fill views with field data // vBEP void solve(); // vQUEP calcuations with shifting boundaries, // numtr, pviol, bshift: arguments for quepsim_s() void solve(int numtr, double pviol, double bshift); // vBEP only: double pass solver, consider transmission resonances // in output to mode of order oo, with polarization op, at boundary obdr, // resolved with a stepsize that is reduced by a factor of srf void solveR(SBorder obdr, Polarization op, int oo, double srf); // setup: // rc: the structure under investigation, // incoming field: // guided mode of polarization p, order o, // coming in at border bdr, with unit amplitude, // at primary angle of incidence t (^o), // beam of full width w (1/e, field), // focus at fcy, fcz, // represented by na angles between t-dt and t+dt, // dt determined such that spectral contributions with relative // amplitude below dtlev are neglected // // vQUEP computations: // wx: vertical computational window, // Mx: number of expansion terms per vertical slice, // wz: horizontal computational window, // Mx: number of expansion terms per horizontal layer Bundle(SegWgStruct rc, CBorder bdr, Polarization p, int o, double t, double w, double fcy, double fcz, int na, double dtlev, Interval wx, int Mx, Interval wz, int Mz); Bundle(Circuit rc, CBorder bdr, Polarization p, int o, double t, double w, double fcy, double fcz, int na, double dtlev, Interval wx, int Mx, Interval wz, int Mz); // vBEP computations: // wx: vertical computational window, // Mx: number of expansion terms per vertical slice, Bundle(SegWgStruct rc, SBorder bdr, Polarization p, int o, double t, double w, double fcy, double fcz, int na, double dtlev, Interval wx, int Mx); Bundle(Circuit rc, SBorder bdr, Polarization p, int o, double t, double w, double fcy, double fcz, int na, double dtlev, Interval wx, int Mx); // containers for field inspection ViewArray VA; // containers for field levels at specific positions ProbeArray FA; // containers for the registration of guided modal output power PortArray PA; // registration of the guided modal input power double Pin; // computational model, 'B' (vBEP) or 'Q' (vQUEP) char CM; // a single lateral spectral component: double ky; QuepField qfld; BepField bfld; Complex spfld(Fcomp cp, double x, double y, double z); }; #endif // BUNDLE_H