Public Types | Public Member Functions | Private Attributes | List of all members
beluga::SparseValueGrid< MapType, NDim > Class Template Reference

Generic N dimensional sparse value regular grid. More...

#include <sparse_value_grid.hpp>

Inheritance diagram for beluga::SparseValueGrid< MapType, NDim >:
Inheritance graph
[legend]

Public Types

using key_type = typename map_type::key_type
 Key type for the key-value pairs. More...
 
using map_type = MapType
 Underlying associative container. More...
 
using mapped_type = typename map_type::mapped_type
 Value type of the key-value pairs stored in the data. More...
 

Public Member Functions

const map_typedata () const
 Gets grid data. More...
 
std::optional< mapped_typedata_at (const Eigen::Vector< int, NDim > &cell_index) const
 Gets grid data at cell_index or std::nullopt if it's not present. More...
 
std::optional< mapped_typedata_near (const Eigen::Vector< double, NDim > &coordinates) const
 Gets grid data at real coordinates 'coordinates' or std::nullopt if it's not present. More...
 
double resolution () const
 Gets grid resolution. More...
 
std::size_t size () const
 Gets grid size (ie. number of grid cells). More...
 
 SparseValueGrid ()=default
 Construct without data and with a 1 cell/meter resolution. More...
 
 SparseValueGrid (map_type data, double resolution=1.)
 Constructs the grid. More...
 
- Public Member Functions inherited from beluga::BaseRegularGrid< SparseValueGrid< MapType, NDim >, NDim >
Eigen::Vector< int, NDim > cell_near (const Eigen::Vector< double, NDim > &p) const
 Compute nearest grid cell coordinates given plane coordinates. More...
 
Eigen::Vector< double, NDim > coordinates_at (const Eigen::Vector< int, NDim > &pi) const
 Compute plane coordinates given grid cell coordinates. More...
 
auto coordinates_for (Range &&cells) const
 Compute plane coordinates given a range of cell coordinates. More...
 

Private Attributes

map_type data_
 
double resolution_ = 1.0
 

Detailed Description

template<typename MapType, int NDim>
class beluga::SparseValueGrid< MapType, NDim >

Generic N dimensional sparse value regular grid.

Template Parameters
MapTypeAssociative container representing a mapping from a Eigen::Vector<int, NDim> to a value of type MapType::mapped_type. It should implement a subset of standard library's associative containers public API. In particular, given 'm' a possibly const instance of MapType:
  • MapType::key_type must be Eigen::Vector<int, NDim>.
  • MapType::mapped_type should be the value type of the associative container entries.
  • 'm.at(const Eigen::Vector<int, NDim>& cell_index) const' should return a const reference to 'MapType::value_type' representing the value at that index, or throw 'std::out_of_range' if it doesn't exist.
  • 'm.find(const Eigen::Vector<int, NDim>&)' should follow the same API as std::map.
NDimDimension of the grid.

Definition at line 46 of file sparse_value_grid.hpp.

Member Typedef Documentation

◆ key_type

template<typename MapType , int NDim>
using beluga::SparseValueGrid< MapType, NDim >::key_type = typename map_type::key_type

Key type for the key-value pairs.

Definition at line 55 of file sparse_value_grid.hpp.

◆ map_type

template<typename MapType , int NDim>
using beluga::SparseValueGrid< MapType, NDim >::map_type = MapType

Underlying associative container.

Definition at line 51 of file sparse_value_grid.hpp.

◆ mapped_type

template<typename MapType , int NDim>
using beluga::SparseValueGrid< MapType, NDim >::mapped_type = typename map_type::mapped_type

Value type of the key-value pairs stored in the data.

Definition at line 53 of file sparse_value_grid.hpp.

Constructor & Destructor Documentation

◆ SparseValueGrid() [1/2]

template<typename MapType , int NDim>
beluga::SparseValueGrid< MapType, NDim >::SparseValueGrid ( )
default

Construct without data and with a 1 cell/meter resolution.

◆ SparseValueGrid() [2/2]

template<typename MapType , int NDim>
beluga::SparseValueGrid< MapType, NDim >::SparseValueGrid ( map_type  data,
double  resolution = 1. 
)
inlineexplicit

Constructs the grid.

Parameters
dataGrid data.
resolutionGrid resolution.

Definition at line 63 of file sparse_value_grid.hpp.

Member Function Documentation

◆ data()

template<typename MapType , int NDim>
const map_type& beluga::SparseValueGrid< MapType, NDim >::data ( ) const
inline

Gets grid data.

Definition at line 74 of file sparse_value_grid.hpp.

◆ data_at()

template<typename MapType , int NDim>
std::optional<mapped_type> beluga::SparseValueGrid< MapType, NDim >::data_at ( const Eigen::Vector< int, NDim > &  cell_index) const
inline

Gets grid data at cell_index or std::nullopt if it's not present.

Definition at line 77 of file sparse_value_grid.hpp.

◆ data_near()

template<typename MapType , int NDim>
std::optional<mapped_type> beluga::SparseValueGrid< MapType, NDim >::data_near ( const Eigen::Vector< double, NDim > &  coordinates) const
inline

Gets grid data at real coordinates 'coordinates' or std::nullopt if it's not present.

Definition at line 86 of file sparse_value_grid.hpp.

◆ resolution()

template<typename MapType , int NDim>
double beluga::SparseValueGrid< MapType, NDim >::resolution ( ) const
inline

Gets grid resolution.

Definition at line 68 of file sparse_value_grid.hpp.

◆ size()

template<typename MapType , int NDim>
std::size_t beluga::SparseValueGrid< MapType, NDim >::size ( ) const
inline

Gets grid size (ie. number of grid cells).

Definition at line 71 of file sparse_value_grid.hpp.

Member Data Documentation

◆ data_

template<typename MapType , int NDim>
map_type beluga::SparseValueGrid< MapType, NDim >::data_
private

Definition at line 91 of file sparse_value_grid.hpp.

◆ resolution_

template<typename MapType , int NDim>
double beluga::SparseValueGrid< MapType, NDim >::resolution_ = 1.0
private

Definition at line 92 of file sparse_value_grid.hpp.


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


beluga
Author(s):
autogenerated on Tue Jul 16 2024 02:59:54