18 void reportError(
int errNum,
const char *errMsg) { errorMsgStream << errMsg; }
25 ErrorHandler() { astSetPutErr(reportError); }
27 ErrorHandler(ErrorHandler
const &) =
delete;
28 ErrorHandler(ErrorHandler &&) =
delete;
29 ErrorHandler &operator=(ErrorHandler
const &) =
delete;
30 ErrorHandler &operator=(ErrorHandler &&) =
delete;
33 auto errMsg = errorMsgStream.
str();
35 errorMsgStream.
clear();
40 errorMsgStream.
str(
"");
49 void assertOK(AstObject *rawPtr1, AstObject *rawPtr2) {
53 static ErrorHandler *errHandler =
new ErrorHandler();
70 int nPoints = vec.
size() / nAxes;
71 if (nPoints * nAxes != vec.
size()) {
73 os <<
"vec length = " << vec.
size() <<
" not a multiple of nAxes = " << nAxes;
76 Array2D::Index shape = ndarray::makeVector(nAxes, nPoints);
77 Array2D::Index strides = ndarray::makeVector(nPoints, 1);
78 return external(vec.
data(), shape, strides);
ndarray::Array< const double, 2, 2 > ConstArray2D
2D array of const double; typically used for lists of const points
ndarray::Array< double, 2, 2 > Array2D
2D array of const double; typically used for lists of const points
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.