https://mooseframework.inl.gov
RayTracingAngularQuadratureTest.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "gtest/gtest.h"
11 
13 
14 TEST(RayTracingAngularQuadratureTest, gaussLegendre)
15 {
16  const std::vector<Real> x = {
17  3.5964357465057e-05, 0.0001894843595316997, 0.0004656390634237284, 0.0008644220255445423,
18  0.001385742858309946, 0.002029475369494216, 0.002795462117149317, 0.003683515291404982,
19  0.004693416984663079, 0.005824919319619315, 0.007077744539106756, 0.00845158508695204,
20  0.009946103689537855, 0.01156093344171705, 0.01329567789858499, 0.01514991117378167,
21  0.01712317804462782, 0.01921499406424482, 0.02142484568071723, 0.02375219036332271,
22  0.02619645673582899, 0.0287570447168386, 0.03143332566716089, 0.03422464254418162,
23  0.03713031006319617, 0.0401496148656687, 0.04328181569437978, 0.04652614357542062,
24  0.0498818020069885, 0.05334796715493673, 0.05692378805503834, 0.06060838682190589,
25  0.06440085886451835, 0.06830027310830861, 0.07230567222374851, 0.07641607286138052,
26  0.08063046589323758, 0.08494781666059065, 0.08936706522796428, 0.09388712664335841,
27  0.09850689120461087, 0.1032252247318361, 0.1080409688458743, 0.112952941252679,
28  0.1179599360335803, 0.1230607239413433, 0.1282540527019565, 0.1335386473220729,
29  0.1389132104020281, 0.1443764224543611, 0.1499269422277551, 0.1555634070363229,
30  0.161284433094157, 0.1670886158550527, 0.1729745303573371, 0.1789407315737048,
31  0.1849857547659781, 0.191108115844712, 0.1973063117335476, 0.2035788207382228,
32  0.2099241029201608, 0.2163406004745332, 0.2228267381127095, 0.2293809234490013,
33  0.236001547391602, 0.2426869845376282, 0.2494355935721665, 0.2562457176712257,
34  0.2631156849084962, 0.2700438086658234, 0.2770283880472709, 0.2840677082967137,
35  0.2911600412188127, 0.2983036456032996, 0.3054967676524565, 0.3127376414116798,
36  0.3200244892030347, 0.3273555220616868, 0.3347289401751018, 0.3421429333249114,
37  0.3495956813313329, 0.3570853545000323, 0.3646101140713286, 0.3721681126716179,
38  0.3797574947669143, 0.3873763971183971, 0.3950229492398449, 0.4026952738568517,
39  0.4103914873677097, 0.4181097003058446, 0.4258480178036894, 0.4336045400578885,
40  0.4413773627957088, 0.4491645777425507, 0.456964273090442, 0.4647745339673951,
41  0.4725934429075237, 0.4804190803217888, 0.4882495249692711, 0.4960828544288466,
42  0.5039171455711532, 0.5117504750307287, 0.5195809196782111, 0.527406557092476,
43  0.5352254660326043, 0.5430357269095578, 0.5508354222574486, 0.5586226372042911,
44  0.5663954599421114, 0.5741519821963106, 0.5818902996941556, 0.5896085126322897,
45  0.5973047261431478, 0.6049770507601547, 0.6126236028816023, 0.6202425052330853,
46  0.6278318873283821, 0.6353898859286713, 0.6429146454999678, 0.6504043186686675,
47  0.6578570666750887, 0.6652710598248982, 0.6726444779383132, 0.6799755107969651,
48  0.6872623585883204, 0.6945032323475433, 0.7016963543966999, 0.7088399587811873,
49  0.7159322917032862, 0.722971611952729, 0.7299561913341768, 0.736884315091503,
50  0.7437542823287744, 0.7505644064278338, 0.7573130154623722, 0.763998452608398,
51  0.7706190765509988, 0.7771732618872906, 0.7836593995254668, 0.7900758970798389,
52  0.7964211792617771, 0.8026936882664526, 0.8088918841552878, 0.8150142452340222,
53  0.8210592684262956, 0.8270254696426628, 0.8329113841449474, 0.8387155669058433,
54  0.8444365929636768, 0.8500730577722451, 0.8556235775456391, 0.8610867895979719,
55  0.8664613526779275, 0.8717459472980437, 0.8769392760586565, 0.8820400639664195,
56  0.8870470587473209, 0.8919590311541259, 0.8967747752681641, 0.9014931087953891,
57  0.9061128733566418, 0.9106329347720359, 0.9150521833394096, 0.9193695341067627,
58  0.9235839271386197, 0.9276943277762518, 0.9316997268916918, 0.9355991411354818,
59  0.9393916131780942, 0.9430762119449614, 0.9466520328450634, 0.9501181979930117,
60  0.9534738564245794, 0.9567181843056207, 0.9598503851343319, 0.9628696899368041,
61  0.9657753574558186, 0.9685666743328395, 0.9712429552831616, 0.9738035432641712,
62  0.9762478096366776, 0.9785751543192833, 0.9807850059357555, 0.9828768219553724,
63  0.9848500888262188, 0.9867043221014156, 0.9884390665582832, 0.9900538963104621,
64  0.991548414913048, 0.9929222554608932, 0.9941750806803806, 0.9953065830153369,
65  0.9963164847085949, 0.9972045378828509, 0.9979705246305057, 0.9986142571416898,
66  0.9991355779744554, 0.9995343609365761, 0.9998105156404682, 0.9999640356425352};
67  const std::vector<Real> w = {
68  9.229504873584985e-05, 0.0002148233152253478, 0.000337480317239408, 0.0004600702296712821,
69  0.0005825503573777825, 0.0007048884137269863, 0.0008270537761566921, 0.0009490162524693522,
70  0.001070745819720108, 0.001192212556002391, 0.001313386622258159, 0.001434238259734318,
71  0.001554737793051476, 0.001674855635517603, 0.00179456229540629, 0.001913828382672534,
72  0.00203262461588739, 0.002150921829256565, 0.002268690979679756, 0.002385903153820268,
73  0.002502529575169602, 0.002618541611078469, 0.002733910779775182, 0.002848608757344535,
74  0.002962607384675787, 0.003075878674365886, 0.003188394817591402, 0.003300128190930785,
75  0.003411051363141983, 0.003521137101900877, 0.003630358380479411, 0.003738688384383568,
76  0.003846100517936835, 0.003952568410805129, 0.004058065924474594, 0.004162567158665574,
77  0.004266046457693802, 0.00436847841676277, 0.004469837888211146, 0.004570099987675964,
78  0.00466924010020744, 0.004767233886309951, 0.004864057287920066, 0.004959686534309662,
79  0.005054098147923814, 0.005147268950142769, 0.005239176066975266, 0.005329796934670928,
80  0.005419109305263319, 0.005507091252028186, 0.005593721174869141, 0.005678977805620078,
81  0.005762840213266269, 0.005845287809082791, 0.005926300351689566, 0.006005857952021953,
82  0.006083941078211342, 0.006160530560380212, 0.006235607595353423, 0.006309153751267087,
83  0.006381150972096681, 0.006451581582095985, 0.006520428290126014, 0.006587674193905699,
84  0.006653302784164315, 0.006717297948686756, 0.00677964397627807, 0.006840325560614128,
85  0.006899327804001443, 0.006956636221035364, 0.00701223674215604, 0.007066115717101092,
86  0.007118259918260463, 0.007168656543918306, 0.007217293221401462, 0.007264158010114936,
87  0.007309239404469535, 0.00735252633671367, 0.007394008179647118, 0.007433674749227226,
88  0.007471516307073039, 0.007507523562855361, 0.007541687676577837, 0.007574000260744188,
89  0.007604453382421627, 0.007633039565186618, 0.007659751790959058, 0.007684583501728193,
90  0.007707528601160204, 0.007728581456094411, 0.007747736897929327, 0.007764990223888356,
91  0.007780337198176993, 0.00779377405302219, 0.007805297489593164, 0.007814904678819009,
92  0.007822593262076506, 0.007828361351771701, 0.007832207531805377, 0.007834130857915999,
93  0.007834130857916009, 0.007832207531805585, 0.007828361351772405, 0.007822593262076492,
94  0.007814904678820022, 0.007805297489593507, 0.007793774053022181, 0.007780337198177696,
95  0.007764990223888181, 0.007747736897929041, 0.00772858145609449, 0.007707528601160051,
96  0.007684583501727869, 0.007659751790959727, 0.007633039565186349, 0.007604453382421762,
97  0.007574000260743724, 0.00754168767657653, 0.007507523562855794, 0.007471516307072428,
98  0.007433674749227071, 0.007394008179647186, 0.007352526336714298, 0.007309239404469582,
99  0.0072641580101141, 0.007217293221402119, 0.007168656543918532, 0.007118259918260358,
100  0.00706611571710125, 0.0070122367421562, 0.00695663622103568, 0.006899327804001667,
101  0.006840325560614126, 0.006779643976277895, 0.006717297948686965, 0.006653302784164128,
102  0.00658767419390586, 0.006520428290125645, 0.006451581582096186, 0.006381150972096921,
103  0.0063091537512662, 0.00623560759535319, 0.006160530560380712, 0.006083941078211205,
104  0.006005857952022147, 0.005926300351689471, 0.005845287809082382, 0.00576284021326656,
105  0.00567897780562006, 0.005593721174868762, 0.005507091252028263, 0.005419109305263074,
106  0.005329796934671047, 0.00523917606697564, 0.00514726895014325, 0.00505409814792369,
107  0.004959686534309095, 0.004864057287920338, 0.004767233886310146, 0.00466924010020757,
108  0.00457009998767569, 0.004469837888211489, 0.004368478416763171, 0.004266046457692925,
109  0.004162567158665393, 0.004058065924474268, 0.003952568410804706, 0.003846100517936504,
110  0.003738688384383724, 0.00363035838047838, 0.003521137101901117, 0.003411051363142785,
111  0.003300128190930307, 0.003188394817591546, 0.003075878674366077, 0.002962607384675911,
112  0.002848608757344138, 0.002733910779775525, 0.002618541611078311, 0.002502529575169577,
113  0.002385903153820551, 0.002268690979679305, 0.00215092182925634, 0.002032624615887844,
114  0.001913828382672675, 0.001794562295405616, 0.001674855635518267, 0.001554737793051348,
115  0.001434238259734413, 0.001313386622258311, 0.001192212556002759, 0.001070745819719768,
116  0.0009490162524696159, 0.0008270537761568535, 0.0007048884137273808, 0.0005825503573776667,
117  0.0004600702296706742, 0.0003374803172395162, 0.0002148233152254676, 9.229504873548172e-05};
118 
119  std::vector<Real> x_compare;
120  std::vector<Real> w_compare;
121  RayTracingAngularQuadrature::gaussLegendre(200, x_compare, w_compare);
122 
123  EXPECT_EQ(x.size(), x_compare.size());
124  EXPECT_EQ(w.size(), w_compare.size());
125  for (std::size_t i = 0; i < x_compare.size(); ++i)
126  {
127  EXPECT_NEAR(x[i], x_compare[i], 1.e-10);
128  EXPECT_NEAR(w[i], w_compare[i], 1.e-10);
129  }
130 }
131 
132 TEST(RayTracingAngularQuadratureTest, Chebyshev)
133 {
134  const std::vector<Real> x = {
135  0.000000000000e+00, 6.283185307180e-02, 1.256637061436e-01, 1.884955592154e-01,
136  2.513274122872e-01, 3.141592653590e-01, 3.769911184308e-01, 4.398229715026e-01,
137  5.026548245744e-01, 5.654866776462e-01, 6.283185307180e-01, 6.911503837898e-01,
138  7.539822368616e-01, 8.168140899333e-01, 8.796459430051e-01, 9.424777960769e-01,
139  1.005309649149e+00, 1.068141502221e+00, 1.130973355292e+00, 1.193805208364e+00,
140  1.256637061436e+00, 1.319468914508e+00, 1.382300767580e+00, 1.445132620651e+00,
141  1.507964473723e+00, 1.570796326795e+00, 1.633628179867e+00, 1.696460032938e+00,
142  1.759291886010e+00, 1.822123739082e+00, 1.884955592154e+00, 1.947787445226e+00,
143  2.010619298297e+00, 2.073451151369e+00, 2.136283004441e+00, 2.199114857513e+00,
144  2.261946710585e+00, 2.324778563656e+00, 2.387610416728e+00, 2.450442269800e+00,
145  2.513274122872e+00, 2.576105975944e+00, 2.638937829015e+00, 2.701769682087e+00,
146  2.764601535159e+00, 2.827433388231e+00, 2.890265241303e+00, 2.953097094374e+00,
147  3.015928947446e+00, 3.078760800518e+00, 3.141592653590e+00, 3.204424506662e+00,
148  3.267256359733e+00, 3.330088212805e+00, 3.392920065877e+00, 3.455751918949e+00,
149  3.518583772021e+00, 3.581415625092e+00, 3.644247478164e+00, 3.707079331236e+00,
150  3.769911184308e+00, 3.832743037380e+00, 3.895574890451e+00, 3.958406743523e+00,
151  4.021238596595e+00, 4.084070449667e+00, 4.146902302739e+00, 4.209734155810e+00,
152  4.272566008882e+00, 4.335397861954e+00, 4.398229715026e+00, 4.461061568098e+00,
153  4.523893421169e+00, 4.586725274241e+00, 4.649557127313e+00, 4.712388980385e+00,
154  4.775220833456e+00, 4.838052686528e+00, 4.900884539600e+00, 4.963716392672e+00,
155  5.026548245744e+00, 5.089380098815e+00, 5.152211951887e+00, 5.215043804959e+00,
156  5.277875658031e+00, 5.340707511103e+00, 5.403539364174e+00, 5.466371217246e+00,
157  5.529203070318e+00, 5.592034923390e+00, 5.654866776462e+00, 5.717698629533e+00,
158  5.780530482605e+00, 5.843362335677e+00, 5.906194188749e+00, 5.969026041821e+00,
159  6.031857894892e+00, 6.094689747964e+00, 6.157521601036e+00, 6.220353454108e+00};
160 
161  std::vector<Real> x_compare;
162  std::vector<Real> w_compare;
163  RayTracingAngularQuadrature::chebyshev(100, x_compare, w_compare);
164 
165  EXPECT_EQ(x.size(), x_compare.size());
166  EXPECT_EQ(x.size(), w_compare.size());
167  for (std::size_t i = 0; i < x_compare.size(); ++i)
168  {
169  EXPECT_NEAR(x[i], x_compare[i], 1.e-10);
170  EXPECT_NEAR(6.283185307180e-02, w_compare[i], 1.e-10);
171  }
172 }
173 
174 TEST(RayTracingAngularQuadratureTest, BasicGetters)
175 {
176  const unsigned int polar_order = 3;
177  const unsigned int azimuthal_order = 3;
178  const Real mu_min = -1;
179  const Real mu_max = 1;
180  RayTracingAngularQuadrature aq(3, polar_order, azimuthal_order, mu_min, mu_max);
181 
182  EXPECT_EQ(polar_order, aq.polarOrder());
183  EXPECT_EQ(azimuthal_order, aq.azimuthalOrder());
184  EXPECT_EQ(mu_min, aq.muMin());
185  EXPECT_EQ(mu_max, aq.muMax());
186  EXPECT_EQ((std::size_t)9, aq.numDirections());
187 
188  const Point rotation(1, 0, 0);
189  aq.rotate(rotation);
190  for (unsigned int d = 0; d < 3; ++d)
191  EXPECT_NEAR(rotation(d), aq.currentRotationDirection()(d), 1.e-10);
192 
193  for (unsigned int i = 0; i < aq.numDirections(); ++i)
194  EXPECT_TRUE(aq.hasDirection(i));
195 }
196 
197 void
198 testWeights(const std::vector<std::vector<Real>> & weights, const RayTracingAngularQuadrature & aq)
199 {
200  EXPECT_EQ(weights.size(), aq.numDirections());
201  for (unsigned int l = 0; l < aq.numDirections(); ++l)
202  {
203  EXPECT_EQ(weights[l].size(), aq.getWeights(l).size());
204  for (std::size_t i = 0; i < weights[l].size(); ++i)
205  EXPECT_NEAR(aq.getWeights(l)[i], weights[l][i], 1.e-10);
206  }
207 }
208 
209 void
210 testPolarSins2D(const std::vector<std::vector<Real>> & polar_sins,
211  const RayTracingAngularQuadrature & aq)
212 {
213  EXPECT_EQ(aq.dim(), (unsigned int)2);
214  EXPECT_EQ(polar_sins.size(), aq.numDirections());
215  for (unsigned int l = 0; l < aq.numDirections(); ++l)
216  {
217  EXPECT_EQ(polar_sins[l].size(), aq.numPolar(l));
218  for (std::size_t i = 0; i < polar_sins[l].size(); ++i)
219  EXPECT_NEAR(aq.getPolarSins(l)[i], polar_sins[l][i], 1.e-10);
220  }
221 }
222 
223 void
224 testDirections(const std::vector<Point> & directions, const RayTracingAngularQuadrature & aq)
225 {
226  EXPECT_EQ(directions.size(), aq.numDirections());
227  for (unsigned int l = 0; l < aq.numDirections(); ++l)
228  for (unsigned int d = 0; d < 3; ++d)
229  EXPECT_NEAR(aq.getDirection(l)(d), directions[l](d), 1.e-10);
230 }
231 
232 TEST(RayTracingAngularQuadratureTest, HalfRange2D)
233 {
234  RayTracingAngularQuadrature aq(2, 3, 3, 0, 1);
235  EXPECT_EQ((std::size_t)3, aq.numDirections());
236 
237  const std::vector<std::vector<Real>> weights = {{9.308422677303e-01, 1.163552834663e+00},
238  {9.308422677303e-01, 1.163552834663e+00},
239  {9.308422677303e-01, 1.163552834663e+00}};
240  const std::vector<std::vector<Real>> polar_sins = {{8.660254037844e-01, 4.611959078084e-01},
241  {8.660254037844e-01, 4.611959078084e-01},
242  {8.660254037844e-01, 4.611959078084e-01}};
243  const std::vector<Point> directions = {
244  {1.000000000000e+00, 0.000000000000e+00, 0.000000000000e+00},
245  {-5.000000000000e-01, 8.660254037844e-01, 0.000000000000e+00},
246  {-5.000000000000e-01, -8.660254037844e-01, 0.000000000000e+00}};
247 
248  testWeights(weights, aq);
249  testPolarSins2D(polar_sins, aq);
251 
252  aq.rotate(Point(1, 1, 0));
253 
254  const std::vector<std::vector<Real>> rot_weights = {{9.308422677303e-01, 1.163552834663e+00},
255  {9.308422677303e-01},
256  {1.163552834663e+00},
257  {9.308422677303e-01},
258  {1.163552834663e+00}};
259  const std::vector<std::vector<Real>> rot_polar_sins = {{8.660254037844e-01, 4.611959078084e-01},
260  {8.660254037844e-01},
261  {4.611959078084e-01},
262  {8.660254037844e-01},
263  {4.611959078084e-01}};
264  const std::vector<Point> rot_directions = {
265  {7.071067811865e-01, 7.071067811865e-01, 0.000000000000e+00},
266  {9.805806756909e-01, -1.961161351382e-01, 0.000000000000e+00},
267  {9.350384426221e-01, 3.545463450930e-01, 0.000000000000e+00},
268  {-1.961161351382e-01, 9.805806756909e-01, 0.000000000000e+00},
269  {3.545463450930e-01, 9.350384426221e-01, 0.000000000000e+00}};
270 
271  testWeights(rot_weights, aq);
272  testPolarSins2D(rot_polar_sins, aq);
273  testDirections(rot_directions, aq);
274 }
275 
276 TEST(RayTracingAngularQuadratureTest, FullRange2D)
277 {
278  RayTracingAngularQuadrature aq(2, 3, 4, -1, 1);
279 
280  const std::vector<std::vector<Real>> weights = {{6.981317007977e-01, 8.726646259972e-01},
281  {6.981317007977e-01, 8.726646259972e-01},
282  {6.981317007977e-01, 8.726646259972e-01},
283  {6.981317007977e-01, 8.726646259972e-01}};
284  const std::vector<std::vector<Real>> polar_sins = {{1.000000000000e+00, 6.324555320337e-01},
285  {1.000000000000e+00, 6.324555320337e-01},
286  {1.000000000000e+00, 6.324555320337e-01},
287  {1.000000000000e+00, 6.324555320337e-01}};
288  const std::vector<Point> directions = {
289  {1.000000000000e+00, 0.000000000000e+00, 0.000000000000e+00},
290  {6.123233995737e-17, 1.000000000000e+00, 0.000000000000e+00},
291  {-1.000000000000e+00, 1.224646799147e-16, 0.000000000000e+00},
292  {-1.836970198721e-16, -1.000000000000e+00, 0.000000000000e+00}};
293 
294  testWeights(weights, aq);
295  testPolarSins2D(polar_sins, aq);
297 }
298 
299 TEST(RayTracingAngularQuadratureTest, Cone2D)
300 {
301  RayTracingAngularQuadrature aq(2, 4, 3, 0.8, 1);
302 
303  const std::vector<std::vector<Real>> weights = {{1.365849618394e+00, 7.285454839996e-01},
304  {1.365849618394e+00, 7.285454839996e-01},
305  {1.365849618394e+00, 7.285454839996e-01}};
306  const std::vector<std::vector<Real>> polar_sins = {{3.572779604940e-01, 1.660719917434e-01},
307  {3.572779604940e-01, 1.660719917434e-01},
308  {3.572779604940e-01, 1.660719917434e-01}};
309  const std::vector<Point> directions = {
310  {1.000000000000e+00, 0.000000000000e+00, 0.000000000000e+00},
311  {-5.000000000000e-01, 8.660254037844e-01, 0.000000000000e+00},
312  {-5.000000000000e-01, -8.660254037844e-01, 0.000000000000e+00}};
313 
314  testWeights(weights, aq);
315  testPolarSins2D(polar_sins, aq);
317 
318  aq.rotate(Point(1, 2, 0));
319 
320  const std::vector<std::vector<Real>> rot_weights = {{1.365849618394e+00, 7.285454839996e-01},
321  {1.365849618394e+00},
322  {7.285454839996e-01},
323  {1.365849618394e+00},
324  {7.285454839996e-01}};
325  const std::vector<std::vector<Real>> rot_polar_sins = {{3.572779604940e-01, 1.660719917434e-01},
326  {3.572779604940e-01},
327  {1.660719917434e-01},
328  {3.572779604940e-01},
329  {1.660719917434e-01}};
330  const std::vector<Point> rot_directions = {
331  {4.472135955000e-01, 8.944271909999e-01, 0.000000000000e+00},
332  {7.057959156146e-01, 7.084152211110e-01, 0.000000000000e+00},
333  {5.716162833142e-01, 8.205210689861e-01, 0.000000000000e+00},
334  {1.432546275200e-01, 9.896858651583e-01, 0.000000000000e+00},
335  {3.134470852004e-01, 9.496056680430e-01, 0.000000000000e+00}};
336 
337  testWeights(rot_weights, aq);
338  testPolarSins2D(rot_polar_sins, aq);
339  testDirections(rot_directions, aq);
340 }
341 
342 TEST(RayTracingAngularQuadratureTest, HalfRange3D)
343 {
344  RayTracingAngularQuadrature aq(3, 3, 5, 0, 1);
345 
346  const std::vector<std::vector<Real>> weights = {{3.490658503989e-01},
347  {5.585053606382e-01},
348  {3.490658503989e-01},
349  {3.490658503989e-01},
350  {5.585053606382e-01},
351  {3.490658503989e-01},
352  {3.490658503989e-01},
353  {5.585053606382e-01},
354  {3.490658503989e-01},
355  {3.490658503989e-01},
356  {5.585053606382e-01},
357  {3.490658503989e-01},
358  {3.490658503989e-01},
359  {5.585053606382e-01},
360  {3.490658503989e-01}};
361  const std::vector<Point> directions = {
362  {9.936288716723e-01, 0.000000000000e+00, 1.127016653793e-01},
363  {8.660254037844e-01, 0.000000000000e+00, 5.000000000000e-01},
364  {4.611959078084e-01, 0.000000000000e+00, 8.872983346207e-01},
365  {3.070482074483e-01, 9.449972131829e-01, 1.127016653793e-01},
366  {2.676165673298e-01, 8.236391035463e-01, 5.000000000000e-01},
367  {1.425173732490e-01, 4.386233734099e-01, 8.872983346207e-01},
368  {-8.038626432845e-01, 5.840403970210e-01, 1.127016653793e-01},
369  {-7.006292692220e-01, 5.090369604551e-01, 5.000000000000e-01},
370  {-3.731153271532e-01, 2.710841530274e-01, 8.872983346207e-01},
371  {-8.038626432845e-01, -5.840403970210e-01, 1.127016653793e-01},
372  {-7.006292692220e-01, -5.090369604551e-01, 5.000000000000e-01},
373  {-3.731153271532e-01, -2.710841530274e-01, 8.872983346207e-01},
374  {3.070482074483e-01, -9.449972131829e-01, 1.127016653793e-01},
375  {2.676165673298e-01, -8.236391035463e-01, 5.000000000000e-01},
376  {1.425173732490e-01, -4.386233734099e-01, 8.872983346207e-01}};
377 
378  testWeights(weights, aq);
380 
381  aq.rotate(Point(1, 2, 3));
382 
383  const std::vector<Point> rot_directions = {
384  {-8.586078935314e-01, 5.046059144028e-01, 9.036236116458e-02},
385  {-6.409660482853e-01, 6.545595765332e-01, 4.008918628686e-01},
386  {-1.753657054642e-01, 6.805339898760e-01, 7.114213645727e-01},
387  {-5.833577901160e-01, -4.801349160080e-01, 6.551062136333e-01},
388  {-4.010640197232e-01, -2.037192029917e-01, 8.931103730312e-01},
389  {-4.760752035289e-02, 2.234634938537e-01, 9.735489668838e-01},
390  {5.396988555796e-01, -7.180938037975e-01, 4.393932569278e-01},
391  {5.777678286554e-01, -4.111190156956e-01, 7.050996320409e-01},
392  {4.736626882716e-01, 1.130141415814e-01, 8.734251321905e-01},
393  {9.585359304955e-01, 1.195803460343e-01, -2.586685345987e-01},
394  {9.428171516622e-01, 3.189796303179e-01, 9.668409369634e-02},
395  {6.680672094129e-01, 5.018231838641e-01, 5.494175969549e-01},
396  {9.433483284653e-02, 8.752503299170e-01, -4.743814913042e-01},
397  {1.895981924719e-01, 9.776052213984e-01, -9.132664729392e-02},
398  {2.669456024205e-01, 8.525697394004e-01, 4.492937622616e-01}};
399 
400  testWeights(weights, aq);
401  testDirections(rot_directions, aq);
402 }
403 
404 TEST(RayTracingAngularQuadratureTest, FullRange3D)
405 {
406  RayTracingAngularQuadrature aq(3, 3, 3, -1, 1);
407 
408  const std::vector<std::vector<Real>> weights = {{5.817764173314e-01},
409  {9.308422677303e-01},
410  {5.817764173314e-01},
411  {5.817764173314e-01},
412  {9.308422677303e-01},
413  {5.817764173314e-01},
414  {5.817764173314e-01},
415  {9.308422677303e-01},
416  {5.817764173314e-01}};
417  const std::vector<Point> directions = {
418  {6.324555320337e-01, 0.000000000000e+00, -7.745966692415e-01},
419  {1.000000000000e+00, 0.000000000000e+00, 0.000000000000e+00},
420  {6.324555320337e-01, 0.000000000000e+00, 7.745966692415e-01},
421  {-3.162277660168e-01, 5.477225575052e-01, -7.745966692415e-01},
422  {-5.000000000000e-01, 8.660254037844e-01, 0.000000000000e+00},
423  {-3.162277660168e-01, 5.477225575052e-01, 7.745966692415e-01},
424  {-3.162277660168e-01, -5.477225575052e-01, -7.745966692415e-01},
425  {-5.000000000000e-01, -8.660254037844e-01, 0.000000000000e+00},
426  {-3.162277660168e-01, -5.477225575052e-01, 7.745966692415e-01}};
427 
428  testWeights(weights, aq);
430 }
431 
432 TEST(RayTracingAngularQuadratureTest, Cone3D)
433 {
434  RayTracingAngularQuadrature aq(3, 4, 5, 0.75, 1);
435 
436  const std::vector<std::vector<Real>> weights = {
437  {2.185636451999e-01}, {4.097548855181e-01}, {4.097548855181e-01}, {2.185636451999e-01},
438  {2.185636451999e-01}, {4.097548855181e-01}, {4.097548855181e-01}, {2.185636451999e-01},
439  {2.185636451999e-01}, {4.097548855181e-01}, {4.097548855181e-01}, {2.185636451999e-01},
440  {2.185636451999e-01}, {4.097548855181e-01}, {4.097548855181e-01}, {2.185636451999e-01},
441  {2.185636451999e-01}, {4.097548855181e-01}, {4.097548855181e-01}, {2.185636451999e-01}};
442  std::vector<Point> directions = {{6.412189638587e-01, 0.000000000000e+00, 7.673579610507e-01},
443  {5.540214839611e-01, 0.000000000000e+00, 8.325023695519e-01},
444  {3.977412451860e-01, 0.000000000000e+00, 9.174976304481e-01},
445  {1.855117874682e-01, 0.000000000000e+00, 9.826420389493e-01},
446  {1.981475569478e-01, 6.098354739499e-01, 7.673579610507e-01},
447  {1.712020537928e-01, 5.269057424887e-01, 8.325023695519e-01},
448  {1.229088041263e-01, 3.782744030335e-01, 9.174976304481e-01},
449  {5.732629498455e-02, 1.764321943212e-01, 9.826420389493e-01},
450  {-5.187570388772e-01, 3.768990504464e-01, 7.673579610507e-01},
451  {-4.482127957734e-01, 3.256456577255e-01, 8.325023695519e-01},
452  {-3.217794267193e-01, 2.337864381488e-01, 9.174976304481e-01},
453  {-1.500821887186e-01, 1.090410928002e-01, 9.826420389493e-01},
454  {-5.187570388772e-01, -3.768990504464e-01, 7.673579610507e-01},
455  {-4.482127957734e-01, -3.256456577255e-01, 8.325023695519e-01},
456  {-3.217794267193e-01, -2.337864381488e-01, 9.174976304481e-01},
457  {-1.500821887186e-01, -1.090410928002e-01, 9.826420389493e-01},
458  {1.981475569478e-01, -6.098354739499e-01, 7.673579610507e-01},
459  {1.712020537928e-01, -5.269057424887e-01, 8.325023695519e-01},
460  {1.229088041263e-01, -3.782744030335e-01, 9.174976304481e-01},
461  {5.732629498455e-02, -1.764321943212e-01, 9.826420389493e-01}};
462 
463  testWeights(weights, aq);
465 
466  aq.rotate(Point(0, 1.1, 1.5));
467  const std::vector<Point> rot_directions = {
468  {6.412189638587e-01, 4.537876151607e-01, 6.188012934010e-01},
469  {5.540214839611e-01, 4.923116512368e-01, 6.713340698684e-01},
470  {3.977412451860e-01, 5.425747601114e-01, 7.398746728791e-01},
471  {1.855117874682e-01, 5.810987961874e-01, 7.924074493465e-01},
472  {1.981475569478e-01, 9.455619880039e-01, 2.581667533160e-01},
473  {1.712020537928e-01, 9.172110743248e-01, 3.597411596038e-01},
474  {1.229088041263e-01, 8.476171285219e-01, 5.161769360447e-01},
475  {5.732629498455e-02, 7.233745991178e-01, 6.880718605309e-01},
476  {-5.187570388772e-01, 7.577208923740e-01, 3.959168901112e-01},
477  {-4.482127957734e-01, 7.549139365054e-01, 4.787590606714e-01},
478  {-3.217794267193e-01, 7.311013117978e-01, 6.016218683090e-01},
479  {-1.500821887186e-01, 6.690300781751e-01, 7.279245092222e-01},
480  {-5.187570388772e-01, 1.498543379474e-01, 8.416856966907e-01},
481  {-4.482127957734e-01, 2.297093659682e-01, 8.639090790653e-01},
482  {-3.217794267193e-01, 3.540482084249e-01, 8.781274774492e-01},
483  {-1.500821887186e-01, 4.931675141998e-01, 8.568903894708e-01},
484  {1.981475569478e-01, -3.798675768249e-02, 9.794358334860e-01},
485  {1.712020537928e-01, 6.741222814882e-02, 9.829269801329e-01},
486  {1.229088041263e-01, 2.375323917008e-01, 9.635724097135e-01},
487  {5.732629498455e-02, 4.388229932570e-01, 8.967430381621e-01}};
488 
489  testWeights(weights, aq);
490  testDirections(rot_directions, aq);
491 }
static void gaussLegendre(const unsigned int order, std::vector< Real > &x, std::vector< Real > &w)
Builds Gauss-Legendre quadrature on 0, 1, with weights that sum to 1.
TEST(RayTracingAngularQuadratureTest, gaussLegendre)
Real muMax() const
Get the maximum mu.
void testDirections(const std::vector< Point > &directions, const RayTracingAngularQuadrature &aq)
static void chebyshev(const unsigned int order, std::vector< Real > &x, std::vector< Real > &w)
Builds Chebyshev quadrature on [0, 2] with weights that sum to 2.
const libMesh::Point & getDirection(const unsigned int l) const
Get the direction associated with direction l.
static const std::string directions[3]
Definition: NS.h:22
std::size_t numDirections() const
Get the number of directions in the rotated and projected quadrature.
void testPolarSins2D(const std::vector< std::vector< Real >> &polar_sins, const RayTracingAngularQuadrature &aq)
const std::vector< double > x
std::size_t numPolar(const unsigned int l) const
The number of polar directions associated with the given direction.
unsigned int polarOrder() const
Get the polar order.
unsigned int dim() const
Get the quadrature dimension.
bool hasDirection(const unsigned int l) const
Whether or not the angular quadrature has direction l.
void rotate(const libMesh::Point &rotation_direction)
Rotates the quadrature to a given direction.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void testWeights(const std::vector< std::vector< Real >> &weights, const RayTracingAngularQuadrature &aq)
const std::vector< Real > & getPolarSins(const unsigned int l) const
Gets the polar sins for the direction l.
const std::vector< Real > & getWeights(const unsigned int l) const
Get the weights associated with the direction l.
unsigned int azimuthalOrder() const
Get the azimuthal order.
void ErrorVector unsigned int
const libMesh::Point & currentRotationDirection() const
Get the current rotation direction.
Real muMin() const
Get the minimum mu.