Block-Structured AMR Software Framework
AMReX_SUNMemory.H
Go to the documentation of this file.
1 #ifndef AMREX_SUNMEMORY_H_
2 #define AMREX_SUNMEMORY_H_
3 
4 #include <AMReX_Arena.H>
5 #include <AMReX_Sundials_Core.H>
6 #include <sundials/sundials_context.h>
7 #include <sundials/sundials_memory.h>
8 
9 namespace amrex::sundials {
10 
16 class MemoryHelper {
17 public:
18  MemoryHelper(::sundials::Context* sunctx);
19  ~MemoryHelper();
20  MemoryHelper(const MemoryHelper& rhs);
21  MemoryHelper(MemoryHelper&& rhs) noexcept;
22  MemoryHelper& operator=(MemoryHelper const& rhs) = delete;
23  MemoryHelper& operator=(MemoryHelper&& rhs) noexcept;
24  operator SUNMemoryHelper() const { return helper; }
25 
26  static void Initialize(int nthreads);
27  static void Finalize();
28 private:
29  SUNMemoryHelper helper;
30  ::sundials::Context* sunctx;
31 };
32 
33 
43 
50 amrex::Arena* getArena (SUNMemoryType type);
51 
52 }//amrex::sundials
53 
54 #endif
A virtual base class for objects that manage their own dynamic memory allocation.
Definition: AMReX_Arena.H:100
A SUNDIALS SUNMemoryHelper interface to the amrex::Arena.
Definition: AMReX_SUNMemory.H:16
MemoryHelper(::sundials::Context *sunctx)
Definition: AMReX_SUNMemory.cpp:136
~MemoryHelper()
Definition: AMReX_SUNMemory.cpp:142
SUNMemoryHelper helper
Definition: AMReX_SUNMemory.H:29
static void Initialize(int nthreads)
Definition: AMReX_SUNMemory.cpp:174
MemoryHelper & operator=(MemoryHelper const &rhs)=delete
::sundials::Context * sunctx
Definition: AMReX_SUNMemory.H:30
static void Finalize()
Definition: AMReX_SUNMemory.cpp:190
constexpr int get_thread_num()
Definition: AMReX_OpenMP.H:37
Definition: AMReX_NVector_MultiFab.cpp:15
MemoryHelper * The_SUNMemory_Helper(int i)
Get the i-th SUNMemoryHelper instance.
Definition: AMReX_SUNMemory.cpp:199
amrex::Arena * getArena(SUNMemoryType type)
Get the proper amrex::Arena based on the SUNMemoryType.