FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
Public Types | Public Member Functions | Public Attributes | List of all members
Fiber::DirectProductMemArrayBase< T, Category, MDIMS > Class Template Reference

Class for creating structured types as direct product of one-dimensional arrays. More...

#include <DirectProductArray.hpp>

Inheritance diagram for Fiber::DirectProductMemArrayBase< T, Category, MDIMS >:
Fiber::MemArrayBase< MDIMS > Fiber::MemBase MemCore::Cacheable MemCore::Intercube MemCore::ReferenceBase< Cacheable > Fiber::DirectProductMemArray< T, LinearCoordinateAxisArray, T::SIZE > Fiber::DirectProductMemArray< Eagle::point3, LinearCoordinateAxisArray, T::SIZE > Fiber::DirectProductMemArray< T, Category, MDIMS > Fiber::LinearDirectProductMemArray< Eagle::point3, Eagle::tvector3 > Fiber::LinearDirectProductMemArray< T, DeltaT, MDIMS > Fiber::UniformCartesianArray

Public Types

enum  { COMPONENTS = T::SIZE , Dims = MDIMS }
 
typedef T::value_type component_type
 The components of the structured type T.
 
typedef CoordinateAxisArray< component_type, CategoryCoordinateAxisArray_t
 
typedef FixedArray< double, MDIMSFloatIndex_t
 A multidimensional floating-point index.
 
- Public Types inherited from Fiber::MemArrayBase< MDIMS >
enum  Dims_t
 
typedef MultiIndex< N > MIndex_t
 
- Public Types inherited from Fiber::MemBase
typedef WeakPtrCreativeArrayBase_t Creator_t
 
- Public Types inherited from MemCore::Cacheable
typedef unsigned long cachecounter_t
 
- Public Types inherited from MemCore::ReferenceBase< Cacheable >
typedef Object reference_domain_t
 
typedef WeakPtr< Object, Object > SelfPtr_t
 

Public Member Functions

 DirectProductMemArrayBase (const MemBase::Creator_t &C=MemCore::NullPtr())
 The constructor sets the component map such that the dimensions of the manifold are mapped to the first components of the structure.
 
 DirectProductMemArrayBase (const RefPtr< CoordinateAxisArray_t > C[COMPONENTS], const Eagle::Vector< int, Dims > &CMap, const MemBase::Creator_t &theCreator=MemCore::NullPtr())
 
 DirectProductMemArrayBase (const DirectProductMemArrayBase &Src, const MemBase::Creator_t &theCreator=MemCore::NullPtr())
 
void DeferredConstructor () override
 Virtual deferred reference pointer construction pointer Don't overload if you don't know exactly what this function is supposed to do. See class DynPtr for more info.
 
MemCore::memsize_t memsize () const override
 
bool copyFrom (const RefPtr< MemCore::ChunkBase > &theChunk) override
 
RefPtr< MemArray< MDIMS, T > > createMemArray (const RefPtr< MemCore::ChunkBase > &Data, const MemBase::Creator_t &C) const
 Create a memory array of the same dimensions as the current array, but with data as provided by the Storage.
 
RefPtr< MemBasecreateEquallySizedMemArray (const RefPtr< MemCore::ChunkBase > &Storage, const MemBase::Creator_t &C) const override
 Create a memory array of the same dimensions as the current array, but with data as provided by the Storage.
 
RefPtr< MemBasegetComponentArray (int member, const MemBase::Creator_t &C) override
 
void retrieve (T &retval, const MultiIndex< Dims > &I) const
 Evaluate an index, deliver the coordinate value.
 
FloatIndex_t getIndex (const T &PointCoordinates) const
 Given the coordinates of a point, yield the index where it resides in the array.
 
MultiIndex< DimsSize () const override
 Return the multidimensional number of points covered by this array.
 
MultiIndex< DimsfirstIndex () const
 Return a multidimensional index for the 1st data element, which is just all components to be zero.
 
MultiIndex< DimslastIndex () const
 Return a multidimensional index for the last data element, which is just the largest index in each dimension, the number of elements minus one.
 
RefPtr< MemBasegetSlice (index_t i, const MemBase::Creator_t &C) const override
 For a multidimensional array retrieve the nth slice.
 
voidgetPtr () override
 Implementation of the virtual MemArray function.
 
HyperslabParametersgetHyperslabParameters () override
 
- Public Member Functions inherited from Fiber::MemArrayBase< MDIMS >
 MemArrayBase (const FiberTypeIndex &theFiberTypeIndex, const WeakPtr< CreativeArrayBase > &theCreator)
 
 MemArrayBase (const MemArrayBase< N > &)=delete
 
void operator= (const MemArrayBase< N > &)=delete
 
Fiber::Dims_t rank () const override
 Return the number of array dimensions.
 
virtual RefPtr< MemBasenewMemArraynD (const MultiIndex< N > &NewSize, const MemBase::Creator_t &C) const=0
 Create a new array of the same type as the current one, but using the specified dimensions.
 
virtual RefPtr< MemBasecreateSubMemArray (const MultiIndex< N > &Offset, const MultiIndex< N > &CopySize, const MemBase::Creator_t &C) const=0
 Create a new MemArray from a subset of the current array's data.
 
RefPtr< MemBasecreateSubArray (const DynamicSize &Offset, const DynamicSize &CopySize, const MemBase::Creator_t &C) const override
 Implement creation of new memory sub array using the DynamicSize class.
 
DynamicSize getSize () const override
 Return the size of this dataset.
 
RefPtr< ArrayInterpolatorgetInterpolator () const
 
- Public Member Functions inherited from Fiber::MemBase
 MemBase (const FiberTypeIndex &theFiberTypeIndex, const Creator_t &theCreator)
 Empty default constructor.
 
 ~MemBase ()
 Destructor.
 
 MemBase (const MemBase &)=delete
 
MemCore::WeakPtr< MemBasemembase () const
 
virtual index_t nElements () const
 return the number of elements in this array
 
auto NumberOfElements () const
 
auto getNumberOfElements () const
 
virtual const type_infogetType () const =0
 Return the element type of the certain array.
 
virtual std::string getElementAsString (size_t index) const =0
 
MemCore::WeakPtr< FiberTypeBasegetFiberType () const
 
MemCore::memsize_t element_memsize () const
 
virtual RefPtr< MemBasemakeMemArray (const MemBase::Creator_t &C) const =0
 Provide a MemArray, even though the actual data is a procedural array.
 
bool copyFrom (const RefPtr< MemBase > &Mb)
 Copy all data values from the given MemBase.
 
virtual RefPtr< MemBasecopy (const MemBase::Creator_t &C=nullptr) const =0
 Create a copy of the current array, duplicating all data and allocating new memory for it.
 
RefPtr< MemBasecreate (const RefPtr< FiberTypeBase > &FT, const type_info &layout=typeid(void)) const
 Create a new mem array of the same dimensions but different type.
 
template<class T >
RefPtr< MemBasecreate (const type_info &layout=typeid(void)) const
 Create a new mem array of the same dimensions but different type.
 
RefPtr< MemBasecreate (const DynamicSize &DS, const type_info &layout=typeid(void)) const
 Create a new mem array of the same type but different dimensions.
 
RefPtr< MemBasecreate (const type_info &layout=typeid(void)) const
 Create a new mem array of the same type and dimensions, but default values.
 
virtual RefPtr< MemCore::ChunkBasegetChunk () const =0
 Get chunk to underlying data, if this is a contiguous array.
 
virtual const voidOriginPtr () const =0
 Get pointer to origin of linearly procedural array, if it is linear.
 
virtual const voidDeltaPtr () const =0
 Get pointer to delta of linearly procedural array, if it is linear.
 
MemCore::memsize_t memsize () const override
 How much memory is occupied here at all in case it's stored in a chunk?
 
- Public Member Functions inherited from MemCore::Cacheable
 Cacheable (const WeakPtr< Creature > &C)
 
bool isCached () const
 
bool isUncached () const
 
bool markAsUsed ()
 
WeakPtr< CacheBasemyCache () const
 
const WeakPtr< Creature > & myCreator () const
 
int NumberOfListEntries () const
 
void PreDestructor ()
 
void push_back (CacheQueue &Q)
 
void push_front (CacheQueue &Q)
 
void setCreator (const WeakPtr< Creature > &C)
 
- Public Member Functions inherited from MemCore::ReferenceBase< Cacheable >
auto getObjectCountID () const noexcept
 
bool isIdentical (const WeakPtr< Object, Object > &PossibleSelf) const noexcept
 
void mkAutoDestructive ()
 
refcount_t refcount () const noexcept
 
 ReferenceBase (Object *that) noexcept
 
const auto & self () const
 
refcount_t wrefcount () const noexcept
 
- Public Member Functions inherited from MemCore::Intercube
void addInterface (const RefPtr< InterfaceBase > &I) const
 
void addInterfaceData (const Data &D)
 
void addInterfaceData (const Data &D)
 
void clearInterfaces ()
 
bool const_iterateInterfaces (const RefPtr< InterfaceIterationParameter > &IIP) const
 
virtual RefPtr< InterfaceBasecreateInterface (const type_info &) const
 
RefPtr< InterfaceBasefindInterface (const type_info &t) const
 
RefPtr< InterfaceBasegetInterface (const type_info &t)
 
std::string getInterfaceNames (const char delim=';') const
 
bool gotNewInterfaceData (const Data &D)
 
bool gotNewInterfaceData (mutex &M, const Data &D)
 
bool gotNewInterfaceData (mutex &M, const Data &D)
 
bool gotNewInterfaceData (mutex &M, const Data &D, const Selector &S)
 
bool gotNewInterfaceData (mutex &M, const Data &D, const Selector *S)
 
bool hasChangedInterfaceData (const Data &D) const
 
bool hasChangedInterfaceData (const Data &D) const
 
bool hasChangedInterfaceData (const Data &D, const Selector &) const
 
bool hasChangedInterfaceData (const Data &D, const Selector *) const
 
bool hasInterface (const type_info &t) const
 
bool iterateInterfaces (const RefPtr< InterfaceIterationParameter > &IIP)
 
void printInterfaces () const
 
void registerInterface (const type_info &t)
 
void removeInterface ()
 
void removeInterfaceBase (const type_info &InterfaceBaseID)
 

Public Attributes

RefPtr< CoordinateAxisArray_tComponents [COMPONENTS]
 The respective components of the array.
 
Eagle::Vector< int, DimsComponentMap
 Mapping from manifold dimension to component array.
 

Additional Inherited Members

- Static Public Member Functions inherited from Fiber::MemBase
static RefPtr< MemBasecreate (const RefPtr< FiberTypeBase > &FT, const DynamicSize &DS, const type_info &layout=typeid(void))
 Given a description of a certain data type for each element on array, allocate a multidimensional array of the given type.
 
static bool registerCreator (const RefPtr< Allocator > &A, const RefPtr< FiberTypeBase > &FT)
 
- Static Public Attributes inherited from Fiber::MemBase
static int RegisteredTypes = 0
 
- Protected Member Functions inherited from MemCore::Cacheable
void adjustCacheableSize (memsize_t memDiff)
 
- Protected Member Functions inherited from MemCore::ReferenceBase< Cacheable >
virtual void extremeUnction ()
 
ReferenceBaseoperator= (const ReferenceBase &R)
 
void suicide ()
 

Detailed Description

template<class T, class Category, int MDIMS>
class Fiber::DirectProductMemArrayBase< T, Category, MDIMS >

Class for creating structured types as direct product of one-dimensional arrays.

An n-dimensional data type is defined over an n-dimensional manifold by assigning the value of the ith coordinate index to the ith component of the data type. Thus, given a set of $n$ one-dimensional arrays $A_i$, the resulting field is $A_0 \otimes A_1 \otimes \dots A_{n-1}$.

Examples for the one-dimensional component arrays can be data arrays explicitely specifying values, or a procedural array like the PolynomialArray<> that computes the data value from a set of coefficients. All component arrays must be childs of the virtual 1D array class VArray1D<>.

Parameters
TThe type that is created from the respective arrays at each index. It must provide an SIZE enum constant integer and a member typedef "value_type", such that T is equivalent to value_type[SIZE]. Only homogeneous types are allowed. The type T must also provide an element access operator [] that is accessible with an int and is convertible to the value_type.

Member Enumeration Documentation

◆ anonymous enum

