3f56f1f9
dmayerich
initial commit
|
1
2
3
4
5
6
7
8
9
|
#ifndef SPHERESTRUCT_H
#define SPHERESTRUCT_H
#include <ostream>
#include <sstream>
#include <vector>
#include <complex>
#include "fieldslice.h"
#include "dataTypes.h"
|
396a5f12
David Mayerich
added custom code...
|
10
|
#include <algorithm>
|
3f56f1f9
dmayerich
initial commit
|
11
12
13
14
15
16
17
18
19
20
21
22
23
|
struct sphere
{
//sphere position
bsPoint p;
//sphere radius
ptype a;
//sphere material index
|
274c3d2b
dmayerich
fixed visual stud...
|
24
|
unsigned int iMaterial;
|
3f56f1f9
dmayerich
initial commit
|
25
|
|
51b6469a
dmayerich
added look-up tables
|
26
|
//GPU pointer to the scattered field produced by a plane wave
|
3f56f1f9
dmayerich
initial commit
|
27
|
// this is a function of cos(theta) and |r| (distance from sphere center)
|
51b6469a
dmayerich
added look-up tables
|
28
29
30
31
|
fieldslice Usp;
fieldslice Uip;
ptype d_min;
ptype d_max;
|
3f56f1f9
dmayerich
initial commit
|
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
//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);
}
|
51b6469a
dmayerich
added look-up tables
|
54
55
|
//assignment operator
sphere & operator=(const sphere &rhs);
|
3f36b18e
David Mayerich
Adding planewave ...
|
56
|
|
51b6469a
dmayerich
added look-up tables
|
57
58
59
|
//copy constructor
sphere(const sphere &rhs);
|
3f56f1f9
dmayerich
initial commit
|
60
61
62
63
64
65
66
67
68
69
70
71
72
|
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)
{
|
396a5f12
David Mayerich
added custom code...
|
73
|
Nl = ceil( (2 * PI * a) / lambda + 4 * pow( (2 * PI * a) / lambda, (ptype)(1.0/3.0)) + 2);
|
3f56f1f9
dmayerich
initial commit
|
74
75
|
}
|
51b6469a
dmayerich
added look-up tables
|
76
77
78
79
80
81
82
83
84
|
//compute the scattering coefficients
void calcCoeff(ptype lambda, bsComplex n);
//compute the bessel function look-up tables
void calcLut(bsComplex* j, bsComplex* h, ptype lambda, bsComplex n, int aR, int rR);
void calcBesselLut(bsComplex* j, ptype k, bsComplex n, int aR);
void calcHankelLut(bsComplex* h, ptype k, int rR);
//calculate the scattering domain Us(theta, r)
|
3f36b18e
David Mayerich
Adding planewave ...
|
85
|
void calcUp(ptype lambda, bsComplex n, rts::quad<ptype, 3> nfPlane, unsigned int R);
|
3f56f1f9
dmayerich
initial commit
|
86
|
|
51b6469a
dmayerich
added look-up tables
|
87
88
|
void scalarUsp(bsComplex* h, int rR, int thetaR);
void scalarUip(bsComplex* j, int aR, int thetaR);
|
3f56f1f9
dmayerich
initial commit
|
89
90
91
92
93
94
|
};
#endif
|