Bayeux  3.4.1
Core Foundation library for SuperNEMO
gate_function.h
Go to the documentation of this file.
1 //
4 // Copyright (c) 2015 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_GATE_FUNCTION_H
22 #define MYGSL_GATE_FUNCTION_H
23 
24 // Standard library:
25 #include <limits>
26 
27 // Third party:
28 // - Bayeux/datatools :
29 #include <datatools/i_cloneable.h>
30 
31 // This project:
32 #include <mygsl/i_unary_function.h>
33 
34 namespace mygsl {
35 
52  : public i_unary_function,
54  {
55  public:
56 
58  gate_function();
59 
61  gate_function(double width_,
62  double center_ = 0.0,
63  double amplitude_ = std::numeric_limits<double>::quiet_NaN());
64 
66  virtual ~gate_function();
67 
69  virtual bool is_initialized() const;
70 
72  virtual void initialize(const datatools::properties & config_,
73  const unary_function_dict_type & functors_);
74 
76  virtual void reset();
77 
79  void set_width(double width_);
80 
82  double get_width() const;
83 
85  void set_center(double center_);
86 
88  double get_center() const;
89 
91  void set_amplitude(double amplitude_);
92 
94  double get_amplitude() const;
95 
97  double get_non_zero_domain_min() const;
98 
100  double get_non_zero_domain_max() const;
101 
103  virtual void tree_dump(std::ostream & out_ = std::clog,
104  const std::string & title_ = "",
105  const std::string & indent_ = "",
106  bool inherit_ = false) const;
107 
108  protected :
109 
111  double _eval(double x_) const;
112 
114  void _set_defaults();
115 
116  private:
117 
118  double _center_;
119  double _width_;
120  double _amplitude_;
121 
124 
125 
127 
128  };
129 
130 } // end of namespace mygsl
131 
132 #endif // MYGSL_GATE_FUNCTION_H
133 
134 // Local Variables: --
135 // mode: c++ --
136 // c-file-style: "gnu" --
137 // tab-width: 2 --
138 // End: --
#define DATATOOLS_CLONEABLE_DECLARATION(Copyable)
Definition: i_cloneable.h:113
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart printing.
double get_non_zero_domain_min() const
The minimum bound of the non-zero domain (default is plus infinity)
void _set_defaults()
Set default attributes values.
Gate function.
Definition: gate_function.h:51
virtual bool is_initialized() const
Check initialization status.
double _eval(double x_) const
Evaluation.
virtual ~gate_function()
Destructor.
double get_non_zero_domain_max() const
The maximum bound of the non-zero domain (default is plus infinity)
double get_center() const
Return the enter.
Abstract interface for unary functions : R -> R.
Definition: i_unary_function.h:44
void set_amplitude(double amplitude_)
Set the amplitude.
gate_function()
Default constructor.
Top-level namespace of the Bayeux/mygsl module library.
Definition: base_decay_driver.h:47
void set_width(double width_)
Set the width.
void set_center(double center_)
Set the center.
A pure abstract class (interface) for inherited cloneable classes.
Definition: i_cloneable.h:75
double get_width() const
Return the width.
virtual void initialize(const datatools::properties &config_, const unary_function_dict_type &functors_)
Initialization from a container of parameters and a dictionary of functors.
std::map< std::string, unary_function_handle_type > unary_function_dict_type
Alias for dictionary of handles to unary function objects.
Definition: unary_function_utils.h:30
#define MYGSL_UNARY_FUNCTOR_REGISTRATION_INTERFACE(UnaryFunctorClass)
Definition: i_unary_function.h:206
virtual void reset()
Reset the function.
double get_amplitude() const
Return the mplitude.
A dictionary of arbitrary properties.
Definition: properties.h:125