Template Class SparseValueGrid
Defined in File sparse_value_grid.hpp
Inheritance Relationships
Base Type
public beluga::BaseRegularGrid< SparseValueGrid< MapType, NDim >, NDim >
(Template Class BaseRegularGrid)
Class Documentation
-
template<typename MapType, int NDim>
class SparseValueGrid : public beluga::BaseRegularGrid<SparseValueGrid<MapType, NDim>, NDim> Generic N dimensional sparse value regular grid.
- Template Parameters:
MapType – Associative 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.
NDim – Dimension of the grid.
Public Types
Public Functions
-
SparseValueGrid() = default
Construct without data and with a 1 cell/meter resolution.
-
inline explicit SparseValueGrid(map_type data, double resolution = 1.)
Constructs the grid.
- Parameters:
data – Grid data.
resolution – Grid resolution.
-
inline double resolution() const
Gets grid resolution.
-
inline std::size_t size() const
Gets grid size (ie. number of grid cells).
-
inline std::optional<mapped_type> data_at(const Eigen::Vector<int, NDim> &cell_index) const
Gets grid data at cell_index or std::nullopt if it’s not present.
-
inline std::optional<mapped_type> data_near(const Eigen::Vector<double, NDim> &coordinates) const
Gets grid data at real coordinates ‘coordinates’ or std::nullopt if it’s not present.