Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

SAMRAI::tbox::RestartManager Class Reference

#include <source/toolbox/restartdb/RestartManager.h>

List of all members.

Public Member Functions

virtual bool isFromRestart ()
virtual bool openRestartFile (const string &root_dirname, const int restore_num, const int num_nodes)
virtual void closeRestartFile ()
virtual Pointer< DatabasegetRootDatabase ()
virtual void registerRestartItem (const string &name, Serializable *obj)
virtual void unregisterRestartItem (const string &name)
virtual void clearRestartItems ()
virtual void writeRestartFile (const string &root_dirname)
virtual void writeRestartFile (const string &root_dirname, const int restore_num)

Static Public Member Functions

static RestartManagergetManager ()
static void freeManager ()

Protected Member Functions

 RestartManager ()
virtual ~RestartManager ()
void registerSingletonSubclassInstance (RestartManager *subclass_instance)


Detailed Description

Class RestartManager coordinates SAMRAI restart files (currently implemented using the HDF database class) and the objects comprising SAMRAI-based application code. The manager class orchestrates opening and closing the database, stores data to be written out for restart, and writes out the restart data to the database. Note that the restart manager is a Singleton class that acts as a single point of control for restart capabilities. As such its constructor and destructor are protected members; they are not to be called outside of this class.

The general procedure for starting a simulation from a restart file is as follows.

{enumerate}

Technically, there is no need to close the restart file because this will automatically be taken care of by the destructor for the database object.

It is important to note in the initialization process, some objects will need to be constructed in the "empty" state and filled in later using some sort of getFromDatabase() method.

The process for writing out state to a restart file is somewhat more complicated. The following things need to be taken care of.

{enumerate}

When all these items are accounted for, writing to the restart file is accomplished using a writeRestartFile() method. There are two writeRestartFile() methods available. One takes only a restart directory name as an argument whereas the other takes both a restart directory name and a restore number for its arguments. See comments for member functions for more details.

See also:
tbox::Database


Constructor & Destructor Documentation

SAMRAI::tbox::RestartManager::RestartManager  )  [protected]
 

The constructor for RestartManager is protected. Consistent with the definition of a Singleton class, only the manager object has access to the constructor for the class.

The constructor for RestartManager initializes the root data base to a NullDatabase and sets the restart flag to false.

SAMRAI::tbox::RestartManager::~RestartManager  )  [inline, protected, virtual]
 

The destructor for the restart manager is protected, since only the singleton class and subclasses may destroy the manager objects.


Member Function Documentation

RestartManager * SAMRAI::tbox::RestartManager::getManager  )  [static]
 

Return a pointer to the single instance of the restart manager. All access to the restart manager object is through getManager().

Note that when the manager is accessed for the first time, the Singleton instance is registered with the ShutdownRegistry class which destroys such objects at program completion. Thus, users of this class do not explicitly allocate or deallocate the Singleton instance.

void SAMRAI::tbox::RestartManager::freeManager  )  [static]
 

Deallocate the restart manager instance. It is not necessary to call this routine at program termination, since it is automatically called by the ShutdownRegistry class.

bool SAMRAI::tbox::RestartManager::isFromRestart  )  [inline, virtual]
 

Returns true if the run is from a restart file (i.e. a restart file has been opened from main()). Returns false otherwise.

bool SAMRAI::tbox::RestartManager::openRestartFile const string &  root_dirname,
const int  restore_num,
const int  num_nodes
[virtual]
 

Attempts to mount, for reading, the restart file for the processor. If there is no error opening the file, then the restart manager mounts the restart file. Returns true if open is successful; false otherwise.

void SAMRAI::tbox::RestartManager::closeRestartFile  )  [virtual]
 

Closes the restart file.

Pointer< Database > SAMRAI::tbox::RestartManager::getRootDatabase  )  [inline, virtual]
 

Returns a Pointer to the root of the database.

void SAMRAI::tbox::RestartManager::registerRestartItem const string &  name,
Serializable obj
[virtual]
 

Registers an object for restart with the given name.

When assertion checking is active, an unrecoverable exception will result if either the string is empty or the serializable object pointer is null.

void SAMRAI::tbox::RestartManager::unregisterRestartItem const string &  name  )  [virtual]
 

Removes the object with the specified name from the list of restartable items.

When assertion checking is active, an unrecoverable exception will result if the string is empty.

void SAMRAI::tbox::RestartManager::clearRestartItems  )  [virtual]
 

Clear all restart items managed by the restart manager.

void SAMRAI::tbox::RestartManager::writeRestartFile const string &  root_dirname  )  [inline, virtual]
 

Write all objects registered to as restart objects to the restart database. The string argument is the name of the root of restart directory.

Note: This method creates/uses a restart directory structure with 00000 as the restore number.

void SAMRAI::tbox::RestartManager::writeRestartFile const string &  root_dirname,
const int  restore_num
[virtual]
 

Write all objects registered to as restart objects to the restart database. The string argument is the name of the root of restart directory. The integer argument is the identification number associated with the restart files generated.

void SAMRAI::tbox::RestartManager::registerSingletonSubclassInstance RestartManager subclass_instance  )  [protected]
 

Initialize Singleton instance with instance of subclass. This function is used to make the singleton object unique when inheriting from this base class.


The documentation for this class was generated from the following files:
Generated on Fri Dec 2 11:33:34 2005 for SAMRAI by  doxygen 1.4.2