Bayeux  3.4.1
Core Foundation library for SuperNEMO
linear_sampling.h
Go to the documentation of this file.
1 //
4 // Copyright (c) 2016 by François Mauger <mauger@lpccaen.in2p3.fr>
5 //
6 // This file is part of Bayeux.
7 //
8 // Bayeux is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation, either version 3 of the License, or
11 // (at your option) any later version.
12 //
13 // Bayeux is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with Bayeux. If not, see <http://www.gnu.org/licenses/>.
20 
21 #ifndef MYGSL_LINEAR_SAMPLING_H
22 #define MYGSL_LINEAR_SAMPLING_H
23 
24 // This project:
25 #include <mygsl/base_sampling.h>
26 
27 namespace mygsl {
28 
31  : public base_sampling
32  {
33  public:
34 
37 
39  virtual ~linear_sampling();
40 
42  virtual double get_min() const;
43 
45  virtual double get_max() const;
46 
48  std::size_t get_nsteps() const;
49 
51  std::size_t get_nsamples() const;
52 
54  double get_step() const;
55 
57  double get_guard() const;
58 
60  virtual bool is_initialized() const;
61 
63  virtual void initialize(const datatools::properties &);
64 
66  virtual void reset();
67 
69  virtual bool value_to_index(const double x_,
70  std::size_t & index_,
71  sampling::index_classification_type & classification_flags_) const;
72 
75  index_to_value(const std::size_t index_, double & value_) const;
76 
85  void make_range(const double min_,
86  const double max_,
87  const std::size_t nsteps_,
88  const double guard_ = 0.0);
89 
99  void make_from_min(const double min_,
100  const std::size_t nsteps_,
101  const double step_,
102  const double guard_ = 0.0);
103 
104 
115  void make_to_max(const double max_,
116  const std::size_t nsteps_,
117  const double step_,
118  const double guard_ = 0.0);
119 
120  private:
121 
122  void _set_guard_(double guard_);
123 
124  void _init_();
125 
126  void _reset_();
127 
128  private:
129 
130  double _min_;
131  double _max_;
132  std::size_t _nsteps_;
133  double _step_;
134  double _guard_;
135 
136  };
137 
138 } // end of namespace mygsl
139 
140 #endif // MYGSL_BASE_SAMPLING_H
141 
142 // Local Variables: --
143 // mode: c++ --
144 // c-file-style: "gnu" --
145 // tab-width: 2 --
146 // End: --
virtual bool is_initialized() const
Check the initialization status of the sampling.
void make_from_min(const double min_, const std::size_t nsteps_, const double step_, const double guard_=0.0)
Base class for all sampling models.
Definition: base_sampling.h:34
virtual void reset()
Reset/invalidate the sampling.
void make_range(const double min_, const double max_, const std::size_t nsteps_, const double guard_=0.0)
virtual bool value_to_index(const double x_, std::size_t &index_, sampling::index_classification_type &classification_flags_) const
Return the index and a classification associated to a value.
Base sampling.
std::size_t get_nsamples() const
Return the number of nsamples.
void make_to_max(const double max_, const std::size_t nsteps_, const double step_, const double guard_=0.0)
index_classification_type
Definition: sampling_utils.h:53
double get_step() const
Return the step.
double get_guard() const
Return the absolute guard distance around sampling values.
std::size_t get_nsteps() const
Return the number of steps.
virtual double get_min() const
Return the minimum sample.
virtual ~linear_sampling()
Destructor.
linear_sampling()
Default constructor.
Top-level namespace of the Bayeux/mygsl module library.
Definition: base_decay_driver.h:47
virtual sampling::index_classification_type index_to_value(const std::size_t index_, double &value_) const
Return the value associated to a given index.
Linear sampling model.
Definition: linear_sampling.h:30
virtual void initialize(const datatools::properties &)
Reset/invalidate the sampling.
virtual double get_max() const
Return the maximum sample.
A dictionary of arbitrary properties.
Definition: properties.h:125