template<class T , class Category , int MDIMS>
anonymous enum
Enumerator
COMPONENTS 

The number of components of the value type.

Dims 

The dimensionality of the base manifold.

Constructor & Destructor Documentation

◆ DirectProductMemArrayBase()

template<class T , class Category , int MDIMS>
Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::DirectProductMemArrayBase ( const MemBase::Creator_t C = MemCore::NullPtr())
inline

The constructor sets the component map such that the dimensions of the manifold are mapped to the first components of the structure.

All other components are set according to the value of this->origin, which is component-wise initialized with zero.

References Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::ComponentMap, Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::COMPONENTS, and Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::Dims.

Member Function Documentation

◆ copyFrom()

template<class T , class Category , int MDIMS>
bool Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::copyFrom ( const RefPtr< MemCore::ChunkBase > &  theChunk)
inlineoverridevirtual

Implements Fiber::MemBase.

◆ createEquallySizedMemArray()

template<class T , class Category , int MDIMS>
RefPtr< MemBase > Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::createEquallySizedMemArray ( const RefPtr< MemCore::ChunkBase > &  Storage,
const MemBase::Creator_t C 
) const
inlineoverridevirtual

Create a memory array of the same dimensions as the current array, but with data as provided by the Storage.

Will return NullPtr if the sizes don't match. Calls createMemArray() .

Implements Fiber::MemBase.

References Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::createMemArray().

◆ createMemArray()

template<class T , class Category , int MDIMS>
RefPtr< MemArray< MDIMS, T > > Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::createMemArray ( const RefPtr< MemCore::ChunkBase > &  Data,
const MemBase::Creator_t C 
) const
inline

Create a memory array of the same dimensions as the current array, but with data as provided by the Storage.

Will return NullPtr if the sizes don't match.

References size(), and Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::Size().

Referenced by Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::createEquallySizedMemArray().

◆ DeferredConstructor()

template<class T , class Category , int MDIMS>
void Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::DeferredConstructor ( )
inlineoverridevirtual

Virtual deferred reference pointer construction pointer Don't overload if you don't know exactly what this function is supposed to do. See class DynPtr for more info.

Implements Fiber::MemBase.

◆ getComponentArray()

template<class T , class Category , int MDIMS>
RefPtr< MemBase > Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::getComponentArray ( int  member,
const MemBase::Creator_t C 
)
inlineoverridevirtual

Implements Fiber::MemBase.

◆ getHyperslabParameters()

template<class T , class Category , int MDIMS>
HyperslabParameters & Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::getHyperslabParameters ( )
inlineoverridevirtual

Implements Fiber::MemBase.

◆ getIndex()

template<class T , class Category , int MDIMS>
FloatIndex_t Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::getIndex ( const T &  PointCoordinates) const
inline

Given the coordinates of a point, yield the index where it resides in the array.

The result is a floating point index providing information where within one cell the point resides, ie. when the ComponentMap is not identical mapping. Note that the result is normalized between 0.0. and 1.0 when inside the domain.

Todo:
Warning: this code is wrong when the number of components differs from the number of coordinate components. Would be simple to fix, but need to check cautiously.

References Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::ComponentMap, Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::COMPONENTS, Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::Components, and Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::Dims.

◆ getPtr()

template<class T , class Category , int MDIMS>
void * Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::getPtr ( )
inlineoverridevirtual

Implementation of the virtual MemArray function.

Implements Fiber::MemBase.

◆ getSlice()

template<class T , class Category , int MDIMS>
RefPtr< MemBase > Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::getSlice ( index_t  n,
const MemBase::Creator_t C 
) const
inlineoverridevirtual

For a multidimensional array retrieve the nth slice.

The result will be of one dimension less. A Creator object must be given for Cache management.

Implements Fiber::MemArrayBase< MDIMS >.

◆ memsize()

template<class T , class Category , int MDIMS>
MemCore::memsize_t Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::memsize ( ) const
inlineoverridevirtual

Implements MemCore::Cacheable.

◆ Size()

template<class T , class Category , int MDIMS>
MultiIndex< Dims > Fiber::DirectProductMemArrayBase< T, Category, MDIMS >::Size ( ) const
inlineoverridevirtual

Member Data Documentation

◆ ComponentMap