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.
int getSize() const
Return the maximum length of the string, including a null terminator (equal to the number of subfield...
static FieldBase makeDefault()
Needed to allow Keys to be default-constructed.
Field base class default implementation (used for numeric scalars and Angle).
An include file to include the header files for lsst::afw::geom.
void stream(std::ostream &os) const
Defines how Fields are printed.
char const * ConstReference
the type returned by BaseRecord::operator[] (const)
static FieldBase makeDefault()
Needed to allow Keys to be default-constructed.
Angle Element
the type of subfields
Eigen::Matrix< U, SIZE, SIZE > Value
the type returned by BaseRecord::get
lsst::afw::geom::Angle getDec() const
Public header class for ellipse library.
int getElementCount() const
Return the number of subfield elements (equal to the size of the array).
Value getValue(Element const *p, ndarray::Manager::Ptr const &) const
Used to implement RecordBase::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.
void setValue(Element *p, ndarray::Manager::Ptr const &, Value const &v) const
Used to implement RecordBase::set.
void stream(std::ostream &os) const
Defines how Fields are printed.
An include file to include the header files for lsst::afw::coord.
static FieldBase makeDefault()
Needed to allow Keys to be default-constructed.
FieldBase(int size=-1)
Construct a FieldBase with the given size.
Reference getReference(Element *p, ndarray::Manager::Ptr const &m) const
Used to implement RecordBase::operator[] (non-const).
static void setValue(Element *p, ndarray::Manager::Ptr const &, Eigen::MatrixBase< Derived > const &value)
Used to implement RecordBase::set.
U Element
the type of subfields and array elements
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 &, Value v) const
Used to implement RecordBase::set.
Eigen::Matrix< U, SIZE, SIZE > Value
the type returned by BaseRecord::get
double const getIyy() const
Value getValue(Element const *p, ndarray::Manager::Ptr const &) const
Used to implement RecordBase::get.
static FieldBase makeDefault()
Needed to allow Keys to be default-constructed.
void setValue(Element *p, ndarray::Manager::Ptr const &m, Coord const &v) const
Used to implement RecordBase::set.
int getElementCount() const
Return the number of subfield elements (the packed size of the covariance matrix).
U Element
the type of subfields
ConstReference getConstReference(Element const *p, ndarray::Manager::Ptr const &m) const
Used to implement RecordBase::operator[] (const).
int computeCovariancePackedSize(int size)
Defines the packed size of a covariance matrices.
void stream(std::ostream &os) const
Defines how Fields are printed.
static FieldBase makeDefault()
Needed to allow Keys to be default-constructed.
static FieldBase makeDefault()
Needed to allow Keys to be default-constructed.
T const & ConstReference
the type returned by BaseRecord::operator[] (const)
void setValue(Element *p, ndarray::Manager::Ptr const &, Value const &v) const
Used to implement RecordBase::set.
Value getValue(Element const *p, ndarray::Manager::Ptr const &) const
Used to implement RecordBase::get.
static std::string getTypeString()
Return a string description of the field type.
Value getValue(Element const *p, ndarray::Manager::Ptr const &) const
Used to implement RecordBase::get.
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.
boost::intrusive_ptr< Manager > Ptr
FieldBase(int size=-1)
Construct a FieldBase with the given size.
std::string Value
the type returned by BaseRecord::get
T Element
the type of subfields (the same as the type itself for scalars)
int getElementCount() const
Return the number of subfield elements (equal to the size of the string, including a null terminator)...
ConstReference getConstReference(Element const *p, ndarray::Manager::Ptr const &) const
Used to implement RecordBase::operator[] (const).
int getElementCount() const
Return the number of subfield elements (always two for points).
U Element
the type of subfields and matrix elements
int getPackedSize() const
Return the packed size of the covariance matrix.
U Element
the type of subfields and matrix elements
static FieldBase makeDefault()
Needed to allow Keys to be default-constructed.
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 size of the array (equal to the number of subfield elements).
boost::mpl::if_< boost::is_same< U, int >, geom::Point2I, geom::Point2D >::type Value
the type returned by BaseRecord::get
Reference getReference(Element *p, ndarray::Manager::Ptr const &m) const
Used to implement RecordBase::operator[] (non-const).
T Value
the type returned by BaseRecord::get
double const getIxx() const
void setValue(Element *p, ndarray::Manager::Ptr const &, ndarray::ExpressionBase< Derived > const &value) const
Used to implement RecordBase::set; accepts any ndarray expression.
static void setValue(Element *p, ndarray::Manager::Ptr const &, Eigen::MatrixBase< Derived > const &value)
Used to implement RecordBase::set.
void setValue(Element *p, ndarray::Manager::Ptr const &, Eigen::MatrixBase< Derived > const &value) const
Used to implement RecordBase::set.
static FieldBase makeDefault()
Needed to allow Keys to be default-constructed.
Value getValue(Element const *p, ndarray::Manager::Ptr const &) const
Used to implement RecordBase::get.
int getSize() const
Return the number of rows/columns of the covariance matrix.
#define LSST_EXCEPT(type,...)
A multidimensional strided array.
int getElementCount() const
Return the number of subfield elements (always two for points).
ndarray::ArrayRef< U const, 1, 1 > ConstReference
the type returned by BaseRecord::operator[] (const)
void stream(std::ostream &os) const
Defines how Fields are printed.
T & Reference
the type returned by BaseRecord::operator[] (non-const)
int getElementCount() const
the type of subfields
virtual IcrsCoord toIcrs() const
Convert ourself to ICRS: RA, Dec (basically J2000)
void stream(std::ostream &os) const
Defines how Fields are printed.
char * Reference
the type returned by BaseRecord::operator[]
int getSize() const
Return the number of rows/columns of the covariance matrix.
ndarray::ArrayRef< U, 1, 1 > Reference
the type returned by BaseRecord::operator[]
U Element
the type of subfields and matrix elements
void stream(std::ostream &os) const
Defines how Fields are printed.
IcrsCoord Value
the type returned by BaseRecord::get (coord::IcrsCoord, in this case).
ConstReference getConstReference(Element const *p, ndarray::Manager::Ptr const &m) const
Used to implement RecordBase::operator[] (const).
double const getIxy() const
int getElementCount() const
Return the number of subfield elements (the packed size of the covariance matrix).
ndarray::Array< U const, 1, 1 > Value
the type returned by BaseRecord::get
void stream(std::ostream &os) const
Defines how Fields are printed.
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).
Value getValue(Element const *p, ndarray::Manager::Ptr const &m) const
Used to implement RecordBase::get.
Eigen::Matrix< U, Eigen::Dynamic, Eigen::Dynamic > Value
the type returned by BaseRecord::get
Tag types used to declare specialized field types.
void stream(std::ostream &os) const
Defines how Fields are printed.
lsst::afw::geom::Angle getRa() const
A class to handle Icrs coordinates (inherits from Coord)
Include files required for standard LSST Exception handling.
static FieldBase makeDefault()
Needed to allow Keys to be default-constructed.
afw::geom::ellipses::Quadrupole Value
the type returned by BaseRecord::get
char Element
the type of subfields and array elements
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.
void setValue(Element *p, ndarray::Manager::Ptr const &, Value const &v) const
Used to implement RecordBase::set.
Value getValue(Element const *p, ndarray::Manager::Ptr const &) const
Used to implement RecordBase::get.
CRTP base class for all multidimensional expressions.