FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
Public Types | Public Member Functions | List of all members

A class describing an n-dimensional space at runtime. More...

#include <DynamicSize.hpp>

Inheritance diagram for Fiber::DynamicSize:
Fiber::SizeInterface Fiber::FragmentedSizeInterface

Public Types

using rank_t = int
 

Public Member Functions

template<Dims_t N>
 DynamicSize (const MultiIndex< N > &MI)
 Initialize from a MultiIndex of certain dimension.
 
template<class T >
 DynamicSize (Dims_t N, const T values[])
 Assign values from arbitrary type that is convertible into integers.
 
 DynamicSize (Dims_t N, index_t NValue)
 Construct a dynamic size of N dimensions, but all extensions set to the given value.
 
 DynamicSize ()=default
 Empty default constructor, zero rank.
 
 DynamicSize (const DynamicSize &DS)
 Copy constructor.
 
 DynamicSize (index_t SubDimension, const DynamicSize &DS)
 Construct a size of one dimension higher.
 
 DynamicSize (int N, const DynamicSize &L, const DynamicSize &R)
 Addition constructor.
 
 ~DynamicSize ()
 Destructor.
 
DynamicSizeoperator= (const DynamicSize &DS)
 Assignment.
 
bool operator!= (const DynamicSize &DS) const noexcept
 Unequality Comparison.
 
bool operator== (const DynamicSize &DS) const noexcept
 Equality Comparison.
 
template<class T >
DynamicSizesetSize (int N, const T values[])
 Assign values from arbitrary type that is convertible into integers.
 
template<Dims_t N>
DynamicSizeresize (const MultiIndex< N > &MI)
 Set a new size from the given MultiIndex.
 
bool hasIncompatibleLowerDims (const DynamicSize &DS) const noexcept
 
bool hasIncompatibleHigherDims (const DynamicSize &DS) const noexcept
 
bool hasCompatibleHigherDims (const DynamicSize &DS) const noexcept
 
size_t getElementArraySize (const DynamicSize &DataFragmentDims) const noexcept
 Given a base space (this), return the number of elements provided by the given data dims, if it is a multidimensional size of just one dimension higher.
 
bool hasCompatibleLowerDims (const DynamicSize &DS) const noexcept
 
index_t nElements () const
 How many elements here?
 
index_t getNumberOfElements () const
 
rank_t Rank () const
 Dimensionality of the domain (same as rank).
 
rank_t getRank () const
 Dimensionality of the domain (same as rank).
 
rank_t dimensionality () const
 Dimensionality of the domain (same as rank).
 
index_t operator[] (int i) const
 Element access operator.
 
const index_tdims_ptr () const
 Return c pointer to dimension storage.
 
bool isValid () const
 Check if some size has been defined here.
 
bool setSize (int i, index_t what)
 Set the extension of this dimensional size in a certain dimension.
 
template<Dims_t N>
bool changeSize (const MultiIndex< N > &MI)
 Adjust size for lowest matching dimensions.
 
bool increment_dims (int incr)
 Increment each dimensional element by the same value.
 
bool multiply_dims (int incr)
 Multiply each dimensional element by the same factor.
 
DynamicSizeincrement (const DynamicSize &D)
 
DynamicSizeoperator+= (const DynamicSize &D)
 
bool setSize (const DynamicSize &D, int FillUp=1) const
 Set the size from another DynamicSize without changing the rank of this DynamicSize, possible using the FillUp value if the given DynamicSize is smaller than the assigned DynamicSize.
 
template<typename T >
rank_t getDims (T *Dims, int MaxEntries) const
 
template<typename T , int N>
rank_t getDims (T(&Dims)[N]) const
 
template<Dims_t N>
bool get (MultiIndex< N > &MI) const
 Retrieve a dynamic size into a multidimensional index.
 
template<Dims_t N>
MultiIndex< N > getSize () const
 Provide the size stored here as a MultiIndex.
 
std::string str () const
 Create textual version of this string.
 

Detailed Description

A class describing an n-dimensional space at runtime.

This class complements the MultiIndex<N> template classes which have their dimensionality fixed at compile-time. The DynamicSize class may be used for generic operations on arbitrary, runtime-determined dimensions. However, for high performance usually the compile-time MultiIndex<N> classes should be used. Conversion functions are provided, but must be used with care (check return values!).

Examples
XF_LineSetHierarchical.cpp, and XF_LineSetHierarchicalRegularized.cpp.

Constructor & Destructor Documentation

◆ DynamicSize()

Fiber::DynamicSize::DynamicSize ( index_t  SubDimension,
const DynamicSize DS 
)

Construct a size of one dimension higher.

The SubDimension will go into indexed dimension zero.

Member Function Documentation

◆ dims_ptr()

const index_t * Fiber::DynamicSize::dims_ptr ( ) const
inline

Return c pointer to dimension storage.

Don't use this function. C pointers are evil.

◆ get()

template<Dims_t N>
bool Fiber::DynamicSize::get ( MultiIndex< N > &  MI) const
inline

Retrieve a dynamic size into a multidimensional index.

Returns
false if the dimensions don't match

◆ getElementArraySize()

size_t Fiber::DynamicSize::getElementArraySize ( const DynamicSize DataFragmentDims) const
inlinenoexcept

Given a base space (this), return the number of elements provided by the given data dims, if it is a multidimensional size of just one dimension higher.

Returns
1 if the dimensions are of equal number of elements (independent of rank), 0 if the base space dimensions or the rank do not match, the number of the additional dimension otherwise.

◆ getSize()

template<Dims_t N>
MultiIndex< N > Fiber::DynamicSize::getSize ( ) const
inline

Provide the size stored here as a MultiIndex.

All MultiIndex components will be zero if the dimension does not match.

DS.getSize<3>()
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34

◆ operator[]()

index_t Fiber::DynamicSize::operator[] ( int  i) const
inline

Element access operator.

Returns zero if no dimensions have been defined at all, or 1 if the coordinate range is beyond the defined dimensionality.

◆ setSize()

bool Fiber::DynamicSize::setSize ( int  i,
index_t  what 
)
inline

Set the extension of this dimensional size in a certain dimension.

Returns
false if anything went wrong, such as illegal dimension specified.