Example for FMM1D

Here is an example of how to solve lamellar gratings:
#include <iostream>
#include "Grating1d.h"
#include <complex>

#include <tbci/vector.h>
#include <tbci/matrix.h>
#include <tbci/f_matrix.h>
#include <tbci/lapack_stdcplx.h>

using namespace std;

int main()
{
        int nPixels = 2;
        int nLayers = 1;
        double lambda = 1.1;
        double theta = 0.;
        double period = 10.;
        complex<double> n1 = 1.;
        complex<double> n3 = 1.;
        int nOrds=101;
        string polMode = "TE";
        TBCI::Vector <complex<double> > incid(0, nOrds);
        incid[(nOrds-1)/2] = complex <double>(1., 0.);
        
        TBCI::Vector<double> thickness(1., nLayers);
        TBCI::F_Matrix< complex<double> > index(1.,nLayers,nPixels);
        index(0,0)=complex<double>(2.,0.);
        index(0,1)=complex<double>(4.,0.);

        Grating grating(nOrds,nLayers,nPixels);
        grating.setParameters(theta, lambda, period, n1, n3, 0, 0, incid, polMode);
        grating.initLayers(index, thickness);

        for (int j=0;j<nLayers;j++) {grating.layer[j].solve("T");}
        grating.solve("T");
        grating.calcExtField(50,50,20,0,1);
        grating.writeField("field.dat");
        
}

Generated on Thu May 7 16:28:03 2009 for FMM by  doxygen 1.5.5