Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::DataAllocator Struct Reference

Lightweight allocator/deallocator backed by an Arena. More...

#include <AMReX_DataAllocator.H>

Inheritance diagram for amrex::DataAllocator:
amrex::BaseFab< Long > amrex::BaseFab< EBCellFlag > amrex::BaseFab< Real > amrex::BaseFab< int > amrex::BaseFab< char > amrex::BaseFab< GpuComplex< typename MultiFab::value_type > > amrex::BaseFab< HYPRE_Int > amrex::BaseFab< AtomicInt > amrex::BaseFab< PetscInt > amrex::BaseFab< T > amrex::TableData< T, N, ORDER >

Public Member Functions

 DataAllocator () noexcept=default
 Default-construct; alloc/free will use The_Arena().
 DataAllocator (Arena *ar) noexcept
 Construct with an explicit arena ar.
void * alloc (std::size_t sz) const
 Allocate sz bytes from the arena. Throws OutOfMemoryError on failure.
void free (void *pt) const noexcept
 Return the allocation at pt to the arena.
Arena * arena () const noexcept
 Return the stored arena, or The_Arena() if none was set.

Public Attributes

Arena * m_arena = nullptr
 Stored arena pointer (may be null).

Detailed Description

Lightweight allocator/deallocator backed by an Arena.

Falls back to The_Arena() when no arena is supplied.

Constructor & Destructor Documentation

◆ DataAllocator() [1/2]

amrex::DataAllocator::DataAllocator ( )
defaultnoexcept

Default-construct; alloc/free will use The_Arena().

◆ DataAllocator() [2/2]

amrex::DataAllocator::DataAllocator ( Arena * ar)
inlinenoexcept

Construct with an explicit arena ar.

Member Function Documentation

◆ alloc()

void * amrex::DataAllocator::alloc ( std::size_t sz) const
inlinenodiscard

Allocate sz bytes from the arena. Throws OutOfMemoryError on failure.

◆ arena()

Arena * amrex::DataAllocator::arena ( ) const
inlinenodiscardnoexcept

Return the stored arena, or The_Arena() if none was set.

◆ free()

void amrex::DataAllocator::free ( void * pt) const
inlinenoexcept

Return the allocation at pt to the arena.

Member Data Documentation

◆ m_arena

Arena* amrex::DataAllocator::m_arena = nullptr

Stored arena pointer (may be null).


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