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 {
44public:
45
47
49 const Vector<Domain>& offset);
50
51 virtual ~Gridder();
52
54 const Range& value) = 0;
55
57 Range& value) = 0;
58
59 virtual Range correct(const IPosition& loc);
60
61 // Return a correction vector in x for loc y
62 virtual void correctX1D(Vector<Range>& factor, const Int locy);
63
65
67
68 virtual Bool onGrid(const Vector<Int>& loc);
69
70 virtual Bool onGrid(const Vector<Int>& loc, const Vector<Int>& delta);
71
72 virtual Bool onGrid(const Vector<Domain>& pos);
73
74 void setOffset(const Vector<Int>& off);
75
76 void setOffset(const IPosition& off);
77
78protected:
79
80 Int nint(Double val) {return Int(std::floor(val+0.5));}
81
82 virtual void fillCorrectionVectors();
83
84 // Correction factor for 1 dimension. This is virtual and
85 // must be assigned appropriately for derived classes
86 virtual Range correctionFactor1D(Int loc, Int len) = 0;
87
89 IPosition shape; // Shape of array
90
91 Vector<Domain> scale; // Scaling from world to pixel
92 Vector<Domain> offset; // Scaling from world to pixel
93
94 Vector<Domain> posVec; // Scaled location
95
96 Vector<Int> locVec; // Vector for location type quantities
97 Vector<Int> shapeVec; // Vector for shape
98 Vector<Int> zeroShapeVec; // Vector for zero shape
99 Vector<Int> offsetVec; // Offset to be added to coordinates
100 Vector<Int> centerVec; // IPosition for center
101
102 Vector <Vector<Range> > correctionVectors;
103
104};
105
106} //# NAMESPACE CASACORE - END
107
108#ifndef CASACORE_NO_AUTO_TEMPLATES
109#include <casacore/scimath/Mathematics/Gridder.tcc>
110#endif //# CASACORE_NO_AUTO_TEMPLATES
111#endif
virtual Bool onGrid(const Vector< Domain > &pos)
Vector< Int > centerVec
Definition Gridder.h:100
void setOffset(const Vector< Int > &off)
Vector< Vector< Range > > correctionVectors
Definition Gridder.h:102
virtual Bool grid(Array< Range > &, const Vector< Domain > &position, const Range &value)=0
Vector< Domain > scale
Definition Gridder.h:91
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:94
virtual void fillCorrectionVectors()
Vector< Int > locVec
Definition Gridder.h:96
void setOffset(const IPosition &off)
Int nint(Double val)
Definition Gridder.h:80
IPosition shape
Definition Gridder.h:89
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:98
virtual Range correct(const IPosition &loc)
Vector< Domain > offset
Definition Gridder.h:92
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:97
Vector< Int > offsetVec
Definition Gridder.h:99
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:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
double Double
Definition aipstype.h:53