27 #ifdef CH_USE_MEMORY_TRACKING 29 typedef std::pair<long int*, long int*> ppair;
30 typedef std::map<std::string, ppair > VectorList;
32 typedef std::list<int> lst;
33 typedef std::map<std::string, lst*> incr;
35 extern VectorList* vectorList_;
36 extern incr* vectorIncr_;
73 #ifdef CH_USE_MEMORY_TRACKING 85 #ifdef CH_USE_MEMORY_TRACKING 86 increment(invec.
size());
94 Vector(
const std::vector<T>& invec):
v(invec)
96 #ifdef CH_USE_MEMORY_TRACKING 97 increment(invec.size());
107 #ifdef CH_USE_MEMORY_TRACKING 111 #ifdef CH_USE_MEMORY_TRACKING 123 #ifdef CH_USE_MEMORY_TRACKING 127 #ifdef CH_USE_MEMORY_TRACKING 140 v.assign(
size(),inval );
167 #ifdef CH_USE_MEMORY_TRACKING 194 Vector(
unsigned int isize,
const T& value) :
v(isize, value)
196 #ifdef CH_USE_MEMORY_TRACKING 285 #ifdef CH_USE_MEMORY_TRACKING 309 #ifdef CH_USE_MEMORY_TRACKING 310 increment(invec.
size());
312 for (
int ivec = 0; ivec < invec.
size(); ivec++)
315 v.push_back(invec[ivec]);
326 #ifdef CH_USE_MEMORY_TRACKING 327 if (isize >
size()) increment(isize-
size());
328 else decrement(
size()-isize);
330 unsigned int l=
size();
353 void resize(
unsigned int isize,
const T& value)
356 #ifdef CH_USE_MEMORY_TRACKING 357 if (isize >
size()) increment(isize-
size());
358 else decrement(
size()-isize);
361 v.resize(isize, value);
369 std::sort(
v.begin(),
v.end());
383 #ifdef CH_USE_MEMORY_TRACKING 385 static long int bytes;
386 static long int peak;
392 #ifdef CH_USE_MEMORY_TRACKING 394 void increment(
unsigned int i)
398 static unsigned int sizzle =
initFunc();
402 if (bytes > peak) peak = bytes;
406 void decrement(
unsigned int i)
421 #ifdef CH_USE_MEMORY_TRACKING 435 ostream& operator<<(ostream& os, const Vector<T>& vec)
437 for (
int i=0; i<vec.size(); i++) os<<vec[i]<<
" ";
441 #ifdef CH_USE_MEMORY_TRACKING 446 if (vectorList_ == NULL)
448 vectorList_ =
new VectorList;
449 vectorIncr_ =
new incr;
452 ppair tmp(&bytes, &peak);
453 vectorList_->operator[](
typeid(T).
name()) = tmp;
std::vector< T > & stdVector()
Returns std::vector under the hood.
Definition: Vector.H:373
#define CH_assert(cond)
Definition: CHArray.H:37
Vector< T > & operator=(const std::vector< T > &invec)
Definition: Vector.H:105
Vector(const Vector< T > &invec)
Definition: Vector.H:83
one dimensional dynamic array
Definition: Vector.H:52
size_t capacity() const
Definition: Vector.H:345
void swap(Vector< T > &other)
Definition: Vector.H:275
virtual ~Vector()
Definition: Vector.H:71
T & operator[](unsigned int n)
Definition: Vector.H:216
T & front()
Definition: Vector.H:249
void sort()
Definition: Vector.H:367
void append(const Vector< T > &invec)
Definition: Vector.H:307
void pop_back()
Definition: Vector.H:263
void resize(unsigned int isize)
Definition: Vector.H:323
void push_back(const T &in)
Definition: Vector.H:283
void clear()
Definition: Vector.H:165
T & back()
Definition: Vector.H:256
const char * name(const FArrayBox &a_dummySpecializationArg)
Definition: CH_HDF5.H:741
const std::vector< T > & constStdVector() const
Definition: Vector.H:378
Vector< T > & assign(const T &inval)
assign a scalar to every element of the vector
Definition: Vector.H:138
Vector()
Definition: Vector.H:62
Vector(const std::vector< T > &invec)
Definition: Vector.H:94
size_t size() const
Definition: Vector.H:177
Vector(unsigned int isize, const T &value)
Definition: Vector.H:194
void reserve(size_t isize)
Definition: Vector.H:339
Vector< T > & operator=(const Vector< T > &invec)
Definition: Vector.H:121
const T & back() const
Definition: Vector.H:269
void resize(unsigned int isize, const T &value)
Definition: Vector.H:353
Vector(unsigned int isize)
Definition: Vector.H:156
std::vector< T > v
Definition: Vector.H:418