20 inline std::ostream &operator<<(std::ostream &out, const std::pair<int,int> &element)
22 out << element.first <<
"|" << element.second;
56 TPZVec(
const int64_t size,
const T& copy);
69 TPZVec(
const std::initializer_list<T>& list);
114 #if defined(WIN32) && !defined(_WIN64) 120 PZError << __PRETTY_FUNCTION__ <<
" acessing element out of range.";
124 PZError <<
"+-> Index = " << index << std::endl;
131 T&
operator[](
const unsigned int index )
const 136 PZError << __PRETTY_FUNCTION__ <<
" acessing element out of range.";
140 PZError <<
"+-> Index = " << index << std::endl;
153 PZError << __PRETTY_FUNCTION__ <<
" acessing element out of range.";
157 PZError <<
"+-> Index = " << index << std::endl;
167 friend std::ostream& operator<<( std::ostream& Out, const TPZVec< T2 >& v );
184 void Fill(
const T& copy,
const int64_t from=0,
const int64_t numelem=-1);
204 virtual void Resize(
const int64_t newsize,
const T&
object);
212 virtual void Resize(
const int64_t newsize);
213 virtual void resize(
const int64_t newsize)
223 void Print(std::ostream &out = std::cout);
226 virtual void clear();
248 PZError <<
"TPZVec constructor. Bad parameter size " << size <<
" size is set to 0." 272 PZError <<
"TPZVec constructor. Bad parameter size, then size = 0." 287 for( int64_t i = 0; i <
size; i++ )
313 fStore =
new T[list.size()];
315 auto it = list.begin();
316 auto it_end = list.end();
318 for (; it != it_end; it++, aux++)
334 if(
this == ©)
return *
this;
350 auto it = list.begin();
351 auto it_end = list.end();
354 for (; it != it_end; it++, aux++)
366 for( T* walk =
fStore; walk <
end; *walk++ = a );
376 PZError <<
"TPZVec::Resize. Bad parameter newsize." << std::endl;
383 if(newsize) newstore =
new T[newsize];
387 for(i=0L; i<large; i++) {
390 for(;i<newsize;i++) {
391 newstore[i] = object;
408 PZError <<
"TPZVec::Resize. Bad parameter newsize: " << newsize << std::endl;
414 int64_t nlongsize = 1704792168;
415 if((newsize+1) > (1./sz)*nlongsize) {
416 PZError <<
"TPZVec::Resize. Bad parameter newsize: " << newsize << std::endl;
417 std::cout <<
"TPZVec::Resize. Bad parameter newsize: " << newsize << std::endl;
432 T *newstore =
new T[newsize];
435 for(i=0L; i<large; i++) {
462 if(numelem<0 && numelem != -1) {
463 PZError <<
"TPZVec::Fill" << std::endl
464 <<
"It's negative parameter numelem, then numelem = " 471 int64_t
first = (from < 0) ? 0 : from;
472 int64_t nel = numelem;
477 for(int64_t i=first; i<last; i++)
484 out << std::endl <<
"Number of elements = " <<
fNElements;
488 std::ostream& operator<<( std::ostream& Out, const TPZVec< T >& v )
490 std::streamsize width = Out.width();
492 const char* sep = ( width == 0 ?
", " :
"" );
494 int64_t
size = v.NElements();
496 if(size) Out << std::setw(width) << v.fStore[0];
498 for( int64_t ii = 1; ii <
size; ii++ )
500 Out << std::setw( width ) << sep << v.fStore[ ii ];
506 inline std::ostream& operator<<( std::ostream& Out, const TPZVec< std::pair<double,double> >& v )
511 int64_t
size = v.NElements();
515 for( int64_t ii = 0; ii <
size; ii++ )
517 Out <<
"{" << v[ii].first <<
',' << v[ii].second <<
"}";
518 if( ii < size-1) Out <<
",";
void Print(std::ostream &out=std::cout)
Prints the structural information of the vector object to the output stream. This method will not p...
TPZVec()
Creates a vector with size 0.
virtual void resize(const int64_t newsize)
T & operator[](const int64_t index) const
Access operator, will perform bounds checking unless the variable NODEBUG is defined.
Contains declaration of the TPZPageMigrationManager class which implements methods to migrate data in...
This class implements a simple vector storage scheme for a templated class T. Utility.
int64_t size() const
Returns the number of elements of the vector.
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object reallocating the necessary storage, copying the existing objects to the new...
#define DebugStop()
Returns a message to user put a breakpoint in.
virtual void clear()
Empty the vector, make its size zero.
T * begin() const
Casting operator. Returns The fStore pointer.
TPZVec< T > & operator=(const TPZVec< T > ©)
will copy the vector into the current vector.
T * fStore
Allocated storage for the vector object.
int64_t fNElements
Number of elements of the vector object.
void migrate_to_local(char *start, uint64_t sz_in_bytes)
virtual ~TPZVec()
destructor, will delete the storage allocated
void Fill(const T ©, const int64_t from=0, const int64_t numelem=-1)
Will fill the elements of the vector with a copy object.
int64_t NElements() const
Returns the number of elements of the vector.
Contains the declaration of TPZFlopCounter class and TPZCounter struct.
T * end() const
Returns a pointer to the last+1 element.
#define PZError
Defines the output device to error messages and the DebugStop() function.