Skip to content
Snippets Groups Projects
Commit b1d4f6a2 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

Merge branch 'feature/spectrum_func' into develop

parents ae604046 75ea2f36
No related branches found
No related tags found
No related merge requests found
Pipeline #77092 passed
......@@ -392,6 +392,7 @@ set(hpp_for_lib
${PROJECT_SOURCE_DIR}/cpp/omputils.hpp
${PROJECT_SOURCE_DIR}/cpp/shared_array.hpp
${PROJECT_SOURCE_DIR}/cpp/spline.hpp
${PROJECT_SOURCE_DIR}/cpp/spectrum_function.hpp
${PROJECT_SOURCE_DIR}/cpp/full_code/ornstein_uhlenbeck_process.hpp
${PROJECT_SOURCE_DIR}/cpp/full_code/ou_vorticity_equation.hpp
)
......
#include<cmath>
#include<vector>
#include "kspace.hpp"
template <field_backend be,
kspace_dealias type dt>
class spectrum_function
{
private:
const kspace<be, dt> *kk;
const std::vector<double> values;
public:
spectrum_function(
const kspace<be, dt> *KK,
const std::vector &source_values):
kk(KK),
values(source_values)
{
assert(this->values.size() == this->kk->nshells);
}
~spectrum_function(){}
double operator()(double kvalue)
{
assert(kvalue >= double(0));
int index = floor(kvalue / this->kk->dk);
assert(index < this->values.size());
return this->values[index];
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment