RepastHPC  2.3.1
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
repast::AbstractValueLayerND< T > Class Template Referenceabstract

An AbstractValueLayerND is the abstract parent class for N-dimensional value layers. More...

#include <ValueLayerND.h>

Inheritance diagram for repast::AbstractValueLayerND< T >:
repast::ValueLayerND< T > repast::ValueLayerNDSU< T > repast::DiffusionLayerND< T >

Public Member Functions

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 GridDimensionsgetLocalBoundaries ()
 Gets the local boundaries for this process's part of the value layer. More...
 

Static Public Attributes

static int instanceCount = 0
 

Protected Member Functions

 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...
 
virtual void initialize (T initialValue, bool fillBufferZone=false, bool fillLocal=true)=0
 Initializes the array to the specified value. More...
 
virtual void initialize (T initialLocalValue, T initialBufferZoneValue)=0
 Initializes the array to the specified values. More...
 
virtual T addValueAt (T val, Point< int > location, bool &errFlag)=0
 Adds to the value in the grid at a specific location Returns the new value. More...
 
virtual T addValueAt (T val, vector< int > location, bool &errFlag)=0
 Adds to the value in the grid at the specific location Returns the new value. More...
 
virtual T setValueAt (T val, Point< int > location, bool &errFlag)=0
 Sets the value in the grid at a specific location Returns the new value. More...
 
virtual T setValueAt (T val, vector< int > location, bool &errFlag)=0
 Sets the value in the grid at the specific location Returns the new value. More...
 
virtual T getValueAt (Point< int > location, bool &errFlag)=0
 Gets the value in the grid at a specific location. More...
 
virtual T getValueAt (vector< int > location, bool &errFlag)=0
 Gets the value in the grid at a specific location. More...
 
virtual void synchronize ()=0
 Synchronizes across processes. More...
 

Protected Attributes

CartesianTopologycartTopology
 
GridDimensions localBoundaries
 
int length
 
int numDims
 
bool globalSpaceIsPeriodic
 
vector< int > places
 
vector< int > strides
 
vector< DimensionDatum< T > > dimensionData
 
RankDatumneighborData
 
int neighborCount
 
MPI_Request * requests
 
int instanceID
 
int syncCount
 

Detailed Description

template<typename T>
class repast::AbstractValueLayerND< T >

An AbstractValueLayerND is the abstract parent class for N-dimensional value layers.

Constructor & Destructor Documentation

◆ AbstractValueLayerND()

template<typename T >
repast::AbstractValueLayerND< T >::AbstractValueLayerND ( vector< int >  processesPerDim,
GridDimensions  globalBoundaries,
int  bufferSize,
bool  periodic 
)
protected

Constructor.

Parameters
processesPerDimnumber of processes in each dimension
globalBoundariesglobal boundaries for the simulation
bufferSizesize of the buffer zone
periodictrue if the space is periodic, false otherwise

Member Function Documentation

◆ addValueAt() [1/2]

template<typename T >
virtual T repast::AbstractValueLayerND< T >::addValueAt ( val,
Point< int >  location,
bool &  errFlag 
)
protectedpure virtual

Adds to the value in the grid at a specific location Returns the new value.

If the location is not within the local boundaries, sets the error flag to 'true', otherwise it will be set to 'false'

Parameters
valValue to be placed
locationlocation where value is to be placed @errFlag a flag that will be set to 'false' if an error occurs
Returns
the new value in the cell

Implemented in repast::ValueLayerNDSU< T >, and repast::ValueLayerND< T >.

◆ addValueAt() [2/2]

template<typename T >
virtual T repast::AbstractValueLayerND< T >::addValueAt ( val,
vector< int >  location,
bool &  errFlag 
)
protectedpure virtual

Adds to the value in the grid at the specific location Returns the new value.

If the location is not within the local boundaries, sets the error flag to 'true', otherwise it will be set to 'false'

Parameters
valValue to be added
locationlocation where value is to be placed @errFlag a flag that will be set to 'false' if an error occurs
Returns
the new value in the cell

Implemented in repast::ValueLayerNDSU< T >, and repast::ValueLayerND< T >.

◆ getIndex() [1/2]

template<typename T >
int repast::AbstractValueLayerND< T >::getIndex ( Point< int >  location)
protected

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.

The location may be simplified (transformed); if it is not, it is first simplified before the index is calculated.

Parameters
locationthe location to be transformed
Returns
the index from the global base pointer to the position in the array in memory

◆ getIndex() [2/2]

template<typename T >
int repast::AbstractValueLayerND< T >::getIndex ( vector< int >  location,
bool  isSimplified = false 
)
protected

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.

The location may be simplified (transformed); if it is not, it is first simplified before the index is calculated.

Parameters
locationthe location to be transformed
isSimplifiedtrue if the coordinates are already in simplified form
Returns
the index from the global base pointer to the position in the array in memory

◆ getIndexes()

template<typename T >
vector< int > repast::AbstractValueLayerND< T >::getIndexes ( vector< int >  location,
bool  isSimplified = false 
)
protected

