casacore
Loading...
Searching...
No Matches
DiracDFunction.h
Go to the documentation of this file.
1//# DiracDFunction.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: casa-feedback@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#ifndef SCIMATH_DIRACDFUNCTION_H
27#define SCIMATH_DIRACDFUNCTION_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/scimath/Functionals/DiracDParam.h>
32#include <casacore/scimath/Functionals/Function.h>
33
34namespace casacore { //# NAMESPACE CASACORE - BEGIN
35
36//# Forward declarations
37
38// <summary> A one dimensional Dirac delta function
39// </summary>
40
41// <use visibility=export>
42
43// <reviewed reviewer="" date="" tests="tFunctionHolder"
44// demos="">
45// </reviewed>
46
47// <prerequisite>
48// <li> <linkto class="DiracDParam">DiracDParam</linkto>
49// <li> <linkto class="Function">Function</linkto>
50// </prerequisite>
51
52// <etymology>
53// A 1-dimensional Dirac delta.
54// </etymology>
55
56// <synopsis>
57// A <src>DiracD</src> is described by a height, a center and a width
58// (halfwidth). The value is:
59// <srcblock>
60// height (|x-center| == 0.0)
61// 0 (|x-center| != 0.0)
62// </srcblock>
63// The parameters are enumerated by HEIGHT, CENTER and WIDTH. They have
64// default values of (1, 0).
65// </synopsis>
66//
67// <example>
68// <srcblock>
69// DiracDFunction<Double> sf(5.0, 25.0);
70// sf(25); // = 5.0
71// </srcblock>
72// </example>
73
74// <templating arg=T>
75// <li> T should have standard numerical operators
76// </templating>
77
78// <thrown>
79// <li> AipsError if incorrect parameter number specified.
80// </thrown>
81//
82
83template<class T> class DiracDFunction : public DiracDParam<T>
84{
85public:
86 //# Constructors
87 // Constructs the DiracDFunction, Defaults:
88 // height=1, center=0.
89 // <note role=warning> Could not use default arguments
90 // that worked both with gcc and IRIX </note>
91 // <group>
93 explicit DiracDFunction(const T &height) :
94 DiracDParam<T>(height) {}
95 DiracDFunction(const T &height, const T &center) :
96 DiracDParam<T>(height, center) {}
97 // </group>
98
99 // Copy constructor (deep copy)
100 // <group>
101 DiracDFunction(const DiracDFunction<T> &other) : DiracDParam<T>(other) {}
102 template <class W>
103 DiracDFunction(const DiracDFunction<W> &other) : DiracDParam<T>(other) {}
104 // </group>
105
106 // Copy assignment (deep copy)
108 DiracDParam<T>::operator=(other); return *this; }
109
110 // Destructor
111 virtual ~DiracDFunction() {}
112
113 //# Operators
114 // Evaluate the DiracD at <src>x</src>.
115 // If a vector is used as the argument only its first element is used.
116 // <group>
117 virtual T eval(typename Function<T>::FunctionArg x) const;
118 // </group>
119
120 //# Member functions
121 // Return a copy of this object from the heap. The caller is responsible
122 // for deleting this pointer.
123 // <group>
124 virtual Function<T> *clone() const { return new DiracDFunction<T>(*this); }
129 // </group>
130
131 //# Make members of parent classes known.
132protected:
133 using DiracDParam<T>::param_p;
134public:
136 using DiracDParam<T>::HEIGHT;
137 using DiracDParam<T>::CENTER;
138};
139
140
141} //# NAMESPACE CASACORE - END
142
143#ifndef CASACORE_NO_AUTO_TEMPLATES
144#include <casacore/scimath/Functionals/DiracDFunction.tcc>
145#endif //# CASACORE_NO_AUTO_TEMPLATES
146#endif
DiracDFunction()
Constructs the DiracDFunction, Defaults: height=1, center=0.
virtual ~DiracDFunction()
Destructor.
DiracDFunction(const DiracDFunction< W > &other)
virtual Function< typename FunctionTraits< T >::BaseType > * cloneNonAD() const
DiracDFunction< T > & operator=(const DiracDFunction< T > &other)
Copy assignment (deep copy)
virtual Function< typename FunctionTraits< T >::DiffType > * cloneAD() const
DiracDFunction(const DiracDFunction< T > &other)
Copy constructor (deep copy)
DiracDFunction(const T &height, const T &center)
DiracDFunction(const T &height)
virtual Function< T > * clone() const
Return a copy of this object from the heap.
virtual T eval(typename Function< T >::FunctionArg x) const
Evaluate the DiracD at x.
DiracDParam< T > & operator=(const DiracDParam< T > &other)
Copy assignment (deep copy)
FunctionParam< T > param_p
The parameters and masks.
Definition Function.h:330
uInt nparameters() const
Returns the number of parameters.
Definition Function.h:228
this file contains all the compiler specific defines
Definition mainpage.dox:28