casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
KaiserBFunction.h
Go to the documentation of this file.
00001 //# KaiserBFunction.h: A one dimensional Kaiser-Bessel function
00002 //# Copyright (C) 2002,2005
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: KaiserBFunction.h 21024 2011-03-01 11:46:18Z gervandiepen $
00027 
00028 #ifndef SCIMATH_KAISERBFUNCTION_H
00029 #define SCIMATH_KAISERBFUNCTION_H
00030 
00031 //# Includes
00032 #include <casa/aips.h>
00033 #include <scimath/Functionals/KaiserBParam.h>
00034 #include <scimath/Functionals/Function.h>
00035 
00036 namespace casa { //# NAMESPACE CASA - BEGIN
00037 
00038 //# Forward declarations
00039 
00040 // <summary> A one dimensional Kaiser-Bessel function
00041 // </summary>
00042 
00043 // <use visibility=export>
00044 
00045 // <reviewed reviewer="" date="" tests="tFunctionHolder" 
00046 // demos="">
00047 // </reviewed>
00048 
00049 // <prerequisite>
00050 //   <li> <linkto class="KaiserBParam">KaiserBParam</linkto>
00051 //   <li> <linkto class="Function">Function</linkto>
00052 // </prerequisite>
00053 
00054 // <etymology> 
00055 // A Kaiser-Bessel function
00056 // </etymology>
00057 
00058 // <synopsis> 
00059 // A <src>Kaiser-Bessel</src> is described by a height, a center, a width
00060 // (halfwidth) and a parameter.
00061 // The parameters are enumerated by HEIGHT, CENTER, WIDTH, KBPAR. They have
00062 // default values of (1, 0, 1, 2.5).
00063 // </synopsis> 
00064 //
00065 // <example>
00066 // <srcblock>
00067 //    KaiserBFunction<Double> sf;
00068 //    sf(0);            // = 1.0
00069 // </srcblock>
00070 // </example>
00071 
00072 // <templating arg=T>
00073 //  <li> T should have standard numerical operators
00074 // </templating>
00075 
00076 // <thrown>
00077 //    <li> AipsError if incorrect parameter number specified.
00078 // </thrown>
00079 //
00080 
00081 template<class T> class KaiserBFunction : public KaiserBParam<T>
00082 {
00083 public:
00084   //# Constructors
00085   // Constructs the KaiserBFunction, Defaults:
00086   // height=1, center=0, width=1, kbpar=2.5.
00087   // <note role=warning> Could not use default arguments
00088   // that worked both with gcc and IRIX </note>
00089   // <group>
00090   KaiserBFunction() : KaiserBParam<T>() {}
00091   explicit KaiserBFunction(const T &kbpar) :
00092     KaiserBParam<T>(kbpar) {}
00093   // </group>
00094 
00095   // Copy constructor (deep copy)
00096   // <group>
00097   KaiserBFunction(const KaiserBFunction<T> &other) : KaiserBParam<T>(other) {}
00098   template <class W>
00099     KaiserBFunction(const KaiserBFunction<W> &other) : KaiserBParam<T>(other) {}
00100   // </group>
00101 
00102 
00103   // Copy assignment (deep copy)
00104   KaiserBFunction<T> &operator=(const KaiserBFunction<T> &other) {
00105     KaiserBParam<T>::operator=(other); return *this; }
00106     
00107   // Destructor
00108   virtual ~KaiserBFunction() {}
00109 
00110   //# Operators    
00111   // Evaluate the KaiserB at <src>x</src>.
00112   // If a vector is used as the argument only its first element is used.
00113   // <group>
00114   virtual T eval(typename Function<T>::FunctionArg x) const;
00115   // </group>
00116     
00117   //# Member functions
00118   // Return a copy of this object from the heap. The caller is responsible 
00119   // for deleting this pointer. 
00120   // <group>
00121   virtual Function<T> *clone() const { return new KaiserBFunction<T>(*this); }
00122   virtual Function<typename FunctionTraits<T>::DiffType> *cloneAD() const {
00123     return new KaiserBFunction<typename FunctionTraits<T>::DiffType>(*this); }
00124   virtual Function<typename FunctionTraits<T>::BaseType> *cloneNonAD() const {
00125     return new KaiserBFunction<typename FunctionTraits<T>::BaseType>(*this); }
00126 
00127   // </group>
00128 
00129   //# Make members of parent classes known.
00130 protected:
00131   using KaiserBParam<T>::param_p;
00132 public:
00133   using KaiserBParam<T>::KBPAR;
00134   using KaiserBParam<T>::CENTER;
00135   using KaiserBParam<T>::WIDTH;
00136   using KaiserBParam<T>::HEIGHT;
00137 };
00138 
00139 
00140 } //# NAMESPACE CASA - END
00141 
00142 #ifndef CASACORE_NO_AUTO_TEMPLATES
00143 #include <scimath/Functionals/KaiserBFunction.tcc>
00144 #endif //# CASACORE_NO_AUTO_TEMPLATES
00145 #endif