IBAMR  IBAMR version 0.19.
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SAMRAI::hier::VariableContext Class Reference

#include <VariableContext.h>

Inheritance diagram for SAMRAI::hier::VariableContext:
Inheritance graph
[legend]

Public Member Functions

 VariableContext (const std::string &name)
 
virtual ~VariableContext ()
 
int getIndex () const
 
const std::string & getName () const
 
bool operator== (const VariableContext &other) const
 

Static Public Member Functions

static int getCurrentMaximumInstanceNumber ()
 

Private Member Functions

 VariableContext (const VariableContext &)
 
void operator= (const VariableContext &)
 

Private Attributes

std::string d_name
 
int d_index
 

Static Private Attributes

static int s_instance_counter
 

Detailed Description

Class VariableContext is a simple class that is used to manage variable storage in a meaningful, customizable manner. A variable context has a name string and a unique integer instance identifier. Context objects are typically generated and used by the variable database for mapping names to storage locations, but they may also be created independently of the variable database.

SAMRAI applications use contexts and the variable database to manage patch storage locations for variables. For example, an integration algorithm may require multiple unique contexts to manage storage for a problem variable, such as "OLD" and "NEW". The algorithm interacts with the database to obtain the contexts and the mapping between the context and the patch descriptor index to access data on the patch hierarchy.

* Important note:
*
*    It is strongly recommended that context objects be generated by 
*    the variable database and obtained via the getContext() function.
*    While contexts can be created by using the variable context 
*    constructor directly and used with the database, this may produce 
*    unexpected results due to potentially improperly generated and name 
*    string context identifiers.
*
* 
See also
hier::VariableDatabase

Constructor & Destructor Documentation

◆ VariableContext() [1/2]

SAMRAI::hier::VariableContext::VariableContext ( const std::string &  name)

The variable context constructor creates a context with the given name and increments the context index counter.

When assertion checking is active, an unrecoverable assertion results when the name string is empty.

◆ ~VariableContext()

virtual SAMRAI::hier::VariableContext::~VariableContext ( )
virtual

The virtual destructor does nothing interesting.

◆ VariableContext() [2/2]

SAMRAI::hier::VariableContext::VariableContext ( const VariableContext )
private

Member Function Documentation

◆ getCurrentMaximumInstanceNumber()

static int SAMRAI::hier::VariableContext::getCurrentMaximumInstanceNumber ( )
static

Return the current maximum instance number over all variable context objects. The instance identifiers returned from variable context objects are guaranteed to be between 0 and this number minus one. Note that this number changes as new variable contexts are created.

◆ getIndex()

int SAMRAI::hier::VariableContext::getIndex ( ) const

Return integer index for VariableContext object.

◆ getName()

const std::string& SAMRAI::hier::VariableContext::getName ( ) const

Return name string identifier for VariableContext object.

◆ operator==()

bool SAMRAI::hier::VariableContext::operator== ( const VariableContext other) const

Check whether two contexts are the same. Return true if the index of the argument context matches the index of this context object. Otherwise, return false.

◆ operator=()

void SAMRAI::hier::VariableContext::operator= ( const VariableContext )
private

Member Data Documentation

◆ s_instance_counter

int SAMRAI::hier::VariableContext::s_instance_counter
staticprivate

◆ d_name

std::string SAMRAI::hier::VariableContext::d_name
private

◆ d_index

int SAMRAI::hier::VariableContext::d_index
private

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