Reference documentation for deal.II version 9.0.0
histogram.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2017 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  {
85  };
86 
87 
111  template <typename number>
112  void evaluate (const std::vector<Vector<number> > &values,
113  const std::vector<double> &y_values,
114  const unsigned int n_intervals,
115  const IntervalSpacing interval_spacing = linear);
116 
121  template <typename number>
122  void evaluate (const Vector<number> &values,
123  const unsigned int n_intervals,
124  const IntervalSpacing interval_spacing = linear);
125 
131  void write_gnuplot (std::ostream &out) const;
132 
137  static std::string get_interval_spacing_names ();
138 
144  static IntervalSpacing parse_interval_spacing (const std::string &name);
145 
150  std::size_t memory_consumption () const;
151 
156  "Your input argument to this function does not appear to "
157  "have any data in it.");
162  int, int,
163  << "The two array sizes " << arg1 << " and " << arg2
164  << " must match, but don't.");
169  std::string,
170  << "The given name <" << arg1
171  << "> does not match any of the known formats.");
172 
173 private:
177  struct Interval
178  {
183  Interval (const double left_point,
184  const double right_point);
185 
190  std::size_t memory_consumption () const;
191 
195  double left_point;
196 
200  double right_point;
201 
205  unsigned int content;
206  };
207 
218  template <typename number>
219  static bool logarithmic_less (const number n1,
220  const number n2);
221 
226  std::vector<std::vector<Interval> > intervals;
227 
232  std::vector<double> y_values;
233 };
234 
235 
236 DEAL_II_NAMESPACE_CLOSE
237 
238 #endif
std::vector< std::vector< Interval > > intervals
Definition: histogram.h:226
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:358
static ::ExceptionBase & ExcInvalidName(std::string arg1)
Interval(const double left_point, const double right_point)
Definition: histogram.cc:36
static ::ExceptionBase & ExcIncompatibleArraySize(int arg1, int arg2)
std::size_t memory_consumption() const
Definition: histogram.cc:316
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:346
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:217
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:335
static bool logarithmic_less(const number n1, const number n2)
Definition: histogram.cc:26
std::size_t memory_consumption() const
Definition: histogram.cc:46
std::vector< double > y_values
Definition: histogram.h:232
IntervalSpacing
Definition: histogram.h:75
static IntervalSpacing parse_interval_spacing(const std::string &name)
Definition: histogram.cc:299
static ::ExceptionBase & ExcEmptyData()
static std::string get_interval_spacing_names()
Definition: histogram.cc:291
unsigned int content
Definition: histogram.h:205