AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::sidre::ConduitMemory Struct Reference

Object to do Conduit memory operations through Axom. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/develop/src/axom/sidre/core/ConduitMemory.hpp>

Public Member Functions

int axomId () const
 Return the Axom allocator id. More...
 
conduit::index_t conduitId () const
 Return the Conduit allocator id coresponding to axomId(). More...
 
 ~ConduitMemory ()
 

Static Public Member Functions

static conduit::index_t axomAllocIdToConduit (int axomAllocId)
 Convert an Axom allocator id to Conduit, registering a new Conduit allocator if needed. More...
 
static int conduitAllocIdToAxom (conduit::index_t conduitAllocId)
 Convert a Conduit allocator id to Axom. More...
 
static const ConduitMemoryinstanceForAxomId (int axomAllocId)
 Return the instance for the given Axom allocator id. More...
 
static const ConduitMemoryinstanceForConduitId (conduit::index_t conduitAllocId)
 Return the instance for the given Conduit allocator id. More...
 
static conduit::index_t defaultConduitId ()
 Return the default conduit allocator id. More...
 

Detailed Description

Object to do Conduit memory operations through Axom.

This class has no public constructor. Use instanceForAxomId(int axomAllocId) to access the instance for a specific Axom allocator id. The construction registers the appropriate callbacks with Conduit, including the required memset and memcopy callbacks.

Allocator ids have a 1-to-1 relationship with allocators.

Axom's allocator is an extension of the Umpire allocator when Umpire is used. Conduit's allocator is opaque, but when used by this class, it is associated with an Axom allocator (which is an Umpire allocator).

Examples for setting Conduit allocator ids when you have Axom allocator ids:

void foo(conduit::Node& n, int axomAllocId) {
n.set_allocator(axomAllocIdToConduit(axomAllocId));
}
void bar(conduit::Node& n, int axomAllocId) {
const auto& instance = getInstance(axomAllocId);
assert(instance.axomId() == axomAllocId);
n.set_allocator(instance.conduitId());
}
conduit::Node Node
The Node class is the primary object in Conduit.
Definition: SidreTypes.hpp:34
static conduit::index_t axomAllocIdToConduit(int axomAllocId)
Convert an Axom allocator id to Conduit, registering a new Conduit allocator if needed.
Definition: ConduitMemory.hpp:78

Constructor & Destructor Documentation

◆ ~ConduitMemory()

axom::sidre::ConduitMemory::~ConduitMemory ( )
inline

Member Function Documentation

◆ axomId()

int axom::sidre::ConduitMemory::axomId ( ) const
inline

Return the Axom allocator id.

◆ conduitId()

conduit::index_t axom::sidre::ConduitMemory::conduitId ( ) const
inline

Return the Conduit allocator id coresponding to axomId().

◆ axomAllocIdToConduit()

static conduit::index_t axom::sidre::ConduitMemory::axomAllocIdToConduit ( int  axomAllocId)
inlinestatic

Convert an Axom allocator id to Conduit, registering a new Conduit allocator if needed.

References conduitId(), and instanceForAxomId().

◆ conduitAllocIdToAxom()

static int axom::sidre::ConduitMemory::conduitAllocIdToAxom ( conduit::index_t  conduitAllocId)
inlinestatic

Convert a Conduit allocator id to Axom.

The allocator must have been registered by a prior instanceForAxomId() call.

References axomId(), and instanceForConduitId().

◆ instanceForAxomId()

static const ConduitMemory& axom::sidre::ConduitMemory::instanceForAxomId ( int  axomAllocId)
static

Return the instance for the given Axom allocator id.

This method IS NOT thread safe for new values of axomAllocId.

◆ instanceForConduitId()

static const ConduitMemory& axom::sidre::ConduitMemory::instanceForConduitId ( conduit::index_t  conduitAllocId)
static

Return the instance for the given Conduit allocator id.

If conduitAllocId doesn't correspond to an Axom allocator, an object corresponding to axom::INVALID_ALLOCATOR_ID will be returned.

This method IS thread safe.

◆ defaultConduitId()

static conduit::index_t axom::sidre::ConduitMemory::defaultConduitId ( )
inlinestatic

Return the default conduit allocator id.


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