LSSTApplications  16.0-10-g0ee56ad+5,16.0-11-ga33d1f2+5,16.0-12-g3ef5c14+3,16.0-12-g71e5ef5+18,16.0-12-gbdf3636+3,16.0-13-g118c103+3,16.0-13-g8f68b0a+3,16.0-15-gbf5c1cb+4,16.0-16-gfd17674+3,16.0-17-g7c01f5c+3,16.0-18-g0a50484+1,16.0-20-ga20f992+8,16.0-21-g0e05fd4+6,16.0-21-g15e2d33+4,16.0-22-g62d8060+4,16.0-22-g847a80f+4,16.0-25-gf00d9b8+1,16.0-28-g3990c221+4,16.0-3-gf928089+3,16.0-32-g88a4f23+5,16.0-34-gd7987ad+3,16.0-37-gc7333cb+2,16.0-4-g10fc685+2,16.0-4-g18f3627+26,16.0-4-g5f3a788+26,16.0-5-gaf5c3d7+4,16.0-5-gcc1f4bb+1,16.0-6-g3b92700+4,16.0-6-g4412fcd+3,16.0-6-g7235603+4,16.0-69-g2562ce1b+2,16.0-8-g14ebd58+4,16.0-8-g2df868b+1,16.0-8-g4cec79c+6,16.0-8-gadf6c7a+1,16.0-8-gfc7ad86,16.0-82-g59ec2a54a+1,16.0-9-g5400cdc+2,16.0-9-ge6233d7+5,master-g2880f2d8cf+3,v17.0.rc1
LSSTDataManagementBasePackage
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Friends | List of all members
ast::ChebyMap Class Reference

A ChebyMap is a form of Mapping which performs a Chebyshev polynomial transformation. More...

#include <ChebyMap.h>

Inheritance diagram for ast::ChebyMap:
ast::Mapping ast::Object

Public Types

using ObjectPtr = std::unique_ptr< AstObject, Deleter >
 unique pointer holding an AST raw pointer More...
 

Public Member Functions

 ChebyMap (ConstArray2D const &coeff_f, ConstArray2D const &coeff_i, std::vector< double > const &lbnd_f, std::vector< double > const &ubnd_f, std::vector< double > const &lbnd_i, std::vector< double > const &ubnd_i, std::string const &options="")
 Construct a ChebyMap with a specified forward and/or inverse transforms. More...
 
 ChebyMap (ConstArray2D const &coeff_f, int nout, std::vector< double > const &lbnd_f, std::vector< double > const &ubnd_f, std::string const &options="IterInverse=0")
 Construct a ChebyMap with only the forward transform specified. More...
 
virtual ~ChebyMap ()
 
 ChebyMap (ChebyMap const &)=default
 Copy constructor: make a deep copy. More...
 
 ChebyMap (ChebyMap &&)=default
 
ChebyMapoperator= (ChebyMap const &)=delete
 
ChebyMapoperator= (ChebyMap &&)=default
 
std::shared_ptr< ChebyMapcopy () const
 Return a deep copy of this object. More...
 
ChebyDomain getDomain (bool forward) const
 Return the bounding box of the domain of a ChebyMap. More...
 
ChebyMap polyTran (bool forward, double acc, double maxacc, int maxorder, std::vector< double > const &lbnd, std::vector< double > const &ubnd) const
 This function creates a new ChebyMap which is a copy of this one, in which a specified transformation (forward or inverse) has been replaced by a new Chebyshev polynomial transformation. More...
 
ChebyMap polyTran (bool forward, double acc, double maxacc, int maxorder) const
 This method is the same as polyTran except that the bounds are those originally provided when the polynomial whose inverse is being fit was specified. More...
 
int getNIn () const
 Get NIn: the number of input axes. More...
 
int getNOut () const
 Get NOut: the number of output axes. More...
 
bool getIsSimple () const
 Get IsSimple: has the mapping been simplified? More...
 
bool isInverted () const
 Is this an inverted mapping? More...
 
bool getIsLinear () const
 Get IsLinear: is the Mapping linear? More...
 
bool getReport () const
 Get Report: report transformed coordinates to stdout? More...
 
bool hasForward () const
 Is the forward transform available? More...
 
bool hasInverse () const
 Is the inverse transform available? More...
 
std::shared_ptr< Mappinginverted () const
 Get an inverse mapping. More...
 
Array2D linearApprox (PointD const &lbnd, PointD const &ubnd, double tol) const
 Compute a linear approximation to the forward transformation. More...
 
SeriesMap then (Mapping const &next) const
 Return a series compound mapping this(first(input)) containing shallow copies of the original. More...
 
ParallelMap under (Mapping const &next) const
 Return a parallel compound mapping containing shallow copies of the original. More...
 
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. More...
 
void setReport (bool report)
 Set Report: report transformed coordinates to stdout? More...
 
std::shared_ptr< Mappingsimplified () const
 Return a simplied version of the mapping (which may be a compound Mapping such as a CmpMap). More...
 
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. More...
 
Array2D applyForward (ConstArray2D const &from) const
 Perform a forward transformation on a 2-D array, returning the results as a new array. More...
 
std::vector< double > applyForward (std::vector< double > const &from) const
 Perform a forward transformation on a vector, returning the results as a new vector. More...
 
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. More...
 
Array2D applyInverse (ConstArray2D const &from) const
 Perform an inverse transformation on a 2-D array, returning the results as a new 2-D array. More...
 
std::vector< double > applyInverse (std::vector< double > const &from) const
 Perform an inverse transformation on a vector, returning the results as a new vector. More...
 
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. More...
 
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. More...
 
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. More...
 
Array2D tranGridInverse (PointI const &lbnd, PointI const &ubnd, double tol, int maxpix, int nPts) const
 Transform a grid of points in the inverse direction. More...
 
bool operator== (Object const &rhs) const
 Return True if this and rhs are the equal. More...
 
bool operator!= (Object const &rhs) const
 Return True if this and rhs are not equal. More...
 
void clear (std::string const &attrib)
 Clear the values of a specified set of attributes for an Object. More...
 
bool hasAttribute (std::string const &attrib) const
 Does this object have an attribute with the specified name? More...
 
