1D integrator (Gauss-Legendre, tanh-sinh) under precomputation version
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
997 B

#pragma once
// Gaussian quadrature schemes for the interval [0,1] of node count p, 1 <= p <= 100.
#include <cassert>
#include <array>
#include <type_traits>
template <typename T>
struct GLIntegrator {
static_assert(std::is_floating_point_v<T>);
static constexpr int pMax = 100;
// Corresponding to the degree p Gaussian quadrature scheme for the interval [0,1], position of node i, 0 <= i < p.
static inline constexpr T x(int p, int i)
{
assert(1 <= p && p <= pMax && 0 <= i && i < p);
return data[p * (p - 1) + i];
}
// Corresponding to the degree p Gaussian quadrature scheme for the interval [0,1], weight of node i, 0 <= i < p.
static inline constexpr T w(int p, int i)
{
assert(1 <= p && p <= pMax && 0 <= i && i < p);
return data[p * p + i];
}
static constexpr std::array<T, pMax *(pMax + 1)> data = {
// clang-format off
#include "data_cache/GL_weights.hpp"
// clang-format on
};
};