casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: 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 //#
27 //# $Id$
28 
29 #ifndef SCIMATH_GRIDDER_H
30 #define SCIMATH_GRIDDER_H
31 
32 #include <casacore/casa/aips.h>
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 class IPosition;
40 
41 // <summary>
42 // A base class for gridding
43 // </summary>
44 
45 template <class Domain, class Range>
46 class Gridder {
47 public:
48 
49  Gridder();
50 
52  const Vector<Domain>& offset);
53 
54  virtual ~Gridder();
55 
56  virtual Bool grid(Array<Range>&, const Vector<Domain>& position,
57  const Range& value) = 0;
58 
59  virtual Bool degrid(const Array<Range>&, const Vector<Domain>& position,
60  Range& value) = 0;
61 
62  virtual Range correct(const IPosition& loc);
63 
64  // Return a correction vector in x for loc y
65  virtual void correctX1D(Vector<Range>& factor, const Int locy);
66 
68 
70 
71  virtual Bool onGrid(const Vector<Int>& loc);
72 
73  virtual Bool onGrid(const Vector<Int>& loc, const Vector<Int>& delta);
74 
75  virtual Bool onGrid(const Vector<Domain>& pos);
76 
77  void setOffset(const Vector<Int>& off);
78 
79  void setOffset(const IPosition& off);
80 
81 protected:
82 
83  Int nint(Double val) {return Int(std::floor(val+0.5));}
84 
85  virtual void fillCorrectionVectors();
86 
87  // Correction factor for 1 dimension. This is virtual and
88  // must be assigned appropriately for derived classes
89  virtual Range correctionFactor1D(Int loc, Int len) = 0;
90 
92  IPosition shape; // Shape of array
93 
94  Vector<Domain> scale; // Scaling from world to pixel
95  Vector<Domain> offset; // Scaling from world to pixel
96 
97  Vector<Domain> posVec; // Scaled location
98 
99  Vector<Int> locVec; // Vector for location type quantities
100  Vector<Int> shapeVec; // Vector for shape
101  Vector<Int> zeroShapeVec; // Vector for zero shape
102  Vector<Int> offsetVec; // Offset to be added to coordinates
103  Vector<Int> centerVec; // IPosition for center
104 
106 
107 };
108 
109 } //# NAMESPACE CASACORE - END
110 
111 #ifndef CASACORE_NO_AUTO_TEMPLATES
112 #include <casacore/scimath/Mathematics/Gridder.tcc>
113 #endif //# CASACORE_NO_AUTO_TEMPLATES
114 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
int Int
Definition: aipstype.h:50
virtual ~Gridder()
Vector< Domain > scale
Definition: Gridder.h:94
Int nint(Double val)
Definition: Gridder.h:83
Vector< Int > & location(Vector< Int > &loc, const Vector< Domain > &pos)
A base class for gridding.
Definition: Gridder.h:46
virtual Bool degrid(const Array< Range > &, const Vector< Domain > &position, Range &value)=0
LatticeExprNode floor(const LatticeExprNode &expr)
virtual void fillCorrectionVectors()
virtual Range correct(const IPosition &loc)
Vector< Domain > & position(Vector< Domain > &gpos, const Vector< Domain > &pos)
Vector< Domain > offset
Definition: Gridder.h:95
Vector< Int > centerVec
Definition: Gridder.h:103
Vector< Int > shapeVec
Definition: Gridder.h:100
virtual Range correctionFactor1D(Int loc, Int len)=0
Correction factor for 1 dimension.
double Double
Definition: aipstype.h:55
virtual Bool grid(Array< Range > &, const Vector< Domain > &position, const Range &value)=0
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Vector< Int > zeroShapeVec
Definition: Gridder.h:101
Vector< Vector< Range > > correctionVectors
Definition: Gridder.h:105
template &lt;class T, class U&gt; class vector;
Definition: MSFlagger.h:37
IPosition shape
Definition: Gridder.h:92
Vector< Domain > posVec
Definition: Gridder.h:97
void setOffset(const Vector< Int > &off)
Vector< Int > offsetVec
Definition: Gridder.h:102
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
Vector< Int > locVec
Definition: Gridder.h:99
virtual Bool onGrid(const Vector< Int > &loc)
virtual void correctX1D(Vector< Range > &factor, const Int locy)
Return a correction vector in x for loc y.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42