16 #ifndef dealii_vector_memory_h 17 #define dealii_vector_memory_h 20 #include <deal.II/base/config.h> 22 #include <deal.II/base/logstream.h> 23 #include <deal.II/base/smartpointer.h> 24 #include <deal.II/base/thread_management.h> 26 #include <deal.II/lac/vector.h> 32 DEAL_II_NAMESPACE_OPEN
106 template <
typename VectorType = ::Vector<
double>>
153 free(
const VectorType *
const) = 0;
165 "You are trying to deallocate a vector from a memory pool, but this " 166 "vector has not actually been allocated by the same pool before.");
193 :
public std::unique_ptr<VectorType, std::function<void(VectorType *)>>
240 template <
typename VectorType = ::Vector<
double>>
287 free(
const VectorType *
const v)
override;
319 template <
typename VectorType = ::Vector<
double>>
382 free(
const VectorType *
const)
override;
403 using entry_type = std::pair<bool, std::unique_ptr<VectorType>>;
472 namespace GrowingVectorMemoryImplementation
475 release_all_unused_memory();
485 template <
typename VectorType>
487 :
std::unique_ptr<VectorType,
std::function<void(VectorType *)>>(
489 [&mem](VectorType *v) { mem.
free(v); })
494 template <
typename VectorType>
498 return new VectorType();
503 template <
typename VectorType>
514 DEAL_II_NAMESPACE_CLOSE
virtual void free(const VectorType *const) override
virtual VectorType * alloc()=0
virtual ~GrowingVectorMemory() override
static void release_unused_memory()
std::pair< bool, std::unique_ptr< BlockVector< number > > > entry_type
void initialize(const size_type size)
types::global_dof_index size_type
std::vector< entry_type > * data
virtual void free(const VectorType *const)=0
virtual VectorType * alloc() override
static ::ExceptionBase & ExcNotAllocatedHere()
virtual ~VectorMemory() override=default
GrowingVectorMemory(const size_type initial_size=0, const bool log_statistics=false)
virtual void free(const VectorType *const v) override
#define DeclExceptionMsg(Exception, defaulttext)
static Threads::Mutex mutex
unsigned int global_dof_index
virtual std::size_t memory_consumption() const
virtual VectorType * alloc() override
Pointer & operator=(Pointer &&p) noexcept=default