45#ifndef MATH_INTEGRATION_LEGENDREGAUSS1D_HPP
46#define MATH_INTEGRATION_LEGENDREGAUSS1D_HPP
50 template<
class returnType,
class argumentType>
55 virtual returnType integrand(
const argumentType& r)
const = 0;
56 virtual returnType integral(
const argumentType& rmin,
57 const argumentType& rmax,
58 RealType length)
const;
60 std::vector<RealType> xi;
61 std::vector<RealType> w;
72 virtual RealType integrand(
const RealType& r)
const {
return 0; };
77 template<
class returnType,
class argumentType>
88 xi[0] = 1.0 / sqrt(3.);
138 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
139 "LegendreGauss1d does not implement a %d point algorithm\n",
141 painCave.isFatal = 1;
147 template<
class returnType,
class argumentType>
148 LegendreGauss1d<returnType, argumentType>::~LegendreGauss1d() {
155 template<
class returnType,
class argumentType>
156 returnType LegendreGauss1d<returnType, argumentType>::integral(
157 const argumentType& rmin,
const argumentType& rmax,
158 RealType length)
const {
160 for (
size_t i = 0; i < points; i++) {
161 argumentType r = 0.5 * ((xi[i] + 1.0) * rmax + (1.0 - xi[i]) * rmin);
162 s + = integrand(r) * w[i];
164 return 0.5 * length * s;
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.