casacore
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>
33#include <casacore/casa/Arrays/Array.h>
34#include <casacore/casa/Arrays/Vector.h>
35#include <casacore/casa/Arrays/Matrix.h>
36
37namespace casacore { //# NAMESPACE CASACORE - BEGIN
38
39class IPosition;
40
41// <summary>
42// A base class for gridding
43// </summary>
44
45template <class Domain, class Range>
46class Gridder {
47public:
48
50
52 const Vector<Domain>& offset);
53
54 virtual ~Gridder();
55
57 const Range& value) = 0;
58
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
81protected:
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
virtual Bool onGrid(const Vector< Domain > &pos)
Vector< Int > centerVec
Definition: Gridder.h:103
void setOffset(const Vector< Int > &off)
Vector< Vector< Range > > correctionVectors
Definition: Gridder.h:105
virtual Bool grid(Array< Range > &, const Vector< Domain > &position, const Range &value)=0
Vector< Domain > scale
Definition: Gridder.h:94
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:97
virtual void fillCorrectionVectors()
Vector< Int > locVec
Definition: Gridder.h:99
void setOffset(const IPosition &off)
Int nint(Double val)
Definition: Gridder.h:83
IPosition shape
Definition: Gridder.h:92
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:101
virtual Range correct(const IPosition &loc)
Vector< Domain > offset
Definition: Gridder.h:95
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:100
Vector< Int > offsetVec
Definition: Gridder.h:102
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)
this file contains all the compiler specific defines
Definition: mainpage.dox:28
int Int
Definition: aipstype.h:50
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
LatticeExprNode floor(const LatticeExprNode &expr)
double Double
Definition: aipstype.h:55