26 template <
typename number>
29 const unsigned int n_intervals,
30 const unsigned int interval,
31 const bool spans_next_interval)
32 : polynomial(coefficients_on_interval)
33 , n_intervals(n_intervals)
35 , spans_two_intervals(spans_next_interval)
43 template <
typename number>
46 std::vector<number> &
values)
const
55 template <
typename number>
58 const unsigned int n_derivatives,
63 double derivative_change_sign = 1.;
66 const number step = 1. / n_intervals;
68 if (spans_two_intervals)
70 const double offset = step * interval;
71 if (x < offset || x > offset + step + step)
73 for (
unsigned int k = 0; k <= n_derivatives; ++k)
77 else if (x < offset + step)
81 derivative_change_sign = -1.;
82 y = offset + step + step - x;
87 const double offset = step * interval;
88 if (x < offset || x > offset + step)
90 for (
unsigned int k = 0; k <= n_derivatives; ++k)
101 (interval > 0 || derivative_change_sign == -1.)) ||
103 (interval < n_intervals - 1 || derivative_change_sign == -1.)))
106 for (
unsigned int d = 1;
d <= n_derivatives; ++
d)
112 polynomial.value(y, n_derivatives,
values);
115 for (
unsigned int j = 1; j <= n_derivatives; j += 2)
116 values[j] *= derivative_change_sign;
121 template <
typename number>
125 return (polynomial.memory_consumption() +
133 std::vector<PiecewisePolynomial<double>>
135 const unsigned int n_subdivisions,
136 const unsigned int base_degree)
138 std::vector<Polynomial<double>> p_base =
140 for (
auto &polynomial : p_base)
141 polynomial.scale(n_subdivisions);
143 std::vector<PiecewisePolynomial<double>> p;
144 p.reserve(n_subdivisions * base_degree + 1);
146 p.emplace_back(p_base[0], n_subdivisions, 0,
false);
147 for (
unsigned int s = 0; s < n_subdivisions; ++s)
148 for (
unsigned int i = 0; i < base_degree; ++i)
149 p.emplace_back(p_base[i + 1],
152 i == (base_degree - 1) && s < n_subdivisions - 1);
162 template class PiecewisePolynomial<float>;
163 template class PiecewisePolynomial<double>;
164 template class PiecewisePolynomial<long double>;
static std::vector< Polynomial< double > > generate_complete_basis(const unsigned int degree)
PiecewisePolynomial(const Polynomial< number > &coefficients_on_interval, const unsigned int n_intervals, const unsigned int interval, const bool spans_next_interval)
number value(const number x) const
virtual std::size_t memory_consumption() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcZero()
#define Assert(cond, exc)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcMessage(std::string arg1)
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
std::vector< PiecewisePolynomial< double > > generate_complete_Lagrange_basis_on_subdivisions(const unsigned int n_subdivisions, const unsigned int base_degree)
::VectorizedArray< Number, width > abs(const ::VectorizedArray< Number, width > &)