LSST Applications g0265f82a02+c6dfa2ddaf,g1162b98a3f+b2075782a9,g2079a07aa2+1b2e822518,g2bbee38e9b+c6dfa2ddaf,g337abbeb29+c6dfa2ddaf,g3ddfee87b4+a60788ef87,g50ff169b8f+2eb0e556e8,g52b1c1532d+90ebb246c7,g555ede804d+a60788ef87,g591dd9f2cf+ba8caea58f,g5ec818987f+864ee9cddb,g858d7b2824+9ee1ab4172,g876c692160+a40945ebb7,g8a8a8dda67+90ebb246c7,g8cdfe0ae6a+4fd9e222a8,g99cad8db69+5e309b7bc6,g9ddcbc5298+a1346535a5,ga1e77700b3+df8f93165b,ga8c6da7877+aa12a14d27,gae46bcf261+c6dfa2ddaf,gb0e22166c9+8634eb87fb,gb3f2274832+d0da15e3be,gba4ed39666+1ac82b564f,gbb8dafda3b+5dfd9c994b,gbeb006f7da+97157f9740,gc28159a63d+c6dfa2ddaf,gc86a011abf+9ee1ab4172,gcf0d15dbbd+a60788ef87,gdaeeff99f8+1cafcb7cd4,gdc0c513512+9ee1ab4172,ge79ae78c31+c6dfa2ddaf,geb67518f79+ba1859f325,geb961e4c1e+f9439d1e6f,gee10cc3b42+90ebb246c7,gf1cff7945b+9ee1ab4172,w.2024.12
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
lsst::geom::polynomials::PackedIndexIterator< packing > Class Template Reference

An iterator for traversing "packed" triangular 2-d series expansions, in which two 1-d expansions are truncated according to the sum of their orders and all values for one order are stored before any values of the subsequent order. More...

#include <PackedIndex.h>

Public Types

using difference_type = std::ptrdiff_t
 
using value_type = Index2d
 
using pointer = Index2d const *
 
using reference = Index2d const &
 
using iterator_category = std::input_iterator_tag
 

Public Member Functions

constexpr PackedIndexIterator () noexcept
 Construct an iterator at the beginning of an expansion of any order.
 
constexpr PackedIndexIterator (std::size_t nx, std::size_t ny) noexcept
 Construct an iterator pointing to the element with the given x and y orders.
 
constexpr reference operator* () const noexcept
 Dereference the iterator, yielding a Index2d const reference.
 
constexpr pointer operator-> () const noexcept
 Dereference the iterator, yielding a Index2d const pointer.
 
PackedIndexIteratoroperator++ () noexcept
 Move to the next element in the packed array and return the iterator.
 
PackedIndexIterator operator++ (int) noexcept
 Move to the next element in the packed array and return a copy of the iterator before the move.
 
constexpr bool operator== (PackedIndexIterator const &other) const noexcept
 Equality comparison.
 
constexpr bool operator!= (PackedIndexIterator const &other) const noexcept
 Inequality comparison.
 

Static Public Member Functions

static constexpr std::size_t computeOffset (std::size_t order) noexcept
 Return the flattened offset to the start of the given order.
 
static constexpr std::size_t computeSize (std::size_t order) noexcept
 Return the flattened size of an expansion with the given maximum order (inclusive).
 
static constexpr std::size_t computeIndex (std::size_t nx, std::size_t ny) noexcept
 Return the flattened index for the element with the given x and y orders.
 
static constexpr PackedIndexIterator makeEnd (std::size_t order) noexcept
 Construct an iterator one past the end of an expansion with the given order.
 

Detailed Description

template<PackingOrder packing>
class lsst::geom::polynomials::PackedIndexIterator< packing >

An iterator for traversing "packed" triangular 2-d series expansions, in which two 1-d expansions are truncated according to the sum of their orders and all values for one order are stored before any values of the subsequent order.

PackedIndexIterator dereferences to Index2d. Typical usage is via a PackedIndexRange.

This packing ensures that the coefficients for an nth-order expansion are a contiguous subset of the coefficients for an (n+1)th-order expansion.

The packing within each order is set by the packing template parameter.

PackedIndexIterator is an STL input iterator, not a forward iterator; incrementing the iterator invalidates all previously-dereferenced values.

Definition at line 164 of file PackedIndex.h.

Member Typedef Documentation

◆ difference_type

template<PackingOrder packing>
using lsst::geom::polynomials::PackedIndexIterator< packing >::difference_type = std::ptrdiff_t

Definition at line 168 of file PackedIndex.h.

◆ iterator_category

template<PackingOrder packing>
using lsst::geom::polynomials::PackedIndexIterator< packing >::iterator_category = std::input_iterator_tag

Definition at line 172 of file PackedIndex.h.

◆ pointer

template<PackingOrder packing>
using lsst::geom::polynomials::PackedIndexIterator< packing >::pointer = Index2d const *

Definition at line 170 of file PackedIndex.h.

◆ reference

template<PackingOrder packing>
using lsst::geom::polynomials::PackedIndexIterator< packing >::reference = Index2d const &

Definition at line 171 of file PackedIndex.h.

◆ value_type

