Reference documentation for deal.II version 9.2.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
histogram.h
Go to the documentation of this file.
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 
23 
24 #include <deal.II/lac/vector.h>
25 
26 #include <string>
27 #include <vector>
28 
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 
247 
248 #endif
DeclExceptionMsg
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:496
Histogram::write_gnuplot
void write_gnuplot(std::ostream &out) const
Definition: histogram.cc:225
Histogram::logarithmic_less
static bool logarithmic_less(const number n1, const number n2)
Definition: histogram.cc:30
Histogram::ExcInvalidName
static ::ExceptionBase & ExcInvalidName(std::string arg1)
Histogram::Interval::memory_consumption
std::size_t memory_consumption() const
Definition: histogram.cc:47
Histogram::IntervalSpacing
IntervalSpacing
Definition: histogram.h:78
Histogram::get_interval_spacing_names
static std::string get_interval_spacing_names()
Definition: histogram.cc:279
Histogram::Interval::content
unsigned int content
Definition: histogram.h:215
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
Histogram::Interval
Definition: histogram.h:187
DeclException1
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:518
exceptions.h
Histogram::Interval::Interval
Interval(const double left_point, const double right_point)
Definition: histogram.cc:38
Histogram::Interval::left_point
double left_point
Definition: histogram.h:205
vector.h
Histogram::ExcIncompatibleArraySize
static ::ExceptionBase & ExcIncompatibleArraySize(int arg1, int arg2)
Histogram
Definition: histogram.h:72
Histogram::ExcEmptyData
static ::ExceptionBase & ExcEmptyData()
Histogram::logarithmic
@ logarithmic
Definition: histogram.h:87
Histogram::Interval::right_point
double right_point
Definition: histogram.h:210
Histogram::y_values
std::vector< double > y_values
Definition: histogram.h:242
config.h
Histogram::evaluate
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
Histogram::parse_interval_spacing
static IntervalSpacing parse_interval_spacing(const std::string &name)
Definition: histogram.cc:287
Histogram::intervals
std::vector< std::vector< Interval > > intervals
Definition: histogram.h:236
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
Vector< number >
DeclException2
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:541
Histogram::linear
@ linear
Definition: histogram.h:83
Histogram::memory_consumption
std::size_t memory_consumption() const
Definition: histogram.cc:304