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

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

#include <GridMap.h>

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

Public Member Functions

bool contains (const XYIdx &location) const
 
T at (const XYIdx &location) const override
 
void set (const XYIdx &location, const T value) override
 Set value at Location.
 
 GridMap (const MathSize cell_size, const Idx width, const Idx height, T no_data, const int nodata, const MathSize xllcorner, const MathSize yllcorner, const MathSize xurcorner, const MathSize yurcorner, const string_view proj4)
 
 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
 
 GridMap (const GridMap &rhs)
 
GridMap & operator= (GridMap &&rhs) noexcept
 
GridMap & operator= (const GridMap &rhs)
 
void clear () noexcept
 Clear data from GridMap.
 
template<class R >
FileList saveToProbabilityFile (const string_view dir, const string_view 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< XYIdx > makeEdge () const
 Make a list of all Locations that are on the edge of cells with a value.
 
list< XYIdx > makeList () const
 Make a list of all Locations that have a value.
 
- Public Member Functions inherited from fs::GridData< T, T, map< XYIdx, T > >
 GridData (const MathSize cell_size, const Idx width, const Idx height, const T nodata_input, const T nodata_value, const MathSize xllcorner, const MathSize yllcorner, const MathSize xurcorner, const MathSize yurcorner, const string_view proj4, map< XYIdx, T > &&data)
 
 GridData (const GridData &rhs)
 
 GridData (GridData &&rhs) noexcept
 
GridData & operator= (const GridData &rhs) noexcept
 
GridData & operator= (GridData &&rhs) noexcept
 
size_t size () const
 Size of data structure storing values.
 
FileList saveToFileWithoutRetry (const string_view dir, const string_view base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to file based on settings.
 
FileList saveToFileWithRetry (const string_view dir, const string_view base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to file based on settings.
 
FileList saveToFile (const string_view dir, const string_view base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to file based on settings.
 
FileList saveToFile (const string_view dir, const string_view base_name, std::function< R(T value)> convert) const
 Save GridMap contents to file based on settings.
 
FileList saveToFile (const string_view dir, const string_view base_name) const
 Save GridMap contents to file based on settings.
 
- Public Member Functions inherited from fs::Grid< T, T >
constexpr Idx height () const noexcept
 
constexpr Idx width () const noexcept
 
constexpr T nodataInput () const noexcept
 Value used for grid locations that have no data.
 
constexpr T nodataValue () const noexcept
 Value representing no data.
 
- Public Member Functions inherited from fs::GridBase
 GridBase (GridBase &&rhs) noexcept=default
 
 GridBase (const GridBase &rhs)=default
 
GridBase & operator= (const GridBase &rhs)=default
 
GridBase & operator= (GridBase &&rhs) noexcept=default
 
constexpr MathSize cellSize () const noexcept
 Cell size used for GridBase.
 
constexpr FullIdx calculateHeight () const noexcept
 
constexpr FullIdx calculateWidth () const noexcept
 
constexpr MathSize xllcorner () const noexcept
 Lower left corner X coordinate in metres.
 
constexpr MathSize yllcorner () const noexcept
 Lower left corner Y coordinate in metres.
 
constexpr MathSize xurcorner () const noexcept
 Upper right corner X coordinate in metres.
 
constexpr MathSize yurcorner () const noexcept
 Upper right corner Y coordinate in metres.
 
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, const string_view proj4) noexcept
 Constructor.
 
void createPrj (const string_view dir, const string_view base_name) const
 Create .prj file in directory with base name for file.
 
std::optional< Coordinates > findCoordinates (const Point &point, bool flipped) const
 Find Coordinates for Point.
 
std::optional< FullCoordinates > findFullCoordinates (const Point &point, bool flipped) const
 Find FullCoordinates for Point.
 
bool validate (const Point &point) const
 
string saveToTiffFileInt (const Idx width, const Idx height, const tuple< Idx, Idx, Idx, Idx > bounds, const string_view dir, const string_view base_name, const uint16_t bits_per_sample, const bool is_unsigned, std::function< int(const XYIdx &)> value_at, const int nodata_as_int) const
 
string saveToTiffFileFloat (const Idx width, const Idx height, const tuple< Idx, Idx, Idx, Idx > bounds, const string_view dir, const string_view base_name, std::function< double(const XYIdx &)> value_at, const int nodata_as_int) const
 

Protected Member Functions

tuple< Idx, Idx, Idx, Idx > dataBounds () const override
 
- Protected Member Functions inherited from fs::GridData< T, T, map< XYIdx, T > >
string saveToAsciiFile (const string_view dir, const string_view base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to .asc file.
 
string saveToTiffFile (const string_view dir, const string_view base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to .tif file.
 
string saveToTiffFile (const string_view dir, const string_view base_name, std::function< R(T value)> convert, const R no_data) const
 
- Protected Member Functions inherited from fs::Grid< T, T >
 Grid (const MathSize cell_size, const Idx width, const Idx height, const T nodata_input, const T nodata_value, const MathSize xllcorner, const MathSize yllcorner, const MathSize xurcorner, const MathSize yurcorner, const string_view proj4) noexcept
 
 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::GridData< T, T, map< XYIdx, T > >
map< XYIdx, T > data
 Structure that holds data represented by this GridData.
 

Detailed Description

template<class T, class V = T>
class fs::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/2]

template<class T , class V = T>
fs::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() [2/2]

template<class T , class V = T>
fs::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

Member Function Documentation

◆ at()

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

Implements fs::Grid< T, T >.

◆ dataBounds()

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

◆ fireSize()

template<class T , class V = T>
MathSize fs::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< XYIdx > fs::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< XYIdx > fs::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

◆ saveToProbabilityFile()

template<class T , class V = T>
template<class R >
FileList fs::GridMap< T, V >::saveToProbabilityFile ( const string_view dir,
const string_view base_name,
const R divisor ) const
inlinenodiscard

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
Returns
FileList of file names saved to
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::GridMap< T, V >::set ( const XYIdx & location,
const T value )
inlineoverridevirtual

Set value at Location.

Parameters
locationLocation to set value for
valueValue to set at Location

Implements fs::Grid< T, T >.

Here is the caller graph for this function:

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