12 #include "../general/array.hpp"
41 numBlocks(bOffsets.Size()-1),
42 blockOffsets(bOffsets.GetData())
49 :
Vector(bOffsets.Last(), mt),
50 numBlocks(bOffsets.Size()-1),
51 blockOffsets(bOffsets.GetData())
60 numBlocks(v.numBlocks),
61 blockOffsets(v.blockOffsets)
69 Vector(data, bOffsets.Last()),
70 numBlocks(bOffsets.Size()-1),
71 blockOffsets(bOffsets.GetData())
124 if (i < 0) {
return; }
125 if (
blocks[i].
Size() != bOffsets[i+1] - bOffsets[i]) {
break; }
127 "invalid blocks[" << i <<
']');
150 mfem_error(
"Number of Blocks don't match in BlockVector::operator=");
157 mfem_error(
"Size of Blocks don't match in BlockVector::operator=");
~BlockVector()
Destructor.
int Size() const
Return the logical size of the array.
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 SetSize(int s)
Resize the vector to size s.
BlockVector()
empty constructor
const int * blockOffsets
Offset for each block start. (length numBlocks+1)
T * GetData()
Returns the data.
int Size() const
Returns the size of the vector.
void Update(double *data, const Array< int > &bOffsets)
Update method.
double * GetData() const
Return a pointer to the beginning of the Vector data.
MemoryType GetMemoryType() const
Return a MemoryType that is currently valid. If both the host and the device pointers are currently v...
Vector & operator=(const double *v)
Copy Size() entries from v.
bool OwnsData() const
Read the Vector data (host pointer) ownership flag.
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.
BlockVector & operator=(const BlockVector &original)
Assignment operator. this and original must have the same block structure.
MemoryType
Memory types supported by MFEM.
void NewMemoryAndSize(const Memory< double > &mem, int s, bool own_mem)
Reset the Vector to use the given external Memory mem and size s.
void Destroy()
Destroy a vector.
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.