casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DiracDParam.h
Go to the documentation of this file.
1 //# DiracDParam.h: A one dimensional Dirac delta function
2 //# Copyright (C) 2002,2005
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef SCIMATH_DIRACDPARAM_H
29 #define SCIMATH_DIRACDPARAM_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 //# Forward declarations
39 
40 // <summary> A one dimensional Dirac delta function
41 // </summary>
42 
43 // <use visibility=local>
44 
45 // <reviewed reviewer="" date="" tests="tFunctionHolder"
46 // demos="">
47 // </reviewed>
48 
49 // <prerequisite>
50 // <li> <linkto class="FunctionParam">FunctionParam</linkto> class
51 // <li> <linkto class="Function">Function</linkto> class
52 // </prerequisite>
53 
54 // <etymology>
55 // A 1-dimensional Dirac delta.
56 // </etymology>
57 
58 // <synopsis>
59 // A <src>DiracD</src> is described by a height and a center
60 // The value is:
61 // <srcblock>
62 // height (|x-center| == 0.0)
63 // 0 (|x-center| != 0.0)
64 // </srcblock>
65 // The parameters are enumerated by HEIGHT, CENTER. They have
66 // default values of (1, 0).
67 // </synopsis>
68 //
69 // <example>
70 // <srcblock>
71 // DiracDFunction<Double> sf(5.0, 25.0);
72 // sf(25); // = 5.0
73 // </srcblock>
74 // </example>
75 
76 // <templating arg=T>
77 // <li> T should have standard numerical operators
78 // </templating>
79 
80 // <thrown>
81 // <li> AipsError if incorrect parameter number specified.
82 // </thrown>
83 
84 template<class T> class DiracDParam : public Function<T>
85 {
86 public:
87  //# Enumerations
88  // Parameter numbers
89  enum { HEIGHT=0, CENTER};
90 
91  //# Constructors
92  // Constructs the DiracD, Defaults:
93  // height=1, center=0.
94  // <note role=warning> Could not use default arguments
95  // that worked both with gcc and IRIX </note>
96  // <group>
97  DiracDParam();
98  explicit DiracDParam(const T &height);
99  DiracDParam(const T &height, const T &center);
100  // </group>
101 
102  // Copy constructor (deep copy)
103  // <group>
104  DiracDParam(const DiracDParam<T> &other);
105  template <class W>
106  DiracDParam(const DiracDParam<W> &other) :
107  Function<T>(other) {}
108  // </group>
109  // Copy assignment (deep copy)
110  DiracDParam<T> &operator=(const DiracDParam<T> &other);
111 
112  // Destructor
113  virtual ~DiracDParam();
114 
115  //# Operators
116  virtual uInt ndim() const { return 1; }
117 
118  //# Member functions
119  // Give name of function
120  virtual const String &name() const { static String x("diracdelta");
121  return x; }
122 
123  //# Make members of parent classes known.
124 protected:
125  using Function<T>::param_p;
126 public:
128 };
129 
130 
131 } //# NAMESPACE CASACORE - END
132 
133 #ifndef CASACORE_NO_AUTO_TEMPLATES
134 #include <casacore/scimath/Functionals/DiracDParam.tcc>
135 #endif //# CASACORE_NO_AUTO_TEMPLATES
136 #endif
DiracDParam< T > & operator=(const DiracDParam< T > &other)
Copy assignment (deep copy)
DiracDParam(const DiracDParam< W > &other)
Definition: DiracDParam.h:106
virtual ~DiracDParam()
Destructor.
Numerical functional interface class.
Definition: GenericL2Fit.h:46
A one dimensional Dirac delta function.
Definition: DiracDParam.h:84
DiracDParam()
Constructs the DiracD, Defaults: height=1, center=0.
virtual const String & name() const
Give name of function.
Definition: DiracDParam.h:120
String: the storage and methods of handling collections of characters.
Definition: String.h:225
unsigned int uInt
Definition: aipstype.h:51
virtual uInt ndim() const
Returns the number of dimensions of function.
Definition: DiracDParam.h:116