Reference documentation for deal.II version 9.4.1
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
function_cspline.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 2016 - 2022 by the deal.II authors
4//
5// This file is part of the deal.II library.
6//
7// The deal.II library is free software; you can use it, redistribute
8// it, and/or modify it under the terms of the GNU Lesser General
9// Public License as published by the Free Software Foundation; either
10// version 2.1 of the License, or (at your option) any later version.
11// The full text of the license can be found in the file LICENSE.md at
12// the top level directory of deal.II.
13//
14// ---------------------------------------------------------------------
15
16#ifndef dealii_function_cspline_h
17#define dealii_function_cspline_h
18
19#include <deal.II/base/config.h>
20
21#ifdef DEAL_II_WITH_GSL
23# include <deal.II/base/point.h>
25
26# include <gsl/gsl_spline.h>
27
28# include <memory>
29
31
32namespace Functions
33{
35 int,
36 << "Interpolation points vector size can not be <" << arg1
37 << ">.");
38
40 int,
41 int,
42 << "The size of interpolation points <" << arg1
43 << "> is different from the size of interpolation values <"
44 << arg2 << ">.");
45
46
48 int,
49 double,
50 double,
51 << "The input interpolation points are not strictly ordered : "
52 << std::endl
53 << "x[" << arg1 << "] = " << arg2 << " >= x[" << (arg1 + 1)
54 << "] = " << arg3 << '.');
55
58 double,
59 double,
60 double,
61 << "Spline function can not be evaluated outside of the interpolation range: "
62 << std::endl
63 << arg1 << " is not in [" << arg2 << ';' << arg3 << "].");
64
75 template <int dim>
76 class CSpline : public Function<dim>
77 {
78 public:
84 CSpline(const std::vector<double> &interpolation_points,
85 const std::vector<double> &interpolation_values);
86
87 virtual double
88 value(const Point<dim> & point,
89 const unsigned int component = 0) const override;
90
91 virtual Tensor<1, dim>
92 gradient(const Point<dim> & p,
93 const unsigned int component = 0) const override;
94
96 hessian(const Point<dim> & p,
97 const unsigned int component = 0) const override;
98
99 virtual double
100 laplacian(const Point<dim> & p,
101 const unsigned int component = 0) const override;
102
106 virtual std::size_t
107 memory_consumption() const override;
108
109 private:
113 const std::vector<double> interpolation_points;
114
118 const std::vector<double> interpolation_values;
119
123 std::unique_ptr<gsl_interp_accel, void (*)(gsl_interp_accel *)> acc;
124
128 std::unique_ptr<gsl_spline, void (*)(gsl_spline *)> cspline;
129
134 };
135} // namespace Functions
136
138
139#endif
140
141#endif
virtual SymmetricTensor< 2, dim > hessian(const Point< dim > &p, const unsigned int component=0) const override
Threads::Mutex acc_mutex
virtual double value(const Point< dim > &point, const unsigned int component=0) const override
virtual std::size_t memory_consumption() const override
std::unique_ptr< gsl_interp_accel, void(*)(gsl_interp_accel *)> acc
const std::vector< double > interpolation_points
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const override
const std::vector< double > interpolation_values
std::unique_ptr< gsl_spline, void(*)(gsl_spline *)> cspline
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const override
Definition: point.h:111
Definition: tensor.h:503
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
static ::ExceptionBase & ExcCSplineSizeMismatch(int arg1, int arg2)
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:532
static ::ExceptionBase & ExcCSplineRange(double arg1, double arg2, double arg3)
#define DeclException3(Exception3, type1, type2, type3, outsequence)
Definition: exceptions.h:555
static ::ExceptionBase & ExcCSplineOrder(int arg1, double arg2, double arg3)
static ::ExceptionBase & ExcCSplineEmpty(int arg1)
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:509