template<PackingOrder packing>
using lsst::geom::polynomials::PackedIndexIterator< packing >::value_type = Index2d

Definition at line 169 of file PackedIndex.h.

Constructor & Destructor Documentation

◆ PackedIndexIterator() [1/2]

template<PackingOrder packing>
constexpr lsst::geom::polynomials::PackedIndexIterator< packing >::PackedIndexIterator ( )
inlineconstexprnoexcept

Construct an iterator at the beginning of an expansion of any order.

Definition at line 195 of file PackedIndex.h.

195: _index() {}

◆ PackedIndexIterator() [2/2]

template<PackingOrder packing>
constexpr lsst::geom::polynomials::PackedIndexIterator< packing >::PackedIndexIterator ( std::size_t nx,
std::size_t ny )
inlineconstexprnoexcept

Construct an iterator pointing to the element with the given x and y orders.

Definition at line 198 of file PackedIndex.h.

198 :
199 _index(computeIndex(nx, ny), nx, ny)
200 {}
static constexpr std::size_t computeIndex(std::size_t nx, std::size_t ny) noexcept
Return the flattened index for the element with the given x and y orders.

Member Function Documentation

◆ computeIndex()

template<PackingOrder packing>
static constexpr std::size_t lsst::geom::polynomials::PackedIndexIterator< packing >::computeIndex ( std::size_t nx,
std::size_t ny )
inlinestaticconstexprnoexcept

Return the flattened index for the element with the given x and y orders.

Definition at line 185 of file PackedIndex.h.

185 {
186 return computeOffset(nx + ny) + Traits::computeInnerIndex(nx, ny);
187 }
static constexpr std::size_t computeOffset(std::size_t order) noexcept
Return the flattened offset to the start of the given order.

◆ computeOffset()

template<PackingOrder packing>
static constexpr std::size_t lsst::geom::polynomials::PackedIndexIterator< packing >::computeOffset ( std::size_t order)
inlinestaticconstexprnoexcept

Return the flattened offset to the start of the given order.

Definition at line 175 of file PackedIndex.h.

175 {
176 return order*(order + 1)/2;
177 }
table::Key< int > order

◆ computeSize()

template<PackingOrder packing>
static constexpr std::size_t lsst::geom::polynomials::PackedIndexIterator< packing >::computeSize ( std::size_t order)
inlinestaticconstexprnoexcept

Return the flattened size of an expansion with the given maximum order (inclusive).

Definition at line 180 of file PackedIndex.h.

180 {
181 return computeOffset(order + 1);
182 }

◆ makeEnd()

template<PackingOrder packing>
static constexpr PackedIndexIterator lsst::geom::polynomials::PackedIndexIterator< packing >::makeEnd ( std::size_t order)
inlinestaticconstexprnoexcept

Construct an iterator one past the end of an expansion with the given order.

Definition at line 190 of file PackedIndex.h.

190 {
192 }
constexpr PackedIndexIterator() noexcept
Construct an iterator at the beginning of an expansion of any order.

◆ operator!=()

template<PackingOrder packing>
constexpr bool lsst::geom::polynomials::PackedIndexIterator< packing >::operator!= ( PackedIndexIterator< packing > const & other) const
inlineconstexprnoexcept

Inequality comparison.

Definition at line 228 of file PackedIndex.h.

228 {
229 return !(*this == other);
230 }

◆ operator*()

template<PackingOrder packing>
constexpr reference lsst::geom::polynomials::PackedIndexIterator< packing >::operator* ( ) const
inlineconstexprnoexcept

Dereference the iterator, yielding a Index2d const reference.

Definition at line 203 of file PackedIndex.h.

203{ return _index; }

◆ operator++() [1/2]

template<PackingOrder packing>
PackedIndexIterator & lsst::geom::polynomials::PackedIndexIterator< packing >::operator++ ( )
inlinenoexcept

Move to the next element in the packed array and return the iterator.

Definition at line 209 of file PackedIndex.h.

209 {
210 ++_index.flat;
211 Traits::increment(_index);
212 return *this;
213 }
std::size_t flat
Index into the flattened 2-d function.
Definition PackedIndex.h:89

◆ operator++() [2/2]

template<PackingOrder packing>
PackedIndexIterator lsst::geom::polynomials::PackedIndexIterator< packing >::operator++ ( int )
inlinenoexcept

Move to the next element in the packed array and return a copy of the iterator before the move.

Definition at line 216 of file PackedIndex.h.

216 {
217 PackedIndexIterator r(*this);
218 ++(*this);
219 return r;
220 }

◆ operator->()

template<PackingOrder packing>
constexpr pointer lsst::geom::polynomials::PackedIndexIterator< packing >::operator-> ( ) const
inlineconstexprnoexcept

Dereference the iterator, yielding a Index2d const pointer.

Definition at line 206 of file PackedIndex.h.

206{ return &_index; }

◆ operator==()

template<PackingOrder packing>
constexpr bool lsst::geom::polynomials::PackedIndexIterator< packing >::operator== ( PackedIndexIterator< packing > const & other) const
inlineconstexprnoexcept

Equality comparison.

Definition at line 223 of file PackedIndex.h.

223 {
224 return _index == other._index;
225 }

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