Virtual Testbed
Ship dynamics simulator for extreme conditions
Public Types | Public Member Functions | Friends | List of all members
vtb::core::Grid< T, N > Class Template Reference

A region defined by start and end index and lower and upper bound for each dimension. More...

#include <grid.hh>

Public Types

typedef blitz::TinyVector< T, N > vec
 
typedef blitz::TinyVector< int, N > int_n
 

Public Member Functions

 Grid (const Grid &)=default
 
Gridoperator= (const Grid &)=default
 
 Grid (Grid &&)=default
 
Gridoperator= (Grid &&)=default
 
template<class X >
 Grid (const Grid< X, N > &rhs)
 
 Grid (const vec &lbound, const vec &ubound, const int_n &begin_index, const int_n &end_index)
 
 Grid (const vec &lbound, const vec &ubound, const int_n &shape)
 
 Grid (const vec &ubound, const int_n &shape)
 
 Grid (const int_n &shape)
 
template<class ... Tail>
 Grid (const Grid< T, 1 > &head, const Tail &... tail)
 
const int_n shape () const noexcept
 The number of points for all dimensions.
 
int extent (int i) const noexcept
 The number of points for dimension i.
 
const int_n & begin () const noexcept
 Start indices (inclusive).
 
int_n & begin () noexcept
 Start indices (inclusive).
 
int begin (int i) const noexcept
 Start index for dimension i (inclusive).
 
int & begin (int i) noexcept
 Start index for dimension i (inclusive).
 
const int_n & end () const noexcept
 End indices (exclusive).
 
int_n & end () noexcept
 End indices (exclusive).
 
int & end (int i) noexcept
 End index for dimension i (exclusive).
 
int end (int i) const noexcept
 End index for dimension i (exclusive).
 
const vec & lbound () const noexcept
 Lower bound of the region.
 
vec & lbound () noexcept
 Lower bound of the region.
 
lbound (int i) const noexcept
 
T & lbound (int i) noexcept
 
const vec & ubound () const noexcept
 Upper bound of the region.
 
vec & ubound () noexcept
 Upper bound of the region.
 
ubound (int i) const noexcept
 
T & ubound (int i) noexcept
 
int num_patches (int i) const
 The number of patches (intervals) for dimension i.
 
const int_n num_patches () const
 The number of patches (intervals) for all dimensions.
 
const vec size () const noexcept
 The size of the region.
 
const T length (int i) const noexcept
 The size of the region for dimension i.
 
size_t num_elements () const
 Total number of grid points.
 
const T delta (int i) const
 The size of the patch (interval) for dimension i.
 
vec delta () const
 The size of the patch (interval) for all dimensions.
 
const vec operator() (const int_n &i) const noexcept
 Point inside the region specified by index i.
 
const vec operator() (const int_n &i, const vec &delta) const noexcept
 Point inside the region specified by index i and delta.
 
const T operator() (const int i, const int dim) const noexcept
 
const vec index (const vec &x) const noexcept
 
const T index (T x, const int dim) const noexcept
 
Grid< T, N > operator() (const blitz::RectDomain< N > &domain) const
 
template<class ... Tail>
Grid< T, N > operator() (const blitz::Range &head, const Tail &... tail) const
 
template<class ... Tail>
auto select (int head, Tail ... tail) const -> Grid< T, sizeof...(tail)+1 >
 
void compact ()
 
void clear () noexcept
 
bool within_bounds (T x, int dim) const noexcept
 
bool contains (const vec &x) const noexcept
 
template<class ... Args>
bool contains (const vec &x, const Args &... tail) const noexcept
 
bool near (const Grid &rhs, T eps)
 
bool empty () const
 

Friends

bstreamoperator<< (bstream &out, const Grid &rhs)
 
bstreamoperator>> (bstream &in, Grid &rhs)
 
std::ostreamoperator<< (std::ostream &out, const Grid &rhs)
 

Detailed Description

template<class T, int N>
class vtb::core::Grid< T, N >

A region defined by start and end index and lower and upper bound for each dimension.

Template Parameters
Tlength type.
Nno. of dimensions.

Definition at line 25 of file core/grid.hh.