casacore
Loading...
Searching...
No Matches
Gridder.h
Go to the documentation of this file.
1// # Gridder.h: Definition for Gridder
2// # Copyright (C) 1996,1997,1999,2003
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_GRIDDER_H
27#define SCIMATH_GRIDDER_H
28
29#include <casacore/casa/aips.h>
30#include <casacore/casa/Arrays/Array.h>
31#include <casacore/casa/Arrays/Vector.h>
32#include <casacore/casa/Arrays/Matrix.h>
33
34namespace casacore { // # NAMESPACE CASACORE - BEGIN
35
36class IPosition;
37
38// <summary>
39// A base class for gridding
40// </summary>
41
42template <class Domain, class Range>
43class Gridder {
44 public:
46
48
49 virtual ~Gridder();
50
51 virtual Bool grid(Array<Range>&, const Vector<Domain>& position, const Range& value) = 0;
52
53 virtual Bool degrid(const Array<Range>&, const Vector<Domain>& position, Range& value) = 0;
54
55 virtual Range correct(const IPosition& loc);
56
57 // Return a correction vector in x for loc y
58 virtual void correctX1D(Vector<Range>& factor, const Int locy);
59
61
63
64 virtual Bool onGrid(const Vector<Int>& loc);
65
66 virtual Bool onGrid(const Vector<Int>& loc, const Vector<Int>& delta);
67
68 virtual Bool onGrid(const Vector<Domain>& pos);
69
70 void setOffset(const Vector<Int>& off);
71
72 void setOffset(const IPosition& off);
73
74 protected:
75 Int nint(Double val) { return Int(std::floor(val + 0.5)); }
76
77 virtual void fillCorrectionVectors();
78
79 // Correction factor for 1 dimension. This is virtual and
80 // must be assigned appropriately for derived classes
81 virtual Range correctionFactor1D(Int loc, Int len) = 0;
82
84 IPosition shape; // Shape of array
85
86 Vector<Domain> scale; // Scaling from world to pixel
87 Vector<Domain> offset; // Scaling from world to pixel
88
89 Vector<Domain> posVec; // Scaled location
90
91 Vector<Int> locVec; // Vector for location type quantities
92 Vector<Int> shapeVec; // Vector for shape
93 Vector<Int> zeroShapeVec; // Vector for zero shape
94 Vector<Int> offsetVec; // Offset to be added to coordinates
95 Vector<Int> centerVec; // IPosition for center
96
98};
99
100} // namespace casacore
101
102#ifndef CASACORE_NO_AUTO_TEMPLATES
103#include <casacore/scimath/Mathematics/Gridder.tcc>
104#endif // # CASACORE_NO_AUTO_TEMPLATES
105#endif
virtual Bool onGrid(const Vector< Domain > &pos)
Vector< Int > centerVec
Definition Gridder.h:95
void setOffset(const Vector< Int > &off)
Vector< Vector< Range > > correctionVectors
Definition Gridder.h:97
virtual Bool grid(Array< Range > &, const Vector< Domain > &position, const Range &value)=0
Vector< Domain > scale
Definition Gridder.h:86
virtual Bool onGrid(const Vector< Int > &loc)
Gridder(const IPosition &shape, const Vector< Domain > &scale, const Vector< Domain > &offset)
Vector< Domain > posVec
Definition Gridder.h:89
virtual void fillCorrectionVectors()
Vector< Int > locVec
Definition Gridder.h:91
void setOffset(const IPosition &off)
Int nint(Double val)
Definition Gridder.h:75
IPosition shape
Definition Gridder.h:84
virtual Bool degrid(const Array< Range > &, const Vector< Domain > &position, Range &value)=0
virtual Range correctionFactor1D(Int loc, Int len)=0
Correction factor for 1 dimension.
Vector< Int > zeroShapeVec
Definition Gridder.h:93
virtual Range correct(const IPosition &loc)
Vector< Domain > offset
Definition Gridder.h:87
Vector< Domain > & position(Vector< Domain > &gpos, const Vector< Domain > &pos)
Vector< Int > & location(Vector< Int > &loc, const Vector< Domain > &pos)
Vector< Int > shapeVec
Definition Gridder.h:92
Vector< Int > offsetVec
Definition Gridder.h:94
virtual void correctX1D(Vector< Range > &factor, const Int locy)
Return a correction vector in x for loc y.
virtual ~Gridder()
virtual Bool onGrid(const Vector< Int > &loc, const Vector< Int > &delta)
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
int * factor
Definition hdu.h:521
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
NewDelAllocator< T > NewDelAllocator< T >::value
Definition Allocator.h:360
double Double
Definition aipstype.h:53