IBAMR  IBAMR version 0.19.
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Attributes | List of all members
SAMRAI::tbox::InputManager Class Reference

#include <tbox/InputManager.h>

Public Member Functions

virtual Pointer< InputDatabaseparseInputFile (const std::string &filename)
 
virtual void parseInputFile (const std::string &filename, Pointer< InputDatabase > db)
 

Static Public Member Functions

static InputManagergetManager ()
 
static void setManager (InputManager *manager)
 
static void freeManager ()
 
static bool inputDatabaseExists ()
 
static Pointer< DatabasegetInputDatabase ()
 

Protected Member Functions

 InputManager ()
 
virtual ~InputManager ()
 

Private Member Functions

 InputManager (const InputManager &)
 
void operator= (const InputManager &)
 

Static Private Attributes

static InputManagers_manager_instance
 
static bool s_registered_callback
 
static Pointer< Databases_input_db
 

Detailed Description

Class InputManager parses an input file and returns the associated database. This manager class hides the complexity of opening the input file, creating the parser, and populating the database with values. The input manager is simple enough that it did not need to be implemented as a singleton class; however, it was implemented as a singleton to be consistent with the restart manager class.

All processors must call the parsing routines. Any errors are reported to pout and will result in termination of the program.

The input file will generally have the following format. For each object that requires user specified input, an entry of the following format should be included in the input file.

* Object_entry {
*    keyword1 = <value1>     // maybe some end line comments
*    keyword2 = <value2>
*    nested_input_keyword {
*       nested_data_keyword1 = <value1> 
*    }
*     \ldots
* }
* 

For convenience, the input parser also supports C/C++ style comments, "include" files, and some expression evaluation.

Constructor & Destructor Documentation

◆ InputManager() [1/2]

SAMRAI::tbox::InputManager::InputManager ( )
protected

The constructor is protected, since only subclasses of the singleton may access the constructor. Others may not explicitly create a singleton class.

◆ ~InputManager()

virtual SAMRAI::tbox::InputManager::~InputManager ( )
protectedvirtual

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

◆ InputManager() [2/2]

SAMRAI::tbox::InputManager::InputManager ( const InputManager )
private

Member Function Documentation

◆ getManager()

static InputManager* SAMRAI::tbox::InputManager::getManager ( )
static

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

◆ setManager()

static void SAMRAI::tbox::InputManager::setManager ( InputManager manager)
static

Set a new input manager. This routine can only be used by subclasses since the constructor and destructor are protected. The manager object will be deleted at program exit.

◆ freeManager()

static void SAMRAI::tbox::InputManager::freeManager ( )
static

Deallocate the input manager instance. It is not necessary to call this routine at program termination, since it is automatically called by the SAMRAI shutdown routines.

◆ inputDatabaseExists()

static bool SAMRAI::tbox::InputManager::inputDatabaseExists ( )
static

Return whether or not the manager has read an input database. If so, it returns true. If not, false.

◆ getInputDatabase()

static Pointer<Database> SAMRAI::tbox::InputManager::getInputDatabase ( )
static

Accessor method for the root input database held by InputManager.
Inputs are read from the input file and held in this database. This method returns a pointer to the database, allowing any class in SAMRAI to access the information inside it using standard database calls. For example, the following could appear in a SAMRAI class:

  // get root database
  Pointer<Database> root_db =
     InputManager::getManager()->getInputDatabase();
  // get class's sub-database
  Pointer<Database> class_db = root_db->getDatabase("MyClass");
  // get parameter(s) from sub-database
  int dummy = class_db->getInteger("dummy");

where "dummy" was supplied in "MyClass" entry of the input file:

  MyClass {
     dummy = ...
  }

This function is intended for SAMRAI classes in which there is no easy or efficient way to supply input parameters.

◆ parseInputFile() [1/2]

virtual Pointer<InputDatabase> SAMRAI::tbox::InputManager::parseInputFile ( const std::string &  filename)
virtual

Create a new database named "main" from the specified input file.

◆ parseInputFile() [2/2]

virtual void SAMRAI::tbox::InputManager::parseInputFile ( const std::string &  filename,
Pointer< InputDatabase db 
)
virtual

Parse data from the specified file into the existing database.

◆ operator=()

void SAMRAI::tbox::InputManager::operator= ( const InputManager )
private

Member Data Documentation

◆ s_manager_instance

InputManager* SAMRAI::tbox::InputManager::s_manager_instance
staticprivate

◆ s_registered_callback

bool SAMRAI::tbox::InputManager::s_registered_callback
staticprivate

◆ s_input_db

Pointer<Database> SAMRAI::tbox::InputManager::s_input_db
staticprivate

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