LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Member Functions | Private Attributes | List of all members
lsst::meas::algorithms::shapelet::PixelList Class Reference

#include <Pixel.h>

Public Member Functions

 PixelList ()
 
 PixelList (const int n)
 
 PixelList (const PixelList &rhs)
 
PixelListoperator= (const PixelList &rhs)
 
 ~PixelList ()
 
void usePool ()
 
size_t size () const
 
void reserve (const int n)
 
size_t capacity () const
 
void resize (const int n)
 
void clear ()
 
void push_back (const Pixel &p)
 
Pixeloperator[] (const int i)
 
const Pixeloperator[] (const int i) const
 
void sort (const Position &cen)
 

Private Attributes

bool _shouldUsePool
 
boost::shared_ptr< std::vector
< Pixel > > 
_v1
 
boost::shared_ptr< std::vector
< Pixel > > 
_v2
 

Detailed Description

Definition at line 72 of file Pixel.h.

Constructor & Destructor Documentation

lsst::meas::algorithms::shapelet::PixelList::PixelList ( )

Definition at line 32 of file Pixel_omp.cc.

32  :
33  _shouldUsePool(false), _v1(new std::vector<Pixel>())
34  {}
boost::shared_ptr< std::vector< Pixel > > _v1
Definition: Pixel.h:98
lsst::meas::algorithms::shapelet::PixelList::PixelList ( const int  n)

Definition at line 36 of file Pixel_omp.cc.

36  :
37  _shouldUsePool(false), _v1(new std::vector<Pixel>(n))
38  {}
boost::shared_ptr< std::vector< Pixel > > _v1
Definition: Pixel.h:98
lsst::meas::algorithms::shapelet::PixelList::PixelList ( const PixelList rhs)

Definition at line 40 of file Pixel_omp.cc.

40  :
41  _shouldUsePool(false), _v1(new std::vector<Pixel>(rhs.size()))
42  {
43  if (rhs._shouldUsePool)
44  std::copy(rhs._v2->begin(),rhs._v2->end(),_v1->begin());
45  else *_v1 = *rhs._v1;
46  }
SelectEigenView< T >::Type copy(Eigen::EigenBase< T > const &other)
Copy an arbitrary Eigen expression into a new EigenView.
Definition: eigen.h:390
boost::shared_ptr< std::vector< Pixel > > _v1
Definition: Pixel.h:98
lsst::meas::algorithms::shapelet::PixelList::~PixelList ( )

Definition at line 63 of file Pixel_omp.cc.

64  {
65 #ifdef _OPENMP
66 #pragma omp critical (PixelList)
67 #endif
68  {
69  _v2.reset();
70  }
71  }
boost::shared_ptr< std::vector< Pixel > > _v2
Definition: Pixel.h:103

Member Function Documentation

size_t lsst::meas::algorithms::shapelet::PixelList::capacity ( ) const

Definition at line 110 of file Pixel_omp.cc.

111  { return _shouldUsePool ? _v2->capacity() : _v1->capacity(); }
boost::shared_ptr< std::vector< Pixel > > _v2
Definition: Pixel.h:103
boost::shared_ptr< std::vector< Pixel > > _v1
Definition: Pixel.h:98
void lsst::meas::algorithms::shapelet::PixelList::clear ( )

Definition at line 127 of file Pixel_omp.cc.

128  {
129  if (_shouldUsePool) {
130 #ifdef _OPENMP
131 #pragma omp critical (PixelList)
132 #endif
133  {
134  _v2->clear();
135  }
136  } else {
137  _v1->clear();
138  }
139  }
boost::shared_ptr< std::vector< Pixel > > _v2
Definition: Pixel.h:103
boost::shared_ptr< std::vector< Pixel > > _v1
Definition: Pixel.h:98
PixelList & lsst::meas::algorithms::shapelet::PixelList::operator= ( const PixelList rhs)

Definition at line 48 of file Pixel_omp.cc.

49  {
50  if (size() != rhs.size()) resize(rhs.size());
51 
52  if (_shouldUsePool) {
53  if (rhs._shouldUsePool) *_v2 = *rhs._v2;
54  else std::copy(rhs._v1->begin(),rhs._v1->end(),_v2->begin());
55  } else {
56  if (rhs._shouldUsePool)
57  std::copy(rhs._v2->begin(),rhs._v2->end(),_v1->begin());
58  else *_v1 = *rhs._v1;
59  }
60  return *this;
61  }
boost::shared_ptr< std::vector< Pixel > > _v2
Definition: Pixel.h:103
SelectEigenView< T >::Type copy(Eigen::EigenBase< T > const &other)
Copy an arbitrary Eigen expression into a new EigenView.
Definition: eigen.h:390
boost::shared_ptr< std::vector< Pixel > > _v1
Definition: Pixel.h:98
Pixel & lsst::meas::algorithms::shapelet::PixelList::operator[] ( const int  i)

Definition at line 155 of file Pixel_omp.cc.

156  {
157  if (_shouldUsePool) return (*_v2)[i];
158  else return (*_v1)[i];
159  }
boost::shared_ptr< std::vector< Pixel > > _v2
Definition: Pixel.h:103
boost::shared_ptr< std::vector< Pixel > > _v1
Definition: Pixel.h:98
const Pixel & lsst::meas::algorithms::shapelet::PixelList::operator[] ( const int  i) const

Definition at line 161 of file Pixel_omp.cc.

162  {
163  if (_shouldUsePool) return (*_v2)[i];
164  else return (*_v1)[i];
165  }
boost::shared_ptr< std::vector< Pixel > > _v2
Definition: Pixel.h:103
boost::shared_ptr< std::vector< Pixel > > _v1
Definition: Pixel.h:98
void lsst::meas::algorithms::shapelet::PixelList::push_back ( const Pixel p)

Definition at line 141 of file Pixel_omp.cc.

142  {
143  if (_shouldUsePool) {
144 #ifdef _OPENMP
145 #pragma omp critical (PixelList)
146 #endif
147  {
148  _v2->push_back(p);
149  }
150  } else {
151  _v1->push_back(p);
152  }
153  }
boost::shared_ptr< std::vector< Pixel > > _v2
Definition: Pixel.h:103
boost::shared_ptr< std::vector< Pixel > > _v1
Definition: Pixel.h:98
void lsst::meas::algorithms::shapelet::PixelList::reserve ( const int  n)

Definition at line 96 of file Pixel_omp.cc.

97  {
98  if (_shouldUsePool) {
99 #ifdef _OPENMP
100 #pragma omp critical (PixelList)
101 #endif
102  {
103  _v2->reserve(n);
104  }
105  } else {
106  _v1->reserve(n);
107  }
108  }
boost::shared_ptr< std::vector< Pixel > > _v2
Definition: Pixel.h:103
boost::shared_ptr< std::vector< Pixel > > _v1
Definition: Pixel.h:98
void lsst::meas::algorithms::shapelet::PixelList::resize ( const int  n)

Definition at line 113 of file Pixel_omp.cc.

114  {
115  if (_shouldUsePool) {
116 #ifdef _OPENMP
117 #pragma omp critical (PixelList)
118 #endif
119  {
120  _v2->resize(n);
121  }
122  } else {
123  _v1->resize(n);
124  }
125  }
boost::shared_ptr< std::vector< Pixel > > _v2
Definition: Pixel.h:103
boost::shared_ptr< std::vector< Pixel > > _v1
Definition: Pixel.h:98
size_t lsst::meas::algorithms::shapelet::PixelList::size ( ) const

Definition at line 90 of file Pixel_omp.cc.

91  {
92  if (_shouldUsePool) return _v2->size();
93  else return _v1->size();
94  }
boost::shared_ptr< std::vector< Pixel > > _v2
Definition: Pixel.h:103
boost::shared_ptr< std::vector< Pixel > > _v1
Definition: Pixel.h:98
void lsst::meas::algorithms::shapelet::PixelList::sort ( const Position cen)

Definition at line 175 of file Pixel_omp.cc.

176  {
177  PixelListSorter sorter(cen);
178  if (_shouldUsePool) std::sort(_v2->begin(),_v2->end(),sorter);
179  else std::sort(_v1->begin(),_v1->end(),sorter);
180  }
boost::shared_ptr< std::vector< Pixel > > _v2
Definition: Pixel.h:103
boost::shared_ptr< std::vector< Pixel > > _v1
Definition: Pixel.h:98
void lsst::meas::algorithms::shapelet::PixelList::usePool ( )

Definition at line 73 of file Pixel_omp.cc.

74  {
75 #ifdef PIXELLIST_USE_POOL
76  // This should be done before any elements are added.
77  if (_v1.get()) Assert(_v1->size() == 0);
78  if (_v2.get()) Assert(_v2->size() == 0);
79  _v1.reset();
80 #ifdef _OPENMP
81 #pragma omp critical (PixelList)
82 #endif
83  {
84  _v2.reset(new std::vector<Pixel,PoolAllocPixel>());
85  }
86  _shouldUsePool = true;
87 #endif
88  }
boost::shared_ptr< std::vector< Pixel > > _v2
Definition: Pixel.h:103
boost::shared_ptr< std::vector< Pixel > > _v1
Definition: Pixel.h:98
#define Assert(x)
Definition: dbg.h:73

Member Data Documentation

bool lsst::meas::algorithms::shapelet::PixelList::_shouldUsePool
private

Definition at line 97 of file Pixel.h.

boost::shared_ptr<std::vector<Pixel> > lsst::meas::algorithms::shapelet::PixelList::_v1
private

Definition at line 98 of file Pixel.h.

boost::shared_ptr<std::vector<Pixel> > lsst::meas::algorithms::shapelet::PixelList::_v2
private

Definition at line 103 of file Pixel.h.


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