Loading...
Searching...
No Matches
Gridder.h
Go to the documentation of this file.
//# Gridder.h: Definition for Gridder
//# Copyright (C) 1996,1997,1999,2003
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: casa-feedback@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
#ifndef SCIMATH_GRIDDER_H
#define SCIMATH_GRIDDER_H
#include <casacore/casa/aips.h>
#include <casacore/casa/Arrays/Array.h>
#include <casacore/casa/Arrays/Vector.h>
#include <casacore/casa/Arrays/Matrix.h>
namespace casacore { //# NAMESPACE CASACORE - BEGIN
class IPosition;
// <summary>
// A base class for gridding
// </summary>
template <class Domain, class Range>
class Gridder {
public:
Gridder();
Gridder(const IPosition& shape, const Vector<Domain>& scale,
const Vector<Domain>& offset);
virtual ~Gridder();
virtual Bool grid(Array<Range>&, const Vector<Domain>& position,
const Range& value) = 0;
virtual Bool degrid(const Array<Range>&, const Vector<Domain>& position,
Range& value) = 0;
virtual Range correct(const IPosition& loc);
// Return a correction vector in x for loc y
virtual void correctX1D(Vector<Range>& factor, const Int locy);
Vector<Int>& location(Vector<Int>& loc, const Vector<Domain>& pos);
Vector<Domain>& position(Vector<Domain>& gpos, const Vector<Domain>& pos);
virtual Bool onGrid(const Vector<Int>& loc);
virtual Bool onGrid(const Vector<Int>& loc, const Vector<Int>& delta);
virtual Bool onGrid(const Vector<Domain>& pos);
void setOffset(const Vector<Int>& off);
void setOffset(const IPosition& off);
protected:
Int nint(Double val) {return Int(std::floor(val+0.5));}
virtual void fillCorrectionVectors();
// Correction factor for 1 dimension. This is virtual and
// must be assigned appropriately for derived classes
virtual Range correctionFactor1D(Int loc, Int len) = 0;
Int ndim;
IPosition shape; // Shape of array
Vector<Domain> scale; // Scaling from world to pixel
Vector<Domain> offset; // Scaling from world to pixel
Vector<Domain> posVec; // Scaled location
Vector<Int> locVec; // Vector for location type quantities
Vector<Int> shapeVec; // Vector for shape
Vector<Int> zeroShapeVec; // Vector for zero shape
Vector<Int> offsetVec; // Offset to be added to coordinates
Vector<Int> centerVec; // IPosition for center
Vector <Vector<Range> > correctionVectors;
};
} //# NAMESPACE CASACORE - END
#ifndef CASACORE_NO_AUTO_TEMPLATES
#include <casacore/scimath/Mathematics/Gridder.tcc>
#endif //# CASACORE_NO_AUTO_TEMPLATES
#endif
casacore::Array
Definition Array.h:155
casacore::Gridder::onGrid
virtual Bool onGrid(const Vector< Domain > &pos)
casacore::Gridder::centerVec
Vector< Int > centerVec
Definition Gridder.h:100
casacore::Gridder::setOffset
void setOffset(const Vector< Int > &off)
casacore::Gridder::correctionVectors
Vector< Vector< Range > > correctionVectors
Definition Gridder.h:102
casacore::Gridder::grid
virtual Bool grid(Array< Range > &, const Vector< Domain > &position, const Range &value)=0
casacore::Gridder::scale
Vector< Domain > scale
Definition Gridder.h:91
casacore::Gridder::onGrid
virtual Bool onGrid(const Vector< Int > &loc)
casacore::Gridder::Gridder
Gridder()
casacore::Gridder::Gridder
Gridder(const IPosition &shape, const Vector< Domain > &scale, const Vector< Domain > &offset)
casacore::Gridder::posVec
Vector< Domain > posVec
Definition Gridder.h:94
casacore::Gridder::fillCorrectionVectors
virtual void fillCorrectionVectors()
casacore::Gridder::locVec
Vector< Int > locVec
Definition Gridder.h:96
casacore::Gridder::setOffset
void setOffset(const IPosition &off)
casacore::Gridder::nint
Int nint(Double val)
Definition Gridder.h:80
casacore::Gridder::shape
IPosition shape
Definition Gridder.h:89
casacore::Gridder::degrid
virtual Bool degrid(const Array< Range > &, const Vector< Domain > &position, Range &value)=0
casacore::Gridder::correctionFactor1D
virtual Range correctionFactor1D(Int loc, Int len)=0
Correction factor for 1 dimension.
casacore::Gridder::zeroShapeVec
Vector< Int > zeroShapeVec
Definition Gridder.h:98
casacore::Gridder::correct
virtual Range correct(const IPosition &loc)
casacore::Gridder::offset
Vector< Domain > offset
Definition Gridder.h:92
casacore::Gridder::ndim
Int ndim
Definition Gridder.h:88
casacore::Gridder::position
Vector< Domain > & position(Vector< Domain > &gpos, const Vector< Domain > &pos)
casacore::Gridder::location
Vector< Int > & location(Vector< Int > &loc, const Vector< Domain > &pos)
casacore::Gridder::shapeVec
Vector< Int > shapeVec
Definition Gridder.h:97
casacore::Gridder::offsetVec
Vector< Int > offsetVec
Definition Gridder.h:99
casacore::Gridder::correctX1D
virtual void correctX1D(Vector< Range > &factor, const Int locy)
Return a correction vector in x for loc y.
casacore::Gridder::~Gridder
virtual ~Gridder()
casacore::Gridder::onGrid
virtual Bool onGrid(const Vector< Int > &loc, const Vector< Int > &delta)
casacore::IPosition
Definition IPosition.h:117
casacore::Vector
Definition Vector.h:82
casacore
this file contains all the compiler specific defines
Definition mainpage.dox:28
casacore::factor
int * factor
Definition hdu.h:478
casacore::Int
int Int
Definition aipstype.h:48
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
casacore::value
NewDelAllocator< T > NewDelAllocator< T >::value
Definition Allocator.h:369
casacore::Double
double Double
Definition aipstype.h:53