MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Friends
MFM::Grid< GC > Class Template Reference

#include <Grid.h>

Data Structures

class  MyIterator
 

Public Types

typedef MyIterator< Tile< CC > * > iterator_type
 
typedef MyIterator< const Tile
< CC > * > 
const_iterator_type
 

Public Member Functions

void ReportGridStatus (Logger::Level level)
 
RandomGetRandom ()
 
bool * GetBackgroundRadiationEnabledPointer ()
 
void SetSeed (u32 seed)
 
 Grid (ElementRegistry< CC > &elts)
 
void SetIgnoreThreadingProblems (bool value)
 
s32 * GetXraySiteOddsPtr ()
 
void Reinit ()
 
const Element< CC > * LookupElement (u32 elementType) const
 
ElementRegistry< CC > & GetElementRegistry ()
 
void Needed (Element< CC > &anElement)
 
iterator_type begin ()
 
const_iterator_type begin () const
 
iterator_type end ()
 
const_iterator_type end () const
 
void SetTileToExecuteOnly (const SPoint &tileLoc, bool value)
 
bool GetTileExecutionStatus (const SPoint &tileLoc)
 
void EmptyTile (const SPoint &tileLoc)
 
void Clear ()
 
void CheckCaches ()
 
bool IsLegalTileIndex (const SPoint &tileInGrid) const
 
bool MapGridToTile (const SPoint &siteInGrid, SPoint &tileInGrid, SPoint &siteInTile) const
 
bool MapGridToUncachedTile (const SPoint &siteInGrid, SPoint &tileInGrid, SPoint &siteInTile) const
 
void Pause ()
 
void Unpause ()
 
void RecountAtoms ()
 
void PlaceAtom (const T &atom, const SPoint &location)
 
void XRayAtom (const SPoint &location)
 
void MaybeXRayAtom (const SPoint &location)
 
const T * GetAtom (SPoint &loc)
 
T * GetWritableAtom (SPoint &loc)
 
void FillLastEventTile (SPoint &out)
 
Tile< CC > & GetTile (const SPoint &pt)
 
const Tile< CC > & GetTile (const SPoint &pt) const
 
Tile< CC > & GetTile (u32 x, u32 y)
 
const Tile< CC > & GetTile (u32 x, u32 y) const
 
u64 GetTotalEventsExecuted () const
 
void WriteEPSImage (ByteSink &outstrm) const
 
void WriteEPSAverageImage (ByteSink &outstrm) const
 
void ResetEPSCounts ()
 
u32 GetAtomCount (ElementType atomType) const
 
double GetEmptySitePercentage () const
 
void SurroundRectangleWithWall (s32 x, s32 y, s32 w, s32 h, s32 thickness)
 
void RandomNuke ()
 
void SetBackgroundRadiation (bool value)
 
void ToggleBackgroundRadiation ()
 
bool IsBackgroundRadiataionEnabled ()
 
void XRay ()
 
u32 CountActiveSites () const
 

Static Public Member Functions

static u32 GetHeight ()
 
static u32 GetWidth ()
 
static u32 GetHeightSites ()
 
static u32 GetWidthSites ()
 
static const u32 GetTotalSites ()
 

Friends

class GridRenderer
 

Detailed Description

template<class GC>
class MFM::Grid< GC >

A two-dimensional grid of simulated Tiles.

Member Function Documentation

template<class GC >
void MFM::Grid< GC >::CheckCaches ( )

Based on the current connectivity pattern, check the visible regions of each tile against the caches of its connected tiles. Report debug messages for any discrepancies.

template<class GC >
void MFM::Grid< GC >::Clear ( )

Empties this Grid of all held Atoms. Also increments the grid generation.

template<class GC>
void MFM::Grid< GC >::EmptyTile ( const SPoint tileLoc)
inline

Clears a Tile of all of its held atoms. Also sets the tile generation to the grid's generation.

