Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
c2_factory.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
35 //
36 // $Id: c2_factory.hh 66995 2013-01-29 14:46:45Z gcosmo $
37 
38 #ifndef __has_c2_factory_hh
39 #define __has_c2_factory_hh 1
40 
41 #include "c2_function.hh"
42 
55 template <typename float_type> class c2_factory {
56 public:
57 
59 static c2_classic_function_p<float_type> &classic_function(float_type (*c_func)(float_type))
60  { return *new c2_classic_function_p<float_type>(c_func); }
63  { return *new c2_plugin_function_p<float_type>(); }
66  { return *new c2_plugin_function_p<float_type>(f); }
75  { return *new c2_scaled_function_p<float_type>(outer, scale); }
78  { return *new c2_cached_function_p<float_type>(func); }
80 static c2_constant_p<float_type> &constant(float_type x) { return *new c2_constant_p<float_type>(x); }
84  { return *new interpolating_function_p<float_type>(); }
103  float_type x0, const c2_function<float_type> &f0, float_type x2, const c2_function<float_type> &f2,
104  bool auto_center, float_type y1)
105  { return *new c2_connector_function_p<float_type>(x0, f0, x2, f2, auto_center, y1); }
108  const c2_fblock<float_type> &fb0, const c2_fblock<float_type> &fb2,
109  bool auto_center, float_type y1)
110  { return *new c2_connector_function_p<float_type>(fb0, fb2, auto_center, y1); }
113  float_type x0, float_type y0, float_type yp0, float_type ypp0,
114  float_type x2, float_type y2, float_type yp2, float_type ypp2,
115  bool auto_center, float_type y1)
117  x0, y0, yp0, ypp0, x2, y2, yp2, ypp2, auto_center, y1); }
120  { return *new c2_piecewise_function_p<float_type>(); }
122 static c2_sin_p<float_type> &sin() { return *new c2_sin_p<float_type>(); }
124 static c2_cos_p<float_type> &cos() { return *new c2_cos_p<float_type>(); }
126 static c2_tan_p<float_type> &tan() { return *new c2_tan_p<float_type>(); }
128 static c2_log_p<float_type> &log() { return *new c2_log_p<float_type>(); }
130 static c2_exp_p<float_type> &exp() { return *new c2_exp_p<float_type>(); }
134 static c2_recip_p<float_type> &recip(float_type scale=1)
135  { return *new c2_recip_p<float_type>(scale); }
139 static c2_linear_p<float_type> &linear(float_type x0, float_type y0, float_type slope)
140  { return *new c2_linear_p<float_type>(x0, y0, slope); }
143  float_type x0, float_type y0, float_type xcoef, float_type x2coef)
144  { return *new c2_quadratic_p<float_type>(x0, y0, xcoef, x2coef); }
146 static c2_power_law_p<float_type> &power_law(float_type scale, float_type power)
147  { return *new c2_power_law_p<float_type>(scale, power); }
150  { return *new c2_inverse_function_p<float_type>(source); }
151 
152 #if 0
153 template <template <typename f_t> class Final >
155  static interpolating_function_p<float_type> & inverse_integrated_density_bins(
156  const std::vector<float_type> &bincenters, const std::vector<float_type> &binheights)
157  throw(c2_exception)
158  {
159  return ::inverse_integrated_density_bins<float_type, Final<float_type> >
160  (bincenters, binheights);
161  }
163 template <template <typename f_t> class Final >
164  static interpolating_function_p<float_type> & inverse_integrated_density_function(
165  const std::vector<float_type> &bincenters, const c2_function<float_type> &binheights)
166  throw(c2_exception)
167  {
168  return ::inverse_integrated_density_function<float_type, Final<float_type> >
169  (bincenters, binheights);
170  }
171 #endif
172 
173 };
174 
175 #endif