Skip to content

Commit 49637a4

Browse files
committed
crystal last fix
1 parent df4bf95 commit 49637a4

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

Intern/rayx-core/src/Shader/Crystal.h

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ namespace RAYX {
1919
// Output:
2020
// returns theta - the angle of incidence in radians
2121
// **********************************************************
22-
RAYX_FN_ACC double getTheta(Ray r, glm::dvec3 normal, double offsetAngle) {
22+
RAYX_FN_ACC
23+
inline double getTheta(Ray r, glm::dvec3 normal, double offsetAngle) {
24+
2325
double al = normal[0];
2426
double am = normal[1];
2527
double an = normal[2];
@@ -55,7 +57,9 @@ RAYX_FN_ACC double getTheta(Ray r, glm::dvec3 normal, double offsetAngle) {
5557
/// @param d lattice spacing*2
5658
/// @param order Diffraction order
5759
/// @return the bragg angle theta (rad)
58-
RAYX_FN_ACC double getBraggAngle(double energy, double dSpacing2) {
60+
RAYX_FN_ACC
61+
inline double getBraggAngle(double energy, double dSpacing2) {
62+
5963
int order = 1;
6064
double wavelength = hvlam(energy);
6165
double theta_factor = (order * wavelength) / dSpacing2;
@@ -73,7 +77,8 @@ RAYX_FN_ACC double getBraggAngle(double energy, double dSpacing2) {
7377
/// @param braggAngle Bragg angle θ_B (in radians)
7478
/// @param alpha Tilt between surface and diffraction planes α (in radians) (offset Angle)
7579
/// @return Asymmetry factor b (dimensionless)
76-
RAYX_FN_ACC double getAsymmetryFactor(double braggAngle, double alpha) {
80+
RAYX_FN_ACC
81+
inline double getAsymmetryFactor(double braggAngle, double alpha) {
7782
double numerator = complex::sin(braggAngle - alpha);
7883
double denominator = complex::sin(braggAngle + alpha);
7984

@@ -86,8 +91,10 @@ RAYX_FN_ACC double getAsymmetryFactor(double braggAngle, double alpha) {
8691
/// Defined in Batterman & Cole (1964), p. 685.
8792
/// @param wavelength X-ray wavelength (in nm)
8893
/// @param unitCellVolume Unit cell volume (in nm³)
89-
/// @return Diffraction prefactor Γ
90-
RAYX_FN_ACC double getDiffractionPrefactor(double wavelength, double unitCellVolume) {
94+
/// @return Diffraction prefactor Γ
95+
RAYX_FN_ACC
96+
inline double getDiffractionPrefactor(double wavelength, double unitCellVolume) {
97+
9198
// Avoid division by zero
9299
if (wavelength <= 0.0 || unitCellVolume <= 0.0) {
93100
return 0.0;
@@ -113,9 +120,12 @@ RAYX_FN_ACC double getDiffractionPrefactor(double wavelength, double unitCellVol
113120
/// @param polFactor Polarization factor
114121
/// @param gamma Diffraction prefactor
115122
/// @return Complex η parameter
116-
RAYX_FN_ACC complex::Complex computeEta(double theta, double bragg, double asymmetry, double structureFactorReFH, double structureFactorImFH,
117-
double structureFactorReFHC, double structureFactorImFHC, double structureFactorReF0,
118-
double structureFactorImF0, double polFactor, double gamma) {
123+
RAYX_FN_ACC
124+
inline complex::Complex computeEta(double theta, double bragg, double asymmetry,
125+
double structureFactorReFH, double structureFactorImFH,
126+
double structureFactorReFHC, double structureFactorImFHC,
127+
double structureFactorReF0, double structureFactorImF0,
128+
double polFactor, double gamma) {
119129
// Calculate numerator terms
120130
complex::Complex top_term1 = asymmetry * (theta - bragg) * sin(2.0 * theta);
121131
complex::Complex top_term2 = 0.5 * gamma * complex::Complex(structureFactorReF0, structureFactorImF0) * (1.0 - asymmetry);
@@ -145,8 +155,10 @@ RAYX_FN_ACC complex::Complex computeEta(double theta, double bragg, double asymm
145155
/// @param structureFactorReFHC Real part of structure factor
146156
/// @param structureFactorImFHC Imaginary part of structure factor
147157
/// @return Complex reflection coefficient R
148-
RAYX_FN_ACC complex::Complex computeR(complex::Complex eta, double structureFactorReFH, double structureFactorImFH, double structureFactorReFHC,
149-
double structureFactorImFHC) {
158+
RAYX_FN_ACC
159+
inline::Complex computeR(complex::Complex eta,
160+
double structureFactorReFH, double structureFactorImFH,
161+
double structureFactorReFHC, double structureFactorImFHC) {
150162
complex::Complex one(1.0, 0.0);
151163
complex::Complex FH(structureFactorReFH, structureFactorImFH);
152164
complex::Complex FHC(structureFactorReFHC, structureFactorImFHC);

0 commit comments

Comments
 (0)