Fish - FiberLib for VISH 0.3
Fish - The Fiber Bundle API for the Vish Visualization Shell
Fiber::UnaryOperator< Operator, PrimaryValueType, ResultValueType > Struct Template Reference

Implementing an unary operation on a fields with on-demand computation per fragment and discarding data when memory is tight. More...

#include <UnaryOperator.hpp>

Inheritance diagram for Fiber::UnaryOperator< Operator, PrimaryValueType, ResultValueType >:
Eagle::Operator< OperatorID_t CompType, OperatorID_t bop >

Public Types

typedef PrimaryValueType primary_value_type
typedef ResultValueType result_type

Public Member Functions

 UnaryOperator ()
 The constructor.
template<Dims_t Dims>
bool computeFragment (MemArray< Dims, result_type > &Result, const MemArray< Dims, primary_value_type > &PrimaryArray, const RefPtr< FragmentID > &myFragmentID)
template<Dims_t Dims>
bool computeIndexedFragment (MemArray< Dims, result_type > &Result, const MemArray< Dims, primary_value_type > &PrimaryArray, const RefPtr< FragmentID > &myFragmentID)

Detailed Description

template<class Operator, class PrimaryValueType, class ResultValueType = PrimaryValueType>
struct Fiber::UnaryOperator< Operator, PrimaryValueType, ResultValueType >

Implementing an unary operation on a fields with on-demand computation per fragment and discarding data when memory is tight.

To be used in conjunction with the ComputationalField class. The Operator API is compatible with the Operators as defined in the Eagle library, and it is easiest to just use one of those.

The provided Operator class needs to provide a member function "binary(result,source)" which computes a certain value for a given input data element. It can be a static function or a member function. Example:

struct NegationOperator
{
static void binary(double&result, double inputValue)
{
result = -inputValue;
}
};
RefPtr<Field> Negation(const RefPtr<Field>&InputField)
{
return newComputationalField( MyOp, InputField);
}
ComputationalField< FieldOperator > * newComputationalField(const FieldOperator &FO, const RefPtr< Field > &InputField, const MemCore::RefPtr< MemCore::Cache > &theCache=MemCore::Cache::MemCache())
A convenience template function to construct a computational field (class ComputationalField) from an...
Definition ComputationalField.hpp:266
UnaryOperator()
The constructor.
Definition UnaryOperator.hpp:57

This class implements the computeFragment() function as expected by the ComputationalField class.