16 #ifndef dealii_vector_memory_h 17 #define dealii_vector_memory_h 20 #include <deal.II/base/config.h> 21 #include <deal.II/base/smartpointer.h> 22 #include <deal.II/base/logstream.h> 23 #include <deal.II/base/thread_management.h> 24 #include <deal.II/lac/vector.h> 30 DEAL_II_NAMESPACE_OPEN
103 template <
typename VectorType = ::Vector<
double> >
133 virtual VectorType *
alloc () = 0;
149 virtual void free (
const VectorType *
const) = 0;
160 "You are trying to deallocate a vector from a memory pool, but this " 161 "vector has not actually been allocated by the same pool before.");
187 class Pointer :
public std::unique_ptr<VectorType, std::function<void (VectorType *)> >
233 template <
typename VectorType = ::Vector<
double> >
259 virtual VectorType *
alloc ();
278 virtual void free (
const VectorType *
const v);
310 template <
typename VectorType = ::Vector<
double> >
352 virtual VectorType *
alloc ();
371 virtual void free (
const VectorType *
const);
390 typedef std::pair<bool, std::unique_ptr<VectorType> >
entry_type;
457 namespace GrowingVectorMemoryImplementation
459 void release_all_unused_memory();
469 template <
typename VectorType>
473 std::unique_ptr<VectorType,
std::function<void (VectorType *)> >
474 (mem.alloc(), [&mem](VectorType *v)
482 template <
typename VectorType>
486 return new VectorType();
491 template <
typename VectorType>
503 DEAL_II_NAMESPACE_CLOSE
virtual VectorType * alloc()=0
static void release_unused_memory()
virtual VectorType * alloc()
void initialize(const size_type size)
std::vector< entry_type > * data
virtual void free(const VectorType *const)=0
static ::ExceptionBase & ExcNotAllocatedHere()
GrowingVectorMemory(const size_type initial_size=0, const bool log_statistics=false)
unsigned int global_dof_index
virtual VectorType * alloc()
#define DeclExceptionMsg(Exception, defaulttext)
static Threads::Mutex mutex
virtual void free(const VectorType *const)
virtual ~VectorMemory()=default
virtual ~GrowingVectorMemory()
std::pair< bool, std::unique_ptr< VectorType > > entry_type
virtual void free(const VectorType *const v)
virtual std::size_t memory_consumption() const
types::global_dof_index size_type
Pointer & operator=(Pointer &&p) noexcept=default