#pragma once #include #include #include struct integrand_handle_base { virtual ~integrand_handle_base() = default; virtual double f(double x, double y, double z) const = 0; virtual double w() const = 0; virtual double w_without_grad() const = 0; virtual bool strict_polynomial() const = 0; }; // struct SIv2_API common_integrand_handle final : public integrand_handle_base { // virtual ~common_integrand_handle() = default; // virtual double f(double x, double y, double z) const { return handle(x, y, z); } // virtual double w() const { return 1.; } // virtual bool strict_polynomial() const { return false; } // std::function handle{}; // }; struct SIv2_API polynomial_integrand_handle final : public integrand_handle_base { virtual ~polynomial_integrand_handle() = default; virtual double f(double x, double y, double z) const { return algorithm::fast_power(x, p1) * algorithm::fast_power(y, p2) * algorithm::fast_power(z, p3); } virtual double w() const { return coeff / (p1 + p2 + p3 + 3); } virtual double w_without_grad() const { return coeff; } virtual bool strict_polynomial() const { return true; } double coeff{}; uint8_t p1{}, p2{}, p3{}; };