2 #ifndef AFW_TABLE_FieldBase_h_INCLUDED
3 #define AFW_TABLE_FieldBase_h_INCLUDED
8 #include "boost/mpl/vector.hpp"
9 #include "boost/preprocessor/punctuation/paren.hpp"
22 namespace lsst {
namespace afw {
namespace table {
34 return (i < j) ? (i + j*(j+1)/2) : (j + i*(i+1)/2);
39 return size * (size + 1) / 2;
63 #ifndef SWIG_BUG_3465431_FIXED
70 lsst::pex::exceptions::LogicError,
71 "Constructor disabled (it only appears to exist as a workaround for a SWIG bug)."
82 void stream(std::ostream & os)
const {}
122 #ifndef SWIG_BUG_3465431_FIXED
129 lsst::pex::exceptions::LogicError,
130 "Constructor disabled (it only appears to exist as a workaround for a SWIG bug)."
145 return Value(p[0], p[1]);
165 template <
typename U>
184 #ifndef SWIG_BUG_3465431_FIXED
191 lsst::pex::exceptions::LogicError,
192 "Constructor disabled (it only appears to exist as a workaround for a SWIG bug)."
222 template <
typename U>
234 #ifndef SWIG_BUG_3465431_FIXED
241 lsst::pex::exceptions::LogicError,
242 "Constructor disabled (it only appears to exist as a workaround for a SWIG bug)."
257 return Value(p[0], p[1], p[2]);
271 template <
typename U>
297 lsst::pex::exceptions::LengthError,
298 "Size must be provided when constructing an array field."
317 void stream(std::ostream & os)
const { os <<
", size=" << _size; }
335 template <
typename Derived>
339 if (value.template getSize<0>() != _size) {
341 lsst::pex::exceptions::LengthError,
342 "Incorrect size in array field assignment."
345 for (
int i = 0; i < _size; ++i) p[i] = value[i];
364 template <
typename U>
368 typedef Eigen::Matrix<U,Eigen::Dynamic,Eigen::Dynamic>
Value;
385 lsst::pex::exceptions::LengthError,
386 "Size must be provided when constructing a covariance field."
408 void stream(std::ostream & os)
const { os <<
", size=" << _size; }
412 Value m(_size, _size);
413 for (
int i = 0; i < _size; ++i) {
414 for (
int j = 0; j < _size; ++j) {
422 template <
typename Derived>
426 if (value.rows() != _size || value.cols() != _size) {
428 lsst::pex::exceptions::LengthError,
429 "Incorrect size in covariance field assignment."
432 for (
int i = 0; i < _size; ++i) {
433 for (
int j = 0; j < _size; ++j) {
451 template <
typename U>
454 static int const SIZE = 2;
455 static int const PACKED_SIZE = 3;
457 typedef Eigen::Matrix<U,SIZE,SIZE>
Value;
472 #ifndef SWIG_BUG_3465431_FIXED
479 lsst::pex::exceptions::LogicError,
480 "Constructor disabled (it only appears to exist as a workaround for a SWIG bug)."
496 for (
int i = 0; i < SIZE; ++i) {
497 for (
int j = 0; j < SIZE; ++j) {
505 template <
typename Derived>
509 BOOST_STATIC_ASSERT( Derived::RowsAtCompileTime == SIZE);
510 BOOST_STATIC_ASSERT( Derived::ColsAtCompileTime == SIZE);
511 for (
int i = 0; i < SIZE; ++i) {
512 for (
int j = 0; j < SIZE; ++j) {
529 template <
typename U>
532 static int const SIZE = 3;
533 static int const PACKED_SIZE = 6;
535 typedef Eigen::Matrix<U,SIZE,SIZE>
Value;
550 #ifndef SWIG_BUG_3465431_FIXED
557 lsst::pex::exceptions::LogicError,
558 "Constructor disabled (it only appears to exist as a workaround for a SWIG bug)."
574 for (
int i = 0; i < SIZE; ++i) {
575 for (
int j = 0; j < SIZE; ++j) {
583 template <
typename Derived>
587 BOOST_STATIC_ASSERT( Derived::RowsAtCompileTime == SIZE);
588 BOOST_STATIC_ASSERT( Derived::ColsAtCompileTime == SIZE);
589 for (
int i = 0; i < SIZE; ++i) {
590 for (
int j = 0; j < SIZE; ++j) {
644 void stream(std::ostream & os)
const { os <<
", size=" << _size; }
668 #endif // !AFW_TABLE_FieldBase_h_INCLUDED
A proxy class for Array with deep assignment operators.
An ellipse core with quadrupole moments as parameters.
Value getValue(Element const *p, ndarray::Manager::Ptr const &m) const
Used to implement RecordBase::get.
static FieldBase makeDefault()
Needed to allow Keys to be default-constructed.
U Element
the type of subfields and matrix elements
FieldBase(int size=-1)
Construct a FieldBase with the given size.
Field base class default implementation (used for numeric scalars and Angle).
An include file to include the header files for lsst::afw::geom.
ndarray::Array< U const, 1, 1 > Value
the type returned by BaseRecord::get
int getSize() const
Return the number of rows/columns of the covariance matrix.
int getElementCount() const
Return the number of subfield elements (equal to the size of the string, including a null terminator)...
int getSize() const
Return the size of the array (equal to the number of subfield elements).
void stream(std::ostream &os) const
Defines how Fields are printed.
int getSize() const
Return the number of rows/columns of the covariance matrix.
void setValue(Element *p, ndarray::Manager::Ptr const &, Eigen::MatrixBase< Derived > const &value) const
Used to implement RecordBase::set.
Public header class for ellipse library.
Eigen::Matrix< U, SIZE, SIZE > Value
the type returned by BaseRecord::get
Value getValue(Element const *p, ndarray::Manager::Ptr const &) const
Used to implement RecordBase::get.
int getElementCount() const
Return the number of subfield elements (the packed size of the covariance matrix).
int getPackedSize() const
Return the packed size of the covariance matrix.
static FieldBase makeDefault()
Needed to allow Keys to be default-constructed.
An include file to include the header files for lsst::afw::coord.
Eigen::Matrix< U, SIZE, SIZE > Value
the type returned by BaseRecord::get
void setValue(Element *p, ndarray::Manager::Ptr const &, Value const &v) const
Used to implement RecordBase::set.
lsst::afw::geom::Angle getRa() const
double const getIxy() const
U Element
the type of subfields and array elements
Value getValue(Element const *p, ndarray::Manager::Ptr const &) const
Used to implement RecordBase::get.
detail::ExternalInitializer< T, N, Owner > external(T *data, Vector< int, N > const &shape, Vector< int, N > const &strides, Owner const &owner)
Create an expression that initializes an Array with externally allocated memory.
void setValue(Element *p, ndarray::Manager::Ptr const &, ndarray::ExpressionBase< Derived > const &value) const
Used to implement RecordBase::set; accepts any ndarray expression.
int getElementCount() const
Return the number of subfield elements (equal to the size of the array).
static FieldBase makeDefault()
Needed to allow Keys to be default-constructed.
static FieldBase makeDefault()
Needed to allow Keys to be default-constructed.
int getElementCount() const
Return the number of subfield elements (the packed size of the covariance matrix).
static void setValue(Element *p, ndarray::Manager::Ptr const &, Eigen::MatrixBase< Derived > const &value)
Used to implement RecordBase::set.
Value getValue(Element const *p, ndarray::Manager::Ptr const &) const
Used to implement RecordBase::get.
FieldBase(int size=-1)
Construct a FieldBase with the given size.
void stream(std::ostream &os) const
Defines how Fields are printed.
ndarray::ArrayRef< U, 1, 1 > Reference
the type returned by BaseRecord::operator[]
Value getValue(Element const *p, ndarray::Manager::Ptr const &) const
Used to implement RecordBase::get.
char const * ConstReference
the type returned by BaseRecord::operator[] (const)
int computeCovariancePackedSize(int size)
Defines the packed size of a covariance matrices.
int getElementCount() const
Return the number of subfield elements (the packed size of the covariance matrix).
void stream(std::ostream &os) const
Defines how Fields are printed.
ndarray::ArrayRef< U const, 1, 1 > ConstReference
the type returned by BaseRecord::operator[] (const)
boost::intrusive_ptr< Manager > Ptr
Value getValue(Element const *p, ndarray::Manager::Ptr const &) const
Used to implement RecordBase::get.
void setValue(Element *p, ndarray::Manager::Ptr const &m, Coord const &v) const
Used to implement RecordBase::set.
Include files required for standard LSST Exception handling.
static FieldBase makeDefault()
Needed to allow Keys to be default-constructed.
U Element
the type of subfields
Eigen::Matrix< U, Eigen::Dynamic, Eigen::Dynamic > Value
the type returned by BaseRecord::get
ConstReference getConstReference(Element const *p, ndarray::Manager::Ptr const &) const
Used to implement RecordBase::operator[] (const).
double const getIyy() const
afw::geom::ellipses::Quadrupole Value
the type returned by BaseRecord::get
U Element
the type of subfields and matrix elements
ConstReference getConstReference(Element const *p, ndarray::Manager::Ptr const &m) const
Used to implement RecordBase::operator[] (const).
void setValue(Element *p, ndarray::Manager::Ptr const &, Value const &v) const
Used to implement RecordBase::set.
int getElementCount() const
Return the number of subfield elements (always one for scalars).
int getSize() const
Return the number of rows/columns of the covariance matrix.
int indexCovariance(int i, int j)
Defines the ordering of packed covariance matrices.
Vector< T, N > makeVector(T v1, T v2,..., T vN)
Variadic constructor for Vector.
int getSize() const
Return the maximum length of the string, including a null terminator (equal to the number of subfield...
int getPackedSize() const
Return the packed size of the covariance matrix.
static FieldBase makeDefault()
Needed to allow Keys to be default-constructed.
int getElementCount() const
the type of subfields
int getElementCount() const
Return the number of subfield elements (always two for points).
void stream(std::ostream &os) const
Defines how Fields are printed.
void stream(std::ostream &os) const
Defines how Fields are printed.
T Element
the type of subfields (the same as the type itself for scalars)
#define LSST_EXCEPT(type,...)
A multidimensional strided array.
void stream(std::ostream &os) const
Defines how Fields are printed.
Reference getReference(Element *p, ndarray::Manager::Ptr const &) const
Used to implement RecordBase::operator[] (non-const).
void stream(std::ostream &os) const
Defines how Fields are printed.
T Value
the type returned by BaseRecord::get
Value getValue(Element const *p, ndarray::Manager::Ptr const &) const
Used to implement RecordBase::get.
int getPackedSize() const
Return the packed size of the covariance matrix.
static FieldBase makeDefault()
Needed to allow Keys to be default-constructed.
Reference getReference(Element *p, ndarray::Manager::Ptr const &m) const
Used to implement RecordBase::operator[] (non-const).
char * Reference
the type returned by BaseRecord::operator[]
void setValue(Element *p, ndarray::Manager::Ptr const &, Value v) const
Used to implement RecordBase::set.
IcrsCoord Value
the type returned by BaseRecord::get (coord::IcrsCoord, in this case).
virtual IcrsCoord toIcrs() const
Convert ourself to ICRS: RA, Dec (basically J2000)
static FieldBase makeDefault()
Needed to allow Keys to be default-constructed.
void stream(std::ostream &os) const
Defines how Fields are printed.
boost::mpl::if_< boost::is_same< U, int >, geom::Point2I, geom::Point2D >::type Value
the type returned by BaseRecord::get
std::string Value
the type returned by BaseRecord::get
void setValue(Element *p, ndarray::Manager::Ptr const &, Value const &v) const
Used to implement RecordBase::set.
T const & ConstReference
the type returned by BaseRecord::operator[] (const)
char Element
the type of subfields and array elements
Angle Element
the type of subfields
Reference getReference(Element *p, ndarray::Manager::Ptr const &m) const
Used to implement RecordBase::operator[] (non-const).
Tag types used to declare specialized field types.
void stream(std::ostream &os) const
Defines how Fields are printed.
A class to handle Icrs coordinates (inherits from Coord)
static void setValue(Element *p, ndarray::Manager::Ptr const &, Eigen::MatrixBase< Derived > const &value)
Used to implement RecordBase::set.
int getElementCount() const
Return the number of subfield elements (always two for points).
double const getIxx() const
T & Reference
the type returned by BaseRecord::operator[] (non-const)
static FieldBase makeDefault()
Needed to allow Keys to be default-constructed.
lsst::afw::geom::Angle getDec() const
ConstReference getConstReference(Element const *p, ndarray::Manager::Ptr const &m) const
Used to implement RecordBase::operator[] (const).
Value getValue(Element const *p, ndarray::Manager::Ptr const &) const
Used to implement RecordBase::get.
U Element
the type of subfields and matrix elements
CRTP base class for all multidimensional expressions.
static std::string getTypeString()
Return a string description of the field type.