Gets a vector of the indexed locations.

If the value passed is already simplified (transformed), does not transform.

Parameters
locationthe location to be transformed
isSimplifiedtrue if the coordinates are already in simplified form
Returns
the transformed coordinates

◆ getLocalBoundaries()

template<typename T >
const GridDimensions& repast::AbstractValueLayerND< T >::getLocalBoundaries ( )
inline

Gets the local boundaries for this process's part of the value layer.

Returns
the local boundaries

◆ getValueAt() [1/2]

template<typename T >
virtual T repast::AbstractValueLayerND< T >::getValueAt ( Point< int >  location,
bool &  errFlag 
)
protectedpure virtual

Gets the value in the grid at a specific location.

If the location is not within the boundaries, sets the error flag to 'true', otherwise it will be set to 'false'

Parameters
locationlocation where value is to be placed @errFlag a flag that will be set to 'false' if an error occurs
Returns
the value in the cell

Implemented in repast::ValueLayerNDSU< T >, and repast::ValueLayerND< T >.

◆ getValueAt() [2/2]

template<typename T >
virtual T repast::AbstractValueLayerND< T >::getValueAt ( vector< int >  location,
bool &  errFlag 
)
protectedpure virtual

Gets the value in the grid at a specific location.

If the location is not within the boundaries, sets the error flag to 'true', otherwise it will be set to 'false'

Parameters
locationlocation where value is to be placed @errFlag a flag that will be set to 'false' if an error occurs
Returns
the value in the cell

Implemented in repast::ValueLayerNDSU< T >, and repast::ValueLayerND< T >.

◆ initialize() [1/2]

template<typename T >
virtual void repast::AbstractValueLayerND< T >::initialize ( initialLocalValue,
initialBufferZoneValue 
)
protectedpure virtual

Initializes the array to the specified values.

initialize(val1, val2); // Initializes the local space to val1 and the buffer zones to val2

Parameters
initialLocalValuevalue to be placed in local cells
initialBufferZoneValuevalue to be placed in non-local cells

Implemented in repast::ValueLayerNDSU< T >, and repast::ValueLayerND< T >.

◆ initialize() [2/2]

template<typename T >
virtual void repast::AbstractValueLayerND< T >::initialize ( initialValue,
bool  fillBufferZone = false,
bool  fillLocal = true 
)
protectedpure virtual

Initializes the array to the specified value.

Usage:

initialize(val); // Initializes only the local space initialize(val, true); // Initializes the entire space initialize(val, false); // Initializes only the local space (default) initialize(val, true, false); // Initializes only the buffer zone initialize(val, false, true); // Initializes only the local space (default) initialize(val, true, true); // Initializes the entire space initialize(val, false, false); // Does nothing

Parameters
initialValueValue to be placed in the array
fillBufferZonetrue if the value should be placed in all local cells
fillLocaltrue if the value should be placed in all non-local cells

Implemented in repast::ValueLayerNDSU< T >, and repast::ValueLayerND< T >.

◆ isInLocalBounds()

template<typename T >
bool repast::AbstractValueLayerND< T >::isInLocalBounds ( vector< int >  coords)
virtual

Returns true only if the coordinates given are within the local boundaries.

Parameters
coordsCoordinates to be tested
Returns
true if the coordinates are within the local boundaries

◆ setValueAt() [1/2]

template<typename T >
virtual T repast::AbstractValueLayerND< T >::setValueAt ( val,
Point< int >  location,
bool &  errFlag 
)
protectedpure virtual

Sets the value in the grid at a specific location Returns the new value.

If the location is not within the local boundaries, sets the error flag to 'true', otherwise it will be set to 'false'

Parameters
valValue to be added
locationlocation where value is to be placed @errFlag a flag that will be set to 'false' if an error occurs
Returns
the new value in the cell

Implemented in repast::ValueLayerNDSU< T >, and repast::ValueLayerND< T >.

◆ setValueAt() [2/2]

template<typename T >
virtual T repast::AbstractValueLayerND< T >::setValueAt ( val,
vector< int >  location,
bool &  errFlag 
)
protectedpure virtual

Sets the value in the grid at the specific location Returns the new value.

If the location is not within the local boundaries, sets the error flag to 'true', otherwise it will be set to 'false'

Parameters
valValue to be added
locationlocation where value is to be placed @errFlag a flag that will be set to 'false' if an error occurs
Returns
the new value in the cell

Implemented in repast::ValueLayerNDSU< T >, and repast::ValueLayerND< T >.

◆ synchronize()

template<typename T >
virtual void repast::AbstractValueLayerND< T >::synchronize ( )
protectedpure virtual

Synchronizes across processes.

This copies the values in the interior 'buffer zones' from self and sends to adjacent processes, while receiving data from adjacent processes and placing it in the appropriate exterior buffer zones.

Implemented in repast::ValueLayerNDSU< T >, and repast::ValueLayerND< T >.


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