39 numBlocks(bOffsets.Size()-1),
40 blockOffsets(bOffsets.GetData())
47 :
Vector(bOffsets.Last(), mt),
48 numBlocks(bOffsets.Size()-1),
49 blockOffsets(bOffsets.GetData())
58 numBlocks(v.numBlocks),
59 blockOffsets(v.blockOffsets)
67 Vector(data, bOffsets.Last()),
68 numBlocks(bOffsets.Size()-1),
69 blockOffsets(bOffsets.GetData())
77 numBlocks(bOffsets.Size()-1),
78 blockOffsets(bOffsets.GetData())
87 numBlocks(bOffsets.Size()-1),
88 blockOffsets(bOffsets.GetData())
143 if (i < 0) {
return; }
144 if (
blocks[i].
Size() != bOffsets[i+1] - bOffsets[i]) {
break; }
146 "invalid blocks[" << i <<
']');
169 mfem_error(
"Number of Blocks don't match in BlockVector::operator=");
176 mfem_error(
"Size of Blocks don't match in BlockVector::operator=");
int Size() const
Return the logical size of the array.
T * GetData()
Returns the data.
T & Last()
Return the last element in the array.
A class to handle Vectors in a block fashion.
BlockVector & operator=(const BlockVector &original)
Assignment operator. this and original must have the same block structure.
void Update(real_t *data, const Array< int > &bOffsets)
Update method.
void SyncFromBlocks() const
Synchronize the memory location flags (i.e. the memory validity flags) of the big/monolithic block-ve...
const int * blockOffsets
Offset for each block start. (length numBlocks+1)
~BlockVector()
Destructor.
int numBlocks
Number of blocks in the blockVector.
void SyncToBlocks() const
Synchronize the memory location flags (i.e. the memory validity flags) of the big/monolithic block-ve...
Vector * blocks
array of Vector objects used to extract blocks without allocating memory.
void GetBlockView(int i, Vector &blockView)
Get the i-th vector in the block.
BlockVector()
empty constructor
MemoryType GetMemoryType() const
Return a MemoryType that is currently valid. If both the host and the device pointers are currently v...
bool OwnsData() const
Read the Vector data (host pointer) ownership flag.
void SyncAliasMemory(const Vector &v) const
Update the alias memory location of the vector to match v.
void SyncMemory(const Vector &v) const
Update the memory location of the vector to match v.
void Destroy()
Destroy a vector.
int Size() const
Returns the size of the vector.
void SetSize(int s)
Resize the vector to size s.
void NewDataAndSize(real_t *d, int s)
Set the Vector data and size, deleting the old data, if owned.
real_t * GetData() const
Return a pointer to the beginning of the Vector data.
Vector & operator=(const real_t *v)
Copy Size() entries from v.
void MakeRef(Vector &base, int offset, int size)
Reset the Vector to be a reference to a sub-vector of base.
void mfem_error(const char *msg)
MemoryType
Memory types supported by MFEM.