22#ifndef ASTSHIM_MAPPING_H
23#define ASTSHIM_MAPPING_H
249 AstObject *rawSimpMap =
reinterpret_cast<AstObject *
>(astSimplify(
getRawPtr()));
251 return Object::fromAstObject<Mapping>(rawSimpMap,
true);
284 _tran(fromArr,
true, toArr);
318 _tran(fromArr,
false, toArr);
360 _tranGrid(lbnd, ubnd, tol, maxpix,
true,
to);
371 _tranGrid(lbnd, ubnd, tol, maxpix,
true,
to);
382 _tranGrid(lbnd, ubnd, tol, maxpix,
false,
to);
392 _tranGrid(lbnd, ubnd, tol, maxpix,
false,
to);
400 explicit Mapping(AstMapping *rawMap) :
Object(reinterpret_cast<AstObject *>(rawMap)) {
404 os <<
"this is a " <<
getClassName() <<
", which is not a Mapping";
411 return std::static_pointer_cast<Mapping>(copyImpl<Mapping, AstMapping>());
427 template <
typename Class>
443 void _tranGrid(
PointI const &lbnd,
PointI const &ubnd,
double tol,
int maxpix,
bool doForward,
An abstract base class for objects which transform one set of coordinates to another.
bool hasForward() const
Is the forward transform available?
std::shared_ptr< Mapping > simplified() const
Return a simplied version of the mapping (which may be a compound Mapping such as a CmpMap).
bool isInverted() const
Is this an inverted mapping?
void tranGridInverse(PointI const &lbnd, PointI const &ubnd, double tol, int maxpix, Array2D const &to) const
Transform a grid of points in the inverse direction.
std::shared_ptr< Mapping > copy() const
Return a deep copy of this object.
Array2D tranGridForward(PointI const &lbnd, PointI const &ubnd, double tol, int maxpix, int nPts) const
Transform a grid of points in the inverse direction, returning the results as a new Array2D.
void tranGridForward(PointI const &lbnd, PointI const &ubnd, double tol, int maxpix, Array2D const &to) const
Transform a grid of points in the forward direction.
Array2D applyForward(ConstArray2D const &from) const
Perform a forward transformation on a 2-D array, returning the results as a new array.
bool getReport() const
Get Report: report transformed coordinates to stdout?
Mapping(Mapping const &)=default
Copy constructor: make a deep copy.
void applyInverse(ConstArray2D const &from, Array2D const &to) const
Perform an inverse transformation on a 2-D array, putting the results into a pre-allocated 2-D array.
Mapping(AstMapping *rawMap)
Construct a mapping from a pointer to a raw AST subclass of AstMapping.
void applyForward(ConstArray2D const &from, Array2D const &to) const
Perform a forward transformation on 2-D array, putting the results into a pre-allocated 2-D array.
std::shared_ptr< Class > decompose(int i, bool copy) const
Return a deep copy of one of the two component mappings.
ParallelMap under(Mapping const &next) const
Return a parallel compound mapping containing shallow copies of the original.
Array2D linearApprox(PointD const &lbnd, PointD const &ubnd, double tol) const
Compute a linear approximation to the forward transformation.
bool getIsSimple() const
Get IsSimple: has the mapping been simplified?
Array2D applyInverse(ConstArray2D const &from) const
Perform an inverse transformation on a 2-D array, returning the results as a new 2-D array.
Mapping & operator=(Mapping const &)=delete
Array2D tranGridInverse(PointI const &lbnd, PointI const &ubnd, double tol, int maxpix, int nPts) const
Transform a grid of points in the inverse direction.
double rate(PointD const &at, int ax1, int ax2) const
Evaluate the rate of change of the Mapping with respect to a specified input, at a specified position...
bool getIsLinear() const
Get IsLinear: is the Mapping linear?
int getNOut() const
Get NOut: the number of output axes.
Mapping(Mapping &&)=default
void setReport(bool report)
Set Report: report transformed coordinates to stdout?
std::vector< double > applyInverse(std::vector< double > const &from) const
Perform an inverse transformation on a vector, returning the results as a new vector.
virtual std::shared_ptr< Object > copyPolymorphic() const override
Return a deep copy of this object.
bool hasInverse() const
Is the inverse transform available?
int getNIn() const
Get NIn: the number of input axes.
std::shared_ptr< Mapping > inverted() const
Get an inverse mapping.
std::vector< double > applyForward(std::vector< double > const &from) const
Perform a forward transformation on a vector, returning the results as a new vector.
Mapping & operator=(Mapping &&)=default
Abstract base class for all AST objects.
std::string getClassName() const
Get Class: the name of the class (e.g.
bool getB(std::string const &attrib) const
Get the value of an attribute as a bool.
int getI(std::string const &attrib) const
Get the value of an attribute as an int.
void setB(std::string const &attrib, bool value)
Set the value of an attribute as a bool.
AstObject const * getRawPtr() const
Get the raw AST pointer.
A parallel compound mapping where the first Mapping is used to transform the lower numbered coordinat...
A series compound mapping where the first Mapping is used to transform the coordinates of each point ...
void assertEqual(T1 val1, std::string const &descr1, T2 val2, std::string const &descr2)
AST wrapper classes and functions.
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST's state is bad.
ConstArray2D arrayFromVector(std::vector< double > const &vec, int nAxes)
Reshape a vector as a 2-dimensional array that shares the same memory.
ndarray::Array< double, 2, 2 > Array2D
2D array of const double; typically used for lists of const points
ndarray::Array< const double, 2, 2 > ConstArray2D
2D array of const double; typically used for lists of const points