24 data =
new char[asize * elementsize];
39 delete [] (
char*)
data;
47 if (nsize < minsize) { nsize = minsize; }
49 p =
new char[nsize * elementsize];
56 delete [] (
char*)
data;
65 for (
int i = 0; i < size; i++)
68 if ( !((i+1) % width) || i+1 == size )
86 for (
int i = 0; i < size; i++)
88 out << operator[](i) <<
'\n';
101 for (
int i = 0; i < size; i++)
110 MFEM_ASSERT(size > 0,
"Array is empty with size " << size);
112 T max = operator[](0);
113 for (
int i = 1; i < size; i++)
114 if (max <
operator[](i))
125 MFEM_ASSERT(size > 0,
"Array is empty with size " << size);
127 T min = operator[](0);
128 for (
int i = 1; i < size; i++)
129 if (
operator[](i) < min)
141 T sum =
static_cast<T
>(0);
142 for (
int i = 0; i < size; i++)
153 T sum =
static_cast<T
>(0);
154 for (
int i = 0; i < size; i++)
165 T val_prev = operator[](0), val;
166 for (
int i = 1; i < size; i++)
182 int height = this->NumRows();
183 int width = this->NumCols();
185 for (
int i = 0; i < height; i++)
187 out <<
"[row " << i <<
"]\n";
188 for (
int j = 0; j < width; j++)
191 if ( (j+1) == width_ || (j+1) % width_ == 0 )
void Load(std::istream &in, int fmt=0)
Read an Array from the stream in using format fmt. The format fmt can be:
~BaseArray()
Free the allocated memory.
void * data
Pointer to data.
void Save(std::ostream &out, int fmt=0) const
Save the Array to the stream out using the format fmt. The format fmt can be:
T Min() const
Find the minimal element in the array, using the comparison operator < for class T.
void GrowSize(int minsize, int elementsize)
int size
Size of the array.
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
int allocsize
Size of the allocated memory.
void Print(std::ostream &out=mfem::out, int width=4)
Prints array to stream with width elements per row.
int IsSorted()
return true if the array is sorted.
void PartialSum()
Partial Sum.
void Print(std::ostream &out=mfem::out, int width=4) const
Prints array to stream with width elements per row.
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...