Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
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>
6#include <sundials/sundials_context.h>
7#include <sundials/sundials_memory.h>
8
15namespace amrex::sundials {
16
23public:
25 MemoryHelper(::sundials::Context* sunctx);
29 MemoryHelper(const MemoryHelper& rhs);
31 MemoryHelper(MemoryHelper&& rhs) noexcept;
32 MemoryHelper& operator=(MemoryHelper const& rhs) = delete;
33 MemoryHelper& operator=(MemoryHelper&& rhs) noexcept = delete;
35 operator SUNMemoryHelper() const { return helper; }
36
42 static void Initialize(int nthreads);
44 static void Finalize();
45private:
46 SUNMemoryHelper helper;
47 ::sundials::Context* sunctx;
48};
49
50
58
65amrex::Arena* getArena (SUNMemoryType type);
66
67}//amrex::sundials
68
69#endif
A virtual base class for objects that manage their own dynamic memory allocation.
Definition AMReX_Arena.H:132
A SUNDIALS SUNMemoryHelper interface to the amrex::Arena.
Definition AMReX_SUNMemory.H:22
~MemoryHelper()
Destroy the associated SUNMemoryHelper and free resources.
Definition AMReX_SUNMemory.cpp:143
static void Initialize(int nthreads)
Allocate one helper per OpenMP thread using the given count.
Definition AMReX_SUNMemory.cpp:161
MemoryHelper & operator=(MemoryHelper &&rhs) noexcept=delete
static void Finalize()
Destroy all helpers created by Initialize().
Definition AMReX_SUNMemory.cpp:177
MemoryHelper & operator=(MemoryHelper const &rhs)=delete
constexpr int get_thread_num()
Definition AMReX_OpenMP.H:37
Definition AMReX_NVector_MultiFab.cpp:17
amrex::Arena * getArena(SUNMemoryType type)
Return the AMReX arena used to satisfy allocations of type.
MemoryHelper * The_SUNMemory_Helper(int i)
Get the OpenMP-thread-local SUNMemoryHelper instance.
Definition AMReX_SUNMemory.cpp:186