FireSTARR
Loading...
Searching...
No Matches
fs::data::GridMap< T, V > Class Template Reference

A GridData that uses an unordered_map for storage. More...

#include <GridMap.h>

Inheritance diagram for fs::data::GridMap< T, V >:
Collaboration diagram for fs::data::GridMap< T, V >:

Public Member Functions

bool contains (const Location &location) const
 Determine if Location has a value.
 
template<class P >
bool contains (const Position< P > &position) const
 
at (const Location &location) const override
 Retrieve value at Location.
 
template<class P >
at (const Position< P > &position) const
 
void set (const Location &location, const T value) override
 Set value at Location.
 
template<class P >
void set (const Position< P > &position, const T value)
 
 GridMap (const MathSize cell_size, const Idx rows, const Idx columns, T no_data, const int nodata, const MathSize xllcorner, const MathSize yllcorner, const MathSize xurcorner, const MathSize yurcorner, string &&proj4)
 Constructor.
 
 GridMap (const Grid< T, V > &grid)
 Construct empty GridMap with same extent as given Grid.
 
 GridMap (const GridBase &grid_info, T no_data)
 Construct empty GridMap with same extent as given Grid.
 
 GridMap (GridMap &&rhs) noexcept
 Move constructor.
 
 GridMap (const GridMap &rhs)
 Copy constructor.
 
GridMapoperator= (GridMap &&rhs) noexcept
 Move assignment.
 
GridMapoperator= (const GridMap &rhs)
 Copy assignment.
 
void clear () noexcept
 Clear data from GridMap.
 
template<class R >
string saveToProbabilityFile (const string &dir, const string &base_name, const R divisor) const
 Save GridMap contents to .asc file as probability.
 
MathSize fireSize () const noexcept
 Calculate area for cells that have a value (ha)
 
list< LocationmakeEdge () const
 Make a list of all Locations that are on the edge of cells with a value.
 
list< LocationmakeList () const
 Make a list of all Locations that have a value.
 
- Public Member Functions inherited from fs::data::GridData< T, T, map< Location, T > >
 GridData (const MathSize cell_size, const Idx rows, const Idx columns, const T nodata_input, const T nodata_value, const MathSize xllcorner, const MathSize yllcorner, const MathSize xurcorner, const MathSize yurcorner, string &&proj4, map< Location, T > &&data)
 Constructor.
 
 GridData (const GridData &rhs)
 Copy constructor.
 
 GridData (GridData &&rhs) noexcept
 Move constructor.
 
GridDataoperator= (const GridData &rhs) noexcept
 Copy assignment.
 
GridDataoperator= (GridData &&rhs) noexcept
 Move assignment.
 
size_t size () const
 Size of data structure storing values.
 
