BSplinebasis
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
bspline::support::Grid< T > Class Template Referencefinal

Represents a global Grid. More...

#include <Grid.h>

Public Types

using const_iterator = typename std::vector< T >::const_iterator
 Iterator type.
 

Public Member Functions

template<typename Iter >
 Grid (Iter begin, Iter end)
 Constructs a Grid from a set of begin and end iterators.
 
 Grid (std::vector< T > v)
 Constructs a Grid from a std::vector.
 
 Grid (const std::initializer_list< T > &v)
 Constructs a Grid from a std::initializer_list.
 
 Grid (std::shared_ptr< const std::vector< T > > data)
 Constructs a Grid from a std::shared_ptr<const std::vector<T>>.
 
 Grid (const Grid &g) noexcept=default
 Default copy constructor.
 
Gridoperator= (const Grid &g) noexcept=default
 Default copy assignment operator.
 
 ~Grid ()=default
 Default destructor.
 
 Grid (Grid &&g)=delete
 Explicitly deleted move constructor.
 
Gridoperator= (Grid &&g)=delete
 Explicitly deleted move assignment operator.
 
bool operator== (const Grid &g) const
 Comparison operator.
 
bool operator!= (const Grid &g) const
 Negated comparison operator.
 
size_t size () const
 Returns the number of elements of the Grid.
 
std::shared_ptr< const std::vector< T > > getData () const
 Gives access to the underlying data.
 
bool empty () const
 Checks whether the spline is empty.
 
const Toperator[] (size_t i) const
 Gives access to the i-th element of the Grid.
 
const Tat (size_t i) const
 Gives access to the i-th element of the Grid.
 
const Tfront () const
 Returns a reference to the first element of the Grid.
 
const Tback () const
 Returns a reference to the last element of the Grid.
 
const_iterator begin () const
 Returns the begin iterator of the Grid.
 
const_iterator end () const
 Returns the end iterator of the Grid..
 
size_t findElement (const T &x) const
 Returns the index corresponding to the element x.
 

Detailed Description

template<typename T>
class bspline::support::Grid< T >

Represents a global Grid.

Template Parameters
TThe datatype of the Grid elements.

Constructor & Destructor Documentation

◆ Grid() [1/6]

template<typename T >
template<typename Iter >
bspline::support::Grid< T >::Grid ( Iter  begin,
Iter  end 
)
inline

Constructs a Grid from a set of begin and end iterators.

Parameters
beginThe iterator referencing the first element to be copied into the Grid.
endThe iterator referencing the element behind the last element to be copied into the Grid.
Template Parameters
IterThe type of the two iterators.
Exceptions
BSplineExceptionIf the Grid is empty or contains only a single element, or if the elements are not in steadily increasing order.

◆ Grid() [2/6]

template<typename T >
bspline::support::Grid< T >::Grid ( std::vector< T v)
inlineexplicit

Constructs a Grid from a std::vector.

Parameters
vThe input vector.
Exceptions
BSplineExceptionIf the Grid is empty or contains only a single element, or if the elements are not in steadily increasing order.

◆ Grid() [3/6]

template<typename T >
bspline::support::Grid< T >::Grid ( const std::initializer_list< T > &  v)
inlineexplicit

Constructs a Grid from a std::initializer_list.

Parameters
vThe input initializer_list.
Exceptions
BSplineExceptionIf the Grid is empty or contains only a single element, or if the elements are not in steadily increasing order.

◆ Grid() [4/6]

template<typename T >
bspline::support::Grid< T >::Grid ( std::shared_ptr< const std::vector< T > >  data)
inlineexplicit

Constructs a Grid from a std::shared_ptr<const std::vector<T>>.

Parameters
dataA shared pointer to the Grid elements.
Exceptions
BSplineExceptionIf the Grid is empty or contains only a single element, or if the elements are not in steadily increasing order.

◆ Grid() [5/6]

