FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
Public Types | Public Member Functions | List of all members
Fiber::SliceExtractor< Converter, InputType > Struct Template Reference

Template class to construct an OnDemandCreator to extract a 2D slice from a 3D data array with abitrary data conversion during extraction. More...

#include <SliceExtractor.hpp>

Public Types

typedef SliceExtractor< Converter, META::NIL >::Constructor_t Constructor_t
 
typedef Converter::output_type output_type
 
typedef InputType input_type
 

Public Member Functions

 SliceExtractor (Constructor_t &Params, const WeakPtr< CreativeArrayBase > &CAB)
 

Detailed Description

template<class Converter, class InputType>
struct Fiber::SliceExtractor< Converter, InputType >

Template class to construct an OnDemandCreator to extract a 2D slice from a 3D data array with abitrary data conversion during extraction.

The slice extractor for a specific input type.

The converter template class argument needs to provides an optional input and mandatory output types, plus a copy() function:

struct CopyConverter
{
typedef double input_type;
typedef double output_type;
template <class Dst, class Src>
void copy(Dst&dst, const Src&src) const
{
dst = src;
}
};
constexpr _OI copy(_II __first, _II __last, _OI __result)
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34

Using the SliceExtractor then allows to define a Creator that extracts slices on demand from a list of possible input types:

using namespace META;

Usage:

...
CopyConverter myConverter;
// Extract 2D data from 3D on demand.
OutputField->setCreator(new MyExtractionCreator(
static RefPtr< Cache, CacheBase > & MemCache()
Definition CreativeIterator.hpp:84

Note that some output arrays require the destination type to be a type itself instead of a reference to a type when access to an array is performed via a proxy class. This is the case for instance when using FixedArray<> as argument type:

struct ToDbl3Converter
{
typedef FixedArray<double,3> output_type;
template <class Dst, class Src>
void copy(Dst dst, const Src&src) const
{
dst = src;
}
};

As advanced usage, the converter may also perform numerical operations during slice extraction, for instance computing the norm of a vector (actually, a 3-vector's base class in this code snippet):

struct NormalizingConverter
{
typedef double output_type;
void copy(double&dst, const FixedArray<double,3>&P) const
{
dst = sqrt( P[0]*P[0] + P[1]*P[1] + P[2]*P[2] );
}
};
complex< _Tp > sqrt(const complex< _Tp > &)
See also
Slicer