27template <
typename number>
31 return (((n1 < n2) && (n1 > 0)) || ((n1 < n2) && (n2 <= 0)) ||
32 ((n2 < n1) && (n1 > 0) && (n2 <= 0)));
53template <
typename number>
56 const std::vector<double> &y_values_,
57 const unsigned int n_intervals,
62 "Your input data needs to contain at least one input vector."));
64 ExcMessage(
"The number of intervals needs to be at least one."));
65 for (
unsigned int i = 0; i < values.size(); ++i)
67 Assert(values.size() == y_values_.size(),
75 number min_value = 0, max_value = 0;
76 switch (interval_spacing)
80 min_value = *std::min_element(values[0].
begin(), values[0].
end());
81 max_value = *std::max_element(values[0].
begin(), values[0].
end());
83 for (
unsigned int i = 1; i < values.size(); ++i)
87 *std::min_element(values[i].
begin(), values[i].
end()));
90 *std::max_element(values[i].
begin(), values[i].
end()));
98 const auto logarithmic_less_function =
101 min_value = *std::min_element(values[0].
begin(),
103 logarithmic_less_function);
105 max_value = *std::max_element(values[0].
begin(),
107 logarithmic_less_function);
109 for (
unsigned int i = 1; i < values.size(); ++i)
112 *std::min_element(values[i].
begin(),
114 logarithmic_less_function),
115 logarithmic_less_function);
118 *std::max_element(values[i].
begin(),
120 logarithmic_less_function),
121 logarithmic_less_function);
136 if (max_value <= min_value)
137 max_value = min_value + 1;
150 switch (interval_spacing)
154 const float delta = (max_value - min_value) / n_intervals;
156 for (
unsigned int n = 0;
n < n_intervals; ++
n)
157 intervals[0].emplace_back(min_value +
n * delta,
158 min_value + (
n + 1) * delta);
168 for (
unsigned int n = 0;
n < n_intervals; ++
n)
181 for (
unsigned int i = 1; i < values.size(); ++i)
186 for (
unsigned int i = 0; i < values.size(); ++i)
197 for (
unsigned int n = 0;
n < n_intervals; ++
n)
208template <
typename number>
211 const unsigned int n_intervals,
214 std::vector<Vector<number>> values_list(1, values);
216 std::vector<double>(1, 0.),
228 ExcMessage(
"There is nothing to write into the output file. "
229 "Did you forget to call the evaluate() function?"));
235 for (
const auto &interval :
intervals[0])
236 out << interval.left_point <<
' ' << interval.content << std::endl
237 << interval.right_point <<
' ' << interval.content << std::endl;
248 for (
int i =
intervals.size() - 1; i >= 0; --i)
252 << (i <
static_cast<int>(
intervals.size()) - 1 ?
255 <<
' ' <<
intervals[i][
n].content << std::endl
257 << (i < static_cast<int>(
intervals.size()) - 1 ?
260 <<
' ' <<
intervals[i][
n].content << std::endl;
280 return "linear|logarithmic";
288 if (name ==
"linear")
290 else if (name ==
"logarithmic")
314 const std::vector<double> &
y_values,
315 const unsigned int n_intervals,
319 const unsigned int n_intervals,
326 const std::vector<double> &
y_values,
327 const unsigned int n_intervals,
331 const unsigned int n_intervals,
void write_gnuplot(std::ostream &out) const
static std::string get_interval_spacing_names()
std::vector< double > y_values
static IntervalSpacing parse_interval_spacing(const std::string &name)
static bool logarithmic_less(const number n1, const number n2)
std::vector< std::vector< Interval > > intervals
std::size_t memory_consumption() const
void evaluate(const std::vector< Vector< number > > &values, const std::vector< double > &y_values, const unsigned int n_intervals, const IntervalSpacing interval_spacing=linear)
const value_type * const_iterator
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
cell_iterator begin(const unsigned int level=0) const
cell_iterator end() const
#define DEAL_II_ASSERT_UNREACHABLE()
static ::ExceptionBase & ExcInvalidName(std::string arg1)
static ::ExceptionBase & ExcIO()
#define Assert(cond, exc)
static ::ExceptionBase & ExcIncompatibleArraySize(int arg1, int arg2)
static ::ExceptionBase & ExcEmptyData()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
std::enable_if_t< std::is_fundamental_v< T >, std::size_t > memory_consumption(const T &t)
::VectorizedArray< Number, width > log(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > exp(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
Interval(const double left_point, const double right_point)
std::size_t memory_consumption() const