Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GridConversion::ExampleProgram Namespace Reference

Encapsulate example program-specific code constructs. More...

Classes

class  ExampleProgramComLine
 The ComLineObject for the example programs. More...
 
class  SerialProgram
 Implementation of the basic parts of the serial program example. More...
 

Typedefs

typedef IRAD::Profiler::ProfilerObj ProfilerType
 Convenience type definition for Profiler object. More...
 
typedef std::string StackType
 Convenience type definition for program stack. More...
 
typedef
IRAD::Global::GlobalObj
< StackType, int, ProfilerType
GlobalType
 Convenience type definition for the serial global object. More...
 
typedef ExampleProgramComLine ComLineType
 Convenience type definition for the example comline object. More...
 
typedef IRAD::Global::Program
< GlobalType, ComLineType
SerialProgramType
 Convenience type definition for the serial program. More...
 
typedef
GridConversion::ExampleProgram::SerialProgram 
SEProgramType
 Convenience definition for serial program type. More...
 

Functions

template<typename ProgramType >
int Driver (int argc, char *argv[])
 Unified driver for the example programs. More...
 

Detailed Description

Encapsulate example program-specific code constructs.

This namespace contains all of the base code constructs that are used in the example programs. These example programs have several features which make them very easy to integrate in composite software systems.

  • Program is entirely encapsulated in program object
  • All screen output is automatically tagged with the program name
  • Common look-and-feel interface
  • Interface functionality allows menu-driven integration

Other convenient features of this API are:

  • Built-in stack tracing for debugging
  • Built-in profiling utilities
  • Advanced command-line handling
  • Built-in parallelism

Typedef Documentation

Convenience type definition for the example comline object.

Definition at line 114 of file ExampleProgram.H.

typedef IRAD::Global::GlobalObj<StackType,int,ProfilerType> GlobalType

Convenience type definition for the serial global object.

The global object encapsulates all of the built-in functionalities for a program. Its interface and implementation are defined in IRAD/include/Global.H

Definition at line 53 of file ExampleProgram.H.

typedef IRAD::Profiler::ProfilerObj ProfilerType

Convenience type definition for Profiler object.

Definition at line 41 of file ExampleProgram.H.

Convenience definition for serial program type.

Definition at line 480 of file ExampleProgram.H.

Convenience type definition for the serial program.

For a detailed description of the program type, see IRAD::Global::Program documentation.

Definition at line 121 of file ExampleProgram.H.

typedef std::string StackType

Convenience type definition for program stack.

Definition at line 45 of file ExampleProgram.H.

Function Documentation

int GridConversion::ExampleProgram::Driver ( int  argc,
char *  argv[] 
)

Unified driver for the example programs.

This driver is exactly the same for both the serial and parallel example programs. It is a direct replacement for main and is responsible for creating the "Program object" and calling its Initialization, Run, and Finalize methods.

Definition at line 444 of file ExampleProgram.H.

References SerialProgram::Initialize(), SerialProgram::Run(), and SerialProgram::VerbLevel().

445  {
446  ProgramType MyProgram(argc,argv);
447  int retval = MyProgram.Initialize();
448  if(retval){
449  if(retval > 0){ // then there was an error
450  MyProgram.ErrOut("Error in Program Initialization.\n");
451  return(1);
452  }
453  else return(0); // no error, but the program should not continue
454  }
455  if(MyProgram.VerbLevel() > 1)
456  MyProgram.StdOut("Calling RUN.\n");
457  if(MyProgram.Run()){
458  MyProgram.ErrOut("Error in Program RUN method.\n");
459  return(1);
460  }
461  if(MyProgram.VerbLevel() > 1){
462  std::ostringstream Ostr;
463  MyProgram.Report(Ostr);
464  MyProgram.StdOut(Ostr.str());
465  MyProgram.StdOut("Calling Finalize.\n");
466  }
467  if(MyProgram.Finalize()){
468  MyProgram.ErrOut("Error in Program Finalization.\n");
469  return(1);
470  }
471  if(MyProgram.VerbLevel() > 1)
472  MyProgram.StdOut("All done.\n");
473  return(0);
474  }
Implementation of the basic parts of the serial program example.

Here is the call graph for this function: