12 #include "../general/array.hpp"
31 numBlocks(bOffsets.Size()-1),
32 blockOffsets(bOffsets.GetData()),
42 numBlocks(v.numBlocks),
43 blockOffsets(v.blockOffsets),
52 Vector(data, bOffsets.Last()),
53 numBlocks(bOffsets.Size()-1),
54 blockOffsets(bOffsets.GetData()),
68 for (
int i =
numBlocks; i < oldNumBlocks; ++i)
72 for (
int i = oldNumBlocks; i <
numBlocks; ++i)
73 tmp_block[i] =
new Vector(data+blockOffsets[i], blockOffsets[i+1]-blockOffsets[i]);
79 mfem_error(
"Number of Blocks don't match in BlockVector::operator=");
83 mfem_error(
"Size of Blocks don't match in BlockVector::operator=");
85 for (
int i = 0; i < original.
size; i++)
100 for (
int i = 0; i <
tmp_block.Size(); ++i)
~BlockVector()
Destructor.
int Size() const
Logical size of the array.
Vector()
Default constructor for Vector. Sets size = 0 and data = NULL.
void NewDataAndSize(double *d, int s)
void GetBlockView(int i, Vector &blockView)
Get the i-th vector in the block.
BlockVector()
empty constructor
const int * blockOffsets
Offset for each block start. (length numBlocks+1)
T * GetData()
Returns the data.
void Update(double *data, const Array< int > &bOffsets)
Update method.
Vector & operator=(const double *v)
Array< Vector * > tmp_block
array of Vector objects used to extract blocks without allocating memory.
int numBlocks
Number of blocks in the blockVector.
BlockVector & operator=(const BlockVector &original)
Assignment operator. this and original must have the same block structure.
void mfem_error(const char *msg)
T & Last()
Return the last element in the array.
Vector & GetBlock(int i)
Get the i-th vector in the block.