Skip to content

Commit

Permalink
Make basic CDI functions constexpr (#1109)
Browse files Browse the repository at this point in the history
* Make basic CDI functions constexpr

+ Move functions that don't require any class member data outside CDI class
+ Mark basic integration functions as constexpr
+ Remove files that formerly held low-level planck integration functions

* Don't use .data() yet, requires C++17

* Make CDI functions available on device

+ Hard code std::pow of max double as there's no constexpr pow in msvc
+ Add device/config to Cmake for CDI
  • Loading branch information
alexrlongne authored Aug 19, 2021
1 parent 7985859 commit 605e1e1
Show file tree
Hide file tree
Showing 9 changed files with 243 additions and 335 deletions.
8 changes: 4 additions & 4 deletions src/cdi/CDI.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ double CDI::integratePlanckSpectrum(size_t const groupIndex, double const T) {
const double upper_bound = frequencyGroupBoundaries[groupIndex];
Check(upper_bound > lower_bound);

double integral = integratePlanckSpectrum(lower_bound, upper_bound, T);
double integral = rtt_cdi::integratePlanckSpectrum(lower_bound, upper_bound, T);

Ensure(integral >= 0.0);
Ensure(integral <= 1.0);
Expand All @@ -136,7 +136,7 @@ double CDI::integratePlanckSpectrum(const double T) {
Check(upper_bound > lower_bound);

// calculate the integral
double integral = integratePlanckSpectrum(lower_bound, upper_bound, T);
double integral = rtt_cdi::integratePlanckSpectrum(lower_bound, upper_bound, T);

Ensure(integral >= 0.0 && integral <= 1.0);

Expand Down Expand Up @@ -165,7 +165,7 @@ double CDI::integrateRosselandSpectrum(size_t const groupIndex, double const T)
const double highFreq = frequencyGroupBoundaries[groupIndex];
Check(highFreq > lowFreq);

double rosseland = integrateRosselandSpectrum(lowFreq, highFreq, T);
double rosseland = rtt_cdi::integrateRosselandSpectrum(lowFreq, highFreq, T);

return rosseland;
}
Expand Down Expand Up @@ -196,7 +196,7 @@ void CDI::integrate_Rosseland_Planckian_Spectrum(const size_t groupIndex, const
Check(highFreq > lowFreq);

// Call the general frequency version
integrate_Rosseland_Planckian_Spectrum(lowFreq, highFreq, T, planck, rosseland);
rtt_cdi::integrate_Rosseland_Planckian_Spectrum(lowFreq, highFreq, T, planck, rosseland);
return;
}

Expand Down
Loading

0 comments on commit 605e1e1

Please sign in to comment.