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);
270 _tran(from,
true, to);
284 _tran(fromArr,
true, toArr);
304 _tran(from,
false, to);
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";
427 template <
typename Class>
443 void _tranGrid(
PointI const &lbnd,
PointI const &ubnd,
double tol,
int maxpix,
bool doForward,
A series compound mapping where the first Mapping is used to transform the coordinates of each point ...
std::vector< double > applyInverse(std::vector< double > const &from) const
Perform an inverse transformation on a vector, returning the results as a new vector.
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...
ndarray::Array< const double, 2, 2 > ConstArray2D
2D array of const double; typically used for lists of const points
virtual std::shared_ptr< Object > copyPolymorphic() const override
Return a deep copy of this object.
Mapping(Mapping const &)=default
Copy constructor: make a deep copy.
AstObject const * getRawPtr() const
Get the raw AST pointer.
void setB(std::string const &attrib, bool value)
Set the value of an attribute as a bool.
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...
int getI(std::string const &attrib) const
Get the value of an attribute as an int.
bool hasInverse() const
Is the inverse transform available?
ndarray::Array< double, 2, 2 > Array2D
2D array of const double; typically used for lists of const points
AST wrapper classes and functions.
std::string getClassName() const
Get Class: the name of the class (e.g.
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.
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST's state is bad.
SeriesMap then(Mapping const &next) const
Return a series compound mapping this(first(input)) containing shallow copies of the original...
std::shared_ptr< Class > decompose(int i, bool copy) const
Return a deep copy of one of the two component mappings.
bool isInverted() const
Is this an inverted mapping?
An abstract base class for objects which transform one set of coordinates to another.
std::shared_ptr< Mapping > inverted() const
Get an inverse mapping.
std::shared_ptr< Mapping > simplified() const
Return a simplied version of the mapping (which may be a compound Mapping such as a CmpMap)...
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.
Mapping(AstMapping *rawMap)
Construct a mapping from a pointer to a raw AST subclass of AstMapping.
std::vector< double > applyForward(std::vector< double > const &from) const
Perform a forward transformation on a vector, returning the results as a new vector.
A parallel compound mapping where the first Mapping is used to transform the lower numbered coordinat...
Mapping & operator=(Mapping const &)=delete
bool getB(std::string const &attrib) const
Get the value of an attribute as a bool.
bool getReport() const
Get Report: report transformed coordinates to stdout?
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< Mapping > copy() const
Return a deep copy of this object.
T static_pointer_cast(T... args)
bool getIsLinear() const
Get IsLinear: is the Mapping linear?
Array2D linearApprox(PointD const &lbnd, PointD const &ubnd, double tol) const
Compute a linear approximation to the forward transformation.
ParallelMap under(Mapping const &next) const
Return a parallel compound mapping containing shallow copies of the original.
void setReport(bool report)
Set Report: report transformed coordinates to stdout?
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...
int getNIn() const
Get NIn: the number of input axes.
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...
void assertEqual(T1 val1, std::string const &descr1, T2 val2, std::string const &descr2)
ConstArray2D arrayFromVector(std::vector< double > const &vec, int nAxes)
Reshape a vector as a 2-dimensional array that shares the same memory.
bool hasForward() const
Is the forward transform available?
Array2D tranGridInverse(PointI const &lbnd, PointI const &ubnd, double tol, int maxpix, int nPts) const
Transform a grid of points in the inverse direction.
Abstract base class for all AST objects.
int getNOut() const
Get NOut: the number of output axes.
Array2D applyForward(ConstArray2D const &from) const
Perform a forward transformation on a 2-D array, returning the results as a new array.