Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
histogram.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2018 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_histogram_h
17 #define dealii_histogram_h
18 
19 
20 #include <deal.II/base/config.h>
21 
22 #include <deal.II/base/exceptions.h>
23 
24 #include <deal.II/lac/vector.h>
25 
26 #include <string>
27 #include <vector>
28 
29 DEAL_II_NAMESPACE_OPEN
30 
31 
72 class Histogram
73 {
74 public:
79  {
88  };
89 
90 
114  template <typename number>
115  void
116  evaluate(const std::vector<Vector<number>> &values,
117  const std::vector<double> & y_values,
118  const unsigned int n_intervals,
119  const IntervalSpacing interval_spacing = linear);
120 
125  template <typename number>
126  void
127  evaluate(const Vector<number> &values,
128  const unsigned int n_intervals,
129  const IntervalSpacing interval_spacing = linear);
130 
136  void
137  write_gnuplot(std::ostream &out) const;
138 
143  static std::string
145 
151  static IntervalSpacing
152  parse_interval_spacing(const std::string &name);
153 
158  std::size_t
159  memory_consumption() const;
160 
165  "Your input argument to this function does not appear to "
166  "have any data in it.");
171  int,
172  int,
173  << "The two array sizes " << arg1 << " and " << arg2
174  << " must match, but don't.");
179  std::string,
180  << "The given name <" << arg1
181  << "> does not match any of the known formats.");
182 
183 private:
187  struct Interval
188  {
193  Interval(const double left_point, const double right_point);
194 
199  std::size_t
200  memory_consumption() const;
201 
205  double left_point;
206 
210  double right_point;
211 
215  unsigned int content;
216  };
217 
228  template <typename number>
229  static bool
230  logarithmic_less(const number n1, const number n2);
231 
236  std::vector<std::vector<Interval>> intervals;
237 
242  std::vector<double> y_values;
243 };
244 
245 
246 DEAL_II_NAMESPACE_CLOSE
247 
248 #endif
std::vector< std::vector< Interval > > intervals
Definition: histogram.h:236
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:541
static ::ExceptionBase & ExcInvalidName(std::string arg1)
Interval(const double left_point, const double right_point)
Definition: histogram.cc:38
static ::ExceptionBase & ExcIncompatibleArraySize(int arg1, int arg2)
void evaluate(const std::vector< Vector< number >> &values, const std::vector< double > &y_values, const unsigned int n_intervals, const IntervalSpacing interval_spacing=linear)
Definition: histogram.cc:56
std::size_t memory_consumption() const
Definition: histogram.cc:304
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:518
void write_gnuplot(std::ostream &out) const
Definition: histogram.cc:225
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:496
static bool logarithmic_less(const number n1, const number n2)
Definition: histogram.cc:30
std::size_t memory_consumption() const
Definition: histogram.cc:47
std::vector< double > y_values
Definition: histogram.h:242
IntervalSpacing
Definition: histogram.h:78
static IntervalSpacing parse_interval_spacing(const std::string &name)
Definition: histogram.cc:287
static ::ExceptionBase & ExcEmptyData()
static std::string get_interval_spacing_names()
Definition: histogram.cc:279
unsigned int content
Definition: histogram.h:215