template<typename T >
bspline::support::Grid< T >::Grid ( const Grid< T > &  g)
defaultnoexcept

Default copy constructor.

Parameters
gGrid to be copied.

◆ Grid() [6/6]

template<typename T >
bspline::support::Grid< T >::Grid ( Grid< T > &&  g)
delete

Explicitly deleted move constructor.

Parameters
gGrid to (not) be moved.

Member Function Documentation

◆ at()

template<typename T >
const T & bspline::support::Grid< T >::at ( size_t  i) const
inline

Gives access to the i-th element of the Grid.

Returns a reference to the ith element of the Grid. Checks the bounds.

Parameters
iThe index of the element to be returned.
Returns
A reference to the ith element.
Exceptions
BSplineExceptionIf the access is out of bounds.

◆ back()

template<typename T >
const T & bspline::support::Grid< T >::back ( ) const
inline

Returns a reference to the last element of the Grid.

Returns
A reference to the last element.
Exceptions
BSplineExceptionIf the Grid is empty.

◆ begin()

template<typename T >
const_iterator bspline::support::Grid< T >::begin ( ) const
inline

Returns the begin iterator of the Grid.

Returns
An iterator to the first element.

◆ empty()

template<typename T >
bool bspline::support::Grid< T >::empty ( ) const
inline

Checks whether the spline is empty.

Checks whether the Grids holds any elements. Note: It is not possible to construct an empty Grid, so this method will always return false.

Returns
True if this Grid holds no element.

◆ end()

template<typename T >
const_iterator bspline::support::Grid< T >::end ( ) const
inline

Returns the end iterator of the Grid..

Returns
An iterator pointing behind the last element.

◆ findElement()

template<typename T >
size_t bspline::support::Grid< T >::findElement ( const T x) const
inline

Returns the index corresponding to the element x.

Parameters
xThe element to be searched for.
Exceptions
BSplineExceptionIf the element could not be found.

◆ front()

template<typename T >
const T & bspline::support::Grid< T >::front ( ) const
inline

Returns a reference to the first element of the Grid.

Returns
A reference to the first element.
Exceptions
BSplineExceptionIf the Grid is empty.

◆ getData()

template<typename T >
std::shared_ptr< const std::vector< T > > bspline::support::Grid< T >::getData ( ) const
inline

Gives access to the underlying data.

Returns a shared pointer to the elements of this Grid.

Returns
A shared pointer to the elements of this Grid.

◆ operator!=()

template<typename T >
bool bspline::support::Grid< T >::operator!= ( const Grid< T > &  g) const
inline

Negated comparison operator.

Parameters
gThe Grid to compare this Grid with.
Returns
Returns false if the Grids represent the same logical Grid.

◆ operator=() [1/2]

template<typename T >
Grid & bspline::support::Grid< T >::operator= ( const Grid< T > &  g)
defaultnoexcept

Default copy assignment operator.

Parameters
gGrid to be copied.

◆ operator=() [2/2]

template<typename T >
Grid & bspline::support::Grid< T >::operator= ( Grid< T > &&  g)
delete

Explicitly deleted move assignment operator.

Parameters
gGrid to (not) be moved.

◆ operator==()

template<typename T >
bool bspline::support::Grid< T >::operator== ( const Grid< T > &  g) const
inline

Comparison operator.

Parameters
gThe Grid to compare this Grid with.
Returns
Returns true if the Grids represent the same logical Grid.

◆ operator[]()

template<typename T >
const T & bspline::support::Grid< T >::operator[] ( size_t  i) const
inline

Gives access to the i-th element of the Grid.

Returns a reference to the ith element of the Grid. Performs no bounds checks.

Parameters
iThe index of the element to be returned.
Returns
A reference to the ith element.

◆ size()

template<typename T >
size_t bspline::support::Grid< T >::size ( ) const
inline

Returns the number of elements of the Grid.

Returns
The number of Grid points.

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