MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
|
#include <AbstractDriver.h>
Public Member Functions | |
void | AutosaveGrid (u32 epochs) |
void | SaveGrid (const char *filename) |
void | LoadFromConfigurationPath () |
const char * | GetSimDirPathTemporary (const char *format,...) const |
void | ReloadCurrentConfigurationPath () |
virtual void | DoEpochEvents (OurGrid &grid, u32 epochs, u32 epochAEPS) |
void | Init (u32 argc, const char **argv) |
VArguments & | GetVArguments () |
void | RegisterArgument (const char *description, const char *filter, VArgumentHandleValue func, void *handlerArg, bool runFunc) |
void | RegisterSection (const char *sectionLabel) |
virtual void | AddDriverArguments () |
virtual void | ReinitUs () |
u32 | GetHaltAfterAEPS () |
double | GetAEPS () |
double | GetAER () |
void | SetAER (double aer) |
double | GetRecentAER () |
void | SetRecentAER (double aer) |
u32 | GetAEPSPerFrame () |
double | GetOverheadPercent () |
OurGrid & | GetGrid () |
void | SetSeed (u32 seed) |
void | Reinit () |
void | Run () |
Protected Types | |
enum | { W = GC::GRID_WIDTH } |
enum | { H = GC::GRID_HEIGHT } |
enum | { R = P::EVENT_WINDOW_RADIUS } |
typedef GC::CORE_CONFIG | CC |
typedef CC::PARAM_CONFIG | P |
typedef CC::ATOM_TYPE | T |
typedef ElementRegistry< CC > | OurElementRegistry |
typedef StdElements< CC > | OurStdElements |
typedef Grid< GC > | OurGrid |
typedef ElementTable< CC > | OurElementTable |
Protected Member Functions | |
void | NeedElement (Element< CC > *element) |
void | WriteTimeBasedData (FileByteSink &fp, bool exists) |
void | SetIgnoreThreadingProblems (bool value) |
void | WriteTimeBasedData () |
void | UpdateGrid (OurGrid &grid) |
void | DecrementAEPSPerFrame (u32 amount) |
void | IncrementAEPSPerFrame (u32 amount) |
virtual void | PostReinit (VArguments &args) |
virtual void | ReinitEden ()=0 |
void | ReinitPhysics () |
virtual void | PostReinitPhysics () |
virtual void | DefineNeededElements ()=0 |
virtual void | PostUpdate () |
virtual void | OnceOnly (VArguments &args) |
virtual void | RunHelper () |
void | SetAEPSPerEpoch (u32 aeps) |
u32 | GetAEPSPerEpoch () const |
Protected Attributes | |
Element< CC > * | m_neededElements [MAX_NEEDED_ELEMENTS] |
u32 | m_neededElementCount |
Static Protected Attributes | |
static const u32 | EVENT_WINDOW_RADIUS = R |
static const u32 | GRID_WIDTH = W |
static const u32 | GRID_HEIGHT = H |
An abstract driver from which all MFM drivers should inherit. This should be the highest level structure and contain just about everything needed to run a successful simulation.
|
protected |
The CoreConfig used to describe templated pieces of the core components.
|
protected |
Template shortcut for an ElementRegistry with the correct template parameters.
|
protected |
Template shortcut for an ElementTable with the correct template parameters.
|
protected |
Template shortcut for a Grid with the correct template parameters.
|
protected |
Template shortcut for an instance of StdElements with the correct template parameters.
|
protected |
The ParamConfig used to configure several templated pieces of the core components.
|
protected |
The type of every Atom used in this simulation.
|
protected |
Exported from the GridConfiguration, the enumerated width of the Grid used by this simulation.
|
protected |
Exported from the GridConfiguration, the enumerated height of the Grid used by this simulation.
|
protected |
Exported from the GridConfiguration, the enumerated size of every EventWindow used by this simulation.
|
inlinevirtual |
Adds any command-line arguments desired, by calling #RegisterArgument with appropriate arguments. Note: (Sub-)subclasses of AbstractDriver should always override this method, even if they do not wish to add command-line arguments, and begin their overriding method with Super::AddDriverArguments(). Such chaining lets all levels of abstraction define command-line arguments, with the most abstract going first.
Reimplemented in MFM::AbstractGUIDriver< GC >, MFM::AbstractGUIDriver< OurGridConfig >, MFM::MFMSimSBarDemo, MFM::AbstractHeadlessDriver< GC >, MFM::MFMSimQBDemo, MFM::MFMSimDHSDemo, and MFM::MFMSimDHSDemo.
|
inlineprotected |
Subtracts m_aepsPerFrame
(or, the number of AEPS which should elapse every call to UpdateGrid()
) by one, keeping it above 0
at all times.
amount | The amount of AEPS per frame to decrement by. |
|
protectedpure virtual |
To be defined by the top level driver only. This allows all Elements to be known by this AbstractDriver before they are inserted into its sub-drivers .
Implemented in MFM::MFMSimSBarDemo, MFM::MFMSimQBDemo, MFM::MFMSimDHSDemo, and MFM::MFMSimDHSDemo.
|
inlinevirtual |
Method to do end-of-epoch processing. Base class recounts the grid and handles –gridImage and –tileImage processing here, so all subclasses should override this method and do Super::DoEpochEvents to ensure all methods are called.
Reimplemented in MFM::AbstractGUIDriver< GC >, and MFM::AbstractGUIDriver< OurGridConfig >.
|
inline |
Gets a formatted string representing a working path to the assets directory of this simulation. This is where the local copy of the res/
directory is kept and should be used for finding any assets in that location.
format | The formatting string used to parse the arguments that follow it into a reasonable format. |
format
, with the location of the local resources directory prepended to it.
|
inlineprotected |
Adds one to m_aepsPerFrame
(or, the number of AEPS which should elapse every call to UpdateGrid()
), keeping it below 1000
at all times.
amount | The amount of AEPS per frame to increment by. |
|
inlineprotectedvirtual |
To be run during first initialization, only once. This runs after all standard argument parsing and is available to extend that behavior. Any overrides of this method should be certain to call Super::OnceOnly (probably at the beginning, but in any case, sometime) during their execution, so more abstract levels can do any processing they need to.
args | The VArguments , which should have been gotten from the command line. These allow this method to configure itself properly from the command line arguments. |
Reimplemented in MFM::AbstractGUIDriver< GC >, MFM::AbstractGUIDriver< OurGridConfig >, MFM::MFMSimSBarDemo, MFM::AbstractHeadlessDriver< GC >, MFM::MFMSimQBDemo, MFM::MFMSimDHSDemo, and MFM::MFMSimDHSDemo.
|
inlineprotectedvirtual |
Called at the end of the Reinit() call. This is for custom initialization behavior.
args | The VArguments , which should have been gotten from the command line, which will be processed again during this call. |
Reimplemented in MFM::AbstractGUIDriver< GC >, and MFM::AbstractGUIDriver< OurGridConfig >.
|
inlineprotectedvirtual |
Used by GUI Drivers to register Elements in places needed.
Reimplemented in MFM::AbstractGUIDriver< GC >, and MFM::AbstractGUIDriver< OurGridConfig >.
|
inlineprotectedvirtual |
To be run at the end of a frame update.
Reimplemented in MFM::AbstractGUIDriver< GC >, MFM::AbstractGUIDriver< OurGridConfig >, and MFM::AbstractHeadlessDriver< GC >.
|
protectedpure virtual |
Establish the Garden of Eden configuration on the grid.
Implemented in MFM::MFMSimSBarDemo, MFM::MFMSimQBDemo, MFM::MFMSimDHSDemo, and MFM::MFMSimDHSDemo.
|
inlineprotected |
Register any element types needed for the run.
|
inlineprotectedvirtual |
The main loop which runs this simulation.
Reimplemented in MFM::AbstractGUIDriver< GC >, and MFM::AbstractGUIDriver< OurGridConfig >.
|
inlineprotected |
Runs the held Grid and all its associated threads for a brief amount of time, letting about m_aepsPerFrame
AEPS occur before pausing. This also learns about how long an AEPS takes to elapse, making subsequent calls more accurate in duration.
grid | The Grid which is updated during this call. |
|
staticprotected |
The size of every EventWindow used by this simulation.
|
staticprotected |
The height of the Grid used by this simulation.
|
staticprotected |
The width of the Grid used by this simulation.