QUGaR 0.0.4
Loading...
Searching...
No Matches
qugar::TensorIndexRangeTP< dim > Class Template Reference

Class representing a dim-dimensional range defined by lower and upper tensor bounds. More...

#include <tensor_index_tp.hpp>

Classes

class  Iterator
 Iterator class for tensor index ranges. More...
 

Public Member Functions

 TensorIndexRangeTP (const TensorIndexTP< dim > &lower_bound, const TensorIndexTP< dim > &upper_bound)
 Constructs a new TensorIndexRangeTP object from its lower and upper bounds.
 
 TensorIndexRangeTP (const TensorIndexTP< dim > &upper_bound)
 Constructs a new TensorIndexRangeTP object from its upper bound. The lower bound is assumed to be zero.
 
 TensorIndexRangeTP (const TensorSizeTP< dim > &upper_bound)
 Constructs a new TensorIndexRangeTP object from its upper bound. The lower bound is assumed to be zero.
 
 TensorIndexRangeTP (int upper_bound)
 Constructs a new TensorIndexRangeTP object from its upper bound. The lower bound is assumed to be zero.
 
TensorSizeTP< dim > get_sizes () const
 Gets the sizes along all the directions.
 
int size () const
 returns the number of entries in the range.
 
std::array< TensorIndexRangeTP< dim >, 2 > split () const
 Splits the current range along the direction with a largest number of indices.
 
Iterator cbegin () const
 Creates a begin iterator.
 
Iterator begin () const
 Creates a begin iterator.
 
Iterator cend () const
 Creates an end iterator.
 
Iterator end () const
 Creates an end iterator.
 
const TensorIndexTP< dim > & get_lower_bound () const
 Gets the lower bound.
 
const TensorIndexTP< dim > & get_upper_bound () const
 Gets the upper bound.
 
bool is_in_range (const TensorIndexTP< dim > &index) const
 Checks that the given index is contained in the range.
 
bool is_in_range (int index) const
 Checks that the given index is contained in the range.
 

Private Attributes

TensorIndexTP< dim > lower_bound_
 Lower bounds.
 
TensorIndexTP< dim > upper_bound_
 Upper bounds.
 

Detailed Description

template<int dim>
class qugar::TensorIndexRangeTP< dim >

Class representing a dim-dimensional range defined by lower and upper tensor bounds.

Template Parameters
dimDimension of the indices.

Constructor & Destructor Documentation

◆ TensorIndexRangeTP() [1/4]

template<int dim>
qugar::TensorIndexRangeTP< dim >::TensorIndexRangeTP ( const TensorIndexTP< dim > & lower_bound,
const TensorIndexTP< dim > & upper_bound )

Constructs a new TensorIndexRangeTP object from its lower and upper bounds.

Parameters
lower_boundLower bounds.
upper_boundUpper bounds.

◆ TensorIndexRangeTP() [2/4]

template<int dim>
qugar::TensorIndexRangeTP< dim >::TensorIndexRangeTP ( const TensorIndexTP< dim > & upper_bound)
explicit

Constructs a new TensorIndexRangeTP object from its upper bound. The lower bound is assumed to be zero.

Parameters
upper_boundUpper bounds.

◆ TensorIndexRangeTP() [3/4]

template<int dim>
qugar::TensorIndexRangeTP< dim >::TensorIndexRangeTP ( const TensorSizeTP< dim > & upper_bound)
explicit

Constructs a new TensorIndexRangeTP object from its upper bound. The lower bound is assumed to be zero.

Parameters
upper_boundUpper bounds.

◆ TensorIndexRangeTP() [4/4]

template<int dim>
qugar::TensorIndexRangeTP< dim >::TensorIndexRangeTP ( int upper_bound)
explicit

Constructs a new TensorIndexRangeTP object from its upper bound. The lower bound is assumed to be zero.

Parameters
upper_boundUpper bounds. All components are set to the given value.

Member Function Documentation

◆ begin()

template<int dim>
Iterator qugar::TensorIndexRangeTP< dim >::begin ( ) const

Creates a begin iterator.

Returns
Created iterator.

◆ cbegin()

template<int dim>
Iterator qugar::TensorIndexRangeTP< dim >::cbegin ( ) const

Creates a begin iterator.

Returns
Created iterator.
Note
Constant version.

◆ cend()

template<int dim>
Iterator qugar::TensorIndexRangeTP< dim >::cend ( ) const

Creates an end iterator.

Returns
Created iterator.
Note
Constant version.

◆ end()

template<int dim>
Iterator qugar::TensorIndexRangeTP< dim >::end ( ) const

Creates an end iterator.

Returns
Created iterator.

◆ get_lower_bound()

template<int dim>
const TensorIndexTP< dim > & qugar::TensorIndexRangeTP< dim >::get_lower_bound ( ) const
nodiscard

Gets the lower bound.

Returns
Lower bound.

◆ get_sizes()

template<int dim>
TensorSizeTP< dim > qugar::TensorIndexRangeTP< dim >::get_sizes ( ) const
nodiscard

Gets the sizes along all the directions.

Returns
Range sizes along all the directions.

◆ get_upper_bound()

template<int dim>
const TensorIndexTP< dim > & qugar::TensorIndexRangeTP< dim >::get_upper_bound ( ) const
nodiscard

Gets the upper bound.

Returns
Upper bound.

◆ is_in_range() [1/2]

template<int dim>
bool qugar::TensorIndexRangeTP< dim >::is_in_range ( const TensorIndexTP< dim > & index) const
nodiscard

Checks that the given index is contained in the range.

Parameters
indexIndex to be checked.
Returns
Whether the index is contained in the range or not.

◆ is_in_range() [2/2]

template<int dim>
bool qugar::TensorIndexRangeTP< dim >::is_in_range ( int index) const
nodiscard

Checks that the given index is contained in the range.

Parameters
indexIndex to be checked.
Returns
Whether the index is contained in the range or not.

◆ size()

template<int dim>
int qugar::TensorIndexRangeTP< dim >::size ( ) const
nodiscard

returns the number of entries in the range.

Returns
Number of entries in the range.

◆ split()

template<int dim>
std::array< TensorIndexRangeTP< dim >, 2 > qugar::TensorIndexRangeTP< dim >::split ( ) const
nodiscard

Splits the current range along the direction with a largest number of indices.

Returns
Two generated ranges wrapped in shared pointers.

Member Data Documentation

◆ lower_bound_

template<int dim>
TensorIndexTP<dim> qugar::TensorIndexRangeTP< dim >::lower_bound_
private

Lower bounds.

◆ upper_bound_

template<int dim>
TensorIndexTP<dim> qugar::TensorIndexRangeTP< dim >::upper_bound_
private

Upper bounds.


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