Gridder.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef SCIMATH_GRIDDER_H
00030 #define SCIMATH_GRIDDER_H
00031
00032 #include <casacore/casa/aips.h>
00033 #include <casacore/casa/Arrays/Array.h>
00034 #include <casacore/casa/Arrays/Vector.h>
00035 #include <casacore/casa/Arrays/Matrix.h>
00036
00037 namespace casacore {
00038
00039 class IPosition;
00040
00041
00042
00043
00044
00045 template <class Domain, class Range>
00046 class Gridder {
00047 public:
00048
00049 Gridder();
00050
00051 Gridder(const IPosition& shape, const Vector<Domain>& scale,
00052 const Vector<Domain>& offset);
00053
00054 virtual ~Gridder();
00055
00056 virtual Bool grid(Array<Range>&, const Vector<Domain>& position,
00057 const Range& value) = 0;
00058
00059 virtual Bool degrid(const Array<Range>&, const Vector<Domain>& position,
00060 Range& value) = 0;
00061
00062 virtual Range correct(const IPosition& loc);
00063
00064
00065 virtual void correctX1D(Vector<Range>& factor, const Int locy);
00066
00067 Vector<Int>& location(Vector<Int>& loc, const Vector<Domain>& pos);
00068
00069 Vector<Domain>& position(Vector<Domain>& gpos, const Vector<Domain>& pos);
00070
00071 virtual Bool onGrid(const Vector<Int>& loc);
00072
00073 virtual Bool onGrid(const Vector<Int>& loc, const Vector<Int>& delta);
00074
00075 virtual Bool onGrid(const Vector<Domain>& pos);
00076
00077 void setOffset(const Vector<Int>& off);
00078
00079 void setOffset(const IPosition& off);
00080
00081 protected:
00082
00083 Int nint(Double val) {return Int(std::floor(val+0.5));}
00084
00085 virtual void fillCorrectionVectors();
00086
00087
00088
00089 virtual Range correctionFactor1D(Int loc, Int len) = 0;
00090
00091 Int ndim;
00092 IPosition shape;
00093
00094 Vector<Domain> scale;
00095 Vector<Domain> offset;
00096
00097 Vector<Domain> posVec;
00098
00099 Vector<Int> locVec;
00100 Vector<Int> shapeVec;
00101 Vector<Int> zeroShapeVec;
00102 Vector<Int> offsetVec;
00103 Vector<Int> centerVec;
00104
00105 Vector <Vector<Range> > correctionVectors;
00106
00107 };
00108
00109 }
00110
00111 #ifndef CASACORE_NO_AUTO_TEMPLATES
00112 #include <casacore/scimath/Mathematics/Gridder.tcc>
00113 #endif //# CASACORE_NO_AUTO_TEMPLATES
00114 #endif