Blame view

nearfield.h 1.89 KB
3f56f1f9   dmayerich   initial commit
1
2
3
4
5
6
  #ifndef NEARFIELD_H
  #define NEARFIELD_H
  
  //#include "defaults.h"
  #include "fieldslice.h"
  #include "montecarlo.h"
d6f53e68   dmayerich   rts organization
7
  #include "rts/optics/material.h"
3f56f1f9   dmayerich   initial commit
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  #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;
51b6469a   dmayerich   added look-up tables
34
35
  	ptype d_min, d_max;
  
3f56f1f9   dmayerich   initial commit
36
37
38
39
40
41
42
43
44
45
46
47
  	//	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;
  
51b6469a   dmayerich   added look-up tables
48
49
50
51
52
53
54
55
  	//flag for using a LUT
  	bool lut_uf;
  	bool lut_us;
  
  	//timings
  	float t_Uf;
  	float t_Us;
  
d6f53e68   dmayerich   rts organization
56
  
3f56f1f9   dmayerich   initial commit
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
  
  	//---------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
51b6469a   dmayerich   added look-up tables
91
  	void calcUf();
3f56f1f9   dmayerich   initial commit
92
  	void scalarUf();
51b6469a   dmayerich   added look-up tables
93
94
95
  	void scalarUfLut();
  
  	void calcBesselLut(ptype* j, ptype d_min, ptype d_max, int dR);
3f56f1f9   dmayerich   initial commit
96
97
  
  	//compute the field scattered by all of the materials
51b6469a   dmayerich   added look-up tables
98
  	void calcUs();
3f56f1f9   dmayerich   initial commit
99
  	void scalarUs();
51b6469a   dmayerich   added look-up tables
100
101
  	void scalarUpLut();
  
3f56f1f9   dmayerich   initial commit
102
103
104
105
  
  	//add the incident field to the sum of scattered fields
  	void sumUf();
  
d6f53e68   dmayerich   rts organization
106
  
3f56f1f9   dmayerich   initial commit
107
108
109
110
111
112
113
114
  
  
  
  };
  
  
  
  #endif