Reference documentation for deal.II version 9.2.0
\(\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\}}\)
function_cspline.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2016 - 2019 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
22 # include <deal.II/base/function.h>
23 # include <deal.II/base/point.h>
25 
26 # include <gsl/gsl_spline.h>
27 
29 
30 namespace Functions
31 {
33  int,
34  << "Interpolation points vector size can not be <" << arg1
35  << ">.");
36 
38  int,
39  int,
40  << "The size of interpolation points <" << arg1
41  << "> is different from the size of interpolation values <"
42  << arg2 << ">.");
43 
44 
46  int,
47  double,
48  double,
49  << "The input interpolation points are not strictly ordered : "
50  << std::endl
51  << "x[" << arg1 << "] = " << arg2 << " >= x[" << (arg1 + 1)
52  << "] = " << arg3 << ".");
53 
56  double,
57  double,
58  double,
59  << "Spline function can not be evaluated outside of the interpolation range: "
60  << std::endl
61  << arg1 << " is not in [" << arg2 << ";" << arg3 << "].");
62 
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 
90  virtual ~CSpline() override;
91 
92  virtual double
93  value(const Point<dim> & point,
94  const unsigned int component = 0) const override;
95 
96  virtual Tensor<1, dim>
97  gradient(const Point<dim> & p,
98  const unsigned int component = 0) const override;
99 
101  hessian(const Point<dim> & p,
102  const unsigned int component = 0) const override;
103 
104  virtual double
105  laplacian(const Point<dim> & p,
106  const unsigned int component = 0) const override;
107 
108  std::size_t
109  memory_consumption() const;
110 
111  private:
115  const std::vector<double> interpolation_points;
116 
120  const std::vector<double> interpolation_values;
121 
125  gsl_interp_accel *acc;
126 
130  gsl_spline *cspline;
131 
136  };
137 } // namespace Functions
138 
140 
141 #endif
142 
143 #endif
Functions::CSpline::value
virtual double value(const Point< dim > &point, const unsigned int component=0) const override
Definition: function_cspline.cc:71
Functions
Definition: flow_function.h:28
Functions::CSpline::interpolation_points
const std::vector< double > interpolation_points
Definition: function_cspline.h:115
SymmetricTensor< 2, dim >
Threads::Mutex
Definition: thread_management.h:91
OpenCASCADE::point
Point< spacedim > point(const gp_Pnt &p, const double tolerance=1e-10)
Definition: utilities.cc:188
thread_management.h
Functions::CSpline::interpolation_values
const std::vector< double > interpolation_values
Definition: function_cspline.h:120
Functions::ExcCSplineEmpty
static ::ExceptionBase & ExcCSplineEmpty(int arg1)
Functions::CSpline::acc_mutex
Threads::Mutex acc_mutex
Definition: function_cspline.h:135
Functions::CSpline::acc
gsl_interp_accel * acc
Definition: function_cspline.h:125
Tensor< 1, dim >
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
DeclException3
#define DeclException3(Exception3, type1, type2, type3, outsequence)
Definition: exceptions.h:564
DeclException1
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:518
Functions::CSpline::~CSpline
virtual ~CSpline() override
Definition: function_cspline.cc:59
Functions::CSpline
Definition: function_cspline.h:76
Functions::CSpline::gradient
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const override
Definition: function_cspline.cc:92
Functions::CSpline::CSpline
CSpline(const std::vector< double > &interpolation_points, const std::vector< double > &interpolation_values)
Definition: function_cspline.cc:27
Functions::CSpline::memory_consumption
std::size_t memory_consumption() const
Definition: function_cspline.cc:148
Functions::ExcCSplineOrder
static ::ExceptionBase & ExcCSplineOrder(int arg1, double arg2, double arg3)
function.h
Functions::ExcCSplineRange
static ::ExceptionBase & ExcCSplineRange(double arg1, double arg2, double arg3)
Functions::CSpline::hessian
virtual SymmetricTensor< 2, dim > hessian(const Point< dim > &p, const unsigned int component=0) const override
Definition: function_cspline.cc:137
Functions::CSpline::laplacian
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const override
Definition: function_cspline.cc:116
Functions::ExcCSplineSizeMismatch
static ::ExceptionBase & ExcCSplineSizeMismatch(int arg1, int arg2)
Point< dim >
config.h
Function
Definition: function.h:151
Functions::CSpline::cspline
gsl_spline * cspline
Definition: function_cspline.h:130
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
DeclException2
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:541
point.h