casacore
Loading...
Searching...
No Matches
MarshallableChebyshev.h
Go to the documentation of this file.
1// # MarshalableChebyshev.h: a Marshallable Chebyshev polynomial
2// # Copyright (C) 2002
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// #! ========================================================================
27
28#ifndef SCIMATH_MARSHALLABLECHEBYSHEV_H
29#define SCIMATH_MARSHALLABLECHEBYSHEV_H
30
31#include <casacore/casa/aips.h>
32#include <casacore/scimath/Functionals/Chebyshev.h>
33#include <casacore/scimath/Functionals/FunctionMarshallable.h>
34
35namespace casacore { // # NAMESPACE CASACORE - BEGIN
36
37// # Forward Declarations
38
39// <summary> A Chebyshev function class that supports serialization
40// </summary>
41
42// <use visibility=export>
43
44// <reviewed reviewer="wbrouw" date="2001/11/12" tests="tChebyshev" demos="">
45// </reviewed>
46
47// <prerequisite>
48// <li> <linkto class=Function>Function</linkto>
49// </prerequisite>
50//
51// <etymology>
52// This class is named after Chebyshev Type I polynomials. "Marshallable"
53// means that the class can be serialized into a form that can be transmitted
54// to another execution context.
55// </etymology>
56//
57// <synopsis>
58// This class is a specialization of the Chebyshev class that supports
59// serialization. That is, it allows one to write the state of the Chebyshev
60// polynomial object into a Record. This record can then be transmitted
61// to another execution context where it
62// can be "reconstituted" as a new object with identical state as this one.
63// This documentation focusses on this serialization functionality (also known
64// as "marshalling"); for details about the general features of the Chebyshev
65// polynomial series, see the <linkto class="Chebyshev">Chebyshev</linkto>
66// class.
67// </synopsis>
68//
69// <example>
70// </example>
71//
72// <motivation>
73// Making Chebyshev Marshallable provides a convenient way of configuring
74// the simulator tool from .
75// </motivation>
76//
77// <thrown>
78// <li> Assertion in debug mode if attempt is made to address incorrect
79// coefficients
80// </thrown>
81//
82
83template <class T>
85 private:
86 static const String modenames[];
87
88 public:
89 static const String FUNCTYPE;
90 static const String FUNCFIELDS[];
91
92 // definitions of the fields stored in a serialized Record. The
93 // actual string names are stored in FUNCFIELDS
95 // the array of coefficients
97 // the default mode
99 // the default value to use when mode=CONSTANT
101 // the 2-element double array
103 // the number of supported fields
105 };
106
107 // # Constructors
108 // create a zero-th order Chebyshev polynomial with the first coefficient
109 // equal to zero. The bounded domain is [T(-1), T(1)]. The
110 // OutOfDomainMode is CONSTANT, and the default value is T(0).
112
113 // create an n-th order Chebyshev polynomial with the coefficients
114 // equal to zero. The bounded domain is [T(-1), T(1)]. The
115 // OutOfDomainMode is CONSTANT, and the default value is T(0).
117
118 // create a zero-th order Chebyshev polynomical with the first coefficient
119 // equal to one.
120 // min is the minimum value of its Chebyshev interval, and
121 // max is the maximum value.
122 // mode sets the behavior of the function outside the Chebyshev interval
123 // (see setOutOfIntervalMode() and OutOfIntervalMode enumeration
124 // definition for details).
125 // defval is the value returned when the function is evaluated outside
126 // the Chebyshev interval and mode=CONSTANT.
128 const T &min, const T &max,
130 const T &defval = T(0))
131 : Chebyshev<T>(min, max, mode, defval), FunctionMarshallable(FUNCTYPE) {}
132
133 // create a fully specified Chebyshev polynomial.
134 // coeffs holds the coefficients of the Chebyshev polynomial (see
135 // setCoefficients() for details).
136 // min is the minimum value of its canonical range, and
137 // max is the maximum value.
138 // mode sets the behavior of the function outside the Chebyshev interval
139 // (see setOutOfIntervalMode() and OutOfIntervalMode enumeration
140 // definition for details).
141 // defval is the value returned when the function is evaluated outside
142 // the canonical range and mode=CONSTANT.
144 const Vector<T> &coeffs, const T &min, const T &max,
146 const T &defval = T(0))
147 : Chebyshev<T>(coeffs, min, max, mode, defval), FunctionMarshallable(FUNCTYPE) {}
148
149 // create a fully specified Chebyshev polynomial from parameters
150 // stored in a Record.
152
153 // create a deep copy of another Chebyshev polynomial
154 // <group>
159 // </group>
160
161 // make a (deep) copy of another Chebyshev polynomial
162 // <group>
170 return *this;
171 }
172 // </group>
173
174 // Destructor
176
177 // store the state of this Function into a Record
178 virtual void store(Record &gr) const;
179
180 // Create a copy of this object. The caller is responsible for
181 // deleting the pointer.
182 virtual Function<T> *clone() const { return new MarshallableChebyshev<T>(*this); }
183};
184
185} // namespace casacore
186
187#ifndef CASACORE_NO_AUTO_TEMPLATES
188#include <casacore/scimath/Functionals/MarshallableChebyshev.tcc>
189#endif // # CASACORE_NO_AUTO_TEMPLATES
190#endif
OutOfIntervalMode
Modes that identify how this function behaves outside its Chebyshev interval (see setInterval()).
@ CONSTANT
return a constant, default value.
Chebyshev()
create a zero-th order Chebyshev polynomial with the first coefficient equal to zero.
Definition Chebyshev.h:239
Chebyshev< T > & operator=(const Chebyshev< T > &other)
make this instance a (deep) copy of another Chebyshev polynomial
Definition Chebyshev.h:293
virtual FunctionMarshallable & operator=(const FunctionMarshallable &other)
FunctionMarshallable(const String &functype)
create a FunctionMarshallable.
MarshallableChebyshev(const Record &gr)
create a fully specified Chebyshev polynomial from parameters stored in a Record.
MarshallableChebyshev(const uInt n)
create an n-th order Chebyshev polynomial with the coefficients equal to zero.
virtual Function< T > * clone() const
Create a copy of this object.
MarshallableChebyshev()
create a zero-th order Chebyshev polynomial with the first coefficient equal to zero.
MarshallableChebyshev(const MarshallableChebyshev< T > &other)
FieldNames
definitions of the fields stored in a serialized Record.
@ NFieldNames
the number of supported fields
@ COEFFS
the array of coefficients
@ INTERVAL
the 2-element double array
@ DEF
the default value to use when mode=CONSTANT
MarshallableChebyshev(const Chebyshev< T > &other)
create a deep copy of another Chebyshev polynomial
MarshallableChebyshev< T > & operator=(const MarshallableChebyshev< T > &other)
make a (deep) copy of another Chebyshev polynomial
MarshallableChebyshev< T > & operator=(const Chebyshev< T > &other)
MarshallableChebyshev(const Vector< T > &coeffs, const T &min, const T &max, const typename ChebyshevEnums::OutOfIntervalMode mode=ChebyshevEnums::CONSTANT, const T &defval=T(0))
create a fully specified Chebyshev polynomial.
virtual void store(Record &gr) const
store the state of this Function into a Record
MarshallableChebyshev(const T &min, const T &max, const typename ChebyshevEnums::OutOfIntervalMode mode=ChebyshevEnums::CONSTANT, const T &defval=T(0))
create a zero-th order Chebyshev polynomical with the first coefficient equal to one.
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
unsigned int uInt
Definition aipstype.h:49
LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)