Hex: GaussLegendre Class Reference

| Hex 2.2 Hydrogen-electron collision solver

Public Member Functions
GaussLegendre Class Reference

Gauss-Legendre quadrature. More...

`#include <gauss.h>`

Inheritance diagram for GaussLegendre:
[legend]
Collaboration diagram for GaussLegendre:
[legend]

## Public Member Functions

void | scaled_nodes_and_weights (int points, Complex x1, Complex x2, Complex *xs, Complex *ws) const
| Get Gauss-Legendre quadrature points and weights in interval. More...
template<class Functor , class... Data>
Complex | quad (Functor f, Bspline const &bspline, int points, int iknot, Complex x1, Complex x2, Data... data) const
| Gauss-Legendre integrator. More...
template<class ClassPtr , class Functor , class... Data>
Complex | quadMFP (ClassPtr ptr, Functor f, Bspline const &bspline, int points, int iknot, Complex x1, Complex x2, Data... data) const
| Gauss-Legendre integrator. More...

## Additional Inherited Members

Static Public Member Functions inherited from GaussLegendreData
static void | gauss_nodes_and_weights (int points, const Real *&vx, const Real *&vw)
| Retrieve Gauss-Legendre data. More...
static void | precompute_nodes_and_weights (int points)
| Precalculate nodes and weights so that the retrieval is fast and thread-safe. More...

## Detailed Description

This class's purpose is aid in fixed-order Gauss-Legendre quadrature. It is constructed above a B-spline environment, which is passed to the constructor. The functions "p_points" and "p_weights" return evaluation nodes and weights, respectively, and the functions "quad" do the fixed-order quadrature itself. Every call to p_points or p_weights resuts in call to gauss_nodes_and_weights, which uses GSL to get the requested data. The computed nodes and weights are stored in a cache table to allow faster subsequent computations.

## Member Function Documentation

## ◆ quad()

template<class Functor , class... Data>

Complex GaussLegendre::quad | ( | Functor | f,
|  | Bspline const & | bspline,
|  | int | points,
|  | int | iknot,
|  | Complex | x1,
|  | Complex | x2,
|  | Data... | data
| ) |  | const

inline

Integrate the given function.

Parameters

  f | Function of type (void (*) (unsigned, complex*, complex*, data...)), where the first parameter is number of points to evaluate, the second parameter is pointer to an array of double complex values at which to evaluate, the third is pointer to an array into which the data will be written (responsibility for memory management is on callers side) and finally the fourth (and further) parameter is any other data to be suplied to the function.
  data | Data to pass to the function.
  points | Gauss-Legendre points count.
  iknot | Knot index.
  x1 | Left integration boundary.
  x2 | Right integration boundary.

It must be

t[iknot] <= x1 <= t[iknot+1]
t[iknot] <= x2 <= t[iknot+1]

## ◆ quadMFP()

template<class ClassPtr , class Functor , class... Data>

Complex GaussLegendre::quadMFP | ( | ClassPtr | ptr,
|  | Functor | f,
|  | Bspline const & | bspline,
|  | int | points,
|  | int | iknot,
|  | Complex | x1,
|  | Complex | x2,
|  | Data... | data
| ) |  | const

inline

This is a variant of the other quad function that can be used together with the pointer-to-member-function arguments. A typical usage woud be

Class A { ... };
A a;
result = quad (&a, &a::integrand, ...);

## ◆ scaled_nodes_and_weights()

void GaussLegendre::scaled_nodes_and_weights | ( | int | points,
|  | Complex | x1,
|  | Complex | x2,
|  | Complex * | xs,
|  | Complex * | ws
| ) |  | const

Map Gauss-Legendre points provided by gauss_nodes_and_weights to a complex interval \( (x_1,x_2) \).

The documentation for this class was generated from the following files:

- src/gauss.h
- src/gauss.cpp