Reference documentation for deal.II version GIT 472adc65c1 2022-06-27 15:55:01+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Public Member Functions | Static Public Member Functions | List of all members
PrimitiveVectorMemory< VectorType > Class Template Referenceabstract

#include <deal.II/lac/vector_memory.h>

Inheritance diagram for PrimitiveVectorMemory< VectorType >:
[legend]

Public Member Functions

virtual VectorType * alloc () override
 
virtual void free (const VectorType *const v) override
 
virtual void free (const ::Vector< double > *const)=0
 

Static Public Member Functions

static ::ExceptionBaseExcNotAllocatedHere ()
 

Subscriptor functionality

Classes derived from Subscriptor provide a facility to subscribe to this object. This is mostly used by the SmartPointer class.

void subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
void unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
unsigned int n_subscriptions () const
 
template<typename StreamType >
void list_subscribers (StreamType &stream) const
 
void list_subscribers () const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 
static ::ExceptionBaseExcInUse (int arg1, std::string arg2, std::string arg3)
 
static ::ExceptionBaseExcNoSubscriber (std::string arg1, std::string arg2)
 
using map_value_type = decltype(counter_map)::value_type
 
using map_iterator = decltype(counter_map)::iterator
 
std::atomic< unsigned int > counter
 
std::map< std::string, unsigned int > counter_map
 
std::vector< std::atomic< bool > * > validity_pointers
 
const std::type_info * object_info
 
static std::mutex mutex
 
void check_no_subscribers () const noexcept
 

Detailed Description

template<typename VectorType = ::Vector<double>>
class PrimitiveVectorMemory< VectorType >

Simple memory management. See the documentation of the base class for a description of its purpose.

This class allocates and deletes vectors as needed from the global heap, i.e. performs no specially adapted actions for memory management.

Definition at line 236 of file vector_memory.h.

Member Function Documentation

◆ free()

virtual void VectorMemory< ::Vector< double > >::free ( const VectorType * const  )
pure virtualinherited

Return a vector and indicate that it is not going to be used any further by the place that called alloc() to get a pointer to it.

Warning
Just like using new and delete explicitly in code invites bugs where memory is leaked (either because the corresponding delete is forgotten altogether, or because of exception safety issues), using the alloc() and free() functions explicitly invites writing code that accidentally leaks memory. You should consider using the VectorMemory::Pointer class instead, which provides the same kind of service that std::unique provides for arbitrary memory allocated on the heap.

◆ ExcNotAllocatedHere()

static ::ExceptionBase& VectorMemory< ::Vector< double > >::ExcNotAllocatedHere ( )
staticinherited

Vector was not allocated from this memory pool.

Note
The message that will be printed by this exception reads:
"You are trying to deallocate a vector from a memory pool, but this " "vector has not actually been allocated by the same pool before."

The documentation for this class was generated from the following file: