Blame view

nearfield.h 2.01 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
  #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;
  
3f36b18e   David Mayerich   Adding planewave ...
25
26
27
  	//incident field polarization;
  	bsVector E;
  
3f56f1f9   dmayerich   initial commit
28
29
30
31
32
  	//position of the focus in 3D space
  	bsVector k;		//cartesian coordinates, normalized
  	bsPoint focus;
  
  	//slice position and orientation in world space

3f36b18e   David Mayerich   Adding planewave ...
33
  	rts::quad<ptype, 3> pos;
3f56f1f9   dmayerich   initial commit
34
35
36
  
  	//slices for the focused field
  	fieldslice Uf;
51b6469a   dmayerich   added look-up tables
37
38
  	ptype d_min, d_max;
  
3f56f1f9   dmayerich   initial commit
39
40
41
42
43
44
45
46
47
48
49
50
  	//	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
51
52
53
54
55
56
57
58
  	//flag for using a LUT
  	bool lut_uf;
  	bool lut_us;
  
  	//timings
  	float t_Uf;
  	float t_Us;
  
d6f53e68   dmayerich   rts organization
59
  
3f56f1f9   dmayerich   initial commit
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
91
92
93
  
  	//---------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
94
  	void calcUf();
3f36b18e   David Mayerich   Adding planewave ...
95
96
  
  	//scalar functions
3f56f1f9   dmayerich   initial commit
97
  	void scalarUf();
51b6469a   dmayerich   added look-up tables
98
99
  	void scalarUfLut();
  
3f36b18e   David Mayerich   Adding planewave ...
100
101
102
103
  	//vector functions
  	void vectorUf();
  	void vectorUfLut();
  
51b6469a   dmayerich   added look-up tables
104
  	void calcBesselLut(ptype* j, ptype d_min, ptype d_max, int dR);
3f56f1f9   dmayerich   initial commit
105
106
  
  	//compute the field scattered by all of the materials
51b6469a   dmayerich   added look-up tables
107
  	void calcUs();
3f56f1f9   dmayerich   initial commit
108
  	void scalarUs();
51b6469a   dmayerich   added look-up tables
109
110
  	void scalarUpLut();
  
3f56f1f9   dmayerich   initial commit
111
112
113
114
  
  	//add the incident field to the sum of scattered fields
  	void sumUf();
  
d6f53e68   dmayerich   rts organization
115
  
3f56f1f9   dmayerich   initial commit
116
117
118
119
120
121
122
123
  
  
  
  };
  
  
  
  #endif