std::string getClassName () const
 Get Class: the name of the class (e.g. More...
 
std::string getID () const
 Get ID: object identification string that is not copied. More...
 
std::string getIdent () const
 Get Ident: object identification string that is copied. More...
 
int getNObject () const
 Get NObject: number of AST objects in existence of the same type as the underlying AST class. More...
 
int getObjSize () const
 Get ObjSize: the in-memory size of the AST object in bytes. More...
 
int getRefCount () const
 Get RefCount: number of active pointers to the underlying AST object. More...
 
bool getUseDefs () const
 Get UseDefs: allow use of default values for Object attributes? More...
 
void lock (bool wait)
 Lock this object for exclusive use by the calling thread. More...
 
bool same (Object const &other) const
 Does this contain the same AST object as another? More...
 
void setID (std::string const &id)
 Set ID: object identification string that is not copied. More...
 
void setIdent (std::string const &ident)
 Set Ident: object identification string that is copied. More...
 
void setUseDefs (bool usedefs)
 Set UseDefs: allow use of default values for Object attributes? More...
 
void show (std::ostream &os, bool showComments=true) const
 Print a textual description the object to an ostream. More...
 
std::string show (bool showComments=true) const
 Return a textual description the object as a string. More...
 
bool test (std::string const &attrib) const
 Has this attribute been explicitly set (and not subsequently cleared)? More...
 
void unlock (bool report=false)
 Unlock this object previously locked using lock, so that other threads can use this object. More...
 
AstObject const * getRawPtr () const
 Get the raw AST pointer. More...
 
AstObject * getRawPtr ()
 Get the raw AST pointer. More...
 

Static Public Member Functions

static std::shared_ptr< ObjectfromString (std::string const &str)
 Construct an Object from a string, using astFromString. More...
 
template<typename Class >
static std::shared_ptr< Class > fromAstObject (AstObject *rawObj, bool copy)
 Given a bare AST object pointer return a shared pointer to an ast::Object of the correct type. More...
 

Protected Member Functions

virtual std::shared_ptr< ObjectcopyPolymorphic () const override
 Return a deep copy of this object. More...
 
 ChebyMap (AstChebyMap *map)
 Construct a ChebyMap from an raw AST pointer. More...
 
template<typename Class >
std::shared_ptr< Class > decompose (int i, bool copy) const
 Return a deep copy of one of the two component mappings. More...
 
template<typename T , typename AstT >
std::shared_ptr< T > copyImpl () const
 Implementation of deep copy. More...
 
bool getB (std::string const &attrib) const
 Get the value of an attribute as a bool. More...
 
std::string const getC (std::string const &attrib) const
 Get the value of an attribute as a string. More...
 
double getD (std::string const &attrib) const
 Get the value of an attribute as a double. More...
 
float getF (std::string const &attrib) const
 Get the value of an attribute as a float. More...
 
int getI (std::string const &attrib) const
 Get the value of an attribute as an int. More...
 
long int getL (std::string const &attrib) const
 Get the value of an attribute as a long int. More...
 
void set (std::string const &setting)
 Assign a set of attribute values, over-riding any previous values. More...
 
void setB (std::string const &attrib, bool value)
 Set the value of an attribute as a bool. More...
 
void setC (std::string const &attrib, std::string const &value)
 Set the value of an attribute as a string. More...
 
void setD (std::string const &attrib, double value)
 Set the value of an attribute as a double. More...
 
void setF (std::string const &attrib, float value)
 Set the value of an attribute as a float. More...
 
void setI (std::string const &attrib, int value)
 Set the value of an attribute as an int. More...
 
void setL (std::string const &attrib, long int value)
 Set the value of an attribute as a long int. More...
 

Static Protected Member Functions

template<typename ShimT , typename AstT >
static std::shared_ptr< ShimT > makeShim (AstObject *p)
 Functor to make an astshim instance from a raw AST pointer of the corresponding type. More...
 

Friends

class Object
 

Detailed Description

A ChebyMap is a form of Mapping which performs a Chebyshev polynomial transformation.

Each output coordinate is a linear combination of Chebyshev polynomials of the first kind, of order zero up to a specified maximum order, evaluated at the input coordinates. The coefficients to be used in the linear combination are specified separately for each output coordinate.

For a 1-dimensional ChebyMap, the forward transformation is defined as follows:

f(x) = c0 T0(x') + c1 T1(x') + c2 T2(x') + ...

where:

For an N-dimensional ChebyMap, the forward transformation is a generalisation of the above form. Each output axis value is the sum of ncoeff terms, where each term is the product of a single coefficient value and N factors of the form `Tn(x'_i), wherex'_i` is the normalised value of the i'th input axis value.

The forward and inverse transformations are defined independantly by separate sets of coefficients, supplied when the ChebyMap is created. If no coefficients are supplied to define the inverse transformation, the polyTran method can instead be used to create an inverse transformation. The inverse transformation so generated will be a Chebyshev polynomial with coefficients chosen to minimise the residuals left by a round trip (forward transformation followed by inverse transformation).

Attributes

All those of Mapping. In addition, the forward and inverse bounds can be retrieved using getDomain

Strictly speaking, ChebyMap it has all the attributes of PolyMap, but the only attributes PolyMap adds to Mapping are iterative inverse parameters and those are ignored by ChebyMap because it does not (yet) support an iterative inverse.

Definition at line 97 of file ChebyMap.h.

Member Typedef Documentation

◆ ObjectPtr

using ast::Object::ObjectPtr = std::unique_ptr<AstObject, Deleter>
inherited

unique pointer holding an AST raw pointer

Definition at line 59 of file Object.h.

Constructor & Destructor Documentation

◆ ChebyMap() [1/5]

ast::ChebyMap::ChebyMap ( ConstArray2D const &  coeff_f,
ConstArray2D const &  coeff_i,
std::vector< double > const &  lbnd_f,
std::vector< double > const &  ubnd_f,
std::vector< double > const &  lbnd_i,
std::vector< double > const &  ubnd_i,
std::string const &  options = "" 
)
inlineexplicit

Construct a ChebyMap with a specified forward and/or inverse transforms.

The two sets of coefficients are independent of each other: the inverse transform need not undo the forward transform.

Parameters
[in]coeff_fA matrix of coefficients describing the forward transformation. If coeff_f is empty then no forward transformation is provided.
[in]coeff_iA matrix of coefficients describing the inverse transformation. If coeff_i is empty then no inverse transformation is provided, unless you specify suitable options to request an iterative inverse; see the ChebyMap(ConstArray2D const &, int, std::vector<double> const &, std::string const &) "other constructor" for details.
[in]lbnd_fLower bounds for input data; one element per input axis
[in]ubnd_fUpper bounds for input data; one element per input axis
[in]lbnd_iLower bounds for output data; one element per output axis
[in]ubnd_iUpper bounds for output data; one element per output axis
[in]optionsComma-separated list of attribute assignments.

If a transform is not specified then the corresponding bounds are ignored (not even length-checked) and can be empty. For example if coeff_f is empty then lbnd_f and ubnd_f are ignored.

Exceptions
std::invalid_argumentif neither transform is specified (coeff_f and coeff_i are both empty).
std::invalid_argumentif the forward transform is specified (coeff_f is not empty) and lbnd_f or ubnd_f do not have nin elements.
std::invalid_argumentif the inverse transform is specified (coeff_i is not empty) and lbnd_i or ubnd_i do not have nout elements.

Coefficient Matrices

The coefficients describing a forward transformation are specified as 2-dimensional ndarray, with one row per coefficient. Each row contains the following consecutive (2 + nin) values:

  • The first element is the coefficient value.
  • The next element is the integer index of the ChebyMap output which uses the coefficient within its defining polynomial (the first output has index 1).
  • The remaining elements give the Chebyshev order to use with each corresponding input coordinate value, or 0 to ignore that input coordinate. Powers must not be negative and floating point values are rounded to the nearest integer.

For example, suppose you want to make a ChebyMap with 3 inputs and 2 outputs. Then each row of coeff_f must have 5 = 2 + nin elements. A row with values (1.2, 2, 6, 3, 0) describes a coefficient that increments output 2 as follows:

`out2 += 1.2 * T6(in1') * T3(in2') * T0(in3')`

and a row with values (-1.5, 1, 0, 0, 0) describes a coefficient that increments output 1 with a constant value of -1.5 (since all powers are 0):

`out1 += -1.5 * T0(in1') * T0(in2') * T0(in3')`

where inI' is the normalized value of input axis I.

The final value of each output coordinate is the sum of all values specified by coefficients which increment that output coordinate, or 0 if there are no such coefficients.

The coefficients describing the inverse transformation work the same way, of course, but each coefficient is described by (2 + nout) values.

Definition at line 161 of file ChebyMap.h.

165  : Mapping(reinterpret_cast<AstMapping *>(
166  _makeRawChebyMap(coeff_f, coeff_i, lbnd_f, ubnd_f, lbnd_i, ubnd_i, options))) {}
Mapping(Mapping const &)=default
Copy constructor: make a deep copy.
tuple options
Definition: lsstimport.py:47

◆ ChebyMap() [2/5]

ast::ChebyMap::ChebyMap ( ConstArray2D const &  coeff_f,
int  nout,
std::vector< double > const &  lbnd_f,
std::vector< double > const &  ubnd_f,
std::string const &  options = "IterInverse=0" 
)
inlineexplicit

Construct a ChebyMap with only the forward transform specified.

If the polynomial is invertible and you want an inverse can you call polyTran to fit one (at this time the iterative inverse offered by PolyMap is not available for ChebyMap).

Parameters
[in]coeff_fA (2 + nin) x ncoeff_f matrix of coefficients describing the forward transformation.
[in]noutNumber of output coordinates.
[in]lbnd_fLower bounds for input data; one element per input axis
[in]ubnd_fUpper bounds for input data; one element per input axis
[in]optionsComma-separated list of attribute assignments.
Exceptions
std::invalid_argumentif the forward transform is not defined (coeff_f is empty)
std::invalid_argumentif lbnd_f or ubnd_f do not have nin elements

Definition at line 184 of file ChebyMap.h.

186  : Mapping(reinterpret_cast<AstMapping *>(
187  _makeRawChebyMap(coeff_f, nout, lbnd_f, ubnd_f, options))) {}
Mapping(Mapping const &)=default
Copy constructor: make a deep copy.
tuple options
Definition: lsstimport.py:47

◆ ~ChebyMap()

virtual ast::ChebyMap::~ChebyMap ( )
inlinevirtual

Definition at line 189 of file ChebyMap.h.

189 {}

◆ ChebyMap() [3/5]

ast::ChebyMap::ChebyMap ( ChebyMap const &  )
default

Copy constructor: make a deep copy.

◆ ChebyMap() [4/5]

ast::ChebyMap::ChebyMap ( ChebyMap &&  )
default

◆ ChebyMap() [5/5]

ast::ChebyMap::ChebyMap ( AstChebyMap *  map)
protected

Construct a ChebyMap from an raw AST pointer.

Definition at line 49 of file ChebyMap.cc.

49  : Mapping(reinterpret_cast<AstMapping *>(map)) {
50  if (!astIsAChebyMap(getRawPtr())) {
52  os << "this is a " << getClassName() << ", which is not a ChebyMap";
53  throw std::invalid_argument(os.str());
54  }
55 }
Mapping(Mapping const &)=default
Copy constructor: make a deep copy.
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
std::string getClassName() const
Get Class: the name of the class (e.g.
Definition: Object.h:138
T str(T... args)
std::ostream * os
Definition: Schema.cc:746

Member Function Documentation

◆ applyForward() [1/3]

void ast::Mapping::applyForward ( ConstArray2D const &  from,
Array2D const &  to 
) const
inlineinherited

Perform a forward transformation on 2-D array, putting the results into a pre-allocated 2-D array.

Parameters
[in]frominput coordinates, with dimensions (nPts, nIn)
[out]totransformed coordinates, with dimensions (nPts, nOut)

Definition at line 260 of file Mapping.h.

260 { _tran(from, true, to); }
table::Key< int > from
table::Key< int > to

◆ applyForward() [2/3]

Array2D ast::Mapping::applyForward ( ConstArray2D const &  from) const
inlineinherited

Perform a forward transformation on a 2-D array, returning the results as a new array.

Parameters
[in]frominput coordinates, with dimensions (nPts, nIn)
Returns
the results as a new array with dimensions (nPts, nOut)

Definition at line 268 of file Mapping.h.

268  {
269  Array2D to = ndarray::allocate(getNOut(), from.getSize<1>());
270  _tran(from, true, to);
271  return to;
272  }
table::Key< int > from
ndarray::Array< double, 2, 2 > Array2D
2D array of const double; typically used for lists of const points
Definition: base.h:42
table::Key< int > to
int getNOut() const
Get NOut: the number of output axes.
Definition: Mapping.h:82

◆ applyForward() [3/3]

std::vector<double> ast::Mapping::applyForward ( std::vector< double > const &  from) const
inlineinherited

Perform a forward transformation on a vector, returning the results as a new vector.

Parameters
[in]frominput coordinates as a vector, with axes adjacent, e.g. x0, y0, x1, y1...xn, yn
Returns
the results as a new vector

Definition at line 280 of file Mapping.h.

280  {
281  auto fromArr = arrayFromVector(from, getNIn());
282  std::vector<double> to(fromArr.getSize<1>() * getNOut());
283  auto toArr = arrayFromVector(to, getNOut());
284  _tran(fromArr, true, toArr);
285  return to;
286  }
table::Key< int > to
int getNIn() const
Get NIn: the number of input axes.
Definition: Mapping.h:77
ConstArray2D arrayFromVector(std::vector< double > const &vec, int nAxes)
Reshape a vector as a 2-dimensional array that shares the same memory.
Definition: base.cc:65
int getNOut() const
Get NOut: the number of output axes.
Definition: Mapping.h:82

◆ applyInverse() [1/3]

void ast::Mapping::applyInverse ( ConstArray2D const &  from,
Array2D const &  to 
) const
inlineinherited

Perform an inverse transformation on a 2-D array, putting the results into a pre-allocated 2-D array.

Parameters
[in]frominput coordinates, with dimensions (nPts, nOut)
[out]totransformed coordinates, with dimensions (nPts, nIn)

Definition at line 294 of file Mapping.h.

294 { _tran(from, false, to); }
table::Key< int > from
table::Key< int > to

◆ applyInverse() [2/3]

Array2D ast::Mapping::applyInverse ( ConstArray2D const &  from) const
inlineinherited

Perform an inverse transformation on a 2-D array, returning the results as a new 2-D array.

Parameters
[in]fromoutput coordinates, with dimensions (nPts, nOut)
Returns
the results as a new array with dimensions (nPts, nIn)

Definition at line 302 of file Mapping.h.

302  {
303  Array2D to = ndarray::allocate(getNIn(), from.getSize<1>());
304  _tran(from, false, to);
305  return to;
306  }
table::Key< int > from
ndarray::Array< double, 2, 2 > Array2D
2D array of const double; typically used for lists of const points
Definition: base.h:42
table::Key< int > to
int getNIn() const
Get NIn: the number of input axes.
Definition: Mapping.h:77

◆ applyInverse() [3/3]

std::vector<double> ast::Mapping::applyInverse ( std::vector< double > const &  from) const
inlineinherited

Perform an inverse transformation on a vector, returning the results as a new vector.

Parameters
[in]frominput coordinates as a vector, with axes adjacent, e.g. x0, y0, x1, y1...xn, yn
Returns
the results as a new vector

Definition at line 314 of file Mapping.h.

314  {
315  auto fromArr = arrayFromVector(from, getNOut());
316  std::vector<double> to(fromArr.getSize<1>() * getNIn());
317  auto toArr = arrayFromVector(to, getNIn());
318  _tran(fromArr, false, toArr);
319  return to;
320  }
table::Key< int > to
int getNIn() const
Get NIn: the number of input axes.
Definition: Mapping.h:77
ConstArray2D arrayFromVector(std::vector< double > const &vec, int nAxes)
Reshape a vector as a 2-dimensional array that shares the same memory.
Definition: base.cc:65
int getNOut() const
Get NOut: the number of output axes.
Definition: Mapping.h:82

◆ clear()

void ast::Object::clear ( std::string const &  attrib)
inlineinherited

Clear the values of a specified set of attributes for an Object.

Clearing an attribute cancels any value that has previously been explicitly set for it, so that the standard default attribute value will subsequently be used instead. This also causes the astTest function to return the value zero for the attribute, indicating that no value has been set.

Definition at line 118 of file Object.h.

118  {
119  astClear(getRawPtr(), attrib.c_str());
120  assertOK();
121  }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49

◆ copy()

std::shared_ptr<ChebyMap> ast::ChebyMap::copy ( ) const
inline

Return a deep copy of this object.

Definition at line 198 of file ChebyMap.h.

virtual std::shared_ptr< Object > copyPolymorphic() const override
Return a deep copy of this object.
Definition: ChebyMap.h:307
T static_pointer_cast(T... args)
ChebyMap(ConstArray2D const &coeff_f, ConstArray2D const &coeff_i, std::vector< double > const &lbnd_f, std::vector< double > const &ubnd_f, std::vector< double > const &lbnd_i, std::vector< double > const &ubnd_i, std::string const &options="")
Construct a ChebyMap with a specified forward and/or inverse transforms.
Definition: ChebyMap.h:161

◆ copyImpl()

template<typename T , typename AstT >
std::shared_ptr<T> ast::Object::copyImpl ( ) const
inlineprotectedinherited

Implementation of deep copy.

Should be called to implement copyPolymorphic by all derived classes.

Definition at line 319 of file Object.h.

319  {
320  auto *rawptr = reinterpret_cast<AstT *>(astCopy(getRawPtr()));
321  auto retptr = std::shared_ptr<T>(new T(rawptr));
322  assertOK();
323  return retptr;
324  }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49

◆ copyPolymorphic()

virtual std::shared_ptr<Object> ast::ChebyMap::copyPolymorphic ( ) const
inlineoverrideprotectedvirtual

Return a deep copy of this object.

This is called by copy.

Each subclass must override this method. The standard implementation is:

return copyImpl<astshim_class, ast_class>();

for example Frame implements this as:

return copyImpl<Frame, AstFrame>();

Reimplemented from ast::Mapping.

Definition at line 307 of file ChebyMap.h.

307  {
308  return copyImpl<ChebyMap, AstChebyMap>();
309  }

◆ decompose()

template<typename Class >
template std::shared_ptr< Mapping > ast::Mapping::decompose ( int  i,
bool  copy 
) const
protectedinherited

Return a deep copy of one of the two component mappings.

This is intended to be exposed by classes that need it (e.g. CmpMap, CmpFrame and TranMap) as operator[].

Template Parameters
Classastshim class of returned object, typically Mapping or Frame.
Parameters
[in]iIndex: 0 for the first mapping, 1 for the second
[in]copyIf true make a deep copy, else a shallow copy
Exceptions
std::invalid_argumentif i is not 0 or 1.
std::runtime_errorif this mapping is not a compound mapping.

Definition at line 64 of file Mapping.cc.

64  {
65  if ((i < 0) || (i > 1)) {
67  os << "i =" << i << "; must be 0 or 1";
68  throw std::invalid_argument(os.str());
69  }
70  // Report pre-existing problems now so our later test for "not a compound object" is accurate
71  assertOK();
72 
73  AstMapping *rawMap1;
74  AstMapping *rawMap2;
75  int series, invert1, invert2;
76  astDecompose(getRawPtr(), &rawMap1, &rawMap2, &series, &invert1, &invert2);
77 
78  if (!rawMap2) {
79  // Not a compound object; free rawMap1 (rawMap2 is null, so no need to free it) and throw an exception
80  astAnnul(reinterpret_cast<AstObject *>(rawMap1));
82  os << "This " << getClassName() << " is not a compound object";
83  throw std::runtime_error(os.str());
84  }
85 
86  // Make a deep copy of the returned object and free the shallow copies
87  AstMapping *retRawMap;
88  int invert;
89  if (i == 0) {
90  retRawMap = reinterpret_cast<AstMapping *>(astCopy(reinterpret_cast<AstObject *>(rawMap1)));
91  invert = invert1;
92  } else {
93  retRawMap = reinterpret_cast<AstMapping *>(astCopy(reinterpret_cast<AstObject *>(rawMap2)));
94  invert = invert2;
95  }
96  astAnnul(reinterpret_cast<AstObject *>(rawMap1));
97  astAnnul(reinterpret_cast<AstObject *>(rawMap2));
98 
99  // If the mapping's internal invert flag does not match the value used when the CmpMap was made
100  // then invert the mapping. Note that it is not possible to create such objects in astshim
101  // but it is possible to read in objects created by other software.
102  if (invert != astGetI(retRawMap, "Invert")) {
103  astInvert(retRawMap);
104  }
105 
106  return Object::fromAstObject<Class>(reinterpret_cast<AstObject *>(retRawMap), copy);
107 }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
std::string getClassName() const
Get Class: the name of the class (e.g.
Definition: Object.h:138
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49
Relationship invert(Relationship r)
Given the relationship between two sets A and B (i.e.
Definition: Relationship.h:55
T str(T... args)
std::shared_ptr< Mapping > copy() const
Return a deep copy of this object.
Definition: Mapping.h:72
std::ostream * os
Definition: Schema.cc:746

◆ fromAstObject()

template<typename Class >
template std::shared_ptr< Object > ast::Object::fromAstObject< Object > ( AstObject *  rawObj,
bool  copy 
)
staticinherited

Given a bare AST object pointer return a shared pointer to an ast::Object of the correct type.

The returned object takes ownership of the pointer. This is almost always what you want, for instance astDecompose returns shallow copies of the internal pointers.

Template Parameters
ClassThe class of the returned shared pointer. (The actual class will be the correct class of rawPtr.)
Parameters
[in]rawObjA bare AST object pointer
[in]copyIf True then make a deep copy of the pointer (and free the original)

Definition at line 132 of file Object.cc.

132  {
133  AstObject *rawObjCopy = rawObj;
134  if (copy) {
135  rawObjCopy = reinterpret_cast<AstObject *>(astCopy(rawObj));
136  astAnnul(rawObj);
137  }
138  assertOK(rawObjCopy);
139 
140  // Make the appropriate ast shim object and dynamically cast to the desired output type
141  auto retObjectBeforeCast = Object::_basicFromAstObject(rawObjCopy);
142  auto retObject = std::dynamic_pointer_cast<Class>(retObjectBeforeCast);
143  if (!retObject) {
145  os << "The component is of type " << retObject->getClassName()
146  << ", which could not be cast to the desired type " << typeid(Class).name();
147  throw std::runtime_error(os.str());
148  }
149  return retObject;
150 }
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49
std::shared_ptr< Object > copy() const
Return a deep copy of this object.
Definition: Object.h:108
T str(T... args)
T dynamic_pointer_cast(T... args)
std::ostream * os
Definition: Schema.cc:746

◆ fromString()

static std::shared_ptr<Object> ast::Object::fromString ( std::string const &  str)
inlinestaticinherited

Construct an Object from a string, using astFromString.

Definition at line 88 of file Object.h.

88  {
89  auto *rawPtr = reinterpret_cast<AstObject *>(astFromString(str.c_str()));
90  return Object::_basicFromAstObject(rawPtr);
91  }

◆ getB()

bool ast::Object::getB ( std::string const &  attrib) const
inlineprotectedinherited

Get the value of an attribute as a bool.

If possible, the attribute value is converted to the type you request.

Exceptions
std::runtime_errorif the attribute does not exist or the value cannot be converted

Definition at line 347 of file Object.h.

347  {
348  bool val = astGetI(getRawPtr(), attrib.c_str());
349  assertOK();
350  return val;
351  }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49
ImageT val
Definition: CR.cc:146

◆ getC()

std::string const ast::Object::getC ( std::string const &  attrib) const
inlineprotectedinherited

Get the value of an attribute as a string.

If possible, the attribute value is converted to the type you request.

Exceptions
std::runtime_errorif the attribute does not exist or the value cannot be converted

Definition at line 360 of file Object.h.

360  {
361  char const *rawval = astGetC(getRawPtr(), attrib.c_str());
362  assertOK();
363  return std::string(rawval);
364  }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49
STL class.

◆ getClassName()

std::string ast::Object::getClassName ( ) const
inlineinherited

Get Class: the name of the class (e.g.

ZoomMap)

Note: if AST returns "CmpMap" then the name will be changed to "SeriesMap" or "ParallelMap", as appropriate.

Definition at line 138 of file Object.h.

138 { return detail::getClassName(getRawPtr()); }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
std::string getClassName(AstObject const *rawObj)
Get the AST class name, changing CmpMap to SeriesMap or ParallelMap as appropriate.
Definition: utils.cc:37

◆ getD()

double ast::Object::getD ( std::string const &  attrib) const
inlineprotectedinherited

Get the value of an attribute as a double.

If possible, the attribute value is converted to the type you request.

Exceptions
std::runtime_errorif the attribute does not exist or the value cannot be converted

Definition at line 373 of file Object.h.

373  {
374  double val = astGetD(getRawPtr(), attrib.c_str());
375  assertOK();
376  return val;
377  }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49
ImageT val
Definition: CR.cc:146

◆ getDomain()

ChebyDomain ast::ChebyMap::getDomain ( bool  forward) const

Return the bounding box of the domain of a ChebyMap.

Return the upper and lower limits of the box defining the domain of either the forward or inverse transformation of a ChebyMap. These are the values that were supplied when the ChebyMap was created.

If the requested direction was fit using polyTran, and so does not have a user-specified domain bounding box, this method returns a box determined by calling MapBox on opposite direction's transformation.

Parameters
[in]forwardIf true return the domain of the forward transform, else the inverse
Exceptions
std::runtime_errorif the domain cannot be computed

Definition at line 57 of file ChebyMap.cc.

57  {
58  int nElements = forward ? getNIn() : getNOut();
59  std::vector<double> lbnd(nElements, 0.0);
60  std::vector<double> ubnd(nElements, 0.0);
61  astChebyDomain(getRawPtr(), static_cast<int>(forward), lbnd.data(), ubnd.data());
62  assertOK();
63  for (auto &val : lbnd) {
64  if (val == AST__BAD) {
65  throw std::runtime_error("Could not compute domain");
66  }
67  }
68  for (auto &val : ubnd) {
69  if (val == AST__BAD) {
70  throw std::runtime_error("Could not compute domain");
71  }
72  }
73  return ChebyDomain(lbnd, ubnd);
74 }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49
ImageT val
Definition: CR.cc:146
int getNIn() const
Get NIn: the number of input axes.
Definition: Mapping.h:77
int getNOut() const
Get NOut: the number of output axes.
Definition: Mapping.h:82
T forward(T... args)

◆ getF()

float ast::Object::getF ( std::string const &  attrib) const
inlineprotectedinherited

Get the value of an attribute as a float.

If possible, the attribute value is converted to the type you request.

Exceptions
std::runtime_errorif the attribute does not exist or the value cannot be converted

Definition at line 386 of file Object.h.

386  {
387  float val = astGetF(getRawPtr(), attrib.c_str());
388  assertOK();
389  return val;
390  }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49
ImageT val
Definition: CR.cc:146

◆ getI()

int ast::Object::getI ( std::string const &  attrib) const
inlineprotectedinherited

Get the value of an attribute as an int.

If possible, the attribute value is converted to the type you request.

Exceptions
std::runtime_errorif the attribute does not exist or the value cannot be converted

Definition at line 399 of file Object.h.

399  {
400  int val = astGetI(getRawPtr(), attrib.c_str());
401  assertOK();
402  return val;
403  }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49
ImageT val
Definition: CR.cc:146

◆ getID()

std::string ast::Object::getID ( ) const
inlineinherited

Get ID: object identification string that is not copied.

Definition at line 141 of file Object.h.

141 { return getC("ID"); }
std::string const getC(std::string const &attrib) const
Get the value of an attribute as a string.
Definition: Object.h:360

◆ getIdent()

std::string ast::Object::getIdent ( ) const
inlineinherited

Get Ident: object identification string that is copied.

Definition at line 144 of file Object.h.

144 { return getC("Ident"); }
std::string const getC(std::string const &attrib) const
Get the value of an attribute as a string.
Definition: Object.h:360

◆ getIsLinear()

bool ast::Mapping::getIsLinear ( ) const
inlineinherited

Get IsLinear: is the Mapping linear?

Definition at line 100 of file Mapping.h.

100 { return getB("IsLinear"); }
bool getB(std::string const &attrib) const
Get the value of an attribute as a bool.
Definition: Object.h:347

◆ getIsSimple()

bool ast::Mapping::getIsSimple ( ) const
inlineinherited

Get IsSimple: has the mapping been simplified?

Definition at line 87 of file Mapping.h.

87 { return getI("IsSimple"); }
int getI(std::string const &attrib) const
Get the value of an attribute as an int.
Definition: Object.h:399

◆ getL()

long int ast::Object::getL ( std::string const &  attrib) const
inlineprotectedinherited

Get the value of an attribute as a long int.

If possible, the attribute value is converted to the type you request.

Exceptions
std::runtime_errorif the attribute does not exist or the value cannot be converted

Definition at line 412 of file Object.h.

412  {
413  long int val = astGetL(getRawPtr(), attrib.c_str());
414  assertOK();
415  return val;
416  }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49
ImageT val
Definition: CR.cc:146

◆ getNIn()

int ast::Mapping::getNIn ( ) const
inlineinherited

Get NIn: the number of input axes.

Definition at line 77 of file Mapping.h.

77 { return getI("NIn"); }
int getI(std::string const &attrib) const
Get the value of an attribute as an int.
Definition: Object.h:399

◆ getNObject()

int ast::Object::getNObject ( ) const
inlineinherited

Get NObject: number of AST objects in existence of the same type as the underlying AST class.

Warning
Intended only for debugging astshim.

Definition at line 152 of file Object.h.

152 { return getI("NObject"); }
int getI(std::string const &attrib) const
Get the value of an attribute as an int.
Definition: Object.h:399

◆ getNOut()

int ast::Mapping::getNOut ( ) const
inlineinherited

Get NOut: the number of output axes.

Definition at line 82 of file Mapping.h.

82 { return getI("NOut"); }
int getI(std::string const &attrib) const
Get the value of an attribute as an int.
Definition: Object.h:399

◆ getObjSize()

int ast::Object::getObjSize ( ) const
inlineinherited

Get ObjSize: the in-memory size of the AST object in bytes.

Definition at line 155 of file Object.h.

155 { return getI("ObjSize"); }
int getI(std::string const &attrib) const
Get the value of an attribute as an int.
Definition: Object.h:399

◆ getRawPtr() [1/2]

AstObject const* ast::Object::getRawPtr ( ) const
inlineinherited

Get the raw AST pointer.

Intended for internal use only, but cannot be made protected without endless "friend class" declarations.

Definition at line 291 of file Object.h.

291 { return &*_objPtr; };

◆ getRawPtr() [2/2]

AstObject* ast::Object::getRawPtr ( )
inlineinherited

Get the raw AST pointer.

Intended for internal use only, but cannot be made protected without endless "friend class" declarations.

Definition at line 293 of file Object.h.

293 { return &*_objPtr; };

◆ getRefCount()

int ast::Object::getRefCount ( ) const
inlineinherited

Get RefCount: number of active pointers to the underlying AST object.

Warning
Intended only for debugging astshim.

Definition at line 162 of file Object.h.

162 { return getI("RefCount"); }
int getI(std::string const &attrib) const
Get the value of an attribute as an int.
Definition: Object.h:399

◆ getReport()

bool ast::Mapping::getReport ( ) const
inlineinherited

Get Report: report transformed coordinates to stdout?

Definition at line 105 of file Mapping.h.

105 { return getB("Report"); }
bool getB(std::string const &attrib) const
Get the value of an attribute as a bool.
Definition: Object.h:347

◆ getUseDefs()

bool ast::Object::getUseDefs ( ) const
inlineinherited

Get UseDefs: allow use of default values for Object attributes?

Definition at line 165 of file Object.h.

165 { return getB("UseDefs"); }
bool getB(std::string const &attrib) const
Get the value of an attribute as a bool.
Definition: Object.h:347

◆ hasAttribute()

bool ast::Object::hasAttribute ( std::string const &  attrib) const
inlineinherited

Does this object have an attribute with the specified name?

Definition at line 126 of file Object.h.

126  {
127  bool ret = astHasAttribute(getRawPtr(), attrib.c_str());
128  assertOK();
129  return ret;
130  }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49

◆ hasForward()

bool ast::Mapping::hasForward ( ) const
inlineinherited

Is the forward transform available?

Note
This gets the TranForward attribute, but is named hasForward instead of getTranForward for clarity, since it does not return a transform.

Definition at line 114 of file Mapping.h.

114 { return getB("TranForward"); }
bool getB(std::string const &attrib) const
Get the value of an attribute as a bool.
Definition: Object.h:347

◆ hasInverse()

bool ast::Mapping::hasInverse ( ) const
inlineinherited

Is the inverse transform available?

Note
This gets the TranInverse attribute, but is named hasInverse instead of getTranInverse for clarity, since it does not return a transform.

Definition at line 123 of file Mapping.h.

123 { return getB("TranInverse"); }
bool getB(std::string const &attrib) const
Get the value of an attribute as a bool.
Definition: Object.h:347

◆ inverted()

std::shared_ptr< Mapping > ast::Mapping::inverted ( ) const
inherited

Get an inverse mapping.

An inverse mapping is a deep copy of a mapping whose Invert attribute has been toggled, as indicated by isInverted. This swaps the meaning of "input" and "output", and of "forward" and "inverse". Thus it swaps the behavior of applyForward and applyInverse, getNIn and getNOut, hasForward and hasInverse and so on.

Note that the inverse mapping contains exactly the same model coefficients as the original, but they are used by applyInverse instead of applyForward. Thus for example if a ZoomMap has a zoom factor of 4.0 then its inverse also reports a zoom factor of 4.0 (despite behaving like an uninverted ZoomMap with zoom factor of 0.25).

Definition at line 41 of file Mapping.cc.

41  {
42  auto rawCopy = reinterpret_cast<AstMapping *>(astCopy(getRawPtr()));
43  astInvert(rawCopy);
44  assertOK(reinterpret_cast<AstObject *>(rawCopy));
45  // use false because the pointer has already been copied
46  return Object::fromAstObject<Mapping>(reinterpret_cast<AstObject *>(rawCopy), false);
47 }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49

◆ isInverted()

bool ast::Mapping::isInverted ( ) const
inlineinherited

Is this an inverted mapping?

Note: this gets the Invert attribute. This method is not called getInvert because that sounds like it might return the inverse.

Definition at line 95 of file Mapping.h.

95 { return getB("Invert"); }
bool getB(std::string const &attrib) const
Get the value of an attribute as a bool.
Definition: Object.h:347

◆ linearApprox()

Array2D ast::Mapping::linearApprox ( PointD const &  lbnd,
PointD const &  ubnd,
double  tol 
) const
inherited

Compute a linear approximation to the forward transformation.

Parameters
[in]lbndInput point defining the lower bounds of the box over which the linear approximation is computed.
[in]ubndInput point defining the upper bounds of the box over which the linear approximation is computed.
[in]tolThe maximum permitted deviation from linearity, expressed as apositive Cartesian displacement in the output coordinate space. If a linear fit to the forward transformation of the Mapping deviates from the true transformation by more than this amount at any point which is tested, then raise an exception.
Returns
The co-efficients of the linear approximation to the specified transformation, as an 1 + nIn x nOut array. The first index is [constant, gradiant for input 1, gradiant for input 2...] and the second index is [output 1, output 2, ...]. For example, if the Mapping has 2 inputs and 3 outputs then the coefficients are:
X_out = fit[0, 0] + fit[1, 0] X_in + fit[2, 0] Y_in
Y_out = fit[0, 1] + fit[1, 1] X_in + fit[2, 1] Y_in
Z_out = fit[0, 2] + fit[1, 2] X_in + fit[2, 2] Y_in
Exceptions
std::runtime_errorif the forward transformation cannot be modeled to within the specified tol.

Definition at line 49 of file Mapping.cc.

49  {
50  int const nIn = getNIn();
51  int const nOut = getNOut();
52  detail::assertEqual(lbnd.size(), "lbnd.size", static_cast<std::size_t>(nIn), "nIn");
53  detail::assertEqual(ubnd.size(), "ubnd.size", static_cast<std::size_t>(nIn), "nIn");
54  Array2D fit = ndarray::allocate(ndarray::makeVector(1 + nIn, nOut));
55  int isOK = astLinearApprox(getRawPtr(), lbnd.data(), ubnd.data(), tol, fit.getData());
56  if (!isOK) {
57  throw std::runtime_error("Mapping not sufficiently linear");
58  }
59  assertOK();
60  return fit;
61 }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
ndarray::Array< double, 2, 2 > Array2D
2D array of const double; typically used for lists of const points
Definition: base.h:42
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49
int getNIn() const
Get NIn: the number of input axes.
Definition: Mapping.h:77
void assertEqual(T1 val1, std::string const &descr1, T2 val2, std::string const &descr2)
Definition: utils.h:47
int getNOut() const
Get NOut: the number of output axes.
Definition: Mapping.h:82

◆ lock()

void ast::Object::lock ( bool  wait)
inlineinherited

Lock this object for exclusive use by the calling thread.

The thread-safe public interface to AST is designed so that an error is reported if any thread attempts to use an Object that it has not previously locked for its own exclusive use using this function. When an Object is created, it is initially locked by the thread that creates it, so newly created objects do not need to be explicitly locked. However, if an Object pointer is passed to another thread, the original thread must first unlock it (using astUnlock) and the new thread must then lock it (using astLock) before the new thread can use the Object.

Parameters
[in]waitIf the Object is curently locked by another thread then this function will either report an error or block. If a non-zero value is supplied for "wait", the calling thread waits until the object is available for it to use. Otherwise, an error is reported and the function returns immediately without locking the Object.

Notes

  • The Locked object will belong to the current AST context.
  • This function returns without action if the Object is already locked by the calling thread.
  • If simultaneous use of the same object is required by two or more threads, Object::copy should be used to to produce a deep copy of the Object for each thread. Each copy should then be unlocked by the parent thread (i.e. the thread that created the copy), and then locked by the child thread (i.e. the thread that wants to use the copy).
  • This function returns without action if the AST library has been built without POSIX thread support (i.e. the "-with-pthreads" option was not specified when running the "configure" script).

Definition at line 201 of file Object.h.

201  {
202  astLock(getRawPtr(), static_cast<int>(wait));
203  assertOK();
204  }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49

◆ makeShim()

template<typename ShimT , typename AstT >
static std::shared_ptr<ShimT> ast::Object::makeShim ( AstObject *  p)
inlinestaticprotectedinherited

Functor to make an astshim instance from a raw AST pointer of the corresponding type.

Template Parameters
ShimTOutput astshim class
AstTOutput AST class

Definition at line 309 of file Object.h.

309  {
310  return std::shared_ptr<ShimT>(new ShimT(reinterpret_cast<AstT *>(p)));
311  }

◆ operator!=()

bool ast::Object::operator!= ( Object const &  rhs) const
inlineinherited

Return True if this and rhs are not equal.

See operator== for details

Definition at line 82 of file Object.h.

82  {
83  return !(*this == rhs); };

◆ operator=() [1/2]

ChebyMap& ast::ChebyMap::operator= ( ChebyMap const &  )
delete

◆ operator=() [2/2]

ChebyMap& ast::ChebyMap::operator= ( ChebyMap &&  )
default

◆ operator==()

bool ast::Object::operator== ( Object const &  rhs) const
inherited

Return True if this and rhs are the equal.

For two objects be equal, they both must have the same attributes and all contained objects must be equal.

Definition at line 82 of file Object.cc.

82  {
83  auto thisStr = this->show(false);
84  auto rhsStr = rhs.show(false);
85  return rhsStr == thisStr;
86 }
void show(std::ostream &os, bool showComments=true) const
Print a textual description the object to an ostream.
Definition: Object.cc:152

◆ polyTran() [1/2]

ChebyMap ast::ChebyMap::polyTran ( bool  forward,
double  acc,
double  maxacc,
int  maxorder,
std::vector< double > const &  lbnd,
std::vector< double > const &  ubnd 
) const

This function creates a new ChebyMap which is a copy of this one, in which a specified transformation (forward or inverse) has been replaced by a new Chebyshev polynomial transformation.

The coefficients of the new transformation are estimated by sampling the other transformation and performing a least squares polynomial fit in the opposite direction to the sampled positions and values.

This method can only be used on (1-input,1-output) or (2-input, 2-output) ChebyMaps.

Parameters
[in]forwardIf true the forward transformation is replaced. Otherwise the inverse transformation is replaced.
[in]accThe target accuracy, expressed as a geodesic distance within the ChebyMap's input space (if forward is false) or output space (if forward is true).
[in]maxaccThe maximum allowed accuracy for an acceptable polynomial, expressed as a geodesic distance within the ChebyMap's input space (if forward is false) or output space (if forward is true).
[in]maxorderThe maximum allowed polynomial order. This is one more than the maximum power of either input axis. So for instance, a value of 3 refers to a quadratic polynomial. Note, cross terms with total powers greater than or equal to maxorder are not inlcuded in the fit. So the maximum number of terms in each of the fitted polynomials is maxorder*(maxorder + 1)/2.
[in]lbndA vector holding the lower bounds of a rectangular region within the ChebyMap's input space (if forward is false) or output space (if forward is true). If both lbnd and ubnd are empty (the default) then they will be estimated. The new polynomial will be evaluated over this rectangle. The length should equal getNIn() or getNOut(), depending on forward.
[in]ubndA vector holding the upper bounds of a rectangular region within the ChebyMap's input space (if forward is false) or output space (if forward is true). If both lbnd and ubnd are empty (the default) then they will be estimated. The new polynomial will be evaluated over this rectangle. The length should equal getNIn() or getNOut(), depending on forward.
Exceptions
std::invalid_argumentif the size of lbnd or ubnd does not match getNIn() (if forward false) or getNOut() (if forward true).

The variant that takes omits the lbnd and ubnd arguments uses the full domain of the polynomial whose inverse is being fit.

Note

The transformation to create is specified by the forward parameter. In what follows "X" refers to the inputs of the ChebyMap, and "Y" to the outputs of the ChebyMap. The forward transformation transforms input values (X) into output values (Y), and the inverse transformation transforms output values (Y) into input values (X). Within a ChebyMap, each transformation is represented by an independent set of polynomials, P_f or P_i: Y=P_f(X) for the forward transformation and X=P_i(Y) for the inverse transformation.

The forward parameter specifies the transformation to be replaced. If it is true, a new forward transformation is created by first finding the input values (X) using the inverse transformation (which must be available) at a regular grid of points (Y) covering a rectangular region of the ChebyMap's output space. The coefficients of the required forward polynomial, Y=P_f(X), are chosen in order to minimise the sum of the squared residuals between the sampled values of Y and P_f(X).

If forward is false (probably the most likely case), a new inverse transformation is created by first finding the output values (Y) using the forward transformation (which must be available) at a regular grid of points (X) covering a rectangular region of the ChebyMap's input space. The coefficients of the required inverse polynomial, X=P_i(Y), are chosen in order to minimise the sum of the squared residuals between the sampled values of X and P_i(Y).

This fitting process is performed repeatedly with increasing polynomial orders (starting with linear) until the target accuracy is achieved, or a specified maximum order is reached. If the target accuracy cannot be achieved even with this maximum-order polynomial, the best fitting maximum-order polynomial is returned so long as its accuracy is better than "maxacc". If it is not, an error is reported.

Definition at line 30 of file ChebyMap.cc.

31  {
32  return ChebyMap(detail::polyTranImpl<AstChebyMap>(*this, forward, acc, maxacc, maxorder, lbnd, ubnd));
33 }
ChebyMap(ConstArray2D const &coeff_f, ConstArray2D const &coeff_i, std::vector< double > const &lbnd_f, std::vector< double > const &ubnd_f, std::vector< double > const &lbnd_i, std::vector< double > const &ubnd_i, std::string const &options="")
Construct a ChebyMap with a specified forward and/or inverse transforms.
Definition: ChebyMap.h:161
template AstChebyMap * polyTranImpl< AstChebyMap >(ChebyMap const &, bool, double, double, int, std::vector< double > const &, std::vector< double > const &)

◆ polyTran() [2/2]

ChebyMap ast::ChebyMap::polyTran ( bool  forward,
double  acc,
double  maxacc,
int  maxorder 
) const

This method is the same as polyTran except that the bounds are those originally provided when the polynomial whose inverse is being fit was specified.

Definition at line 35 of file ChebyMap.cc.

35  {
36  // Note: AST directly supports specifying lbnd or ubnd as NULL for ChebyMap
37  // but the code provide explicit bounds for two reasons:
38  // - This simplifies the interface to polyTranImpl.
39  // - This simplifies the interface to ChebyMap.polyTran by requiring
40  // either both boundaries or neither. Though admittedly this code
41  // could let polyTranImpl do the work instead of calling getDomain.
42  // - When this code was written, the feature of allowing NULL for lbnd or ubnd
43  // didn't work (though I expect it to be fixed very soon).
44  auto domain = getDomain(!forward);
45  return ChebyMap(detail::polyTranImpl<AstChebyMap>(*this, forward, acc, maxacc, maxorder, domain.lbnd,
46  domain.ubnd));
47 }
ChebyMap(ConstArray2D const &coeff_f, ConstArray2D const &coeff_i, std::vector< double > const &lbnd_f, std::vector< double > const &ubnd_f, std::vector< double > const &lbnd_i, std::vector< double > const &ubnd_i, std::string const &options="")
Construct a ChebyMap with a specified forward and/or inverse transforms.
Definition: ChebyMap.h:161
template AstChebyMap * polyTranImpl< AstChebyMap >(ChebyMap const &, bool, double, double, int, std::vector< double > const &, std::vector< double > const &)
ChebyDomain getDomain(bool forward) const
Return the bounding box of the domain of a ChebyMap.
Definition: ChebyMap.cc:57

◆ rate()

double ast::Mapping::rate ( PointD const &  at,
int  ax1,
int  ax2 
) const
inlineinherited

Evaluate the rate of change of the Mapping with respect to a specified input, at a specified position.

The result is estimated by interpolating the function using a fourth order polynomial in the neighbourhood of the specified position. The size of the neighbourhood used is chosen to minimise the RMS residual per unit length between the interpolating polynomial and the supplied Mapping function. This method produces good accuracy but can involve evaluating the Mapping 100 or more times.

Parameters
[in]atThe input position at which the rate of change is to be evaluated.
[in]ax1The index of the output for which the rate of change is to be found (1 for first output).
[in]ax2The index of the input which is to be varied in order to find the rate of change (1 for the first input).
Returns
The rate of change of Mapping output ax1 with respect to input ax2, evaluated at at, or nan if the value cannot be calculated.

Definition at line 215 of file Mapping.h.

215  {
216  detail::assertEqual(at.size(), "at.size", static_cast<std::size_t>(getNIn()), "nIn");
217  double result = astRate(getRawPtr(), const_cast<double *>(at.data()), ax1, ax2);
218  assertOK();
219  return result;
220  }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
py::object result
Definition: schema.cc:284
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49
int getNIn() const
Get NIn: the number of input axes.
Definition: Mapping.h:77
void assertEqual(T1 val1, std::string const &descr1, T2 val2, std::string const &descr2)
Definition: utils.h:47

◆ same()

bool ast::Object::same ( Object const &  other) const
inlineinherited

Does this contain the same AST object as another?

This is a test of identity, not of equality.

Definition at line 211 of file Object.h.

211 { return astSame(getRawPtr(), other.getRawPtr()); }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
ItemVariant const * other
Definition: Schema.cc:56

◆ set()

void ast::Object::set ( std::string const &  setting)
inlineprotectedinherited

Assign a set of attribute values, over-riding any previous values.

The attributes and their new values are specified via a character string, which should contain a comma-separated list of the form: "attribute_1 = value_1, attribute_2 = value_2, ... " where "attribute_n" specifies an attribute name, and the value to the right of each " =" sign should be a suitable textual representation of the value to be assigned. This value will be interpreted according to the attribute's data type.

Notes

  • Attribute names are not case sensitive and may be surrounded by white space
  • Attribute names are not case sensitive and may be surrounded by white space.
  • White space may also surround attribute values, where it will generally be ignored (except for string-valued attributes where it is significant and forms part of the value to be assigned).
  • To include a literal comma or percent sign in the value assigned to an attribute, the whole attribute value should be enclosed in quotation markes.
Exceptions
std::runtime_errorif the attribute is read-only

Definition at line 439 of file Object.h.

439 { astSet(getRawPtr(), "%s", setting.c_str()); }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291

◆ setB()

void ast::Object::setB ( std::string const &  attrib,
bool  value 
)
inlineprotectedinherited

Set the value of an attribute as a bool.

If possible, the type you provide is converted to the actual type of the attribute.

Exceptions
std::runtime_errorif the attribute does not exist or the value cannot be converted

Definition at line 448 of file Object.h.

448  {
449  astSetI(getRawPtr(), attrib.c_str(), value);
450  assertOK();
451  }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49

◆ setC()

void ast::Object::setC ( std::string const &  attrib,
std::string const &  value 
)
inlineprotectedinherited

Set the value of an attribute as a string.

If possible, the type you provide is converted to the actual type of the attribute.

Exceptions
std::runtime_errorif the attribute does not exist or the value cannot be converted

Definition at line 460 of file Object.h.

460  {
461  astSetC(getRawPtr(), attrib.c_str(), value.c_str());
462  assertOK();
463  }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49

◆ setD()

void ast::Object::setD ( std::string const &  attrib,
double  value 
)
inlineprotectedinherited

Set the value of an attribute as a double.

If possible, the type you provide is converted to the actual type of the attribute.

Exceptions
std::runtime_errorif the attribute does not exist or the value cannot be converted

Definition at line 472 of file Object.h.

472  {
473  astSetD(getRawPtr(), attrib.c_str(), value);
474  assertOK();
475  }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49

◆ setF()

void ast::Object::setF ( std::string const &  attrib,
float  value 
)
inlineprotectedinherited

Set the value of an attribute as a float.

If possible, the type you provide is converted to the actual type of the attribute.

Exceptions
std::runtime_errorif the attribute does not exist or the value cannot be converted

Definition at line 484 of file Object.h.

484  {
485  astSetF(getRawPtr(), attrib.c_str(), value);
486  assertOK();
487  }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49

◆ setI()

void ast::Object::setI ( std::string const &  attrib,
int  value 
)
inlineprotectedinherited

Set the value of an attribute as an int.

If possible, the type you provide is converted to the actual type of the attribute.

Exceptions
std::runtime_errorif the attribute does not exist or the value cannot be converted

Definition at line 496 of file Object.h.

496  {
497  astSetI(getRawPtr(), attrib.c_str(), value);
498  assertOK();
499  }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49

◆ setID()

void ast::Object::setID ( std::string const &  id)
inlineinherited

Set ID: object identification string that is not copied.

Definition at line 214 of file Object.h.

214 { setC("ID", id); }
void setC(std::string const &attrib, std::string const &value)
Set the value of an attribute as a string.
Definition: Object.h:460

◆ setIdent()

void ast::Object::setIdent ( std::string const &  ident)
inlineinherited

Set Ident: object identification string that is copied.

Definition at line 217 of file Object.h.

217 { setC("Ident", ident); }
void setC(std::string const &attrib, std::string const &value)
Set the value of an attribute as a string.
Definition: Object.h:460

◆ setL()

void ast::Object::setL ( std::string const &  attrib,
long int  value 
)
inlineprotectedinherited

Set the value of an attribute as a long int.

If possible, the type you provide is converted to the actual type of the attribute.

Exceptions
std::runtime_errorif the attribute does not exist or the value cannot be converted

Definition at line 508 of file Object.h.

508  {
509  astSetL(getRawPtr(), attrib.c_str(), value);
510  assertOK();
511  }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49

◆ setReport()

void ast::Mapping::setReport ( bool  report)
inlineinherited

Set Report: report transformed coordinates to stdout?

Definition at line 225 of file Mapping.h.

225 { setB("Report", report); }
void setB(std::string const &attrib, bool value)
Set the value of an attribute as a bool.
Definition: Object.h:448

◆ setUseDefs()

void ast::Object::setUseDefs ( bool  usedefs)
inlineinherited

Set UseDefs: allow use of default values for Object attributes?

Definition at line 220 of file Object.h.

220 { setB("UseDefs", usedefs); }
void setB(std::string const &attrib, bool value)
Set the value of an attribute as a bool.
Definition: Object.h:448

◆ show() [1/2]

void ast::Object::show ( std::ostream os,
bool  showComments = true 
) const
inherited

Print a textual description the object to an ostream.

Parameters
[in,out]osThe stream to which to write the string representation.
[in]showCommentsShow comments?

Definition at line 152 of file Object.cc.

152  {
153  Stream stream(nullptr, &os);
154  Channel ch(stream, showComments ? "" : "Comment=0");
155  ch.write(*this);
156  assertOK();
157 }
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49

◆ show() [2/2]

std::string ast::Object::show ( bool  showComments = true) const
inherited

Return a textual description the object as a string.

Parameters
[in]showCommentsShow comments?

Definition at line 159 of file Object.cc.

159  {
161  show(os, showComments);
162  return os.str();
163 }
T str(T... args)
void show(std::ostream &os, bool showComments=true) const
Print a textual description the object to an ostream.
Definition: Object.cc:152
std::ostream * os
Definition: Schema.cc:746

◆ simplified()

std::shared_ptr<Mapping> ast::Mapping::simplified ( ) const
inlineinherited

Return a simplied version of the mapping (which may be a compound Mapping such as a CmpMap).

Simplification eliminates redundant computational steps and merges separate steps which can be performed more efficiently in a single operation. As a simple example, a Mapping which multiplied coordinates by 5, and then multiplied the result by 10, could be simplified to a single step which multiplied by 50. Similarly, a Mapping which multiplied by 5, and then divided by 5, could be reduced to a simple copying operation.

This function should typically be applied to Mappings which have undergone substantial processing or have been formed by merging other Mappings. It is of potential benefit, for example, in reducing execution time if applied before using a Mapping to transform a large number of coordinates.

Note
If the supplied Mapping is a FrameSet, the returned Mapping will be a deep copy of the supplied FrameSet in which all the inter-Frame Mappings have been simplified. Mappings that have a set value for their ref Object_Ident "Ident" attribute are unchanged by simplification. This is so that their individual identity is preserved. This restriction does not apply to the simplification of Frames. The returned mapping is always independent of the original (a deep copy), unlike astSimplify.

Definition at line 248 of file Mapping.h.

248  {
249  AstObject *rawSimpMap = reinterpret_cast<AstObject *>(astSimplify(getRawPtr()));
250  assertOK(rawSimpMap);
251  return Object::fromAstObject<Mapping>(rawSimpMap, true);
252  }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49

◆ test()

bool ast::Object::test ( std::string const &  attrib) const
inlineinherited

Has this attribute been explicitly set (and not subsequently cleared)?

Warning
Unlike the underlying astTest function, throws an exception if an error results

Notes

  • Attribute names are not case sensitive and may be surrounded by white space.
  • As you might expect, the returned value for a read-only attribute is always false.
Exceptions
std::runtime_errorif an error results.

Definition at line 249 of file Object.h.

249  {
250  bool res = astTest(getRawPtr(), attrib.c_str());
251  assertOK();
252  return res;
253  }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49

◆ then()

SeriesMap ast::Mapping::then ( Mapping const &  next) const
inherited

Return a series compound mapping this(first(input)) containing shallow copies of the original.

Parameters
[in]nextthe mapping whose input is the output of this mapping
Exceptions
std::invalid_argumentif the number of input axes of next does not match the number of output axes of this mapping.
Warning
The contained mappings are shallow copies (just like AST); if you want deep copies then make them manually.

Definition at line 37 of file Mapping.cc.

37 { return SeriesMap(*this, next); }

◆ tranGridForward() [1/2]

void ast::Mapping::tranGridForward ( PointI const &  lbnd,
PointI const &  ubnd,
double  tol,
int  maxpix,
Array2D const &  to 
) const
inlineinherited

Transform a grid of points in the forward direction.

Parameters
[in]lbndThe coordinates of the centre of the first pixel in the input grid along each dimension, size = nIn
[in]ubndThe coordinates of the centre of the last pixel in the input grid along each dimension, size = nIn
[in]tolThe maximum tolerable geometrical distortion which may be introduced as a result of approximating non-linear Mappings by a set of piece-wise linear transformations. This should be expressed as a displacement within the output coordinate system of the Mapping.

If piece-wise linear approximation is not required, a value of zero may be given. This will ensure that the Mapping is used without any approximation, but may increase execution time.

If the value is too high, discontinuities between the linear approximations used in adjacent panel will be higher. If this is a problem, reduce the tolerance value used.

Parameters
[in]maxpixA value which specifies an initial scale size (in input grid points) for the adaptive algorithm which approximates non-linear Mappings with piece-wise linear transformations. Normally, this should be a large value (larger than any dimension of the region of the input grid being used). In this case, a first attempt to approximate the Mapping by a linear transformation will be made over the entire input region. If a smaller value is used, the input region will first be divided into sub-regions whose size does not exceed " maxpix" grid points in any dimension. Only at this point will attempts at approximation commence. This value may occasionally be useful in preventing false convergence of the adaptive algorithm in cases where the Mapping appears approximately linear on large scales, but has irregularities (e.g. holes) on smaller scales. A value of, say, 50 to 100 grid points can also be employed as a safeguard in general-purpose software, since the effect on performance is minimal. If too small a value is given, it will have the effect of inhibiting linear approximation altogether (equivalent to setting " tol" to zero). Although this may degrade performance, accurate results will still be obtained.
[in]toComputed points, with dimensions (nPts, nOut), where nPts the desired number of points

Definition at line 358 of file Mapping.h.

359  {
360  _tranGrid(lbnd, ubnd, tol, maxpix, true, to);
361  }
table::Key< int > to

◆ tranGridForward() [2/2]

Array2D ast::Mapping::tranGridForward ( PointI const &  lbnd,
PointI const &  ubnd,
double  tol,
int  maxpix,
int  nPts 
) const
inlineinherited

Transform a grid of points in the inverse direction, returning the results as a new Array2D.

See the overload of tranGridForward that outputs the data as the last argument for more information

Definition at line 369 of file Mapping.h.

369  {
370  Array2D to = ndarray::allocate(nPts, getNOut());
371  _tranGrid(lbnd, ubnd, tol, maxpix, true, to);
372  return to;
373  }
ndarray::Array< double, 2, 2 > Array2D
2D array of const double; typically used for lists of const points
Definition: base.h:42
table::Key< int > to
int getNOut() const
Get NOut: the number of output axes.
Definition: Mapping.h:82

◆ tranGridInverse() [1/2]

void ast::Mapping::tranGridInverse ( PointI const &  lbnd,
PointI const &  ubnd,
double  tol,
int  maxpix,
Array2D const &  to 
) const
inlineinherited

Transform a grid of points in the inverse direction.

See tranGridForward for the arguments, swapping nIn and nOut

Definition at line 380 of file Mapping.h.

381  {
382  _tranGrid(lbnd, ubnd, tol, maxpix, false, to);
383  }
table::Key< int > to

◆ tranGridInverse() [2/2]

Array2D ast::Mapping::tranGridInverse ( PointI const &  lbnd,
PointI const &  ubnd,
double  tol,
int  maxpix,
int  nPts 
) const
inlineinherited

Transform a grid of points in the inverse direction.

See tranGridForward for the arguments, swapping nIn and nOut

Definition at line 390 of file Mapping.h.

390  {
391  Array2D to = ndarray::allocate(nPts, getNIn());
392  _tranGrid(lbnd, ubnd, tol, maxpix, false, to);
393  return to;
394  }
ndarray::Array< double, 2, 2 > Array2D
2D array of const double; typically used for lists of const points
Definition: base.h:42
table::Key< int > to
int getNIn() const
Get NIn: the number of input axes.
Definition: Mapping.h:77

◆ under()

ParallelMap ast::Mapping::under ( Mapping const &  next) const
inherited

Return a parallel compound mapping containing shallow copies of the original.

The resulting mapping has getNIn() + next.getNIn() inputs and getNOut() + next.getNOut() outputs. The first getNIn() axes of input are transformed by this mapping, producing the first getNOut() axes of output. The remaining axes of input are processed by next, resulting in the remaining axes of output.

The name comes the way vectors are sometimes shown for matrix multiplication: vertically, with the first axis at the bottom and the last axis at the top.

Parameters
[in]nextthe mapping that processes the final next.getNin() axes of input to produce the final next.getNout() axes of output.
Warning
The contained mappings are shallow copies (just like AST); if you want deep copies then make them manually.

Definition at line 39 of file Mapping.cc.

39 { return ParallelMap(*this, next); }

◆ unlock()

void ast::Object::unlock ( bool  report = false)
inlineinherited

Unlock this object previously locked using lock, so that other threads can use this object.

See lock for further details.

Parameters
[in]reportIf true, an error will be reported if the supplied Object, or any Object contained within the supplied Object, is not currently locked by the running thread. If false, such Objects will be left unchanged, and no error will be reported.

Notes

  • This function attempts to execute even if AST's global error status is set, but no further error report will be made if it subsequently fails under these circumstances.
  • All unlocked Objects are excluded from AST context handling until they are re-locked using astLock.
  • This function returns without action if the Object is not currently locked by any thread. If it is locked by the running thread, it is unlocked. If it is locked by another thread, an error will be reported if "error" is non-zero.
  • This function returns without action if the AST library has been built without POSIX thread support (i.e. the "-with-pthreads" option was not specified when running the "configure" script).

Definition at line 279 of file Object.h.

279  {
280  astUnlock(getRawPtr(), static_cast<int>(report));
281  assertOK();
282  }
AstObject const * getRawPtr() const
Get the raw AST pointer.
Definition: Object.h:291
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST&#39;s state is bad.
Definition: base.cc:49

Friends And Related Function Documentation

◆ Object

friend class Object
friend

Definition at line 98 of file ChebyMap.h.


The documentation for this class was generated from the following files: