#include <algorithm>
#include <array>
#include <vector>
Go to the source code of this file.
|
#define | UNUSED(expr) (void)(expr) |
| Macro to mark unused variables (including parameters) and silence the warning while documenting that it is intentionally unused. More...
|
|
#define | M_PI 3.14159265358979323846 |
|
#define | PI M_PI |
|
|
typedef std::tuple< int, int, int, int > | BBoxInt |
|
typedef std::tuple< double, double, double, double > | BBoxFloat |
|
typedef std::tuple< bool, bool, bool, bool > | BBoxBool |
|
template<typename T > |
using | Bare = typename std::remove_cv< typename std::remove_reference< T >::type >::type |
|
|
template<typename Container , typename Value > |
bool | container_contains (const Container &container, const Value &value) |
| Return true if container contains value. More...
|
|
template<typename Container , typename Generator > |
void | shuffle_container (Container &container, Generator &generator) |
| Reorder items in container. More...
|
|
template<typename Tuple > |
constexpr build_indices< std::tuple_size< Bare< Tuple > >::value >::type | make_indices () |
|
template<typename Tuple , int... Indices> |
std::array< typename std::tuple_element< 0, Bare< Tuple > >::type, std::tuple_size< Bare< Tuple > >::value > | to_array (Tuple &&tuple, indices< Indices... >) |
|
template<typename Tuple > |
auto | to_array (Tuple &&tuple) -> decltype(to_array(std::declval< Tuple >(), make_indices< Tuple >())) |
|
std::string | quarantine_enum_to_string (Direction type) |
|
template<typename RasterIndex , typename RasterType > |
std::vector< std::vector< RasterIndex > > | find_suitable_cells (const RasterType &raster) |
| Create a list of suitable cells in from a host raster. More...
|
|
◆ M_PI
#define M_PI 3.14159265358979323846 |
◆ PI
◆ UNUSED
#define UNUSED |
( |
|
expr | ) |
(void)(expr) |
Macro to mark unused variables (including parameters) and silence the warning while documenting that it is intentionally unused.
It is recommended to also document why the variable is unused, but left in the code.
Usage:
To be replaced by [[maybe_unused]]
once we migrate to C++17 or higher.
Definition at line 33 of file utils.hpp.
◆ Bare
template<typename T >
using Bare = typename std::remove_cv<typename std::remove_reference<T>::type>::type |
◆ BBoxBool
typedef std::tuple<bool, bool, bool, bool> BBoxBool |
◆ BBoxFloat
typedef std::tuple<double, double, double, double> BBoxFloat |
◆ BBoxInt
typedef std::tuple<int, int, int, int> BBoxInt |
◆ Direction
Spread direction.
Spread, typically wind, direction. Values are in degrees and are used in computations. None
means that there is no wind.
Enumerator |
---|
N | North.
|
NE | Northeast.
|
E | East.
|
SE | Southeast.
|
S | South.
|
SW | Southwest.
|
W | West.
|
NW | Northwest.
|
None | No direction (non-directional)
|
Definition at line 83 of file utils.hpp.
◆ container_contains()
template<typename Container , typename Value >
bool container_contains |
( |
const Container & |
container, |
|
|
const Value & |
value |
|
) |
| |
Return true if container contains value.
Definition at line 46 of file utils.hpp.
◆ find_suitable_cells()
template<typename RasterIndex , typename RasterType >
std::vector<std::vector<RasterIndex> > find_suitable_cells |
( |
const RasterType & |
raster | ) |
|
Create a list of suitable cells in from a host raster.
Suitable cell is defined as cell with value higher than zero, i.e., there is at least one host.
Suitable cells datastructure is vector of vectors where the nested vector always has size equal to two and contains row and column index. The type was chosen to work well with Rcpp.
First template parameter is the index type for the resulting sutibale cell indices. Second template parameter is deduced automatically from the function parameter.
Definition at line 173 of file utils.hpp.
◆ make_indices()
template<typename Tuple >
◆ quarantine_enum_to_string()
std::string quarantine_enum_to_string |
( |
Direction |
type | ) |
|
◆ shuffle_container()
template<typename Container , typename Generator >
void shuffle_container |
( |
Container & |
container, |
|
|
Generator & |
generator |
|
) |
| |
Reorder items in container.
Definition at line 56 of file utils.hpp.
◆ to_array() [1/2]
template<typename Tuple >
auto to_array |
( |
Tuple && |
tuple | ) |
-> decltype(to_array(std::declval<Tuple>(), make_indices<Tuple>()))
|
◆ to_array() [2/2]
template<typename Tuple , int... Indices>
std::array< typename std::tuple_element<0, Bare<Tuple> >::type, std::tuple_size<Bare<Tuple> >::value> to_array |
( |
Tuple && |
tuple, |
|
|
indices< Indices... > |
|
|
) |
| |