string saveToFileWithoutRetry (const string &dir, const string &base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to file based on settings.
 
string saveToFileWithRetry (const string &dir, const string &base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to file based on settings.
 
string saveToFile (const string &dir, const string &base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to file based on settings.
 
string saveToFile (const string &dir, const string &base_name, std::function< R(T value)> convert) const
 Save GridMap contents to file based on settings.
 
string saveToFile (const string &dir, const string &base_name) const
 Save GridMap contents to file based on settings.
 
- Public Member Functions inherited from fs::data::Grid< T, T >
constexpr Idx rows () const noexcept
 Number of rows in the GridBase.
 
constexpr Idx columns () const noexcept
 Number of columns in the GridBase.
 
constexpr T nodataInput () const noexcept
 Value used for grid locations that have no data.
 
constexpr T nodataValue () const noexcept
 Value representing no data.
 
at (const Position< P > &position) const
 
void set (const Position< P > &position, const T value)
 
- Public Member Functions inherited from fs::data::GridBase
 GridBase (GridBase &&rhs) noexcept=default
 Move constructor.
 
 GridBase (const GridBase &rhs)=default
 Copy constructor.
 
GridBaseoperator= (const GridBase &rhs)=default
 Copy assignment.
 
GridBaseoperator= (GridBase &&rhs) noexcept=default
 Move assignment.
 
constexpr MathSize cellSize () const noexcept
 Cell size used for GridBase.
 
constexpr FullIdx calculateRows () const noexcept
 Number of rows in the GridBase.
 
constexpr FullIdx calculateColumns () const noexcept
 Number of columns in the GridBase.
 
constexpr MathSize xllcorner () const noexcept
 Lower left corner X coordinate in meters.
 
constexpr MathSize yllcorner () const noexcept
 Lower left corner Y coordinate in meters.
 
constexpr MathSize xurcorner () const noexcept
 Upper right corner X coordinate in meters.
 
constexpr MathSize yurcorner () const noexcept
 Upper right corner Y coordinate in meters.
 
constexpr const string & proj4 () const noexcept
 Proj4 string defining coordinate system for this grid. Must be a UTM projection.
 
 GridBase (MathSize cell_size, MathSize xllcorner, MathSize yllcorner, MathSize xurcorner, MathSize yurcorner, string &&proj4) noexcept
 Constructor.
 
 GridBase () noexcept
 Default constructor.
 
void createPrj (const string &dir, const string &base_name) const
 Create .prj file in directory with base name for file.
 
unique_ptr< Coordinates > findCoordinates (const topo::Point &point, bool flipped) const
 Find Coordinates for Point.
 
unique_ptr< FullCoordinates > findFullCoordinates (const topo::Point &point, bool flipped) const
 Find FullCoordinates for Point.
 

Protected Member Functions

tuple< Idx, Idx, Idx, Idx > dataBounds () const override
 
- Protected Member Functions inherited from fs::data::GridData< T, T, map< Location, T > >
string saveToAsciiFile (const string &dir, const string &base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to .asc file.
 
string saveToTiffFile (const string &dir, const string &base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to .tif file.
 
- Protected Member Functions inherited from fs::data::Grid< T, T >
 Grid (const MathSize cell_size, const Idx rows, const Idx columns, const T nodata_input, const T nodata_value, const MathSize xllcorner, const MathSize yllcorner, const MathSize xurcorner, const MathSize yurcorner, string &&proj4) noexcept
 Constructor.
 
 Grid (const GridBase &grid_info, T no_data) noexcept
 Construct based on GridBase and no data value.
 

Additional Inherited Members

- Public Attributes inherited from fs::data::GridData< T, T, map< Location, T > >
map< Location, T > data
 Structure that holds data represented by this GridData.
 

Detailed Description

template<class T, class V = T>
class fs::data::GridMap< T, V >

A GridData that uses an unordered_map for storage.

Template Parameters
TType of data after conversion from initialization type.
VType of data used as an input when initializing.

Constructor & Destructor Documentation

◆ GridMap() [1/5]

template<class T , class V = T>
fs::data::GridMap< T, V >::GridMap ( const MathSize cell_size,
const Idx rows,
const Idx columns,
T no_data,
const int nodata,
const MathSize xllcorner,
const MathSize yllcorner,
const MathSize xurcorner,
const MathSize yurcorner,
string && proj4 )
inline

Constructor.

Parameters
cell_sizeCell width and height (m)
rowsNumber of rows
columnsNumber of columns
no_dataValue that represents no data
nodataInteger value that represents no data
xllcornerLower left corner X coordinate (m)
yllcornerLower left corner Y coordinate (m)
xllcornerUpper right corner X coordinate (m)
yllcornerUpper right corner Y coordinate (m)
proj4Proj4 projection definition
Here is the call graph for this function:

◆ GridMap() [2/5]

template<class T , class V = T>
fs::data::GridMap< T, V >::GridMap ( const Grid< T, V > & grid)
inlineexplicit

Construct empty GridMap with same extent as given Grid.

Parameters
gridGrid to use extent from

◆ GridMap() [3/5]

template<class T , class V = T>
fs::data::GridMap< T, V >::GridMap ( const GridBase & grid_info,
T no_data )
inline

Construct empty GridMap with same extent as given Grid.

Parameters
grid_infoGrid to use extent from
no_dataValue to use for no data

◆ GridMap() [4/5]

template<class T , class V = T>
fs::data::GridMap< T, V >::GridMap ( GridMap< T, V > && rhs)
inlinenoexcept

Move constructor.

Parameters
rhsGridMap to move from

◆ GridMap() [5/5]

template<class T , class V = T>
fs::data::GridMap< T, V >::GridMap ( const GridMap< T, V > & rhs)
inline

Copy constructor.

Parameters
rhsGridMap to copy from

Member Function Documentation

◆ at()

template<class T , class V = T>
T fs::data::GridMap< T, V >::at ( const Location & location) const
inlinenodiscardoverridevirtual

Retrieve value at Location.

Parameters
locationLocation to get value for
Returns
Value at Location

Implements fs::data::Grid< T, T >.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ contains()

template<class T , class V = T>
bool fs::data::GridMap< T, V >::contains ( const Location & location) const
inlinenodiscard

Determine if Location has a value.

Parameters
locationLocation to determine if present in GridMap
Returns
Whether or not a value is present for the Location

◆ dataBounds()

template<class T , class V = T>
tuple< Idx, Idx, Idx, Idx > fs::data::GridMap< T, V >::dataBounds ( ) const
inlineoverrideprotectedvirtual

◆ fireSize()

template<class T , class V = T>
MathSize fs::data::GridMap< T, V >::fireSize ( ) const
inlinenodiscardnoexcept

Calculate area for cells that have a value (ha)

Returns
Area for cells that have a value (ha)
Here is the call graph for this function:

◆ makeEdge()

template<class T , class V = T>
list< Location > fs::data::GridMap< T, V >::makeEdge ( ) const
inlinenodiscard

Make a list of all Locations that are on the edge of cells with a value.

Returns
A list of all Locations that are on the edge of cells with a value
Here is the call graph for this function:

◆ makeList()

template<class T , class V = T>
list< Location > fs::data::GridMap< T, V >::makeList ( ) const
inlinenodiscard

Make a list of all Locations that have a value.

Returns
A list of all Locations that have a value

◆ operator=() [1/2]

template<class T , class V = T>
GridMap & fs::data::GridMap< T, V >::operator= ( const GridMap< T, V > & rhs)
inline

Copy assignment.

Parameters
rhsGridMap to copy from
Returns
This, after assignment

◆ operator=() [2/2]

template<class T , class V = T>
GridMap & fs::data::GridMap< T, V >::operator= ( GridMap< T, V > && rhs)
inlinenoexcept

Move assignment.

Parameters
rhsGridMap to move from
Returns
This, after assignment

◆ saveToProbabilityFile()

template<class T , class V = T>
template<class R >
string fs::data::GridMap< T, V >::saveToProbabilityFile ( const string & dir,
const string & base_name,
const R divisor ) const
inline

Save GridMap contents to .asc file as probability.

Parameters
dirDirectory to save into
base_nameFile base name to use
divisorNumber of simulations to divide by to calculate probability per cell
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set()

template<class T , class V = T>
void fs::data::GridMap< T, V >::set ( const Location & location,
const T value )
inlineoverridevirtual

Set value at Location.

Parameters
locationLocation to set value for
valueValue to set at Location

Implements fs::data::Grid< T, T >.

Here is the call graph for this function:

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