Class FastFinder

Nested Relationships

Class Documentation

class FastFinder

Fast locator in starlists.

This is an auxillary class for matching objects from starlists. It allows to locate rapidly the closest objects from a given position. The very simple strategy is to sort objects according to 1 coordinate x, and to build an index that allows to select the objects with the x coordinate inside an interval. Then every slice in x is sorted according to y, which enables a fast scan inside a x slice. listMatchCollect takes about 10ms (PC 450 MHz, optimized “-O4”) for a match between lists of about 2000 objects each, which is fast enough for our needs. The same “locator” is used in listMatchupShift, to avoid scanning the whole input lists. Timing on listMatchCollect and listMatchupShift indicates a gain in speed by more than one order of magnitude after implementation of this FastFinder.

Public Functions

FastFinder(const BaseStarList &list, const unsigned nXSlice = 100)

Constructor.

std::shared_ptr<const BaseStar> lsst::jointcal::FastFinder::findClosest(const Point & where, const double maxDist, bool(*SkipIt)(const BaseStar &) = nullptr) const

Find the closest with some rejection capability.

std::shared_ptr<const BaseStar> lsst::jointcal::FastFinder::secondClosest(const Point & where, const double maxDist, std::shared_ptr< const BaseStar > & closest, bool(*SkipIt)(const BaseStar &) = nullptr) const
void dump() const

mostly for debugging

Iterator beginScan(const Point &where, double maxDist) const
void findRangeInSlice(const int iSlice, const double yStart, const double yEnd, pstar &start, pstar &end) const
pstar locateYStart(pstar begin, pstar end, double yVal) const
pstar locateYEnd(pstar begin, pstar end, double yVal) const

Public Members

decltype(stars) typedef ::value_type lsst::jointcal::FastFinder::stars_element
decltype(stars) typedef ::const_iterator lsst::jointcal::FastFinder::pstar
const BaseStarList baselist
unsigned count
std::vector<std::shared_ptr<const BaseStar>> stars
unsigned nslice
std::vector<unsigned> index
double xmin
double xmax
double xstep
class Iterator

Iterator meant to traverse objects within some limiting distance. Initializer is beginScan and end condition is (*it == NULL). Used by findClosest & co.

Public Functions

void check() const
Iterator(const FastFinder &f, const Point &where, double maxDist)
void operator++()
stars_element operator*() const

Public Members

const FastFinder &finder
int currentSlice
int endSlice
double yStart
double yEnd
pstar current
pstar pend
pstar null_value