GRINS-0.8.0
List of all members | Public Member Functions | Static Private Attributes
GRINS::SimulationInitializer Class Reference

Initialize static objects needed for simulation. More...

#include <simulation_initializer.h>

Public Member Functions

 SimulationInitializer ()
 
 ~SimulationInitializer ()
 

Static Private Attributes

static bool _is_initialized = false
 Simulation objects may need to be created multiple times within a single GRINS-linked program (e.g. More...
 

Detailed Description

Initialize static objects needed for simulation.

The factory pattern used in GRINS uses static factory objects to handle construction of various modules while providing an easy mechanism for user extensibility for new variants. However, static linking will strip the symbols unless the object is explicitly instantiated. So, we encapluate instantiation of all the factory initialization objects here to ensure they are instantiated before they are used by Simulation at construction time.

Definition at line 37 of file simulation_initializer.h.

Constructor & Destructor Documentation

GRINS::SimulationInitializer::SimulationInitializer ( )

Definition at line 39 of file simulation_initializer.C.

References _is_initialized.

40  {
41  if( !_is_initialized )
42  {
43  ErrorEstimatorFactoryInitializer error_est_init;
44  PhysicsFactoryInitializer physics_init;
45  BoundaryConditionFactoryInitializer bc_init;
46  VariableFactoryInitializer var_init;
47  SolverFactoryInitializer solver_init;
48 
49  _is_initialized = true;
50  }
51  }
static bool _is_initialized
Simulation objects may need to be created multiple times within a single GRINS-linked program (e...
GRINS::SimulationInitializer::~SimulationInitializer ( )
inline

Definition at line 41 of file simulation_initializer.h.

41 {}

Member Data Documentation

bool GRINS::SimulationInitializer::_is_initialized = false
staticprivate

Simulation objects may need to be created multiple times within a single GRINS-linked program (e.g.

for parameter variations), so we need to cache whether or not this initializer has been called during the current program run. If so, then we don't instantiate the factory initializer objects because they've already been created.

Definition at line 51 of file simulation_initializer.h.

Referenced by SimulationInitializer().


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

Generated on Tue Dec 19 2017 12:47:32 for GRINS-0.8.0 by  doxygen 1.8.9.1