Blame view

sphere.h 1.33 KB
3f56f1f9   dmayerich   initial commit
1
2
3
4
5
6
7
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
  #ifndef SPHERESTRUCT_H
  #define SPHERESTRUCT_H
  
  #include <ostream>
  #include <sstream>
  #include <vector>
  #include <complex>
  #include "fieldslice.h"
  #include "dataTypes.h"
  
  
  
  struct sphere
  {
  
      //sphere position
      bsPoint p;
  
      //sphere radius
      ptype a;
  
      //sphere material index
      int iMaterial;
  
      //rtsPointer to the scattered field produced by a plane wave
      //  this is a function of cos(theta) and |r| (distance from sphere center)
      //fieldslice surface;
  
      //resolution of the scattered field
      int thetaR, rR;
  
  	//sphere order
  	int Nl;
  
  	//refractive index for the current lambda
  	bsComplex n;
  
  	//external scattering coefficients
  	std::vector<bsComplex> B;
  
  	//internal scattering coefficients
  	std::vector<bsComplex> A;
  
      sphere(ptype x = 0.0f, ptype y = 0.0f, ptype z = 0.0f, ptype a = 0.0f, int m = 0, int ang = 128)
      {
          this->p = bsPoint(x, y, z);
          this->a = a;
          this->iMaterial = m;
  
  		//surface = fieldslice(ang, ang/2);
      }
  
  	std::string toStr()
  	{
  		std::stringstream ss;
  
  		ss<<p<<", "<<a<<", "<<iMaterial;
  
  		return ss.str();
  	}
  
  	//compute the order required to represent the scattered field
  
  	void calcNl(ptype lambda)
  	{
          Nl = ceil( (2 * PI * a) / lambda + 4 * pow( (2 * PI * a) / lambda, 1.0/3.0) + 2);
  	}
  
  	void calcCoeff(ptype lambda, rts::rtsComplex<ptype> n);
  
  
  
  
  };
  
  #endif