![]() |
GemaCoreLib
The GeMA Core library
|
A vector tailored for storing mesh related data for the common scenario where elements are added to the mesh but the number of added elements is much smaller than the original mesh size. Although conceptually a single vector, internally the storage is split in two parts. A fixed one with the original mesh information and a second one that grows as new elements are added to the mesh. Since the second part is small, standard vector growing practices are not too hurtfull. More...
#include <gmDualVector.h>
Public Types | |
typedef T | DataType |
The stored data type. | |
Public Member Functions | |
GmDualVector () | |
Default constructor. | |
GmDualVector (size_t nvalues) | |
The constructor initializing the "fixed" part size. The vector contents is NOT initialized. | |
~GmDualVector () | |
Destructor. | |
size_t | size () const |
Returns the vector size. | |
const T * | iptr (size_t index) const |
Returns a pointer to the index data inside the vector. By the very nature of this class, accessing following items is only safe if you know that they belong to the same internal vector. This is usually guaranteed by knowing that all data bellonging to a cell, for example, is always together in the same vector, but depends on the class usage. | |
T * | iptr (size_t index) |
Non-const overload for iptr() | |
const T & | operator[] (size_t index) const |
Standard indexing operator. | |
T & | operator[] (size_t index) |
Non-const overload for the standard indexing operator. | |
bool | addValues (size_t numAddedValues, bool tight=false) |
Adds numAddedValues to the set, without any initialization. Returns true on success, false on error. On errors previous values are kept. If the vector is empty, the allocated size will be adjusted to exactly the given size. Otherwise, a growing factor of half of the previous size will be used, unless that is insufficient. If tight is set to true, the allocated size will always match the needed size (unless already allocated). | |
void | restoreSize (size_t oldNumValues) |
Restores the size of the set to the previous size before the last call to addValues(). | |
void | clear () |
Clears all stored data returning the object to a default constructed state. | |
size_t | usedMemory () const |
Returns an estimative of the memory used by the data set in bytes. More... | |
int | numDumpBuffers () const |
Returns the number of internal buffers used by this implementation. | |
char * | dumpBuffer (int i) const |
Returns the i'th internal buffer, i from 0 to numDumpBuffers()-1. | |
size_t | dumpBufferSize (int i) const |
Returns the size in bytes of the i'th internal buffer returned by dumpBuffer(i) | |
Protected Attributes | |
T * | _fixedData |
The fixed part of the dual vector with _fixedSize entries. | |
size_t | _fixedSize |
The number of entries in _fixedData. | |
GmPODVector< T > | _growData |
The variable part. | |
Private Member Functions | |
Q_DISABLE_COPY (GmDualVector) | |
A vector tailored for storing mesh related data for the common scenario where elements are added to the mesh but the number of added elements is much smaller than the original mesh size. Although conceptually a single vector, internally the storage is split in two parts. A fixed one with the original mesh information and a second one that grows as new elements are added to the mesh. Since the second part is small, standard vector growing practices are not too hurtfull.
This class provides a basic vector interface tailored for both the ValueSet needs and for usage on the mesh plugin class. This class does NOT allow for reducing the vector size. See GmDualVectorR instead.
Accepts only POD types.
|
inline |
Returns an estimative of the memory used by the data set in bytes.
It returns in general the variable memory that depends on the number of set entries but does not include constant overheads used by the class for control