12 #include "../general/array.hpp" 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=");
~BlockVector()
Destructor.
void NewDataAndSize(double *d, int s)
Set the Vector data and size, deleting the old data, if owned.
void GetBlockView(int i, Vector &blockView)
Get the i-th vector in the block.
A class to handle Vectors in a block fashion.
void SyncMemory(const Vector &v) const
Update the memory location of the vector to match v.
void SetSize(int s)
Resize the vector to size s.
BlockVector()
empty constructor
const int * blockOffsets
Offset for each block start. (length numBlocks+1)
void SyncFromBlocks() const
Synchronize the memory location flags (i.e. the memory validity flags) of the big/monolithic block-ve...
T * GetData()
Returns the data.
int Size() const
Returns the size of the vector.
void Update(double *data, const Array< int > &bOffsets)
Update method.
Vector & operator=(const double *v)
Copy Size() entries from v.
void mfem_error(const char *msg)
Function called when an error is encountered. Used by the macros MFEM_ABORT, MFEM_ASSERT, MFEM_VERIFY.
int numBlocks
Number of blocks in the blockVector.
double * GetData() const
Return a pointer to the beginning of the Vector data.
BlockVector & operator=(const BlockVector &original)
Assignment operator. this and original must have the same block structure.
MemoryType
Memory types supported by MFEM.
bool OwnsData() const
Read the Vector data (host pointer) ownership flag.
void SyncToBlocks() const
Synchronize the memory location flags (i.e. the memory validity flags) of the big/monolithic block-ve...
void SyncAliasMemory(const Vector &v) const
Update the alias memory location of the vector to match v.
void Destroy()
Destroy a vector.
int Size() const
Return the logical size of the array.
T & Last()
Return the last element in the array.
void MakeRef(Vector &base, int offset, int size)
Reset the Vector to be a reference to a sub-vector of base.
Vector * blocks
array of Vector objects used to extract blocks without allocating memory.
MemoryType GetMemoryType() const
Return a MemoryType that is currently valid. If both the host and the device pointers are currently v...