Reference documentation for deal.II version 8.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
histogram.h
1 // ---------------------------------------------------------------------
2 // @f$Id: histogram.h 30036 2013-07-18 16:55:32Z maier @f$
3 //
4 // Copyright (C) 1999 - 2013 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // The deal.II library is free software; you can use it, redistribute
9 // it, and/or modify it under the terms of the GNU Lesser General
10 // Public License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 // The full text of the license can be found in the file LICENSE at
13 // the top level of the deal.II distribution.
14 //
15 // ---------------------------------------------------------------------
16 
17 #ifndef __deal2__histogram_h
18 #define __deal2__histogram_h
19 
20 
21 #include <deal.II/base/config.h>
23 #include <deal.II/lac/vector.h>
24 #include <vector>
25 #include <string>
26 
27 DEAL_II_NAMESPACE_OPEN
28 
29 
71 class Histogram
72 {
73 public:
79  {
80  linear, logarithmic
81  };
82 
83 
120  template <typename number>
121  void evaluate (const std::vector<Vector<number> > &values,
122  const std::vector<double> &y_values,
123  const unsigned int n_intervals,
124  const IntervalSpacing interval_spacing = linear);
125 
131  template <typename number>
132  void evaluate (const Vector<number> &values,
133  const unsigned int n_intervals,
134  const IntervalSpacing interval_spacing = linear);
135 
143  void write_gnuplot (std::ostream &out) const;
144 
150  static std::string get_interval_spacing_names ();
151 
159  static IntervalSpacing parse_interval_spacing (const std::string &name);
160 
166  std::size_t memory_consumption () const;
167 
171  DeclException0 (ExcEmptyData);
175  DeclException0 (ExcInvalidIntervals);
179  DeclException0 (ExcInvalidData);
183  DeclException2 (ExcIncompatibleArraySize,
184  int, int,
185  << "The two array sizes " << arg1 << " and " << arg2
186  << " must match, but don't.");
190  DeclException1 (ExcInvalidName,
191  std::string,
192  << "The given name <" << arg1
193  << "> does not match any of the known formats.");
194 
195 private:
200  struct Interval
201  {
207  Interval (const double left_point,
208  const double right_point);
209 
215  std::size_t memory_consumption () const;
216 
220  double left_point;
221 
225  double right_point;
226 
231  unsigned int content;
232  };
233 
251  template <typename number>
252  static bool logarithmic_less (const number n1,
253  const number n2);
254 
260  std::vector<std::vector<Interval> > intervals;
261 
267  std::vector<double> y_values;
268 };
269 
270 
271 DEAL_II_NAMESPACE_CLOSE
272 
273 #endif
std::vector< std::vector< Interval > > intervals
Definition: histogram.h:260
void write_gnuplot(std::ostream &out) const
Interval(const double left_point, const double right_point)
DeclException1(ExcInvalidName, std::string,<< "The given name <"<< arg1<< "> does not match any of the known formats.")
static std::string get_interval_spacing_names()
DeclException0(ExcEmptyData)
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)
static IntervalSpacing parse_interval_spacing(const std::string &name)
std::size_t memory_consumption() const
std::vector< double > y_values
Definition: histogram.h:267
static bool logarithmic_less(const number n1, const number n2)
DeclException2(ExcIncompatibleArraySize, int, int,<< "The two array sizes "<< arg1<< " and "<< arg2<< " must match, but don't.")
IntervalSpacing
Definition: histogram.h:78
unsigned int content
Definition: histogram.h:231