RepastHPC
2.3.1
|
The DiffusionLayerND class is an N-dimensional layer of double values that can be used to diffuse through an N-D space. More...
#include <DiffusionLayerND.h>
Public Member Functions | |
DiffusionLayerND (vector< int > processesPerDim, GridDimensions globalBoundaries, int bufferSize, bool periodic, T initialValue=0, T initialBufferZoneValue=0) | |
void | diffuse (Diffusor< T > *diffusor, bool omitSynchronize=false) |
Performs the diffusion operation on the entire grid (only within local boundaries) If omit synchronize is set to 'true' will not perform a synchronization after diffusion- this is mainly useful for performance testing, as a synchronization is required to complete diffusion. More... | |
Public Member Functions inherited from repast::ValueLayerNDSU< T > | |
ValueLayerNDSU (vector< int > processesPerDim, GridDimensions globalBoundaries, int bufferSize, bool periodic, T initialValue=0, T initialBufferZoneValue=0) | |
virtual void | initialize (T initialValue, bool fillBufferZone=false, bool fillLocal=true) |
Inherited from AbstractValueLayerND. | |
virtual void | initialize (T initialLocalValue, T initialBufferZoneValue) |
Inherited from AbstractValueLayerND. | |
virtual T | addValueAt (T val, Point< int > location, bool &errFlag) |
Inherited from AbstractValueLayerND. | |
virtual T | addValueAt (T val, vector< int > location, bool &errFlag) |
Inherited from AbstractValueLayerND. | |
virtual T | setValueAt (T val, Point< int > location, bool &errFlag) |
Inherited from AbstractValueLayerND. | |
virtual T | setValueAt (T val, vector< int > location, bool &errFlag) |
Inherited from AbstractValueLayerND. | |
virtual T | getValueAt (Point< int > location, bool &errFlag) |
Inherited from AbstractValueLayerND. | |
virtual T | getValueAt (vector< int > location, bool &errFlag) |
Inherited from AbstractValueLayerND. | |
virtual void | synchronize () |
Inherited from AbstractValueLayerND. | |
virtual void | write (string fileLocation, string filetag, bool writeSharedBoundaryAreas=false) |
Write this rank's data to a CSV file. | |
void | switchValueLayer () |
Switch from one value layer to the other. | |
virtual T | addSecondaryValueAt (T val, Point< int > location, bool &errFlag) |
Adds the specified value to the value in the non-current data bank at the given location. More... | |
virtual T | addSecondaryValueAt (T val, vector< int > location, bool &errFlag) |
Adds the specified value to the value in the non-current data bank at the given location. More... | |
virtual T | setSecondaryValueAt (T val, Point< int > location, bool &errFlag) |
Sets the specified value to the value in the non-current data bank at the given location. More... | |
virtual T | setSecondaryValueAt (T val, vector< int > location, bool &errFlag) |
Sets the specified value to the value in the non-current data bank at the given location. More... | |
virtual T | getSecondaryValueAt (Point< int > location, bool &errFlag) |
Gets the specified value to the value in the non-current data bank at the given location. More... | |
virtual T | getSecondaryValueAt (vector< int > location, bool &errFlag) |
Gets the specified value to the value in the non-current data bank at the given location. More... | |
virtual void | copyCurrentToSecondary () |
Copies the data in the current value layer to the secondary layer. | |
virtual void | copySecondaryToCurrent () |
Copies the data in the secondary layer to the current value layer. | |
void | flowback () |
ValueLayerNDSU can do something that no other value layer- or, in fact, any other object in Repast HPC- can do: it can take information from non-local processes and allow it to flow back to the local process. More... | |
Public Member Functions inherited from repast::AbstractValueLayerND< T > | |
virtual bool | isInLocalBounds (vector< int > coords) |
Returns true only if the coordinates given are within the local boundaries. More... | |
virtual bool | isInLocalBounds (Point< int > location) |
const GridDimensions & | getLocalBoundaries () |
Gets the local boundaries for this process's part of the value layer. More... | |
Additional Inherited Members | |
Static Public Attributes inherited from repast::AbstractValueLayerND< T > | |
static int | instanceCount = 0 |
Protected Member Functions inherited from repast::AbstractValueLayerND< T > | |
AbstractValueLayerND (vector< int > processesPerDim, GridDimensions globalBoundaries, int bufferSize, bool periodic) | |
Constructor. More... | |
vector< int > | getIndexes (vector< int > location, bool isSimplified=false) |
Gets a vector of the indexed locations. More... | |
int | getIndex (vector< int > location, bool isSimplified=false) |
Given a location in global simulation coordinates, get the offset from the global base pointer to the position in the global array representing that location. More... | |
int | getIndex (Point< int > location) |
Given a location in global simulation coordinates, get the offset from the global base pointer to the position in the global array representing that location. More... | |
Protected Attributes inherited from repast::ValueLayerNDSU< T > | |
T * | dataSpace1 |
T * | dataSpace2 |
T * | currentDataSpace |
T * | otherDataSpace |
Protected Attributes inherited from repast::AbstractValueLayerND< T > | |
CartesianTopology * | cartTopology |
GridDimensions | localBoundaries |
int | length |
int | numDims |
bool | globalSpaceIsPeriodic |
vector< int > | places |
vector< int > | strides |
vector< DimensionDatum< T > > | dimensionData |
RankDatum * | neighborData |
int | neighborCount |
MPI_Request * | requests |
int | instanceID |
int | syncCount |
The DiffusionLayerND class is an N-dimensional layer of double values that can be used to diffuse through an N-D space.
Diffusion is a synchronous updating of cells based on adjacent cells' values.
The synchronous update is achieved through bank switching: two separate grids are maintained, and at any time one of them is 'active' and the other is obsolete and ready to accept the next round of values.
The diffusion routine uses an MPI_Datatype to collect the cells within the defined radius and assemble them into a single buffer. For convenience and performance it uses an MPI send to self- that is, the process performs the send to itself. MPI is used to collect the information from its nested, looped memory and put it into a contiguous and linear buffer. It is up to the diffusor to parse this buffer. Note that if the space is at the edge of a strict boundary, the values in the buffer will be NaN values.
The radius of diffusion must be less than or equal to the size of the buffer zone.
void repast::DiffusionLayerND< T >::diffuse | ( | Diffusor< T > * | diffusor, |
bool | omitSynchronize = false |
||
) |
Performs the diffusion operation on the entire grid (only within local boundaries) If omit synchronize is set to 'true' will not perform a synchronization after diffusion- this is mainly useful for performance testing, as a synchronization is required to complete diffusion.
diffusor | A pointer to an instance of a diffusor class that will contain the simulation-specific diffusion code |
omitSynchronize | If true, diffusion will be done but not synchronized across processes; this is mainly useful for debugging. By default synchronization is performed after diffusion. |