53 os <<
"this is a " <<
getClassName() <<
", which is not a PolyMap";
61 const int nin = coeff_f.getSize<1>() - 2;
62 const int ncoeff_f = coeff_f.getSize<0>();
63 const int nout = coeff_i.getSize<1>() - 2;
64 const int ncoeff_i = coeff_i.getSize<0>();
66 if ((ncoeff_f == 0) && (ncoeff_i == 0)) {
68 "Must specify forward or inverse transform (coeff_f and coeff_i both empty)");
72 os <<
"coeff_f row length = " << nin + 2
73 <<
", which is too short; length = nin + 2 and nin must be > 0";
77 std::ostringstream os;
78 os <<
"coeff_i row length " << nout + 2
79 <<
", which is too short; length = nout + 2 and nout must be > 0";
80 throw std::invalid_argument(os.
str());
83 auto result = astPolyMap(nin, nout, ncoeff_f, coeff_f.getData(), ncoeff_i, coeff_i.getData(),
"%s",
90AstPolyMap *PolyMap::_makeRawPolyMap(
ConstArray2D const &coeff_f,
int nout,
91 std::string
const &options)
const {
92 const int nin = coeff_f.getSize<1>() - 2;
93 const int ncoeff_f = coeff_f.getSize<0>();
95 throw std::invalid_argument(
"Must specify forward transform (coeff_f is empty)");
98 std::ostringstream os;
99 os <<
"coeff_f row length = " << nin + 2
100 <<
", which is too short; length = nin + 2 and nin must be > 0";
101 throw std::invalid_argument(os.
str());
104 std::ostringstream os;
105 os <<
"nout = " << nout <<
" <0 =";
106 throw std::invalid_argument(os.
str());
109 auto result = astPolyMap(nin, nout, ncoeff_f, coeff_f.getData(), 0,
nullptr,
"%s", options.
c_str());
bool isInverted() const
Is this an inverted mapping?
Mapping(Mapping const &)=default
Copy constructor: make a deep copy.
std::string getClassName() const
Get Class: the name of the class (e.g.
AstObject const * getRawPtr() const
Get the raw AST pointer.
PolyMap(ConstArray2D const &coeff_f, ConstArray2D const &coeff_i, std::string const &options="IterInverse=0")
Construct a PolyMap with specified forward and/or inverse transforms.
bool getIterInverse() const
Get IterInverse: does this provide an iterative inverse transformation?
PolyMap 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 PolyMap which is a copy of this one, in which a specified transformation ...
AstMapT * polyTranImpl(MapT const &mapping, bool forward, double acc, double maxacc, int maxorder, std::vector< double > const &lbnd, std::vector< double > const &ubnd)
Call astPolyTran to set (or replace) one direction of a polynomial transform with a fit based on the ...
AST wrapper classes and functions.
ndarray::Array< const double, 2, 2 > ConstArray2D
2D array of const double; typically used for lists of const points
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST's state is bad.