\doxysection{PG\+\_\+\+Kernel.\+h}
\hypertarget{_p_g___kernel_8h_source}{}\label{_p_g___kernel_8h_source}\index{src/PG\_Kernel.h@{src/PG\_Kernel.h}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ }
\DoxyCodeLine{00009\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00010\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{structtrajectory}{trajectory}}\ \{}
\DoxyCodeLine{00011\ \ \ \ \ \textcolor{keyword}{public}:}
\DoxyCodeLine{00012\ \ \ \ \ \ \ \ \ std::vector<Matrix<T>>\ velocities;}
\DoxyCodeLine{00013\ \ \ \ \ \ \ \ \ std::vector<Matrix<T>>\ positions;}
\DoxyCodeLine{00014\ \};}
\DoxyCodeLine{00015\ }
\DoxyCodeLine{00016\ }
\DoxyCodeLine{00025\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00026\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_p_g___kernel}{PG\_Kernel}}\ \{}
\DoxyCodeLine{00027\ }
\DoxyCodeLine{00028\ \ \ \ \ \textcolor{keyword}{private}:}
\DoxyCodeLine{00029\ }
\DoxyCodeLine{00030\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_surface}{Surface<T>}}\ surface;\ \textcolor{comment}{//\ Surface\ object\ for\ storing\ surface\ properties}}
\DoxyCodeLine{00031\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_gas}{Gas<T>}}\ gas;\ \textcolor{comment}{//\ Gas\ object\ for\ storing\ gas\ properties}}
\DoxyCodeLine{00032\ }
\DoxyCodeLine{00033\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ roots;\ \textcolor{comment}{//\ Matrix\ of\ roots\ for\ Hermite\ polynomials}}
\DoxyCodeLine{00034\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ weights;\ \textcolor{comment}{//\ Matrix\ of\ weights\ for\ Hermite\ polynomials}}
\DoxyCodeLine{00035\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ roots\_2d\_r;\ \textcolor{comment}{//\ Matrix\ of\ roots\ for\ 2D\ Hermite\ polynomials\ (row)}}
\DoxyCodeLine{00036\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ roots\_2d\_c;\ \textcolor{comment}{//\ Matrix\ of\ roots\ for\ 2D\ Hermite\ polynomials\ (column)}}
\DoxyCodeLine{00037\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ weights\_2d;\ \textcolor{comment}{//\ Matrix\ of\ weights\ for\ 2D\ Hermite\ polynomials}}
\DoxyCodeLine{00038\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ gamma;\ \textcolor{comment}{//\ Matrix\ of\ gamma\ values\ for\ PG\_Kernel}}
\DoxyCodeLine{00039\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ gamma\_dot;\ \textcolor{comment}{//\ Matrix\ of\ gamma\_dot\ values\ for\ PG\_Kernel}}
\DoxyCodeLine{00040\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ gamma\_2d;\ \textcolor{comment}{//\ Matrix\ of\ gamma\ values\ for\ 2D\ PG\_Kernel}}
\DoxyCodeLine{00041\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ gamma\_dot\_2d;\ \textcolor{comment}{//\ Matrix\ of\ gamma\_dot\ values\ for\ 2D\ PG\_Kernel}}
\DoxyCodeLine{00042\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p\_gamma;\ \textcolor{comment}{//\ Matrix\ of\ p\_gamma\ values\ for\ PG\_Kernel}}
\DoxyCodeLine{00043\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p\_gamma\_dot;\ \textcolor{comment}{//\ Matrix\ of\ p\_gamma\_dot\ values\ for\ PG\_Kernel}}
\DoxyCodeLine{00044\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p\_gamma\_2d;\ \textcolor{comment}{//\ Matrix\ of\ p\_gamma\ values\ for\ 2D\ PG\_Kernel}}
\DoxyCodeLine{00045\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p\_gamma\_dot\_2d;\ \textcolor{comment}{//\ Matrix\ of\ p\_gamma\_dot\ values\ for\ 2D\ PG\_Kernel}}
\DoxyCodeLine{00046\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ mu;\ \textcolor{comment}{//\ Matrix\ of\ mu\ values\ for\ PG\_Kernel}}
\DoxyCodeLine{00047\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ sigma;\ \textcolor{comment}{//\ Matrix\ of\ sigma\ values\ for\ PG\_Kernel}}
\DoxyCodeLine{00048\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ mu\_2d;\ \textcolor{comment}{//\ Matrix\ of\ mu\ values\ for\ 2D\ PG\_Kernel}}
\DoxyCodeLine{00049\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ sigma\_2d;\ \textcolor{comment}{//\ Matrix\ of\ sigma\ values\ for\ 2D\ PG\_Kernel}}
\DoxyCodeLine{00050\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ mu\_gamma;\ \textcolor{comment}{//\ Matrix\ of\ mu\_gamma\ values\ for\ PG\_Kernel}}
\DoxyCodeLine{00051\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ sigma\_gamma;\ \textcolor{comment}{//\ Matrix\ of\ sigma\_gamma\ values\ for\ PG\_Kernel}}
\DoxyCodeLine{00052\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ mu\_gamma\_2d;\ \textcolor{comment}{//\ Matrix\ of\ mu\_gamma\ values\ for\ 2D\ PG\_Kernel}}
\DoxyCodeLine{00053\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ sigma\_gamma\_2d;\ \textcolor{comment}{//\ Matrix\ of\ sigma\_gamma\ values\ for\ 2D\ PG\_Kernel}}
\DoxyCodeLine{00054\ }
\DoxyCodeLine{00055\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ incident\_velocity;\ \textcolor{comment}{//\ Matrix\ of\ incident\ velocities}}
\DoxyCodeLine{00056\ }
\DoxyCodeLine{00057\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ int\_order;\ \textcolor{comment}{//\ Order\ of\ integration\ for\ Hermite\ polynomials}}
\DoxyCodeLine{00058\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{long}\ num\_particles;\ \textcolor{comment}{//\ Number\ of\ particles}}
\DoxyCodeLine{00059\ }
\DoxyCodeLine{00060\ \ \ \ \ \ \ \ \ std::string\ sim\_name;\ \textcolor{comment}{//\ Name\ of\ the\ simulation}}
\DoxyCodeLine{00061\ }
\DoxyCodeLine{00062\ \ \ \ \ \ \ \ \ T\ margin,\ ac\_length,\ mu\_gas,\ T\_gas;\ \textcolor{comment}{//\ Parameters\ for\ PG\_Kernel}}
\DoxyCodeLine{00063\ }
\DoxyCodeLine{00064\ \ \ \ \ \ \ \ \ void\ (*local\_kernel)(T*,\ T*,\ T*,\ T*,\ T*);\ \textcolor{comment}{//\ Pointer\ to\ local\ kernel\ function}}
\DoxyCodeLine{00065\ }
\DoxyCodeLine{00066\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_hermite}{Hermite<T>}}\ herm\_tools;\ \textcolor{comment}{//\ Hermite\ tools\ object}}
\DoxyCodeLine{00067\ }
\DoxyCodeLine{00068\ }
\DoxyCodeLine{00069\ \ \ \ \ \textcolor{keyword}{public}:}
\DoxyCodeLine{00070\ }
\DoxyCodeLine{00076\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_p_g___kernel_af8e1efcc80359072e576592d13f977c3}{PG\_Kernel}}()\ \{}
\DoxyCodeLine{00077\ }
\DoxyCodeLine{00078\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_hermite}{Hermite<T>}}\ herm\_tools;}
\DoxyCodeLine{00079\ }
\DoxyCodeLine{00080\ \ \ \ \ \ \ \ \ \ \ \ \ int\_order\ =\ 25;}
\DoxyCodeLine{00081\ \ \ \ \ \ \ \ \ \ \ \ \ num\_particles\ =\ 1000;}
\DoxyCodeLine{00082\ \ \ \ \ \ \ \ \ \ \ \ \ margin\ =\ 5.0;}
\DoxyCodeLine{00083\ \ \ \ \ \ \ \ \ \ \ \ \ ac\_length\ =\ 1.0;}
\DoxyCodeLine{00084\ \ \ \ \ \ \ \ \ \ \ \ \ mu\_gas\ =\ 4.0;}
\DoxyCodeLine{00085\ \ \ \ \ \ \ \ \ \ \ \ \ T\_gas\ =\ 400.0;}
\DoxyCodeLine{00086\ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00087\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00088\ }
\DoxyCodeLine{00101\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_p_g___kernel_a44101c4d46d0a26d186cb6035fec5124}{PG\_Kernel}}(\mbox{\hyperlink{class_surface}{Surface<T>}}\ surface,\ \mbox{\hyperlink{class_gas}{Gas<T>}}\ gas,\ \textcolor{keywordtype}{void}\ (*local\_kernel)(T*,\ T*,\ T*,\ T*,\ T*),\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ incident\_velocity,\ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{long}\ num\_particles,\ std::string\ sim\_name)\ \{}
\DoxyCodeLine{00102\ }
\DoxyCodeLine{00103\ \ \ \ \ \ \ \ \ \ \ \ \ int\_order\ =\ 25;}
\DoxyCodeLine{00104\ \ \ \ \ \ \ \ \ \ \ \ \ margin\ =\ 5.0;}
\DoxyCodeLine{00105\ }
\DoxyCodeLine{00106\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>surface\ =\ surface;}
\DoxyCodeLine{00107\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>gas\ =\ gas;}
\DoxyCodeLine{00108\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>ac\_length\ =\ surface.\mbox{\hyperlink{class_surface_a40018fe168bd1f761c47160a26e7bbef}{autocorrelation\_length}}();}
\DoxyCodeLine{00109\ }
\DoxyCodeLine{00110\ \ \ \ \ \ \ \ \ \ \ \ \ roots\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_a4cf467389e6bb8f605e6692e80c7799f}{get\_roots}}(int\_order);}
\DoxyCodeLine{00111\ \ \ \ \ \ \ \ \ \ \ \ \ weights\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_ad31dd94ef63c00b04623f4efe224dac2}{get\_weights}}(int\_order);}
\DoxyCodeLine{00112\ }
\DoxyCodeLine{00113\ \ \ \ \ \ \ \ \ \ \ \ \ std::tuple<Matrix<T>,\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}>\ roots\_tuple\ =\ roots.\mbox{\hyperlink{class_matrix_a2e570e590ed9c4cc887041d3b83363ce}{meshgrid}}(roots);}
\DoxyCodeLine{00114\ \ \ \ \ \ \ \ \ \ \ \ \ roots\_2d\_r\ =\ std::get<1>(roots\_tuple);}
\DoxyCodeLine{00115\ \ \ \ \ \ \ \ \ \ \ \ \ roots\_2d\_c\ =\ std::get<0>(roots\_tuple);}
\DoxyCodeLine{00116\ \ \ \ \ \ \ \ \ \ \ \ \ weights\_2d\ =\ weights.\mbox{\hyperlink{class_matrix_a93a24d7519f7158d4c6b50c92c6c2a0d}{outer}}(weights);}
\DoxyCodeLine{00117\ }
\DoxyCodeLine{00118\ \ \ \ \ \ \ \ \ \ \ \ \ gamma\ =\ roots;}
\DoxyCodeLine{00119\ \ \ \ \ \ \ \ \ \ \ \ \ gamma\_dot\ =\ roots;}
\DoxyCodeLine{00120\ \ \ \ \ \ \ \ \ \ \ \ \ gamma\_2d\ =\ roots\_2d\_r;}
\DoxyCodeLine{00121\ \ \ \ \ \ \ \ \ \ \ \ \ gamma\_dot\_2d\ =\ roots\_2d\_c;}
\DoxyCodeLine{00122\ }
\DoxyCodeLine{00123\ \ \ \ \ \ \ \ \ \ \ \ \ mu\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_a0bc7a1db6552e72fbc54b07b1e1635cd}{evaluate}}(surface.\mbox{\hyperlink{class_surface_ae49ebe885cb762b0f09e23edf6e902cc}{get\_mu\_coefficients}}(),\ gamma);}
\DoxyCodeLine{00124\ \ \ \ \ \ \ \ \ \ \ \ \ sigma\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_a0bc7a1db6552e72fbc54b07b1e1635cd}{evaluate}}(surface.\mbox{\hyperlink{class_surface_ad498873671c54f8adad50cf95cc75c40}{get\_sigma\_coefficients}}(),\ gamma);}
\DoxyCodeLine{00125\ \ \ \ \ \ \ \ \ \ \ \ \ mu\_2d\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_a0bc7a1db6552e72fbc54b07b1e1635cd}{evaluate}}(surface.\mbox{\hyperlink{class_surface_ae49ebe885cb762b0f09e23edf6e902cc}{get\_mu\_coefficients}}(),\ gamma\_2d);}
\DoxyCodeLine{00126\ \ \ \ \ \ \ \ \ \ \ \ \ sigma\_2d\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_a0bc7a1db6552e72fbc54b07b1e1635cd}{evaluate}}(surface.\mbox{\hyperlink{class_surface_ad498873671c54f8adad50cf95cc75c40}{get\_sigma\_coefficients}}(),\ gamma\_2d);}
\DoxyCodeLine{00127\ \ \ \ \ \ \ \ \ \ \ \ \ mu\_gamma\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_add73972f2cdeb4c1cb8f800978fe480c}{evaluate\_deriv}}(surface.\mbox{\hyperlink{class_surface_ae49ebe885cb762b0f09e23edf6e902cc}{get\_mu\_coefficients}}(),\ gamma);}
\DoxyCodeLine{00128\ \ \ \ \ \ \ \ \ \ \ \ \ sigma\_gamma\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_add73972f2cdeb4c1cb8f800978fe480c}{evaluate\_deriv}}(surface.\mbox{\hyperlink{class_surface_ad498873671c54f8adad50cf95cc75c40}{get\_sigma\_coefficients}}(),\ gamma);}
\DoxyCodeLine{00129\ \ \ \ \ \ \ \ \ \ \ \ \ mu\_gamma\_2d\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_add73972f2cdeb4c1cb8f800978fe480c}{evaluate\_deriv}}(surface.\mbox{\hyperlink{class_surface_ae49ebe885cb762b0f09e23edf6e902cc}{get\_mu\_coefficients}}(),\ gamma\_2d);}
\DoxyCodeLine{00130\ \ \ \ \ \ \ \ \ \ \ \ \ sigma\_gamma\_2d\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_add73972f2cdeb4c1cb8f800978fe480c}{evaluate\_deriv}}(surface.\mbox{\hyperlink{class_surface_ad498873671c54f8adad50cf95cc75c40}{get\_sigma\_coefficients}}(),\ gamma\_2d);}
\DoxyCodeLine{00131\ }
\DoxyCodeLine{00132\ \ \ \ \ \ \ \ \ \ \ \ \ p\_gamma\ =\ exp(gamma\ *\ gamma\ *\ (-\/1.0)\ /\ 2.0)\ *\ 1.0\ /\ std::sqrt(2.0\ *\ M\_PI);}
\DoxyCodeLine{00133\ \ \ \ \ \ \ \ \ \ \ \ \ p\_gamma\_2d\ =\ exp(gamma\_2d\ *\ gamma\_2d\ *\ (-\/1.0)\ /\ 2.0)\ *\ 1.0\ /\ std::sqrt(2.0\ *\ M\_PI);}
\DoxyCodeLine{00134\ \ \ \ \ \ \ \ \ \ \ \ \ p\_gamma\_dot\ =\ exp(gamma\_dot\ *\ gamma\_dot\ *\ (-\/1.0)\ *\ ac\_length\ *\ ac\_length\ /\ 4.0)\ *\ ac\_length\ /\ std::sqrt(4.0\ *\ M\_PI);}
\DoxyCodeLine{00135\ \ \ \ \ \ \ \ \ \ \ \ \ p\_gamma\_dot\_2d\ =\ exp(gamma\_dot\_2d\ *\ gamma\_dot\_2d\ *\ (-\/1.0)\ *\ ac\_length\ *\ ac\_length\ /\ 4.0)\ *\ ac\_length\ /\ std::sqrt(4.0\ *\ M\_PI);}
\DoxyCodeLine{00136\ }
\DoxyCodeLine{00137\ \ \ \ \ \ \ \ \ \ \ \ \ mu\_gas\ =\ gas.\mbox{\hyperlink{class_gas_a6bd15f51e80e57db68a0b8763b800fb7}{get\_molar\_mass}}();}
\DoxyCodeLine{00138\ \ \ \ \ \ \ \ \ \ \ \ \ T\_gas\ =\ gas.\mbox{\hyperlink{class_gas_aae9cf3b82b2eeb0b9ed96e2c973920cb}{get\_temperature}}();}
\DoxyCodeLine{00139\ }
\DoxyCodeLine{00140\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>local\_kernel\ =\ local\_kernel;}
\DoxyCodeLine{00141\ }
\DoxyCodeLine{00142\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>incident\_velocity\ =\ incident\_velocity;}
\DoxyCodeLine{00143\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>num\_particles\ =\ num\_particles;}
\DoxyCodeLine{00144\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>sim\_name\ =\ sim\_name;}
\DoxyCodeLine{00145\ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00146\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00147\ }
\DoxyCodeLine{00153\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_p_g___kernel_a9e56ddb8940aff75ba812b5bdb04f491}{\string~PG\_Kernel}}()\ \{}
\DoxyCodeLine{00154\ }
\DoxyCodeLine{00155\ \ \ \ \ \ \ \ \ \ \ \ \ int\_order\ =\ 0;}
\DoxyCodeLine{00156\ \ \ \ \ \ \ \ \ \ \ \ \ num\_particles\ =\ 0;}
\DoxyCodeLine{00157\ \ \ \ \ \ \ \ \ \ \ \ \ margin\ =\ 0.0;}
\DoxyCodeLine{00158\ \ \ \ \ \ \ \ \ \ \ \ \ ac\_length\ =\ 0.0;}
\DoxyCodeLine{00159\ \ \ \ \ \ \ \ \ \ \ \ \ mu\_gas\ =\ 0.0;}
\DoxyCodeLine{00160\ \ \ \ \ \ \ \ \ \ \ \ \ T\_gas\ =\ 0.0;}
\DoxyCodeLine{00161\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>local\_kernel\ =\ \textcolor{keyword}{nullptr};}
\DoxyCodeLine{00162\ }
\DoxyCodeLine{00163\ \ \ \ \ \ \ \ \ \}\ \ }
\DoxyCodeLine{00164\ }
\DoxyCodeLine{00170\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_gas}{Gas<T>}}\&\ \mbox{\hyperlink{class_p_g___kernel_ad7dca39d3f859df100f70ba0f7032690}{get\_gas}}()\ \{\textcolor{keywordflow}{return}\ this-\/>gas;\}}
\DoxyCodeLine{00171\ }
\DoxyCodeLine{00177\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_surface}{Surface<T>}}\&\ \mbox{\hyperlink{class_p_g___kernel_ac506eb3f92a95d6fde2be3ef28474a48}{get\_surface}}()\ \{\textcolor{keywordflow}{return}\ this-\/>surface;\}}
\DoxyCodeLine{00178\ }
\DoxyCodeLine{00189\ \ \ \ \ \ \ \ \ T\ \mbox{\hyperlink{class_p_g___kernel_a830430d617d6b572d7b980a839e74c9b}{random\_sampler\_1D}}(T\ (\mbox{\hyperlink{class_p_g___kernel}{PG\_Kernel}}::*pdf)(T,\ std::vector<T>),\ std::vector<T>\ parameters,\ T\ x0,\ T\ size,\ T\ domain\_x[]);}
\DoxyCodeLine{00190\ }
\DoxyCodeLine{00204\ \ \ \ \ \ \ \ \ std::tuple<T,\ T>\ \mbox{\hyperlink{class_p_g___kernel_ac172804eafcceacb8535bacadde04b36}{random\_sampler\_2D}}(T\ (\mbox{\hyperlink{class_p_g___kernel}{PG\_Kernel}}::*pdf)(T,\ T,\ std::vector<T>),\ std::vector<T>\ parameters,\ T\ x0,\ T\ y0,\ T\ size\_x,\ T\ size\_y,\ T\ domain\_x[],\ T\ domain\_y[]);}
\DoxyCodeLine{00205\ }
\DoxyCodeLine{00219\ \ \ \ \ \ \ \ \ std::tuple<T,\ T>\ \mbox{\hyperlink{class_p_g___kernel_a6d32fe0d3b3b9e27284baf3674b6d0d9}{random\_sampler\_angles}}(T\ (\mbox{\hyperlink{class_p_g___kernel}{PG\_Kernel}}::*pdf)(T,\ T,\ std::vector<T>),\ std::vector<T>\ parameters,\ T\ x0,\ T\ y0,\ T\ size\_x,\ T\ size\_y,\ T\ domain\_x[],\ T\ domain\_y[]);}
\DoxyCodeLine{00220\ }
\DoxyCodeLine{00229\ \ \ \ \ \ \ \ \ T\ \mbox{\hyperlink{class_p_g___kernel_a484eadba3fd6f0093e0368715db490a7}{mixture\_pdf}}(T\ gamma,\ T\ gamma\_dot,\ std::vector<T>\ parameters);\ }
\DoxyCodeLine{00230\ }
\DoxyCodeLine{00239\ \ \ \ \ \ \ \ \ T\ \mbox{\hyperlink{class_p_g___kernel_ac52c90dbf2a4a04da725040557647cf4}{kirchhoff\_pdf}}(T\ theta\_r1,\ T\ theta\_r2,\ std::vector<T>\ parameters);}
\DoxyCodeLine{00240\ }
\DoxyCodeLine{00249\ \ \ \ \ \ \ \ \ T\ \mbox{\hyperlink{class_p_g___kernel_a73a86278a501f9b8159eccdf61976fba}{shadow}}(T\ theta\_r1,\ T\ height,\ \textcolor{keywordtype}{int}\ direction);}
\DoxyCodeLine{00250\ }
\DoxyCodeLine{00260\ \ \ \ \ \ \ \ \ T\ \mbox{\hyperlink{class_p_g___kernel_a8478689be7f623b43ed44a8ec78b6bfb}{occlusion}}(T\ theta\_r1,\ T\ height,\ T\ distance,\ \textcolor{keywordtype}{int}\ direction);}
\DoxyCodeLine{00261\ }
\DoxyCodeLine{00269\ \ \ \ \ \ \ \ \ T\ \mbox{\hyperlink{class_p_g___kernel_aa1515ed1da4367fa15c2ca383e84512e}{height\_0\_pdf}}(T\ height\_0,\ std::vector<T>\ parameters);}
\DoxyCodeLine{00270\ }
\DoxyCodeLine{00278\ \ \ \ \ \ \ \ \ T\ \mbox{\hyperlink{class_p_g___kernel_a1b94000c5d48cc5a8a00b080de679095}{distance\_pdf}}(T\ distance,\ std::vector<T>\ parameters);}
\DoxyCodeLine{00279\ }
\DoxyCodeLine{00289\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ \mbox{\hyperlink{class_p_g___kernel_ab0eac7ed14d09f00e969b0b275996806}{global\_to\_local}}(\mbox{\hyperlink{class_matrix}{Matrix<T>}}\ global\_vector,\ T\ theta\_i,\ T\ theta\_r1,\ T\ theta\_r2);}
\DoxyCodeLine{00290\ }
\DoxyCodeLine{00300\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ \mbox{\hyperlink{class_p_g___kernel_a5b3eac0f0d9be8008a9685582adcb5e3}{local\_to\_global}}(\mbox{\hyperlink{class_matrix}{Matrix<T>}}\ local\_vector,\ T\ theta\_i,\ T\ theta\_r1,\ T\ theta\_r2);}
\DoxyCodeLine{00301\ }
\DoxyCodeLine{00310\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ \mbox{\hyperlink{class_p_g___kernel_a606de8649b67946d749e55b867d5e3c4}{angles\_to\_slopes}}(T\ theta\_i,\ T\ theta\_r1,\ T\ theta\_r2);}
\DoxyCodeLine{00311\ }
\DoxyCodeLine{00317\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{structtrajectory}{trajectory<T>}}\ \mbox{\hyperlink{class_p_g___kernel_a0fddecf7d991d5593d31a18f9817a727}{sample\_particle}}();}
\DoxyCodeLine{00318\ }
\DoxyCodeLine{00324\ \ \ \ \ \ \ \ \ std::vector<trajectory<T>>\ \mbox{\hyperlink{class_p_g___kernel_ab5ae1e66209c1a2cd2251d2c95c77994}{sample\_batch}}();}
\DoxyCodeLine{00325\ }
\DoxyCodeLine{00332\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_p_g___kernel_a4328bc06dde45b6abe1046fa8ac0f2aa}{save}}(std::vector<\mbox{\hyperlink{structtrajectory}{trajectory<T>}}>\ trajectories,\ std::string\ filename);}
\DoxyCodeLine{00333\ }
\DoxyCodeLine{00340\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_p_g___kernel_afffaa46fbc8a069857243c5db7159a38}{combine\_files}}(std::string\ filename,\ \textcolor{keywordtype}{int}\ num\_procs);}
\DoxyCodeLine{00341\ }
\DoxyCodeLine{00347\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_p_g___kernel_a18705acb07a38d39fc28bfb53f5e3346}{set\_num\_particles}}(\textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{long}\ num\_particles)\ \{this-\/>num\_particles\ =\ num\_particles;\}}
\DoxyCodeLine{00348\ }
\DoxyCodeLine{00355\ \ \ \ \ \ \ \ \ std::vector<trajectory<T>>\ \mbox{\hyperlink{class_p_g___kernel_a463e12da151ed7f37ba3c42ac75307a7}{import\_data}}(std::string\ filename);}
\DoxyCodeLine{00356\ }
\DoxyCodeLine{00362\ \ \ \ \ \ \ \ \ std::string\&\ \mbox{\hyperlink{class_p_g___kernel_a610798f60550f377858b8cddb372496c}{get\_sim\_name}}()\ \{\textcolor{keywordflow}{return}\ sim\_name;\}}
\DoxyCodeLine{00363\ }
\DoxyCodeLine{00369\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{long}\ \mbox{\hyperlink{class_p_g___kernel_a1d5521b8b9012ac1230f0997065c841f}{get\_num\_particles}}()\ \{\textcolor{keywordflow}{return}\ num\_particles;\}}
\DoxyCodeLine{00370\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00371\ }
\DoxyCodeLine{00372\ \};}
\DoxyCodeLine{00373\ }
\DoxyCodeLine{00374\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00375\ T\ \mbox{\hyperlink{class_p_g___kernel_a830430d617d6b572d7b980a839e74c9b}{PG\_Kernel<T>::random\_sampler\_1D}}(T\ (\mbox{\hyperlink{class_p_g___kernel}{PG\_Kernel}}::*pdf)(T,\ std::vector<T>),\ std::vector<T>\ parameters,\ T\ x0,\ T\ size,\ T\ domain\_x[])\ \{}
\DoxyCodeLine{00376\ }
\DoxyCodeLine{00377\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{long}\ steps\ =\ 100;}
\DoxyCodeLine{00378\ }
\DoxyCodeLine{00379\ \ \ \ \ T\ x\ =\ x0,\ x\_p\ =\ 0.0,\ acceptance\ =\ 0.0;}
\DoxyCodeLine{00380\ }
\DoxyCodeLine{00381\ \ \ \ \ std::random\_device\ rd;}
\DoxyCodeLine{00382\ \ \ \ \ std::seed\_seq\ fullSeed\{rd(),\ rd(),\ rd(),\ rd(),\ rd(),\ rd(),\ rd(),\ rd(),\ rd(),\ rd()\};}
\DoxyCodeLine{00383\ \ \ \ \ std::mt19937\ rng(fullSeed);}
\DoxyCodeLine{00384\ \ \ \ \ std::uniform\_real\_distribution<T>\ uniformDist(0.0f,\ 1.0f);}
\DoxyCodeLine{00385\ \ \ \ \ std::normal\_distribution<T>\ normDist(0.0f,\ 1.0f);}
\DoxyCodeLine{00386\ }
\DoxyCodeLine{00387\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keyword}{auto}\ i\ =\ 0;\ i\ <\ steps;\ i\ ++)\ \{}
\DoxyCodeLine{00388\ }
\DoxyCodeLine{00389\ \ \ \ \ \ \ \ \ T\ step\ =\ normDist(rng)\ *\ size;}
\DoxyCodeLine{00390\ \ \ \ \ \ \ \ \ T\ u\_sample\ =\ uniformDist(rng);}
\DoxyCodeLine{00391\ \ \ \ \ \ \ \ \ x\_p\ =\ x\ +\ step;}
\DoxyCodeLine{00392\ \ \ \ \ \ \ \ \ acceptance\ =\ 0.0;}
\DoxyCodeLine{00393\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(x\_p\ >=\ domain\_x[0]\ \&\&\ x\_p\ <=\ domain\_x[1])\ \{}
\DoxyCodeLine{00394\ \ \ \ \ \ \ \ \ \ \ \ \ acceptance\ =\ std::min(1.0,\ (this-\/>*pdf)(x\_p,\ parameters)\ /\ (this-\/>*pdf)(x,\ parameters));}
\DoxyCodeLine{00395\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00396\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(acceptance\ >\ u\_sample)\ \{}
\DoxyCodeLine{00397\ \ \ \ \ \ \ \ \ \ \ \ \ x\ =\ x\_p;}
\DoxyCodeLine{00398\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00399\ \ \ \ \ \}}
\DoxyCodeLine{00400\ }
\DoxyCodeLine{00401\ \ \ \ \ \textcolor{keywordflow}{return}\ x;}
\DoxyCodeLine{00402\ \}}
\DoxyCodeLine{00403\ }
\DoxyCodeLine{00404\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00405\ std::tuple<T,\ T>\ \mbox{\hyperlink{class_p_g___kernel_ac172804eafcceacb8535bacadde04b36}{PG\_Kernel<T>::random\_sampler\_2D}}(T\ (\mbox{\hyperlink{class_p_g___kernel}{PG\_Kernel}}::*pdf)(T,\ T,\ std::vector<T>),\ std::vector<T>\ parameters,\ T\ x0,\ T\ y0,\ T\ size\_x,\ T\ size\_y,\ T\ domain\_x[],\ T\ domain\_y[])\ \{}
\DoxyCodeLine{00406\ }
\DoxyCodeLine{00407\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{long}\ steps\ =\ 100;}
\DoxyCodeLine{00408\ }
\DoxyCodeLine{00409\ \ \ \ \ T\ x\ =\ x0,\ x\_p,\ y\_p;}
\DoxyCodeLine{00410\ \ \ \ \ T\ y\ =\ y0;}
\DoxyCodeLine{00411\ \ \ \ \ T\ acceptance\ =\ 0.0;}
\DoxyCodeLine{00412\ }
\DoxyCodeLine{00413\ \ \ \ \ std::random\_device\ rd;}
\DoxyCodeLine{00414\ \ \ \ \ std::seed\_seq\ fullSeed\{rd(),\ rd(),\ rd(),\ rd(),\ rd(),\ rd(),\ rd(),\ rd(),\ rd(),\ rd()\};}
\DoxyCodeLine{00415\ \ \ \ \ std::mt19937\ rng(fullSeed);}
\DoxyCodeLine{00416\ \ \ \ \ std::uniform\_real\_distribution<T>\ uniformDist(0.0f,\ 1.0f);}
\DoxyCodeLine{00417\ \ \ \ \ std::normal\_distribution<T>\ normDist(0.0f,\ 1.0f);}
\DoxyCodeLine{00418\ }
\DoxyCodeLine{00419\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keyword}{auto}\ i\ =\ 0;\ i\ <\ steps;\ i\ ++)\ \{}
\DoxyCodeLine{00420\ }
\DoxyCodeLine{00421\ \ \ \ \ \ \ \ \ T\ step\_x\ =\ normDist(rng)\ *\ size\_x;}
\DoxyCodeLine{00422\ \ \ \ \ \ \ \ \ T\ step\_y\ =\ normDist(rng)\ *\ size\_y;}
\DoxyCodeLine{00423\ \ \ \ \ \ \ \ \ T\ u\_sample\ =\ uniformDist(rng);}
\DoxyCodeLine{00424\ \ \ \ \ \ \ \ \ x\_p\ =\ x\ +\ step\_x;}
\DoxyCodeLine{00425\ \ \ \ \ \ \ \ \ y\_p\ =\ y\ +\ step\_y;}
\DoxyCodeLine{00426\ \ \ \ \ \ \ \ \ acceptance\ =\ 0.0;}
\DoxyCodeLine{00427\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(x\_p\ >=\ domain\_x[0]\ \&\&\ x\_p\ <=\ domain\_x[1]\ \&\&\ y\_p\ >=\ domain\_y[0]\ \&\&\ y\_p\ <=\ domain\_y[1])\ \{}
\DoxyCodeLine{00428\ \ \ \ \ \ \ \ \ \ \ \ \ acceptance\ =\ std::min(1.0,\ (this-\/>*pdf)(x\_p,\ y\_p,\ parameters)\ /\ (this-\/>*pdf)(x,\ y,\ parameters));}
\DoxyCodeLine{00429\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00430\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(acceptance\ >\ u\_sample)\ \{}
\DoxyCodeLine{00431\ \ \ \ \ \ \ \ \ \ \ \ \ x\ =\ x\_p;}
\DoxyCodeLine{00432\ \ \ \ \ \ \ \ \ \ \ \ \ y\ =\ y\_p;}
\DoxyCodeLine{00433\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00434\ \ \ \ \ \}}
\DoxyCodeLine{00435\ }
\DoxyCodeLine{00436\ \ \ \ \ \textcolor{keywordflow}{return}\ std::make\_tuple(x,\ y);}
\DoxyCodeLine{00437\ \}}
\DoxyCodeLine{00438\ }
\DoxyCodeLine{00439\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00440\ std::tuple<T,\ T>\ \mbox{\hyperlink{class_p_g___kernel_a6d32fe0d3b3b9e27284baf3674b6d0d9}{PG\_Kernel<T>::random\_sampler\_angles}}(T\ (\mbox{\hyperlink{class_p_g___kernel}{PG\_Kernel}}::*pdf)(T,\ T,\ std::vector<T>),\ std::vector<T>\ parameters,\ T\ theta\_r1,\ T\ theta\_r2,\ T\ size\_x,\ T\ size\_y,\ T\ domain\_x[],\ T\ domain\_y[])\ \{}
\DoxyCodeLine{00441\ }
\DoxyCodeLine{00442\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{long}\ steps\ =\ 100;}
\DoxyCodeLine{00443\ }
\DoxyCodeLine{00444\ \ \ \ \ std::random\_device\ rd;}
\DoxyCodeLine{00445\ \ \ \ \ std::seed\_seq\ fullSeed\{rd(),\ rd(),\ rd(),\ rd(),\ rd(),\ rd(),\ rd(),\ rd(),\ rd(),\ rd()\};}
\DoxyCodeLine{00446\ \ \ \ \ std::mt19937\ rng(fullSeed);}
\DoxyCodeLine{00447\ \ \ \ \ std::uniform\_real\_distribution<T>\ uniformDist(0.0f,\ 1.0f);}
\DoxyCodeLine{00448\ \ \ \ \ std::normal\_distribution<T>\ normDist(0.0f,\ 1.0f);}
\DoxyCodeLine{00449\ }
\DoxyCodeLine{00450\ \ \ \ \ T\ acceptance\ =\ 0.0;}
\DoxyCodeLine{00451\ }
\DoxyCodeLine{00452\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keyword}{auto}\ i\ =\ 0;\ i\ <\ steps;\ i\ ++)\ \{}
\DoxyCodeLine{00453\ }
\DoxyCodeLine{00454\ \ \ \ \ \ \ \ \ T\ step\_x\ =\ normDist(rng)\ *\ size\_x;}
\DoxyCodeLine{00455\ \ \ \ \ \ \ \ \ T\ step\_y\ =\ normDist(rng)\ *\ size\_y;}
\DoxyCodeLine{00456\ \ \ \ \ \ \ \ \ T\ u\_sample\ =\ uniformDist(rng);}
\DoxyCodeLine{00457\ \ \ \ \ \ \ \ \ T\ theta\_r1\_p\ =\ theta\_r1\ +\ step\_x;}
\DoxyCodeLine{00458\ \ \ \ \ \ \ \ \ T\ theta\_r2\_p\ =\ theta\_r2\ +\ step\_y;}
\DoxyCodeLine{00459\ \ \ \ \ \ \ \ \ acceptance\ =\ 0.0;}
\DoxyCodeLine{00460\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(theta\_r1\_p\ <\ 0.0)\ \{}
\DoxyCodeLine{00461\ \ \ \ \ \ \ \ \ \ \ \ \ theta\_r1\_p\ =\ std::abs(theta\_r1\_p);}
\DoxyCodeLine{00462\ \ \ \ \ \ \ \ \ \ \ \ \ theta\_r2\_p\ +=\ M\_PI;}
\DoxyCodeLine{00463\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00464\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(theta\_r2\_p\ <\ 0.0)\ \{}
\DoxyCodeLine{00465\ \ \ \ \ \ \ \ \ \ \ \ \ theta\_r2\_p\ +=\ 2.0\ *\ M\_PI;}
\DoxyCodeLine{00466\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00467\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(theta\_r2\_p\ >\ 2.0\ *\ M\_PI)\ \{}
\DoxyCodeLine{00468\ \ \ \ \ \ \ \ \ \ \ \ \ theta\_r2\_p\ -\/=\ 2.0\ *\ M\_PI;}
\DoxyCodeLine{00469\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00470\ }
\DoxyCodeLine{00471\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(theta\_r1\_p\ <\ domain\_x[1])\ \{}
\DoxyCodeLine{00472\ \ \ \ \ \ \ \ \ \ \ \ \ acceptance\ =\ std::min(1.0,\ (this-\/>*pdf)(theta\_r1\_p,\ theta\_r2\_p,\ parameters)\ /\ (this-\/>*pdf)(theta\_r1,\ theta\_r2,\ parameters));}
\DoxyCodeLine{00473\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00474\ }
\DoxyCodeLine{00475\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(acceptance\ >\ u\_sample)\ \{}
\DoxyCodeLine{00476\ \ \ \ \ \ \ \ \ \ \ \ \ theta\_r1\ =\ theta\_r1\_p;}
\DoxyCodeLine{00477\ \ \ \ \ \ \ \ \ \ \ \ \ theta\_r2\ =\ theta\_r2\_p;}
\DoxyCodeLine{00478\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00479\ \ \ \ \ \}}
\DoxyCodeLine{00480\ }
\DoxyCodeLine{00481\ \ \ \ \ \textcolor{keywordflow}{return}\ std::make\_tuple(theta\_r1,\ theta\_r2);}
\DoxyCodeLine{00482\ \}}
\DoxyCodeLine{00483\ }
\DoxyCodeLine{00484\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00485\ T\ \mbox{\hyperlink{class_p_g___kernel_a484eadba3fd6f0093e0368715db490a7}{PG\_Kernel<T>::mixture\_pdf}}(T\ gamma\_local,\ T\ gamma\_dot\_local,\ std::vector<T>\ parameters)\ \{}
\DoxyCodeLine{00486\ }
\DoxyCodeLine{00487\ \ \ \ \ \textcolor{keywordtype}{bool}\ first\ =\ (bool)parameters[0];}
\DoxyCodeLine{00488\ \ \ \ \ T\ theta\_i\ =\ parameters[1];}
\DoxyCodeLine{00489\ \ \ \ \ T\ distance\ =\ parameters[2];}
\DoxyCodeLine{00490\ }
\DoxyCodeLine{00491\ \ \ \ \ T\ mu\_local\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_a0bc7a1db6552e72fbc54b07b1e1635cd}{evaluate}}(surface.\mbox{\hyperlink{class_surface_ae49ebe885cb762b0f09e23edf6e902cc}{get\_mu\_coefficients}}(),\ gamma\_local);}
\DoxyCodeLine{00492\ \ \ \ \ T\ mu\_dot\_local\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_add73972f2cdeb4c1cb8f800978fe480c}{evaluate\_deriv}}(surface.\mbox{\hyperlink{class_surface_ae49ebe885cb762b0f09e23edf6e902cc}{get\_mu\_coefficients}}(),\ gamma\_local)\ *\ gamma\_dot\_local;}
\DoxyCodeLine{00493\ \ \ \ \ T\ sigma\_local\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_a0bc7a1db6552e72fbc54b07b1e1635cd}{evaluate}}(surface.\mbox{\hyperlink{class_surface_ad498873671c54f8adad50cf95cc75c40}{get\_sigma\_coefficients}}(),\ gamma\_local);}
\DoxyCodeLine{00494\ \ \ \ \ T\ sigma\_gamma\_local\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_add73972f2cdeb4c1cb8f800978fe480c}{evaluate\_deriv}}(surface.\mbox{\hyperlink{class_surface_ad498873671c54f8adad50cf95cc75c40}{get\_sigma\_coefficients}}(),\ gamma\_local);}
\DoxyCodeLine{00495\ }
\DoxyCodeLine{00496\ \ \ \ \ T\ w\ =\ std::sqrt(2.0\ *\ (sigma\_local\ *\ sigma\_local\ /\ ac\_length\ /\ ac\_length)\ +\ sigma\_gamma\_local\ *\ sigma\_gamma\_local\ *\ gamma\_dot\_local\ *\ gamma\_dot\_local);}
\DoxyCodeLine{00497\ \ \ \ \ T\ eta\ =\ 1.0\ /\ std::tan(theta\_i);}
\DoxyCodeLine{00498\ \ \ \ \ T\ slope\_term\ =\ 0.5\ *\ (1.0\ +\ std::erf((eta\ +\ mu\_dot\_local)\ /\ (w\ *\ std::sqrt(2.0))))\ *\ (std::cos(theta\_i)\ +\ mu\_dot\_local\ *\ std::sin(theta\_i))\ +\ }
\DoxyCodeLine{00499\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ w\ *\ std::sin(theta\_i)\ /\ std::sqrt(2.0\ *\ M\_PI)\ *\ std::exp(-\/\ (eta\ +\ mu\_dot\_local)\ *\ (eta\ +\ mu\_dot\_local)\ /\ 2.0\ /\ w\ /\ w);}
\DoxyCodeLine{00500\ \ \ \ \ T\ p\_gamma\_local\ =\ 1.0\ /\ std::sqrt(2.0\ *\ M\_PI)\ *\ std::exp(\ -\/\ gamma\_local\ *\ gamma\_local\ /\ 2.0);}
\DoxyCodeLine{00501\ \ \ \ \ T\ p\_gamma\_dot\_local\ =\ ac\_length\ /\ std::sqrt(4.0\ *\ M\_PI)\ *\ std::exp(-\/\ gamma\_dot\_local\ *\ gamma\_dot\_local\ *\ ac\_length\ *\ ac\_length\ /\ 4.0);}
\DoxyCodeLine{00502\ }
\DoxyCodeLine{00503\ \ \ \ \ \textcolor{keywordflow}{if}(first)\ \{}
\DoxyCodeLine{00504\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ p\_gamma\_local\ *\ p\_gamma\_dot\_local\ *\ slope\_term\ *\ shadow(theta\_i,\ mu\_local,\ -\/1);}
\DoxyCodeLine{00505\ \ \ \ \ \}}
\DoxyCodeLine{00506\ \ \ \ \ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00507\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ p\_gamma\_local\ *\ p\_gamma\_dot\_local\ *\ slope\_term\ *\ occlusion(theta\_i,\ mu\_local,\ distance,\ -\/1);}
\DoxyCodeLine{00508\ \ \ \ \ \}}
\DoxyCodeLine{00509\ }
\DoxyCodeLine{00510\ \}}
\DoxyCodeLine{00511\ }
\DoxyCodeLine{00512\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00513\ T\ \mbox{\hyperlink{class_p_g___kernel_ac52c90dbf2a4a04da725040557647cf4}{PG\_Kernel<T>::kirchhoff\_pdf}}(T\ theta\_r1,\ T\ theta\_r2,\ std::vector<T>\ parameters)\ \{}
\DoxyCodeLine{00514\ }
\DoxyCodeLine{00515\ \ \ \ \ T\ theta\_i\ =\ parameters[0];}
\DoxyCodeLine{00516\ \ \ \ \ T\ gamma\ =\ parameters[1];}
\DoxyCodeLine{00517\ \ \ \ \ T\ gamma\_dot\_x\ =\ parameters[2];}
\DoxyCodeLine{00518\ \ \ \ \ T\ gamma\_dot\_y\ =\ parameters[3];}
\DoxyCodeLine{00519\ \ \ \ \ T\ slope\_x\ =\ parameters[4];}
\DoxyCodeLine{00520\ \ \ \ \ T\ slope\_y\ =\ parameters[5];}
\DoxyCodeLine{00521\ \ \ \ \ T\ tau\ =\ parameters[6];}
\DoxyCodeLine{00522\ }
\DoxyCodeLine{00523\ \ \ \ \ T\ C\ =\ std::exp(-\/\ tau\ *\ tau\ /\ ac\_length\ /\ ac\_length);}
\DoxyCodeLine{00524\ }
\DoxyCodeLine{00525\ \ \ \ \ T\ mu\_gamma\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_add73972f2cdeb4c1cb8f800978fe480c}{evaluate\_deriv}}(surface.\mbox{\hyperlink{class_surface_ae49ebe885cb762b0f09e23edf6e902cc}{get\_mu\_coefficients}}(),\ gamma);}
\DoxyCodeLine{00526\ \ \ \ \ T\ sigma\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_a0bc7a1db6552e72fbc54b07b1e1635cd}{evaluate}}(surface.\mbox{\hyperlink{class_surface_ad498873671c54f8adad50cf95cc75c40}{get\_sigma\_coefficients}}(),\ gamma);}
\DoxyCodeLine{00527\ \ \ \ \ T\ sigma\_gamma\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_add73972f2cdeb4c1cb8f800978fe480c}{evaluate\_deriv}}(surface.\mbox{\hyperlink{class_surface_ad498873671c54f8adad50cf95cc75c40}{get\_sigma\_coefficients}}(),\ gamma);}
\DoxyCodeLine{00528\ }
\DoxyCodeLine{00529\ \ \ \ \ T\ mu\_kirchhoff\_x\ =\ mu\_gamma\ *\ gamma\_dot\_x;}
\DoxyCodeLine{00530\ \ \ \ \ T\ mu\_kirchhoff\_y\ =\ mu\_gamma\ *\ gamma\_dot\_y;}
\DoxyCodeLine{00531\ }
\DoxyCodeLine{00532\ \ \ \ \ T\ vx\ =\ std::sin(theta\_i)\ -\/\ std::sin(theta\_r1)\ *\ std::cos(theta\_r2);}
\DoxyCodeLine{00533\ \ \ \ \ T\ vy\ =\ -\/\ std::sin(theta\_r1)\ *\ std::sin(theta\_r2);}
\DoxyCodeLine{00534\ \ \ \ \ T\ vz\ =\ -\/\ std::cos(theta\_i)\ -\/\ std::cos(theta\_r1);}
\DoxyCodeLine{00535\ }
\DoxyCodeLine{00536\ \ \ \ \ T\ F\ =\ (1.0\ +\ std::cos(theta\_i)\ *\ std::cos(theta\_r1)\ -\/\ std::sin(theta\_i)\ *\ std::sin(theta\_r1)\ *\ std::cos(theta\_r2))\ /\ }
\DoxyCodeLine{00537\ \ \ \ \ \ \ \ \ \ \ \ \ (std::cos(theta\_i)\ *\ std::cos(theta\_i)\ +\ std::cos(theta\_r1)\ *\ std::cos(theta\_i));}
\DoxyCodeLine{00538\ }
\DoxyCodeLine{00539\ \ \ \ \ T\ sigma\_kirchhoff\_x\ =\ std::sqrt((sigma\ *\ sigma\ /\ ac\_length\ /\ ac\_length)\ +\ 0.5\ *\ sigma\_gamma\ *\ sigma\_gamma\ *\ gamma\_dot\_x\ *\ gamma\_dot\_x);}
\DoxyCodeLine{00540\ \ \ \ \ T\ sigma\_kirchhoff\_y\ =\ std::sqrt((sigma\ *\ sigma\ /\ ac\_length\ /\ ac\_length)\ +\ 0.5\ *\ sigma\_gamma\ *\ sigma\_gamma\ *\ gamma\_dot\_y\ *\ gamma\_dot\_y);}
\DoxyCodeLine{00541\ }
\DoxyCodeLine{00542\ \ \ \ \ T\ vx\_k\ =\ (vx\ +\ mu\_kirchhoff\_x\ *\ vz);}
\DoxyCodeLine{00543\ \ \ \ \ T\ vy\_k\ =\ (vy\ +\ mu\_kirchhoff\_y\ *\ vz);}
\DoxyCodeLine{00544\ }
\DoxyCodeLine{00545\ \ \ \ \ T\ p\_kirchhoff\_x\ =\ std::sqrt(2.0\ *\ M\_PI)\ *\ F\ /\ vz\ /\ std::sqrt(1.0\ -\/\ C\ *\ C)\ *\ }
\DoxyCodeLine{00546\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::exp(-\/\ (vx\_k\ *\ vx\_k\ -\/\ 2.0\ *\ C\ *\ vx\_k\ *\ (slope\_x\ -\/\ mu\_kirchhoff\_x)\ *\ vz\ +\ vz\ *\ vz\ *\ (slope\_x\ -\/\ mu\_kirchhoff\_x)\ *\ (slope\_x\ -\/\ mu\_kirchhoff\_x))}
\DoxyCodeLine{00547\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ /\ (4.0\ *\ vz\ *\ vz\ *\ sigma\_kirchhoff\_x\ *\ sigma\_kirchhoff\_x\ *\ (1.0\ -\/\ C\ *\ C)));}
\DoxyCodeLine{00548\ \ \ \ \ T\ p\_kirchhoff\_y\ =\ std::sqrt(2.0\ *\ M\_PI)\ *\ F\ /\ vz\ /\ std::sqrt(1.0\ -\/\ C\ *\ C)\ *\ }
\DoxyCodeLine{00549\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::exp(-\/\ (vy\_k\ *\ vy\_k\ -\/\ 2.0\ *\ C\ *\ vy\_k\ *\ (slope\_y\ -\/\ mu\_kirchhoff\_y)\ *\ vz\ +\ vz\ *\ vz\ *\ (slope\_y\ -\/\ mu\_kirchhoff\_y)\ *\ (slope\_y\ -\/\ mu\_kirchhoff\_y))}
\DoxyCodeLine{00550\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ /\ (4.0\ *\ vz\ *\ vz\ *\ sigma\_kirchhoff\_y\ *\ sigma\_kirchhoff\_y\ *\ (1.0\ -\/\ C\ *\ C)));}
\DoxyCodeLine{00551\ }
\DoxyCodeLine{00552\ \ \ \ \ \textcolor{keywordflow}{return}\ p\_kirchhoff\_x\ *\ p\_kirchhoff\_y\ *\ std::sin(theta\_r1);}
\DoxyCodeLine{00553\ \}}
\DoxyCodeLine{00554\ }
\DoxyCodeLine{00555\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00556\ T\ \mbox{\hyperlink{class_p_g___kernel_a73a86278a501f9b8159eccdf61976fba}{PG\_Kernel<T>::shadow}}(T\ theta\_r1,\ T\ height,\ \textcolor{keywordtype}{int}\ direction)\ \{}
\DoxyCodeLine{00557\ }
\DoxyCodeLine{00558\ \ \ \ \ \textcolor{comment}{//\ Check\ if\ theta\_r1\ is\ greater\ than\ 90\ degrees}}
\DoxyCodeLine{00559\ \ \ \ \ \textcolor{keywordflow}{if}(theta\_r1\ >\ M\_PI\ /\ 2.0)\ \{}
\DoxyCodeLine{00560\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 0.0;}
\DoxyCodeLine{00561\ \ \ \ \ \}}
\DoxyCodeLine{00562\ \ \ \ \ T\ EPSILON\ =\ 1e-\/15;}
\DoxyCodeLine{00563\ \ \ \ \ theta\_r1\ =\ std::max(EPSILON,\ theta\_r1);}
\DoxyCodeLine{00564\ \ \ \ \ T\ eta\ =\ 1.0\ /\ std::tan(theta\_r1);}
\DoxyCodeLine{00565\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ w\_2d\ =\ (sigma\_2d\ *\ sigma\_2d\ /\ ac\_length\ /\ ac\_length\ *\ 2.0\ +\ sigma\_gamma\_2d\ *\ sigma\_gamma\_2d\ *\ gamma\_dot\_2d\ *\ gamma\_dot\_2d)\ \string^\ 0.5;}
\DoxyCodeLine{00566\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ Delta\ =\ (w\_2d\ /\ std::sqrt(2.0\ *\ M\_PI)\ *\ exp(((mu\_gamma\_2d\ *\ gamma\_dot\_2d\ *\ (-\/1.0)\ *\ direction\ +\ eta)\ \string^\ 2.0)\ /\ ((w\_2d\ *\ w\_2d)\ *\ 2.0)\ *\ (-\/1.0))\ -\/\ }
\DoxyCodeLine{00567\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (mu\_gamma\_2d\ *\ gamma\_dot\_2d\ *\ (-\/1.0)\ *\ direction\ +\ eta)\ *\ 0.5\ *\ (erfc((mu\_gamma\_2d\ *\ gamma\_dot\_2d\ *\ (-\/1.0)\ *\ direction\ +\ eta)\ /\ (w\_2d\ *\ std::sqrt(2.0)))));}
\DoxyCodeLine{00568\ \ \ \ \ T\ exponent\ =\ sum(weights\_2d\ *\ p\_gamma\_2d\ *\ p\_gamma\_dot\_2d\ *\ Delta)\ /\ eta;}
\DoxyCodeLine{00569\ \ \ \ \ T\ base\ =\ sum(weights\_2d\ *\ p\_gamma\_2d\ *\ p\_gamma\_dot\_2d\ *\ 0.5\ *\ (erfc((mu\_2d\ *\ (-\/1.0)\ +\ height)\ /\ (sigma\_2d\ *\ std::sqrt(2.0)))\ *\ (-\/1.0)\ +\ 2.0));}
\DoxyCodeLine{00570\ \ \ \ \ base\ =\ std::min(1.0,\ base);}
\DoxyCodeLine{00571\ \ \ \ \ \textcolor{keywordflow}{return}\ std::pow(base,\ exponent);}
\DoxyCodeLine{00572\ \}}
\DoxyCodeLine{00573\ }
\DoxyCodeLine{00574\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00575\ T\ \mbox{\hyperlink{class_p_g___kernel_a8478689be7f623b43ed44a8ec78b6bfb}{PG\_Kernel<T>::occlusion}}(T\ theta\_r1,\ T\ height,\ T\ distance,\ \textcolor{keywordtype}{int}\ direction)\ \{}
\DoxyCodeLine{00576\ }
\DoxyCodeLine{00577\ \ \ \ \ theta\_r1\ =\ std::max(1e-\/12,\ theta\_r1);}
\DoxyCodeLine{00578\ \ \ \ \ T\ eta\ =\ 1.0\ /\ std::tan(theta\_r1);}
\DoxyCodeLine{00579\ \ \ \ \ T\ height\_new\ =\ height\ +\ distance\ *\ eta;}
\DoxyCodeLine{00580\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ w\_2d\ =\ (sigma\_2d\ *\ sigma\_2d\ /\ ac\_length\ /\ ac\_length\ *\ 2.0\ +\ sigma\_gamma\_2d\ *\ sigma\_gamma\_2d\ *\ gamma\_dot\_2d\ *\ gamma\_dot\_2d)\ \string^\ 0.5;}
\DoxyCodeLine{00581\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ Delta\ =\ (w\_2d\ /\ std::sqrt(2.0\ *\ M\_PI)\ *\ exp(((mu\_gamma\_2d\ *\ gamma\_dot\_2d\ *\ (-\/1.0)\ +\ eta)\ \string^\ 2.0)\ /\ ((w\_2d\ *\ w\_2d)\ *\ 2.0)\ *\ (-\/1.0))\ -\/\ }
\DoxyCodeLine{00582\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (mu\_gamma\_2d\ *\ gamma\_dot\_2d\ *\ (-\/1.0)\ +\ eta)\ *\ 0.5\ *\ (erfc((mu\_gamma\_2d\ *\ gamma\_dot\_2d\ *\ (-\/1.0)\ +\ eta)\ /\ (w\_2d\ *\ std::sqrt(2.0)))));}
\DoxyCodeLine{00583\ \ \ \ \ T\ exponent\ =\ sum(weights\_2d\ *\ p\_gamma\_2d\ *\ p\_gamma\_dot\_2d\ *\ Delta)\ /\ eta;}
\DoxyCodeLine{00584\ \ \ \ \ T\ base\_old\ =\ sum(weights\_2d\ *\ p\_gamma\_2d\ *\ p\_gamma\_dot\_2d\ *\ 0.5\ *\ (erfc((mu\_2d\ *\ (-\/1.0)\ +\ height)\ /\ (sigma\_2d\ *\ std::sqrt(2.0)))\ *\ (-\/1.0)\ +\ 2.0));}
\DoxyCodeLine{00585\ \ \ \ \ T\ base\_new\ =\ sum(weights\_2d\ *\ p\_gamma\_2d\ *\ p\_gamma\_dot\_2d\ *\ 0.5\ *\ (erfc((mu\_2d\ *\ (-\/1.0)\ +\ height\_new)\ /\ (sigma\_2d\ *\ std::sqrt(2.0)))\ *\ (-\/1.0)\ +\ 2.0));}
\DoxyCodeLine{00586\ }
\DoxyCodeLine{00587\ \ \ \ \ \textcolor{keywordflow}{return}\ std::pow(base\_old\ /\ base\_new,\ exponent);}
\DoxyCodeLine{00588\ \}}
\DoxyCodeLine{00589\ }
\DoxyCodeLine{00590\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00591\ T\ \mbox{\hyperlink{class_p_g___kernel_a1b94000c5d48cc5a8a00b080de679095}{PG\_Kernel<T>::distance\_pdf}}(T\ distance,\ std::vector<T>\ parameters)\ \{}
\DoxyCodeLine{00592\ }
\DoxyCodeLine{00593\ \ \ \ \ T\ theta\_r1\ =\ std::max(parameters[0],\ 1e-\/12);}
\DoxyCodeLine{00594\ \ \ \ \ T\ height\_0\ =\ parameters[1];}
\DoxyCodeLine{00595\ \ \ \ \ T\ gamma\_0\ =\ parameters[2];}
\DoxyCodeLine{00596\ \ \ \ \ T\ gamma\_dot\_0\ =\ parameters[3];}
\DoxyCodeLine{00597\ \ \ \ \ }
\DoxyCodeLine{00598\ \ \ \ \ T\ eta\ =\ 1.0\ /\ std::tan(theta\_r1);}
\DoxyCodeLine{00599\ \ \ \ \ T\ height\_new\ =\ height\_0\ +\ eta\ *\ distance;}
\DoxyCodeLine{00600\ \ \ \ \ T\ mu\_0\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_a0bc7a1db6552e72fbc54b07b1e1635cd}{evaluate}}(surface.\mbox{\hyperlink{class_surface_ae49ebe885cb762b0f09e23edf6e902cc}{get\_mu\_coefficients}}(),\ gamma\_0);}
\DoxyCodeLine{00601\ \ \ \ \ T\ sigma\_0\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_a0bc7a1db6552e72fbc54b07b1e1635cd}{evaluate}}(surface.\mbox{\hyperlink{class_surface_ad498873671c54f8adad50cf95cc75c40}{get\_sigma\_coefficients}}(),\ gamma\_0);}
\DoxyCodeLine{00602\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ w\_2d\ =\ (sigma\_2d\ *\ sigma\_2d\ /\ ac\_length\ /\ ac\_length\ *\ 2.0\ +\ sigma\_gamma\_2d\ *\ sigma\_gamma\_2d\ *\ gamma\_dot\_2d\ *\ gamma\_dot\_2d)\ \string^\ 0.5;}
\DoxyCodeLine{00603\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ Delta\ =\ (w\_2d\ /\ std::sqrt(2.0\ *\ M\_PI)\ *\ exp(((mu\_gamma\_2d\ *\ gamma\_dot\_2d\ *\ (-\/1.0)\ +\ eta)\ \string^\ 2.0)\ /\ ((w\_2d\ *\ w\_2d)\ *\ 2.0)\ *\ (-\/1.0))\ -\/\ }
\DoxyCodeLine{00604\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (mu\_gamma\_2d\ *\ gamma\_dot\_2d\ *\ (-\/1.0)\ +\ eta)\ *\ 0.5\ *\ (erfc((mu\_gamma\_2d\ *\ gamma\_dot\_2d\ *\ (-\/1.0)\ +\ eta)\ /\ (w\_2d\ *\ std::sqrt(2.0)))));}
\DoxyCodeLine{00605\ \ \ \ \ T\ exponent\ =\ sum(weights\_2d\ *\ p\_gamma\_2d\ *\ p\_gamma\_dot\_2d\ *\ Delta)\ /\ eta;}
\DoxyCodeLine{00606\ \ \ \ \ T\ base\_old\ =\ sum(weights\_2d\ *\ p\_gamma\_2d\ *\ p\_gamma\_dot\_2d\ *\ 0.5\ *\ (erfc((mu\_2d\ *\ (-\/1.0)\ +\ height\_0)\ /\ (sigma\_2d\ *\ std::sqrt(2.0)))\ *\ (-\/1.0)\ +\ 2.0));}
\DoxyCodeLine{00607\ \ \ \ \ T\ base\_new\ =\ sum(weights\_2d\ *\ p\_gamma\_2d\ *\ p\_gamma\_dot\_2d\ *\ 0.5\ *\ (erfc((mu\_2d\ *\ (-\/1.0)\ +\ height\_new)\ /\ (sigma\_2d\ *\ std::sqrt(2.0)))\ *\ (-\/1.0)\ +\ 2.0));}
\DoxyCodeLine{00608\ \ \ \ \ T\ p\_h\ =\ 1.0\ /\ std::sqrt(2.0\ *\ M\_PI)\ /\ sigma\_0\ *\ std::exp(-\/\ (height\_new\ -\/\ mu\_0)\ *\ (height\_new\ -\/\ mu\_0)\ /\ 2.0\ /\ sigma\_0\ /\ sigma\_0);}
\DoxyCodeLine{00609\ \ \ \ \ T\ S\ =\ std::pow(base\_old,\ exponent)\ /\ std::pow(base\_new,\ exponent\ +\ 1.0);}
\DoxyCodeLine{00610\ }
\DoxyCodeLine{00611\ \ \ \ \ \textcolor{keywordflow}{return}\ S\ *\ p\_h;}
\DoxyCodeLine{00612\ \}}
\DoxyCodeLine{00613\ }
\DoxyCodeLine{00614\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00615\ T\ \mbox{\hyperlink{class_p_g___kernel_aa1515ed1da4367fa15c2ca383e84512e}{PG\_Kernel<T>::height\_0\_pdf}}(T\ height\_0,\ std::vector<T>\ parameters)\ \{}
\DoxyCodeLine{00616\ }
\DoxyCodeLine{00617\ \ \ \ \ T\ theta\_i\ =\ parameters[0];}
\DoxyCodeLine{00618\ \ \ \ \ T\ gamma\_0\ =\ parameters[1];}
\DoxyCodeLine{00619\ \ \ \ \ T\ gamma\_dot\_0\ =\ parameters[2];}
\DoxyCodeLine{00620\ }
\DoxyCodeLine{00621\ \ \ \ \ T\ mu\_0\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_a0bc7a1db6552e72fbc54b07b1e1635cd}{evaluate}}(surface.\mbox{\hyperlink{class_surface_ae49ebe885cb762b0f09e23edf6e902cc}{get\_mu\_coefficients}}(),\ gamma\_0);}
\DoxyCodeLine{00622\ \ \ \ \ T\ sigma\_0\ =\ herm\_tools.\mbox{\hyperlink{class_hermite_a0bc7a1db6552e72fbc54b07b1e1635cd}{evaluate}}(surface.\mbox{\hyperlink{class_surface_ad498873671c54f8adad50cf95cc75c40}{get\_sigma\_coefficients}}(),\ gamma\_0);}
\DoxyCodeLine{00623\ }
\DoxyCodeLine{00624\ \ \ \ \ T\ p\_h\ =\ 1.0\ /\ std::sqrt(2.0\ *\ M\_PI)\ /\ sigma\_0\ *\ std::exp(-\/\ std::pow(height\_0\ -\/\ mu\_0,\ 2.0)\ /\ 2.0\ /\ sigma\_0\ /\ sigma\_0);}
\DoxyCodeLine{00625\ }
\DoxyCodeLine{00626\ \ \ \ \ \textcolor{keywordflow}{return}\ p\_h\ *\ shadow(theta\_i,\ height\_0,\ -\/1);}
\DoxyCodeLine{00627\ \}}
\DoxyCodeLine{00628\ }
\DoxyCodeLine{00629\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00630\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ \mbox{\hyperlink{class_p_g___kernel_ab0eac7ed14d09f00e969b0b275996806}{PG\_Kernel<T>::global\_to\_local}}(\mbox{\hyperlink{class_matrix}{Matrix<T>}}\ global\_vector,\ T\ theta\_i,\ T\ theta\_r1,\ T\ theta\_r2)\ \{}
\DoxyCodeLine{00631\ }
\DoxyCodeLine{00632\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ unit\_incident\ =\ global\_vector\ /\ global\_vector.\mbox{\hyperlink{class_matrix_a7ef7109486e3ba18eced478f5cc568cc}{norm}}();}
\DoxyCodeLine{00633\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ z\_local(3,\ 1);}
\DoxyCodeLine{00634\ \ \ \ \ z\_local(0,\ 0)\ =\ std::sin(theta\_r1)\ *\ std::cos(theta\_r2)\ -\/\ std::sin(theta\_i);}
\DoxyCodeLine{00635\ \ \ \ \ z\_local(1,\ 0)\ =\ std::sin(theta\_r1)\ *\ std::sin(theta\_r2);}
\DoxyCodeLine{00636\ \ \ \ \ z\_local(2,\ 0)\ =\ std::cos(theta\_r1)\ +\ std::cos(theta\_i);}
\DoxyCodeLine{00637\ \ \ \ \ z\_local\ /=\ z\_local.\mbox{\hyperlink{class_matrix_a7ef7109486e3ba18eced478f5cc568cc}{norm}}();}
\DoxyCodeLine{00638\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ x\_local(3,\ 1);}
\DoxyCodeLine{00639\ \ \ \ \ x\_local\ =\ unit\_incident\ -\/\ z\_local\ *\ unit\_incident.\mbox{\hyperlink{class_matrix_afcee4f858a2f7dfde3dc28e6d1d32c59}{tr}}().\mbox{\hyperlink{class_matrix_a33b9a1b469adfb4f002564ba874f41c9}{dot}}(z\_local)(0,\ 0);}
\DoxyCodeLine{00640\ \ \ \ \ x\_local\ /=\ x\_local.\mbox{\hyperlink{class_matrix_a7ef7109486e3ba18eced478f5cc568cc}{norm}}();}
\DoxyCodeLine{00641\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ y\_local(3,\ 1);}
\DoxyCodeLine{00642\ \ \ \ \ y\_local\ =\ x\_local.\mbox{\hyperlink{class_matrix_a03b588592a081b3bcba0e121ca0164b1}{cross}}(z\_local);}
\DoxyCodeLine{00643\ \ \ \ \ y\_local\ /=\ y\_local.\mbox{\hyperlink{class_matrix_a7ef7109486e3ba18eced478f5cc568cc}{norm}}();}
\DoxyCodeLine{00644\ }
\DoxyCodeLine{00645\ \ \ \ \ T\ res\_x\ =\ global\_vector.\mbox{\hyperlink{class_matrix_afcee4f858a2f7dfde3dc28e6d1d32c59}{tr}}().\mbox{\hyperlink{class_matrix_a33b9a1b469adfb4f002564ba874f41c9}{dot}}(x\_local)(0,\ 0);}
\DoxyCodeLine{00646\ \ \ \ \ T\ res\_y\ =\ global\_vector.\mbox{\hyperlink{class_matrix_afcee4f858a2f7dfde3dc28e6d1d32c59}{tr}}().\mbox{\hyperlink{class_matrix_a33b9a1b469adfb4f002564ba874f41c9}{dot}}(y\_local)(0,\ 0);}
\DoxyCodeLine{00647\ \ \ \ \ T\ res\_z\ =\ global\_vector.\mbox{\hyperlink{class_matrix_afcee4f858a2f7dfde3dc28e6d1d32c59}{tr}}().\mbox{\hyperlink{class_matrix_a33b9a1b469adfb4f002564ba874f41c9}{dot}}(z\_local)(0,\ 0);}
\DoxyCodeLine{00648\ }
\DoxyCodeLine{00649\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ res(3,\ 1,\ \{res\_x,\ res\_y,\ res\_z\});}
\DoxyCodeLine{00650\ \ \ \ \ }
\DoxyCodeLine{00651\ \ \ \ \ \textcolor{keywordflow}{return}\ res;}
\DoxyCodeLine{00652\ \}}
\DoxyCodeLine{00653\ }
\DoxyCodeLine{00654\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00655\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ \mbox{\hyperlink{class_p_g___kernel_a5b3eac0f0d9be8008a9685582adcb5e3}{PG\_Kernel<T>::local\_to\_global}}(\mbox{\hyperlink{class_matrix}{Matrix<T>}}\ local\_vector,\ T\ theta\_i,\ T\ theta\_r1,\ T\ theta\_r2)\ \{}
\DoxyCodeLine{00656\ }
\DoxyCodeLine{00657\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ unit\_incident(3,\ 1,\ \{std::sin(theta\_i),\ 0.0,\ -\/std::cos(theta\_i)\});}
\DoxyCodeLine{00658\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ z\_local(3,\ 1);}
\DoxyCodeLine{00659\ \ \ \ \ z\_local(0,\ 0)\ =\ std::sin(theta\_r1)\ *\ std::cos(theta\_r2)\ -\/\ std::sin(theta\_i);}
\DoxyCodeLine{00660\ \ \ \ \ z\_local(1,\ 0)\ =\ std::sin(theta\_r1)\ *\ std::sin(theta\_r2);}
\DoxyCodeLine{00661\ \ \ \ \ z\_local(2,\ 0)\ =\ std::cos(theta\_r1)\ +\ std::cos(theta\_i);}
\DoxyCodeLine{00662\ \ \ \ \ z\_local\ /=\ z\_local.\mbox{\hyperlink{class_matrix_a7ef7109486e3ba18eced478f5cc568cc}{norm}}();}
\DoxyCodeLine{00663\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ x\_local(3,\ 1);}
\DoxyCodeLine{00664\ \ \ \ \ x\_local\ =\ unit\_incident\ -\/\ z\_local\ *\ unit\_incident.\mbox{\hyperlink{class_matrix_afcee4f858a2f7dfde3dc28e6d1d32c59}{tr}}().\mbox{\hyperlink{class_matrix_a33b9a1b469adfb4f002564ba874f41c9}{dot}}(z\_local)(0,\ 0);}
\DoxyCodeLine{00665\ \ \ \ \ x\_local\ /=\ x\_local.\mbox{\hyperlink{class_matrix_a7ef7109486e3ba18eced478f5cc568cc}{norm}}();}
\DoxyCodeLine{00666\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ y\_local(3,\ 1);}
\DoxyCodeLine{00667\ \ \ \ \ y\_local\ =\ x\_local.\mbox{\hyperlink{class_matrix_a03b588592a081b3bcba0e121ca0164b1}{cross}}(z\_local);}
\DoxyCodeLine{00668\ \ \ \ \ y\_local\ /=\ y\_local.\mbox{\hyperlink{class_matrix_a7ef7109486e3ba18eced478f5cc568cc}{norm}}();}
\DoxyCodeLine{00669\ \ \ \ \ }
\DoxyCodeLine{00670\ \ \ \ \ \textcolor{keywordflow}{return}\ x\_local\ *\ local\_vector(0,\ 0)\ +\ y\_local\ +\ local\_vector(1,\ 0)\ +\ z\_local\ *\ local\_vector(2,\ 0);}
\DoxyCodeLine{00671\ \}}
\DoxyCodeLine{00672\ }
\DoxyCodeLine{00673\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00674\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ \mbox{\hyperlink{class_p_g___kernel_a606de8649b67946d749e55b867d5e3c4}{PG\_Kernel<T>::angles\_to\_slopes}}(T\ theta\_i,\ T\ theta\_r1,\ T\ theta\_r2)\ \{}
\DoxyCodeLine{00675\ }
\DoxyCodeLine{00676\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ unit\_incident(3,\ 1,\ \{std::sin(theta\_i),\ 0.0,\ -\/std::cos(theta\_i)\});}
\DoxyCodeLine{00677\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ unit\_reflected(3,\ 1,\ \{std::sin(theta\_r1)\ *\ std::cos(theta\_r2),\ std::sin(theta\_r1)\ *\ std::sin(theta\_r2),\ std::cos(theta\_r1)\});}
\DoxyCodeLine{00678\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ normal(3,\ 1);}
\DoxyCodeLine{00679\ \ \ \ \ normal\ =\ unit\_reflected\ -\/\ unit\_incident;}
\DoxyCodeLine{00680\ \ \ \ \ normal\ /=\ std::abs(normal(2,\ 0));}
\DoxyCodeLine{00681\ \ \ \ \ }
\DoxyCodeLine{00682\ \ \ \ \ \textcolor{keywordflow}{return}\ normal;}
\DoxyCodeLine{00683\ \}}
\DoxyCodeLine{00684\ }
\DoxyCodeLine{00685\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00686\ \mbox{\hyperlink{structtrajectory}{trajectory<T>}}\ \mbox{\hyperlink{class_p_g___kernel_a0fddecf7d991d5593d31a18f9817a727}{PG\_Kernel<T>::sample\_particle}}()\ \{}
\DoxyCodeLine{00687\ }
\DoxyCodeLine{00688\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ incident\_velocity\_copy\ =\ this-\/>incident\_velocity;}
\DoxyCodeLine{00689\ }
\DoxyCodeLine{00690\ \ \ \ \ T\ incident\_norm\ =\ incident\_velocity\_copy.\mbox{\hyperlink{class_matrix_a7ef7109486e3ba18eced478f5cc568cc}{norm}}();}
\DoxyCodeLine{00691\ \ \ \ \ T\ theta\_i\ =\ std::acos(-\/\ incident\_velocity\_copy(2,\ 0)\ /\ incident\_norm);}
\DoxyCodeLine{00692\ \ \ \ \ T\ theta\_r1\ =\ 0.0,\ theta\_r2\ =\ 0.0,\ theta\_r2\_total\ =\ 0.0,\ distance\ =\ 1e8;}
\DoxyCodeLine{00693\ \ \ \ \ T\ gamma\_0\ =\ 0.0,\ gamma\_dot\_0\_x\ =\ 0.0,\ gamma\_dot\_0\_y\ =\ 0.0,\ slope\_x\ =\ 0.0,\ slope\_y\ =\ 0.0,\ slope\_x\_new\ =0.0,\ slope\_y\_new\ =\ 0.0;}
\DoxyCodeLine{00694\ }
\DoxyCodeLine{00695\ \ \ \ \ \textcolor{keywordtype}{long}\ num\_col\ =\ 0;}
\DoxyCodeLine{00696\ \ \ \ \ \textcolor{keywordtype}{bool}\ collided\ =\ \textcolor{keyword}{true};}
\DoxyCodeLine{00697\ \ \ \ \ }
\DoxyCodeLine{00698\ \ \ \ \ std::vector<Matrix<T>>\ p\_positions;}
\DoxyCodeLine{00699\ \ \ \ \ std::vector<Matrix<T>>\ p\_velocities;}
\DoxyCodeLine{00700\ }
\DoxyCodeLine{00701\ \ \ \ \ std::random\_device\ rd;}
\DoxyCodeLine{00702\ \ \ \ \ std::seed\_seq\ fullSeed\{rd(),\ rd(),\ rd(),\ rd(),\ rd(),\ rd(),\ rd(),\ rd(),\ rd(),\ rd()\};}
\DoxyCodeLine{00703\ \ \ \ \ std::mt19937\ rng(fullSeed);}
\DoxyCodeLine{00704\ \ \ \ \ std::normal\_distribution<T>\ normDist(0.0f,\ 1.0f);}
\DoxyCodeLine{00705\ }
\DoxyCodeLine{00706\ \ \ \ \ T\ gamma,\ gamma\_dot\_x,\ gamma\_dot\_y;}
\DoxyCodeLine{00707\ \ \ \ \ T\ domain[]\ =\ \{-\/\ margin,\ margin\};}
\DoxyCodeLine{00708\ \ \ \ \ std::tie(gamma,\ gamma\_dot\_x)\ =\ random\_sampler\_2D(\&\mbox{\hyperlink{class_p_g___kernel_a484eadba3fd6f0093e0368715db490a7}{PG\_Kernel::mixture\_pdf}},\ \{1.0,\ theta\_i,\ 0.0\},\ normDist(rng),\ normDist(rng),\ 0.5,\ 0.5,\ domain,\ domain);}
\DoxyCodeLine{00709\ \ \ \ \ gamma\_dot\_y\ =\ normDist(rng)\ *\ std::sqrt(2.0)\ /\ ac\_length;}
\DoxyCodeLine{00710\ }
\DoxyCodeLine{00711\ \ \ \ \ T\ height\_domain[]\ =\ \{-\/margin,\ margin\};}
\DoxyCodeLine{00712\ \ \ \ \ T\ height\_0\ =\ random\_sampler\_1D(\&\mbox{\hyperlink{class_p_g___kernel_aa1515ed1da4367fa15c2ca383e84512e}{PG\_Kernel::height\_0\_pdf}},\ \{theta\_i,\ gamma,\ gamma\_dot\_x\},\ normDist(rng),\ 0.5,\ height\_domain);}
\DoxyCodeLine{00713\ \ \ \ \ p\_positions.push\_back(\mbox{\hyperlink{class_matrix}{Matrix<T>}}(3,\ 1,\ \{height\_0,\ 0.0,\ 0.0\}));}
\DoxyCodeLine{00714\ }
\DoxyCodeLine{00715\ \ \ \ \ \textcolor{keywordflow}{while}(collided)\ \{}
\DoxyCodeLine{00716\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00717\ \ \ \ \ \ \ \ \ T\ angle\_domain\_x[]\ =\ \{0.0,\ M\_PI\ -\/\ theta\_i\};}
\DoxyCodeLine{00718\ \ \ \ \ \ \ \ \ T\ angle\_domain\_y[]\ =\ \{-\/M\_PI,\ M\_PI\};}
\DoxyCodeLine{00719\ \ \ \ \ \ \ \ \ std::tie(theta\_r1,\ theta\_r2)\ =\ random\_sampler\_angles(\&\mbox{\hyperlink{class_p_g___kernel_ac52c90dbf2a4a04da725040557647cf4}{PG\_Kernel::kirchhoff\_pdf}},\ \{theta\_i,\ gamma,\ gamma\_dot\_x,\ gamma\_dot\_y,\ slope\_x,\ slope\_y,\ distance\},\ 1e-\/5,\ 1e-\/5,\ }
\DoxyCodeLine{00720\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (M\_PI\ -\/\ theta\_i)\ *\ 0.25,\ (M\_PI\ -\/\ theta\_i)\ *\ 0.25,\ angle\_domain\_x,\ angle\_domain\_y);}
\DoxyCodeLine{00721\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ slopes\_matrix\ =\ angles\_to\_slopes(theta\_i,\ theta\_r1,\ theta\_r2);}
\DoxyCodeLine{00722\ \ \ \ \ \ \ \ \ slope\_x\_new\ =\ -\/\ slopes\_matrix(0,\ 0);}
\DoxyCodeLine{00723\ \ \ \ \ \ \ \ \ slope\_y\_new\ =\ -\/\ slopes\_matrix(1,\ 0);}
\DoxyCodeLine{00724\ }
\DoxyCodeLine{00725\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ incident\_velocity\_local\ =\ global\_to\_local(incident\_velocity\_copy,\ theta\_i,\ theta\_r1,\ theta\_r2);}
\DoxyCodeLine{00726\ \ \ \ \ \ \ \ \ T\ vel\_in\_array[]\ =\ \{incident\_velocity\_local(0,\ 0),\ incident\_velocity\_local(1,\ 0),\ incident\_velocity\_local(2,\ 0)\};}
\DoxyCodeLine{00727\ \ \ \ \ \ \ \ \ T\ vel\_refl\_array[]\ =\ \{0.0,\ 0.0,\ 0.0\};}
\DoxyCodeLine{00728\ \ \ \ \ \ \ \ \ T\ gsi\_parameters[]\ =\ \{surface.\mbox{\hyperlink{class_surface_a51ee134273b8e968bb34061d482be3c1}{get\_local\_parameters}}()[1],\ surface.\mbox{\hyperlink{class_surface_a51ee134273b8e968bb34061d482be3c1}{get\_local\_parameters}}()[2]\};}
\DoxyCodeLine{00729\ \ \ \ \ \ \ \ \ T\ surface\_parameters[]\ =\ \{surface.\mbox{\hyperlink{class_surface_a51ee134273b8e968bb34061d482be3c1}{get\_local\_parameters}}()[0]\};}
\DoxyCodeLine{00730\ \ \ \ \ \ \ \ \ T\ gas\_parameters[]\ =\ \{gas.\mbox{\hyperlink{class_gas_aae9cf3b82b2eeb0b9ed96e2c973920cb}{get\_temperature}}(),\ gas.\mbox{\hyperlink{class_gas_a7d97eadcb351e8d7d1043771712917fe}{get\_density}}(),\ gas.\mbox{\hyperlink{class_gas_a6bd15f51e80e57db68a0b8763b800fb7}{get\_molar\_mass}}(),\ gas.\mbox{\hyperlink{class_gas_ae17c7893c96ce081e42e19a9a62abdfb}{get\_speed}}()\};}
\DoxyCodeLine{00731\ }
\DoxyCodeLine{00732\ \ \ \ \ \ \ \ \ local\_kernel(vel\_in\_array,\ vel\_refl\_array,\ gsi\_parameters,\ gas\_parameters,\ surface\_parameters);}
\DoxyCodeLine{00733\ }
\DoxyCodeLine{00734\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ reflected\_velocity\_local(3,\ 1,\ \{vel\_refl\_array[0],\ vel\_refl\_array[1],\ vel\_refl\_array[2]\});}
\DoxyCodeLine{00735\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ reflected\_velocity\ =\ local\_to\_global(reflected\_velocity\_local,\ theta\_i,\ theta\_r1,\ theta\_r2);}
\DoxyCodeLine{00736\ }
\DoxyCodeLine{00737\ \ \ \ \ \ \ \ \ theta\_r1\ =\ std::acos(reflected\_velocity(2,\ 0)\ /\ reflected\_velocity.\mbox{\hyperlink{class_matrix_a7ef7109486e3ba18eced478f5cc568cc}{norm}}());}
\DoxyCodeLine{00738\ \ \ \ \ \ \ \ \ theta\_r2\ =\ std::atan2(reflected\_velocity(1,\ 0),\ reflected\_velocity(0,\ 0));}
\DoxyCodeLine{00739\ }
\DoxyCodeLine{00740\ \ \ \ \ \ \ \ \ std::bernoulli\_distribution\ shadow\_pdf(1.0\ -\/\ shadow(theta\_r1,\ height\_0,\ 1));}
\DoxyCodeLine{00741\ \ \ \ \ \ \ \ \ collided\ =\ shadow\_pdf(rng);}
\DoxyCodeLine{00742\ }
\DoxyCodeLine{00743\ \ \ \ \ \ \ \ \ T\ distance\_domain[]\ =\ \{0.0,\ margin\ *\ 5.0\};}
\DoxyCodeLine{00744\ \ \ \ \ \ \ \ \ distance\ =\ random\_sampler\_1D(\&\mbox{\hyperlink{class_p_g___kernel_a1b94000c5d48cc5a8a00b080de679095}{PG\_Kernel::distance\_pdf}},\ \{theta\_r1,\ height\_0,\ gamma,\ gamma\_dot\_x\},\ 0.0,\ 0.5,\ distance\_domain);}
\DoxyCodeLine{00745\ \ \ \ \ \ \ \ \ height\_0\ +=\ distance\ /\ std::tan(theta\_r1);}
\DoxyCodeLine{00746\ \ \ \ \ \ \ \ \ theta\_i\ =\ M\_PI\ -\/\ theta\_r1;}
\DoxyCodeLine{00747\ \ \ \ \ \ \ \ \ theta\_r2\_total\ +=\ theta\_r2;}
\DoxyCodeLine{00748\ }
\DoxyCodeLine{00749\ \ \ \ \ \ \ \ \ incident\_norm\ =\ reflected\_velocity.\mbox{\hyperlink{class_matrix_a7ef7109486e3ba18eced478f5cc568cc}{norm}}();}
\DoxyCodeLine{00750\ \ \ \ \ \ \ \ \ incident\_velocity\_copy(0,\ 0)\ =\ incident\_norm\ *\ std::sin(theta\_i);}
\DoxyCodeLine{00751\ \ \ \ \ \ \ \ \ incident\_velocity\_copy(1,\ 0)\ =\ 0.0;}
\DoxyCodeLine{00752\ \ \ \ \ \ \ \ \ incident\_velocity\_copy(2,\ 0)\ =\ -\/\ incident\_norm\ *\ std::cos(theta\_i);}
\DoxyCodeLine{00753\ }
\DoxyCodeLine{00754\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ global\_reflected\_velocity(3,\ 1,\ \{std::sin(theta\_r1)\ *\ std::cos(theta\_r2\_total),\ }
\DoxyCodeLine{00755\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::sin(theta\_r1)\ *\ std::sin(theta\_r2\_total),\ }
\DoxyCodeLine{00756\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::cos(theta\_r1)\});}
\DoxyCodeLine{00757\ \ \ \ \ \ \ \ \ global\_reflected\_velocity\ *=\ incident\_norm;}
\DoxyCodeLine{00758\ \ \ \ \ \ \ \ \ p\_velocities.push\_back(global\_reflected\_velocity);}
\DoxyCodeLine{00759\ }
\DoxyCodeLine{00760\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ position\_change(3,\ 1,\ \{std::sin(theta\_r1)\ *\ std::cos(theta\_r2\_total),\ }
\DoxyCodeLine{00761\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::sin(theta\_r1)\ *\ std::sin(theta\_r2\_total),\ std::cos(theta\_r1)\});}
\DoxyCodeLine{00762\ \ \ \ \ \ \ \ \ position\_change\ *=\ distance\ /\ std::sin(theta\_r1);}
\DoxyCodeLine{00763\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (collided)\ p\_positions.push\_back(p\_positions.back()\ +\ position\_change);}
\DoxyCodeLine{00764\ }
\DoxyCodeLine{00765\ \ \ \ \ \ \ \ \ slope\_x\ =\ -\/\ std::cos(theta\_r2)\ *\ slope\_x\_new\ -\/\ std::sin(theta\_r2)\ *\ slope\_y\_new;}
\DoxyCodeLine{00766\ \ \ \ \ \ \ \ \ slope\_y\ =\ std::sin(theta\_r2)\ *\ slope\_x\_new\ -\/\ std::cos(theta\_r2)\ *\ slope\_y\_new;}
\DoxyCodeLine{00767\ }
\DoxyCodeLine{00768\ \ \ \ \ \ \ \ \ std::tie(gamma,\ gamma\_dot\_x)\ =\ random\_sampler\_2D(\&\mbox{\hyperlink{class_p_g___kernel_a484eadba3fd6f0093e0368715db490a7}{PG\_Kernel::mixture\_pdf}},\ \{0.0,\ theta\_i,\ distance\},\ normDist(rng),\ normDist(rng),\ 0.5,\ 0.5,\ domain,\ domain);}
\DoxyCodeLine{00769\ \ \ \ \ \ \ \ \ gamma\_dot\_y\ =\ normDist(rng)\ *\ std::sqrt(2.0)\ /\ ac\_length;}
\DoxyCodeLine{00770\ \ \ \ \ \ \ \ \ num\_col\ ++;}
\DoxyCodeLine{00771\ \ \ \ \ \}}
\DoxyCodeLine{00772\ \ \ \ \ \mbox{\hyperlink{structtrajectory}{trajectory<T>}}\ p\_trajectory\ =\ \{p\_velocities,\ p\_positions\};\ }
\DoxyCodeLine{00773\ }
\DoxyCodeLine{00774\ \ \ \ \ \textcolor{keywordflow}{return}\ p\_trajectory;}
\DoxyCodeLine{00775\ \}}
\DoxyCodeLine{00776\ }
\DoxyCodeLine{00777\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00778\ std::vector<trajectory<T>>\ \mbox{\hyperlink{class_p_g___kernel_ab5ae1e66209c1a2cd2251d2c95c77994}{PG\_Kernel<T>::sample\_batch}}()\ \{}
\DoxyCodeLine{00779\ }
\DoxyCodeLine{00780\ \ \ \ \ std::vector<trajectory<T>>\ trajectories;}
\DoxyCodeLine{00781\ }
\DoxyCodeLine{00782\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keyword}{auto}\ i\ =\ 0;\ i\ <\ this-\/>num\_particles;\ i\ ++)\ \{}
\DoxyCodeLine{00783\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{structtrajectory}{trajectory<T>}}\ p\_trajectory\ =\ sample\_particle();}
\DoxyCodeLine{00784\ \ \ \ \ \ \ \ \ trajectories.push\_back(p\_trajectory);}
\DoxyCodeLine{00785\ \ \ \ \ \}}
\DoxyCodeLine{00786\ \ \ \ \ \textcolor{keywordflow}{return}\ trajectories;}
\DoxyCodeLine{00787\ \}}
\DoxyCodeLine{00788\ }
\DoxyCodeLine{00789\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00790\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_p_g___kernel_a4328bc06dde45b6abe1046fa8ac0f2aa}{PG\_Kernel<T>::save}}(std::vector<\mbox{\hyperlink{structtrajectory}{trajectory<T>}}>\ trajectories,\ std::string\ filename)\ \{}
\DoxyCodeLine{00791\ }
\DoxyCodeLine{00792\ \ \ \ \ std::ofstream\ myfile;}
\DoxyCodeLine{00793\ \ \ \ \ myfile.open(filename);}
\DoxyCodeLine{00794\ \ \ \ \ }
\DoxyCodeLine{00795\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{long}\ num\_particles\ =\ trajectories.size();}
\DoxyCodeLine{00796\ }
\DoxyCodeLine{00797\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keyword}{auto}\ i\ =\ 0;\ i\ <\ num\_particles;\ i\ ++)\ \{}
\DoxyCodeLine{00798\ }
\DoxyCodeLine{00799\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{structtrajectory}{trajectory<T>}}\ p\_trajectory\ =\ trajectories[i];}
\DoxyCodeLine{00800\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{long}\ num\_bounces\ =\ p\_trajectory.positions.size();}
\DoxyCodeLine{00801\ }
\DoxyCodeLine{00802\ \ \ \ \ \ \ \ \ myfile\ <<\ num\_bounces\ <<\ \textcolor{stringliteral}{"{}\(\backslash\)n"{}};}
\DoxyCodeLine{00803\ }
\DoxyCodeLine{00804\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keyword}{auto}\ j\ =\ 0;\ j\ <\ 3;\ j\ ++)\ \{}
\DoxyCodeLine{00805\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keyword}{auto}\ k\ =\ 0;\ k\ <\ num\_bounces;\ k\ ++)\ \{}
\DoxyCodeLine{00806\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ myfile\ <<\ p\_trajectory.positions[k](j,\ 0)\ <<\ \textcolor{stringliteral}{"{}\ "{}};}
\DoxyCodeLine{00807\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00808\ \ \ \ \ \ \ \ \ \ \ \ \ myfile\ <<\ \textcolor{stringliteral}{"{}\(\backslash\)n"{}};}
\DoxyCodeLine{00809\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00810\ }
\DoxyCodeLine{00811\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keyword}{auto}\ j\ =\ 0;\ j\ <\ 3;\ j\ ++)\ \{}
\DoxyCodeLine{00812\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keyword}{auto}\ k\ =\ 0;\ k\ <\ num\_bounces;\ k\ ++)\ \{}
\DoxyCodeLine{00813\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ myfile\ <<\ p\_trajectory.velocities[k](j,\ 0)\ <<\ \textcolor{stringliteral}{"{}\ "{}};}
\DoxyCodeLine{00814\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00815\ \ \ \ \ \ \ \ \ \ \ \ \ myfile\ <<\ \textcolor{stringliteral}{"{}\(\backslash\)n"{}};}
\DoxyCodeLine{00816\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00817\ }
\DoxyCodeLine{00818\ \ \ \ \ \}}
\DoxyCodeLine{00819\ \ \ \ \ myfile.close();}
\DoxyCodeLine{00820\ }
\DoxyCodeLine{00821\ \}}
\DoxyCodeLine{00822\ }
\DoxyCodeLine{00823\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00824\ std::vector<trajectory<T>>\ \mbox{\hyperlink{class_p_g___kernel_a463e12da151ed7f37ba3c42ac75307a7}{PG\_Kernel<T>::import\_data}}(std::string\ filename)\ \{}
\DoxyCodeLine{00825\ }
\DoxyCodeLine{00826\ \ \ \ \ std::ifstream\ linecounter(filename);}
\DoxyCodeLine{00827\ \ \ \ \ std::string\ line;}
\DoxyCodeLine{00828\ \ \ \ \ std::vector<trajectory<T>>\ trajectories;}
\DoxyCodeLine{00829\ }
\DoxyCodeLine{00830\ \ \ \ \ \textcolor{keywordtype}{long}\ num\_lines\ =\ 0;}
\DoxyCodeLine{00831\ }
\DoxyCodeLine{00832\ \ \ \ \ \textcolor{keywordflow}{while}(\ std::getline(linecounter,\ line))\ \{}
\DoxyCodeLine{00833\ \ \ \ \ \ \ \ \ ++\ num\_lines;}
\DoxyCodeLine{00834\ \ \ \ \ \}}
\DoxyCodeLine{00835\ }
\DoxyCodeLine{00836\ \ \ \ \ \textcolor{keywordtype}{long}\ num\_particles\ =\ num\_lines\ /\ 7;}
\DoxyCodeLine{00837\ \ \ \ \ \textcolor{keywordtype}{long}\ num\_bounces;}
\DoxyCodeLine{00838\ }
\DoxyCodeLine{00839\ \ \ \ \ std::ifstream\ myfile(filename);}
\DoxyCodeLine{00840\ }
\DoxyCodeLine{00841\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{long}\ i\ =\ 0;\ i\ <\ num\_particles;\ i\ ++)\ \{}
\DoxyCodeLine{00842\ }
\DoxyCodeLine{00843\ \ \ \ \ \ \ \ \ myfile\ >>\ num\_bounces;}
\DoxyCodeLine{00844\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ position(3,\ 1);}
\DoxyCodeLine{00845\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ velocity(3,\ 1);}
\DoxyCodeLine{00846\ \ \ \ \ \ \ \ \ std::vector<Matrix<T>>\ p\_positions(num\_bounces,\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}(3,\ 1));}
\DoxyCodeLine{00847\ \ \ \ \ \ \ \ \ std::vector<Matrix<T>>\ p\_velocities(num\_bounces,\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}(3,\ 1));}
\DoxyCodeLine{00848\ }
\DoxyCodeLine{00849\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{long}\ k\ =\ 0;\ k\ <\ 3;\ k\ ++)\ \{}
\DoxyCodeLine{00850\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{long}\ j\ =\ 0;\ j\ <\ num\_bounces;\ j\ ++)\ \{}
\DoxyCodeLine{00851\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ myfile\ >>\ p\_positions[j](k,\ 0);}
\DoxyCodeLine{00852\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00853\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00854\ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{long}\ k\ =\ 0;\ k\ <\ 3;\ k\ ++)\ \{}
\DoxyCodeLine{00855\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{long}\ j\ =\ 0;\ j\ <\ num\_bounces;\ j\ ++)\ \{}
\DoxyCodeLine{00856\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ myfile\ >>\ p\_velocities[j](k,\ 0);}
\DoxyCodeLine{00857\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00858\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00859\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{structtrajectory}{trajectory<T>}}\ \mbox{\hyperlink{structtrajectory}{trajectory}}\ =\ \{p\_velocities,\ p\_positions\};}
\DoxyCodeLine{00860\ \ \ \ \ \ \ \ \ trajectories.push\_back(\mbox{\hyperlink{structtrajectory}{trajectory}});}
\DoxyCodeLine{00861\ \ \ \ \ \}}
\DoxyCodeLine{00862\ \ \ \ \ }
\DoxyCodeLine{00863\ \ \ \ \ \textcolor{keywordflow}{return}\ trajectories;}
\DoxyCodeLine{00864\ \}}
\DoxyCodeLine{00865\ }
\DoxyCodeLine{00866\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00867\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_p_g___kernel_afffaa46fbc8a069857243c5db7159a38}{PG\_Kernel<T>::combine\_files}}(std::string\ filename,\ \textcolor{keywordtype}{int}\ num\_procs)\ \{}
\DoxyCodeLine{00868\ }
\DoxyCodeLine{00869\ \ \ \ \ std::vector<trajectory<T>>\ trajectories\_total;}
\DoxyCodeLine{00870\ }
\DoxyCodeLine{00871\ \ \ \ \ \textcolor{keywordflow}{for}(\ \textcolor{keywordtype}{long}\ i\ =\ 0;\ i\ <\ num\_procs;\ i\ ++)\ \{}
\DoxyCodeLine{00872\ \ \ \ \ \ \ \ \ std::vector<trajectory<T>>\ trajectories\ =\ import\_data(filename\ +\ \textcolor{stringliteral}{"{}\_"{}}\ +\ std::to\_string(i)\ +\ \textcolor{stringliteral}{"{}.dat"{}});}
\DoxyCodeLine{00873\ \ \ \ \ \ \ \ \ trajectories\_total.insert(trajectories\_total.end(),\ trajectories.begin(),\ trajectories.end());}
\DoxyCodeLine{00874\ \ \ \ \ \ \ \ \ std::remove((filename\ +\ \textcolor{stringliteral}{"{}\_"{}}\ +\ std::to\_string(i)\ +\ \textcolor{stringliteral}{"{}.dat"{}}).c\_str());\ }
\DoxyCodeLine{00875\ \ \ \ \ \}}
\DoxyCodeLine{00876\ \ \ \ \ save(trajectories\_total,\ filename\ +\ \textcolor{stringliteral}{"{}.dat"{}});}
\DoxyCodeLine{00877\ \}}

\end{DoxyCode}
