|
| 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...
|
|
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...
|
|
|
static int | instanceCount = 0 |
|
| 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...
|
|
template<typename T>
class repast::ValueLayerNDSU< T >
ValueLayerNDSU is a version of the ValueLayerND class that facilitates SynchronousUpdating: that is, a process can use the current values in the value layer and create a set of new values, then 'switch' to using the new values.
It does this by using two memory banks.
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.
This is strictly forbidden in every other context in Repast HPC. Consider a local process 0 with an Agent 'A' in one corner of its space. Because 'A' is in the buffer zone, copies of 'A' are made on the other processes adjacent to process 0; in a normal 2-D space this could include three other processes, p1, p2, and p3. Now suppose that p1, p2, and p3 are all allowed to modify their copies of Agent 'A', and then, further, that we wish to migrate these changes back to process 0. How do we reconcile the changes? In general there is no answer.
ValueLayerNDSU, however, makes one special provision for allowing non- local information to flow back to the local process. Assume that as in the agent example, there is a corner of the value layer on p0 that is adjacent to p1, p2, and p3. Copies of the space are made to the other processes. Now assume that these other processes add values to these regions of space. The simulation is responsible for assuring that these additive operations are independent of the simulation synchronization: that in the specific simulation being undertaken, the additions that are occurring without synchronization are semantically acceptable.
The 'flowback' method takes these values and performs what is akin to an MPI 'gather' operation: taking the values from processes p1, p2, and p3 and adding them to the values on p0. The result of the operation is that the values on each process reflect the original values plus the values that were found in the non-local processes, with all values summed.
N.B.: All values in the secondary layer are set to zeros. Values on the original process inside and outside the buffer zones are unchanged. To update the values outside the buffer zones to their new values, perform a 'synchronize' operation after the 'flowback' operation is completed.