Reference documentation for deal.II version 8.4.2
histogram.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2015 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 at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii__histogram_h
17 #define dealii__histogram_h
18 
19 
20 #include <deal.II/base/config.h>
21 #include <deal.II/base/exceptions.h>
22 #include <deal.II/lac/vector.h>
23 #include <vector>
24 #include <string>
25 
26 DEAL_II_NAMESPACE_OPEN
27 
28 
69 class Histogram
70 {
71 public:
76  {
77  linear, logarithmic
78  };
79 
80 
104  template <typename number>
105  void evaluate (const std::vector<Vector<number> > &values,
106  const std::vector<double> &y_values,
107  const unsigned int n_intervals,
108  const IntervalSpacing interval_spacing = linear);
109 
114  template <typename number>
115  void evaluate (const Vector<number> &values,
116  const unsigned int n_intervals,
117  const IntervalSpacing interval_spacing = linear);
118 
124  void write_gnuplot (std::ostream &out) const;
125 
130  static std::string get_interval_spacing_names ();
131 
137  static IntervalSpacing parse_interval_spacing (const std::string &name);
138 
143  std::size_t memory_consumption () const;
144 
148  DeclExceptionMsg (ExcEmptyData,
149  "Your input argument to this function does not appear to "
150  "have any data in it.");
154  DeclException2 (ExcIncompatibleArraySize,
155  int, int,
156  << "The two array sizes " << arg1 << " and " << arg2
157  << " must match, but don't.");
161  DeclException1 (ExcInvalidName,
162  std::string,
163  << "The given name <" << arg1
164  << "> does not match any of the known formats.");
165 
166 private:
170  struct Interval
171  {
176  Interval (const double left_point,
177  const double right_point);
178 
183  std::size_t memory_consumption () const;
184 
188  double left_point;
189 
193  double right_point;
194 
198  unsigned int content;
199  };
200 
211  template <typename number>
212  static bool logarithmic_less (const number n1,
213  const number n2);
214 
219  std::vector<std::vector<Interval> > intervals;
220 
225  std::vector<double> y_values;
226 };
227 
228 
229 DEAL_II_NAMESPACE_CLOSE
230 
231 #endif
std::vector< std::vector< Interval > > intervals
Definition: histogram.h:219
Interval(const double left_point, const double right_point)
Definition: histogram.cc:36
DeclException1(ExcInvalidName, std::string,<< "The given name <"<< arg1<< "> does not match any of the known formats.")
std::size_t memory_consumption() const
Definition: histogram.cc:317
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:54
void write_gnuplot(std::ostream &out) const
Definition: histogram.cc:218
static bool logarithmic_less(const number n1, const number n2)
Definition: histogram.cc:26
std::size_t memory_consumption() const
Definition: histogram.cc:46
DeclExceptionMsg(ExcEmptyData, "Your input argument to this function does not appear to " "have any data in it.")
std::vector< double > y_values
Definition: histogram.h:225
DeclException2(ExcIncompatibleArraySize, int, int,<< "The two array sizes "<< arg1<< " and "<< arg2<< " must match, but don't.")
IntervalSpacing
Definition: histogram.h:75
static IntervalSpacing parse_interval_spacing(const std::string &name)
Definition: histogram.cc:300
static std::string get_interval_spacing_names()
Definition: histogram.cc:292
unsigned int content
Definition: histogram.h:198