Parameters
tileLocThe location of the Tile in this Grid to clear.
template<class GC>
double MFM::Grid< GC >::GetEmptySitePercentage ( ) const
inline

Counts the number of sites which are occupied in this Grid and gets a percentage, in the range [0.0 , 1.0] , describing the sites which are occupied.

Returns
a percentage of the occupied sites in this Grid .
template<class GC>
static u32 MFM::Grid< GC >::GetHeight ( )
inlinestatic

Return the Grid height in Tiles

template<class GC>
static u32 MFM::Grid< GC >::GetHeightSites ( )
inlinestatic

Return the Grid height in (non-cache) sites

template<class GC >
bool MFM::Grid< GC >::GetTileExecutionStatus ( const SPoint tileLoc)

Checks whether or not a specific Tile is currently executing its own events or is simply processing Packets.

Parameters
tileLocThe location of the Tile in this Grid to check.
template<class GC>
static u32 MFM::Grid< GC >::GetWidth ( )
inlinestatic

Return the Grid width in Tiles

template<class GC>
static u32 MFM::Grid< GC >::GetWidthSites ( )
inlinestatic

Return the Grid width in (non-cache) sites

template<class GC>
bool MFM::Grid< GC >::IsBackgroundRadiataionEnabled ( )
inline

Checks to see if this Grid is currently administering background radiataion.

template<class GC >
bool MFM::Grid< GC >::IsLegalTileIndex ( const SPoint tileInGrid) const

Return true iff tileInGrid is a legal tile coordinate in this grid. If this returns false, GetTile(tileInGrid) is unsafe.

template<class GC >
bool MFM::Grid< GC >::MapGridToTile ( const SPoint siteInGrid,
SPoint tileInGrid,
SPoint siteInTile 
) const

Find the grid coordinate of the 'owning tile' (i.e., ignoring caches) for the give siteInGrid. Return false if there isn't one, otherwise set tileInGrid and siteInTile appropriately and return true.

Note that although siteInGrid is specified in 'uncached' coordinates (in which (0,0) is the upperleftmost uncached location of the tile at (0,0)), siteInTile is returned in 'including cache' coordinates (in which (R,R) is the upperleftmost uncached location of the tile at (0,0). See MapGridToUncachedTile for an alternative.

template<class GC >
bool MFM::Grid< GC >::MapGridToUncachedTile ( const SPoint siteInGrid,
SPoint tileInGrid,
SPoint siteInTile 
) const

Find the grid coordinate of the 'owning tile' (i.e., ignoring caches) for the given siteInGrid. Return false if there isn't one, otherwise set tileInGrid and siteInTile appropriately and return true.

template<class GC>
void MFM::Grid< GC >::Pause ( )
inline

Synchronize and pause the entire grid

template<class GC >
void MFM::Grid< GC >::RandomNuke ( )

Picks a random site in the grid, then sets all sites in a randomly sized radius to Element_Empty .

template<class GC >
void MFM::Grid< GC >::RecountAtoms ( )

Resets all atom counts and refreshes the atoms counts in every tile in the grid.

template<class GC >
void MFM::Grid< GC >::SetBackgroundRadiation ( bool  value)

Sets whether or not background radiation will begin mutating the Atoms of this Grid upon writing.

template<class GC >
void MFM::Grid< GC >::SetTileToExecuteOnly ( const SPoint tileLoc,
bool  value 
)

Used to tell this Tile whether or not to actually execute any events, or to just wait on any packet communication from other Tiles instead.

Parameters
tileLocThe position of the Tile to set.
valueIf value is true, this tells the Tile to begin executing its own events. Else, this Tile will only process Packets from other Tiles.
template<class GC>
void MFM::Grid< GC >::ToggleBackgroundRadiation ( )
inline

Toggles the background radiation in this Grid .

template<class GC>
void MFM::Grid< GC >::Unpause ( )
inline

Synchronize and unpause the entire grid

template<class GC >
void MFM::Grid< GC >::XRay ( )

Randomly flips bits in randomly selected sites in this grid.


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