Reference documentation for deal.II version 8.5.1
|
#include <deal.II/lac/vector_memory.h>
Classes | |
class | Pointer |
Public Member Functions | |
virtual | ~VectorMemory () |
virtual VectorType * | alloc ()=0 |
virtual void | free (const VectorType *const)=0 |
Public Member Functions inherited from Subscriptor | |
Subscriptor () | |
Subscriptor (const Subscriptor &) | |
Subscriptor (Subscriptor &&) | |
virtual | ~Subscriptor () |
Subscriptor & | operator= (const Subscriptor &) |
Subscriptor & | operator= (Subscriptor &&) |
void | subscribe (const char *identifier=0) const |
void | unsubscribe (const char *identifier=0) const |
unsigned int | n_subscriptions () const |
void | list_subscribers () const |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Static Public Member Functions | |
static ::ExceptionBase & | ExcNotAllocatedHere () |
Static Public Member Functions inherited from Subscriptor | |
static ::ExceptionBase & | ExcInUse (int arg1, char *arg2, std::string &arg3) |
static ::ExceptionBase & | ExcNoSubscriber (char *arg1, char *arg2) |
Memory management base class for vectors. This is an abstract base class used, among other places, by all iterative methods to allocate space for auxiliary vectors.
The purpose of this class is as follows: in iterative solvers and other places, one needs to allocate temporary storage for vectors, for example for auxiliary vectors. One could allocate and release them anew every time, but this may be expensive in some situations if it has to happen very frequently. A common case for this is when an iterative method is used to invert a matrix in each iteration an outer solver, such as when inverting a matrix block for a Schur complement solver.
In such situations, allocating and deallocating vectors anew in each call to the inner solver is expensive and leads to memory fragmentation. The present class allows to avoid this by offering an interface that other classes can use to allocate and deallocate vectors. Different derived classes then implement different strategies to provide temporary storage vectors to using classes.
For example, the PrimitiveVectorMemory class simply allocates and deallocated vectors each time it is asked for a vector. It is an appropriate implementation to use for iterative solvers that are called only once, or very infrequently.
On the other hand, the GrowingVectorMemory class never returns memory space to the operating system memory management subsystem during its lifetime; it only marks them as unused and allows them to be reused next time a vector is requested.
Yet other classes, when implemented, could provide even other strategies for memory management.
Definition at line 26 of file pointer_matrix.h.
|
inlinevirtual |
Virtual destructor is needed as there are virtual functions in this class.
Definition at line 79 of file vector_memory.h.
|
pure virtual |
Return a pointer to a new vector. The number of elements or their subdivision into blocks (if applicable) is unspecified and users of this function should reset vectors to their proper size. The same holds for the contents of vectors: they are unspecified.
Implemented in GrowingVectorMemory< VectorType >, GrowingVectorMemory< BlockVector< number > >, and PrimitiveVectorMemory< VectorType >.
|
pure virtual |
Return a vector and indicate that it is not going to be used any further by the instance that called alloc() to get a pointer to it.
Implemented in GrowingVectorMemory< VectorType >, GrowingVectorMemory< BlockVector< number > >, and PrimitiveVectorMemory< VectorType >.