| 1 |
// ------------------------------------------------------------------------ |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 |
// Copyright (C) 2017 - 2023 by the deal.II authors |
| 5 |
// |
| 6 |
// This file is part of the deal.II library. |
| 7 |
// |
| 8 |
// Part of the source code is dual licensed under Apache-2.0 WITH |
| 9 |
// LLVM-exception OR LGPL-2.1-or-later. Detailed license information |
| 10 |
// governing the source code and code contributions can be found in |
| 11 |
// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II. |
| 12 |
// |
| 13 |
// ------------------------------------------------------------------------ |
| 14 |
|
| 15 |
#ifndef dealii_polynomials_integrated_legendre_sz_h |
| 16 |
#define dealii_polynomials_integrated_legendre_sz_h |
| 17 |
|
| 18 |
#include <deal.II/base/config.h> |
| 19 |
|
| 20 |
#include <deal.II/base/exceptions.h> |
| 21 |
#include <deal.II/base/point.h> |
| 22 |
#include <deal.II/base/polynomial.h> |
| 23 |
|
| 24 |
|
| 25 |
DEAL_II_NAMESPACE_OPEN |
| 26 |
|
| 27 |
/** |
| 28 |
* Class implementing the integrated Legendre polynomials described in the PhD |
| 29 |
* thesis of Sabine Zaglmayr. |
| 30 |
* |
| 31 |
* This class was written based upon the existing deal.II Legendre class as a |
| 32 |
* base, but with the coefficients adjusted so that the recursive formula is for |
| 33 |
* the integrated Legendre polynomials described in the PhD thesis of Sabine |
| 34 |
* Zaglmayr. The polynomials can be generated recursively from: |
| 35 |
* |
| 36 |
* - $L_{0}(x) = -1$ (added so that it can be generated recursively from 0) |
| 37 |
* - $L_{1}(x) = x$ |
| 38 |
* - $L_{2}(x) = \frac{(x^2 - 1)}{2}$ |
| 39 |
* - $(n+1)L_{n+1} = (2n-1)L_{n} - (n-2)L_{n-1}$. |
| 40 |
* |
| 41 |
* However, it is also possible to generate them directly from the Legendre |
| 42 |
* polynomials: |
| 43 |
* |
| 44 |
* $L_{n} = \frac{l_{n} - l_{n-2}}{2n-1)}$ |
| 45 |
*/ |
| 46 |
class IntegratedLegendreSZ : public Polynomials::Polynomial<double> |
| 47 |
{ |
| 48 |
public: |
| 49 |
/** |
| 50 |
* Constructor generating the coefficients of the polynomials at degree p. |
| 51 |
*/ |
| 52 |
IntegratedLegendreSZ(const unsigned int p); |
| 53 |
|
| 54 |
/** |
| 55 |
* Return the complete set of Integrated Legendre polynomials up to the |
| 56 |
* given degree. |
| 57 |
*/ |
| 58 |
static std::vector<Polynomials::Polynomial<double>> |
| 59 |
generate_complete_basis(const unsigned int degree); |
| 60 |
|
| 61 |
private: |
| 62 |
/** |
| 63 |
* Main function to compute the co-efficients of the polynomial at degree p. |
| 64 |
*/ |
| 65 |
static std::vector<double> |
| 66 |
get_coefficients(const unsigned int k); |
| 67 |
}; |
| 68 |
|
| 69 |
DEAL_II_NAMESPACE_CLOSE |
| 70 |
|
| 71 |
#endif |