25 template <
typename number>
28 const unsigned int n_intervals,
29 const unsigned int interval,
32 , n_intervals(n_intervals)
35 , index(
numbers::invalid_unsigned_int)
43 template <
typename number>
46 const unsigned int index)
47 : n_intervals(
numbers::invalid_unsigned_int)
48 , interval(
numbers::invalid_unsigned_int)
49 , spans_two_intervals(
false)
56 for (
unsigned int i = 0; i <
points.size(); ++i)
60 for (
unsigned int i = 0; i <
points.size() - 1; ++i)
67 template <
typename number>
70 std::vector<number> &values)
const
74 value(
x, values.size() - 1, values.data());
79 template <
typename number>
85 if (points.size() > 0)
87 if (
x > points[index])
88 values[0] = std::max<number>(0.0,
89 1.0 - (
x - points[index]) *
90 one_over_lengths[index]);
91 else if (
x < points[index])
92 values[0] = std::max<number>(0.0,
93 0.0 + (
x - points[index - 1]) *
94 one_over_lengths[index - 1]);
100 if ((
x > points[index]) && (points[index + 1] >=
x))
101 values[1] = -1.0 * one_over_lengths[index];
102 else if ((
x < points[index]) && (points[index - 1] <=
x))
103 values[1] = +1.0 * one_over_lengths[index - 1];
120 const number step = 1. / n_intervals;
122 if (spans_two_intervals)
124 const double offset = step * interval;
131 else if (
x < offset + step)
136 y = offset + step + step -
x;
141 const double offset = step * interval;
151 else if (
x > offset + step)
168 values[0] = value(
x);
184 template <
typename number>
188 return (polynomial.memory_consumption() +
198 std::vector<PiecewisePolynomial<double>>
200 const unsigned int n_subdivisions,
203 std::vector<Polynomial<double>>
p_base =
205 for (
auto &polynomial :
p_base)
206 polynomial.scale(n_subdivisions);
208 std::vector<PiecewisePolynomial<double>> p;
211 p.emplace_back(
p_base[0], n_subdivisions, 0,
false);
212 for (
unsigned int s = 0; s < n_subdivisions; ++s)
214 p.emplace_back(
p_base[i + 1],
223 std::vector<PiecewisePolynomial<double>>
225 const std::vector<
Point<1>> &points)
227 std::vector<PiecewisePolynomial<double>> p;
228 p.reserve(points.size());
230 for (
unsigned int s = 0; s < points.size(); ++s)
231 p.emplace_back(points, s);
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)
std::vector< number > one_over_lengths
number value(const number x) const
virtual std::size_t memory_consumption() const
std::vector< number > points
#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_t< std::is_fundamental_v< T >, std::size_t > memory_consumption(const T &t)
std::vector< PiecewisePolynomial< double > > generate_complete_linear_basis_on_subdivisions(const std::vector< Point< 1 > > &points)
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 > &)