nearfield.h 1.64 KB
#ifndef NEARFIELD_H
#define NEARFIELD_H

//#include "defaults.h"
#include "fieldslice.h"
#include "montecarlo.h"
#include "rts/material.h"
#include "sphere.h"
#include <vector>

#define EPSILON_FLOAT   0.000001

//This structure stores values relevant to creating the near field
struct nearfieldStruct
{
	//incident wavelength
	ptype lambda;

	//condenser numerical aperature (internal and external)
	ptype condenser[2];

	//amplitude of the incident field
	ptype A;

	//position of the focus in 3D space
	bsVector k;		//cartesian coordinates, normalized
	bsPoint focus;

	//slice position and orientation in world space
	rts::rtsQuad<ptype, 3> pos;

	//slices for the focused field
	fieldslice Uf;
	//	and total field: Uf + sum(Us)
	fieldslice U;

	//incident field order
	int m;

	//flag for a vector simulation
	bool scalarSim;

	//flag for a plane wave
	bool planeWave;

	

	//---------Scatterers------------

	//angular resolution of scatterers
	//		number of divisions in [0 pi]
	unsigned int angRes;

	//list of materials
	std::vector< rts::material<ptype> > mVector;

	//list of scatterers
	std::vector<sphere> sVector;

	nearfieldStruct();

	void init();
	void destroy();

	void Simulate();

	void calcSpheres();

	//plane waves for Monte-Carlo sampling
	std::vector<bsVector> inWaves;
	int nWaves;
	void calcWaves();

	std::string toStr();

	void setRes(int x_res, int y_res);

	void setPos(bsPoint pMin, bsPoint pMax, bsVector normal);

	//this function re-computes the focused field
	void scalarUf();

	//compute the field scattered by all of the materials
	void scalarUs();

	//add the incident field to the sum of scattered fields
	void sumUf();

	



};



#endif