FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
Fiber::ComputationalField< FieldOperator > Class Template Reference

A field which contains computational operations that are executed on demand per fragment. More...

#include <ComputationalField.hpp>

Inheritance diagram for Fiber::ComputationalField< FieldOperator >:
Fiber::Field Fiber::Ownable< Field > MemCore::Intercube Fiber::FragmentIDCollectionProvider MemCore::Ageable Fiber::SaveableAttributes Fiber::OwnerBase MemCore::Attributes

Classes

struct  FragmentComputationParameters
 Internal helper class to pass parameters from the computational field class to the on-demand creators per fragment. More...
 
struct  FragmentComputer
 Internal helper class which calls the computeFragment() member function of the associated FieldOperator . More...
 

Public Types

using primary_value_type = typename FieldOperator::primary_value_type
 
using result_type = typename FieldOperator::result_type
 
- Public Types inherited from Fiber::Field
enum class  CreationFailAlternative { Fail , Persistent , Discardable }
 
using fragments_t = FlatMap< FragmentIndex_t, RefPtr< CreativeArrayBase > >
 
using fragment_mutex_t = MemCore::shared_mutex
 
using CAB_t = RefPtr< CreativeArrayBase >
 
typedef WeakPtr< Field, Field::reference_domain_t > WeakFieldPtr_t
 
using NamedFragment = std::pair< RefPtr< CreativeArrayBase >, RefPtr< FragmentID > >
 
using Iterator = FragmentIterator
 
using FragmentIterator_t = std::function< bool(const RefPtr< FragmentID > &, const RefPtr< CreativeArrayBase > &)>
 Callback type for functions iterating over Field fragments.
 
- Public Types inherited from Fiber::OwnerBase
template<class ItemType >
using Item = MemCore::InterfaceData< ItemType >
 An optional convenience class that allows to easily add arbitrary types to Intercubes .
 

Public Member Functions

 ComputationalField (const FieldOperator &FO, const RefPtr< Field > &InputField, const MemCore::RefPtr< MemCore::Cache > &theCache=MemCore::Cache::MemCache())
 The Constructor wants an instance of the associated field operator and the primary input field.
 
 ComputationalField (const FieldOperator &FO, const Field &InputField, const MemCore::RefPtr< MemCore::Cache > &theCache=MemCore::Cache::MemCache())
 The Constructor wants an instance of the associated field operator and the primary input field.
 
bool apply (const RefPtr< FragmentID > &fid, const RefPtr< CreativeArrayBase > &CAB)
 The fragment iteration callback function.
 
int createFieldFragments (const Field &SourceData)
 Create the fragments of this field, usually not to be called explicitly.
 
- Public Member Functions inherited from Fiber::Field
void reserve_fragments (size_t N)
 
void extremeUnction () override
 
void clear ()
 Remove all fragments of this Field.
 
FragmentIndex_t getNumericalID (const RefPtr< FragmentID > &fid)
 
FragmentIndex_t findNumericalID (const RefPtr< FragmentID > &fid) const
 
FragmentIndex_t findNumericalIDByName (const string &FragmentName) const
 
RefPtr< FragmentID > & makeFragmentID (const string &fragmentname)
 Create a new fragment ID if not existent yet.
 
RefPtr< FragmentID > & operator[] (const string &fragmentname)
 
RefPtr< FragmentIDCollectiongetFragmentIDCollection () const override
 
DynamicSize getFragmentLayout () const
 
const FragmentIDCollection::FragmentIDs_tgetFragmentIDs () const
 Return iteratable container of fragment ID's for this field.
 
 Field ()
 Default constructor, no data or fragments.
 
 Field (const RefPtr< FragmentIDCollection > &theFragmentIDCollection)
 Create a new field from an existing FragmentID collection, such as an existing field.
 
 Field (const WeakPtr< Field > &SimilarField)
 
 Field (const FragmentIDCollectionProvider &FICP)
 
 Field (const RefPtr< CreativeArrayBase > &FFC, const RefPtr< FragmentIDCollection > &theFragmentIDCollection=nullptr)
 Create unfragmented field with data creation via Creator.
 
 Field (const RefPtr< MemBase > &Mb, const RefPtr< FragmentIDCollection > &theFragmentIDCollection=nullptr)
 Create unfragmented field with data stored always in memory ( calls setPersistentData() )
 
 Field (const RefPtr< CreativeArrayBase > &FFC, const WeakPtr< Field > &SimilarField)
 
 Field (const RefPtr< MemBase > &MAb, const WeakPtr< Field > &SimilarField)
 
 Field (const RefPtr< CreativeArrayBase > &FFC, const FragmentIDCollectionProvider &FICP)
 
 Field (const RefPtr< MemBase > &MAb, const FragmentIDCollectionProvider &FICP)
 
 Field (const RefPtr< MemBase > &Mb, const RefPtr< MemCore::Cache > &Cache, const RefPtr< FragmentIDCollection > &theFragmentIDCollection=nullptr)
 Create unfragmented field with data stored in memory as long as the cache allows. ( calls setPersistentData() )
 
template<Dims_t DIMS>
 Field (const MultiIndex< DIMS > &NumberOfFragments, const string &FragmentNamePrefix)
 Create a field with a multi-dimensional regular layout for the fragments.
 
template<Dims_t DIMS>
bool setFragmentLayout (const MultiIndex< DIMS > &NumberOfFragments, const string &FragmentNamePrefix)
 Add a multi-dimensional regular layout for the fragments if it had no layout yet.
 
RefPtr< MemBasenewFragmentationArray () const
 For fields with a fragment layout provide such in a MultiArray.
 
template<class T , Dims_t N>
 Field (const MemCore::Ref< MemArray< N, T > > &MemRefPtr, const RefPtr< FragmentIDCollection > &theFragmentIDCollection=nullptr)
 Convenience function initializing from a Ref<> to some MemArray.
 
template<class T , Dims_t N>
 Field (const MemCore::RefPtr< MemArray< N, T > > &MemRefPtr, const RefPtr< FragmentIDCollection > &theFragmentIDCollection=nullptr)
 Convenience function initializing from a RefPtr<> to some MemArray.
 
template<class T , Dims_t N>
 Field (const MemCore::WeakPtr< MemArray< N, T > > &MemRefPtr, const RefPtr< FragmentIDCollection > &theFragmentIDCollection=nullptr)
 Convenience function initializing from a RefPtr<> to some MemArray.
 
template<class T , Dims_t N>
 Field (const MemCore::MemVector< T > &Data, const MultiIndex< N > &Size, const RefPtr< FragmentIDCollection > &theFragmentIDCollection=nullptr)
 Construct an unfragmented field from a MemVector and a MultiIndex.
 
template<class T , Dims_t N>
 Field (const MemCore::RefPtr< MemCore::TypedChunk< T > > &Data, const MultiIndex< N > &Size, const RefPtr< FragmentIDCollection > &theFragmentIDCollection=nullptr)
 Construct an unfragmented field from a Chunk of data and multidimensional index.
 
void own (CreativeArrayBase &CAB)
 
void own (const RefPtr< CreativeArrayBase > &CAB)
 
bool hasData (const RefPtr< FragmentID > &FID=nullptr) const
 Check if there are data on this field fragment.
 
const CAB_tsetPersistentData (const RefPtr< MemBase > &Mb, const RefPtr< FragmentID > &=nullptr, const RefPtr< MemCore::Cache > &Cache=MemCore::Cache::MemCache(), const string &ProvenanceInfo={})
 Set data for a certain field fragment that is always kept in memory, the cache reference is just use to trace memory utilization.
 
const CAB_tsetPersistentData (const RefPtr< MemBase > &Mb, const RefPtr< FragmentID > &fID, const string &ProvenanceInfo)
 
const CAB_tsetPersistentDataByName (const RefPtr< MemBase > &Mb, const string &FragmentName, const RefPtr< MemCore::Cache > &Cache=MemCore::Cache::MemCache())
 
template<class T , Dims_t N>
const CAB_tsetPersistentData (const MemCore::RefPtr< Chunk< T > > &Mb, const MultiIndex< N > &Dimensions, const RefPtr< FragmentID > &FragID=nullptr, const RefPtr< MemCore::Cache > &Cache=MemCore::Cache::MemCache())
 A convenience function to set a field's data from a Chunk of data.
 
template<class T , Dims_t N>
const CAB_tsetPersistentData (Chunk< T > *Mb, const MultiIndex< N > &Dimensions, const RefPtr< FragmentID > &FragID=nullptr, const RefPtr< MemCore::Cache > &Cache=MemCore::Cache::MemCache())
 A convenience function to set a field's data from a Chunk of data.
 
template<class T >
const CAB_tsetPersistentData1D (const MemCore::RefPtr< Chunk< T > > &data, const RefPtr< FragmentID > &FragID=nullptr, const RefPtr< MemCore::Cache > &Cache=MemCore::Cache::MemCache())
 A convenience function to set a field's data from a Chunk of data, interpreting them as one-dimensional.
 
RefPtr< MemArrayPropertiesgetProperties () const
 Return properties associated with this field.
 
const type_infogetFieldStorageType () const
 Get the type of the field.
 
const type_infogetElementType () const
 Retrieve the element type of this field, which is stored with the properties of this field.
 
MemCore::WeakPtr< FiberTypeBasegetElementFiberType () const
 Retrieve the fiber type that is associated with this field.
 
MemCore::WeakPtr< FiberTypeBasegetFiberType () const
 
int getMemoryUsage (memsize_t &UsedMemory, memsize_t &WantedMemory) const
 Get the memory occupied by this field (and all of its fragments).
 
bool isType (const TypeList_t &TL) const
 Check if the type of this field is contained in the given type list.
 
FiberTypeIndex getFiberTypeIndex () const
 
bool addFiberType (TypeList_t &TypeList) const
 Add the type used by this field to the given TypeList.
 
const RefPtr< CreativeArrayBase > & setCreator (const RefPtr< CreativeArrayBase > &FFC, const RefPtr< FragmentID > &=nullptr)
 Sets the creator for an unfragmented field.
 
const RefPtr< CreativeArrayBase > & setCreatorByName (const RefPtr< CreativeArrayBase > &FFC, const string &FragmentName)
 
const RefPtr< CreativeArrayBase > & setCompatibleCreator (const RefPtr< CreativeArrayBase > &CAB, const RefPtr< FragmentID > &fid=nullptr)
 Set the creator for a fragment ID on a different Skeleton such that the fragment IDs are different, only their names matching.
 
FunctionalCreatorsetLambda (const FunctionalCreator::Functor &F, const RefPtr< FragmentID > &fid=nullptr)
 
FunctionalCreatorsetLambda (const RefPtr< FragmentID > &fid, const FunctionalCreator::Functor &F)
 
FunctionalCreatorsetCompatibleLambda (const FunctionalCreator::Functor &F, const RefPtr< FragmentID > &fid=nullptr)
 
const RefPtr< CreativeArrayBase > & setFunctionalCreator (const FunctionalCreator::Functor &F, const RefPtr< FragmentID > &fid=nullptr)
 
template<class Functor >
FunctionalCreatorsetFunctor (const Functor &F, const RefPtr< FragmentID > &fid=nullptr)
 Alias for setLambda().
 
template<class Functor >
FunctionalCreatorsetFunctor (const RefPtr< FragmentID > &fid, const Functor &F)
 Alias for setLambda().
 
size_t nFragments () const
 The number of fragments in this field.
 
size_t NumberOfFragments () const
 The number of fragments in this field.
 
bool isUnfragmented () const
 
bool isFragmented () const
 
RefPtr< FragmentIDgetFragmentID (const string &FragmentName) const
 
RefPtr< FragmentIDoperator() (const string &FragmentName) const
 
RefPtr< CreativeArrayBasegetCreator (const RefPtr< FragmentID > &=nullptr) const
 Get the creator of an unfragmented field.
 
RefPtr< CreativeArrayBaseoperator() (const RefPtr< FragmentID > &FID=nullptr) const
 
RefPtr< CreativeArrayBasegetCreatorByName (const string &FragmentName) const
 Get the creator of an unfragmented field via the textual description of a fragment ID.
 
NamedFragment getCreatorByNameF (const string &FragmentName) const
 
RefPtr< CreativeArrayBasegetCreatorByNumericalID (FragmentIndex_t NumericalID) const
 
RefPtr< CreativeArrayBase > & getCreatorReferenceViaFragmentIndex (FragmentIndex_t NumericalID)
 
RefPtr< CreativeArrayBasegetCreator (FragmentIndex_t NumericalID) const
 
RefPtr< CreativeArrayBasegetCompatibleCreator (const RefPtr< FragmentID > &F=nullptr) const
 Get a creator from a fragment ID that is NAMED similar to one fragment here.
 
NamedFragment getCompatibleCreatorF (const RefPtr< FragmentID > &F=nullptr) const
 Get a creator from a fragment ID that is NAMED similar to one fragment here.
 
RefPtr< MemBasegetData (const RefPtr< FragmentID > &FID=nullptr) const
 Get the data of a contigous field.
 
RefPtr< MemBasegetDataByNumericalID (FragmentIndex_t NumericalID) const
 Get some fragment's data via its numerical fragment ID.
 
 DEPRECATED ("Use function getDataByNumericalID() instead", RefPtr< MemBase > getData(FragmentIndex_t NumericalID) const)
 
RefPtr< MemBasegetFirstData () const
 In case this is field is fragmented, but there is only one fragment, return the ID of this singular fragment.
 
RefPtr< CreativeArrayBasegetFirstCreator () const
 In case this is field is fragmented, but there is only one fragment, return the ID of this singular fragment.
 
RefPtr< FragmentIDgetFirstFragmentID () const
 Get the first fragment ID.
 
RefPtr< MemCore::ChunkBasegetChunk (const RefPtr< FragmentID > &FID=nullptr) const
 Return the stored memory chunk associated with this array.
 
RefPtr< MemBasegetCompatibleData (const RefPtr< FragmentID > &F=nullptr) const
 Get data from a fragment ID that is NAMED similar to one fragment here.
 
unsigned iterate (FragmentIterator &, const MemCore::WeakPtr< FragmentSelector > &FS=nullptr) const
 
template<class T >
unsigned Iterate (const T &t, const MemCore::WeakPtr< FragmentSelector > &FS=nullptr) const
 
template<class T >
unsigned iterate_fragments (const T &t, const MemCore::WeakPtr< FragmentSelector > &FS=nullptr) const
 
Ageable getMostRecentCreatorAge () const
 
Ageable getMostRecentAttributeAge () const
 
bool hasFragmentsNewerThan (const Ageable &A) const
 
unsigned iterate (const FragmentIterator_t &FI, bool parallel=false, bool copy_map_internally=false) const
 
unsigned iterate (bool parallel, const FragmentIterator_t &FI, bool copy_map_internally=false) const
 Same as iterate(const FragmentIterator_t&, bool), just other order of arguments for convenience.
 
unsigned iterate_parallel (const FragmentIterator_t &FI, bool copy_map_internally=false) const
 Iterate over all fragments in parallel.
 
unsigned iterate (FragmentIndexIterator &FFI, const WeakPtr< FragmentSelector > &FS=nullptr, bool copy_map_internally=false) const
 Iterate over the fragments of a field using the integer ID of each fragment.
 
Dims_t Dims () const
 The dimensionality of the field, taken from the getProperties().
 
RefPtr< SizeInterfacegetSize () const
 The size of the field, which is the sum of all fragments.
 
bool isCompatible (const Field &F)
 
void Speak (int indent=0, int maxindent=-1) const
 Informative debug message.
 
string xml () const
 
RefPtr< CreativeArrayBasecreateCreator (const RefPtr< MemBase > &Data, const RefPtr< FragmentID > &=nullptr, CreationFailAlternative=CreationFailAlternative::Persistent, const WeakPtr< MemCore::Cache > &theCache=MemCore::Cache::MemCache())
 Insert some data into a Field with various memory management methods.
 
RefPtr< CreativeArrayBasecreateCreator (const RefPtr< MemBase > &Data, const string &FragmentName, CreationFailAlternative=CreationFailAlternative::Persistent, const WeakPtr< MemCore::Cache > &theCache=MemCore::Cache::MemCache())
 
template<Dims_t N, class T >
std::pair< RefPtr< MemArray< N, T > >, RefPtr< CreativeArrayBase > > createData (const MultiIndex< N > &Size, const RefPtr< FragmentID > &fid=nullptr, Field::CreationFailAlternative FailMode=Field::CreationFailAlternative::Persistent, const WeakPtr< MemCore::Cache > &theCache=MemCore::Cache::MemCache())
 Create a mem array and insert it as a fragment to the Field.
 
template<Dims_t N, class T >
std::pair< RefPtr< MemArray< N, T > >, RefPtr< CreativeArrayBase > > createData (const MultiIndex< N > &Size, const string &fragmentname, Field::CreationFailAlternative FailMode=Field::CreationFailAlternative::Persistent, const WeakPtr< MemCore::Cache > &theCache=MemCore::Cache::MemCache())
 Create a mem array and insert it as a fragment to the Field under the given fragmentname:
 
template<Dims_t Dims>
MultiIndex< Dims > & setFragmentOffset (const string &FragmentName, const MultiIndex< Dims > &Offset)
 Set a fragment's index offset.
 
- Public Member Functions inherited from Fiber::Ownable< Field >
void x_updateOwnershipAge (const MemCore::Ageable &theNewAge) override
 Forward some age to all Owners.
 
void insertOwner (const Container &theOwner)
 Add some owner.
 
bool insertOwner (const MemCore::WeakPtr< Container > &theOwner)
 Add some owner.
 
void addOwner (const Container &theOwner, const MemCore::Ageable &theNewAge)
 Add some owner and broadcast a new age to all Ownerrs.
 
void addOwner (const MemCore::WeakPtr< Container > &theOwner, const MemCore::Ageable &theNewAge)
 Add some owner and broadcast a new age to all Ownerrs.
 
 Ownable ()
 Default constructor, empty Ownership list.
 
 Ownable (const Ownable &)
 Copy constructor, does NOT copy any ownership information, the new Ownable will be unowned.
 
 Ownable (const MemCore::WeakPtr< Container > &theOwner, const MemCore::Ageable &theNewAge)
 Construct an Ownable with an initial owner.
 
 Ownable (const Container &theOwner, const MemCore::Ageable &theNewAge)
 Construct an Ownable with an initial owner.
 
Ownableoperator= (const Ownable &)
 Assignment, does NOT copy any ownership information, the assigned Ownable will retain all its ownership information.
 
MemCore::WeakPtr< Container > getPrimaryOwner () const
 Get the first valid owner.
 
size_t getNumberOfValidOwners () const
 Get the first valid owner.
 
bool processOwnership (MemCore::Intercube &Output, const MemCore::Intercube &Input) const override
 Process some ownership action.
 
- Public Member Functions inherited from Fiber::OwnerBase
bool processOwnership (MemCore::Intercube &OutputAndInput) const
 Process ownership where the input information is shared with the output information in the same Intercube.
 
- 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 Member Functions inherited from MemCore::Ageable
constexpr Ageable (age_t t) noexcept
 
constexpr Ageable (const Ageable &A) noexcept
 
 Ageable (const volatile Ageable &A) noexcept
 
constexpr const AgeablegetAge () const
 
bool isNewerThan (const Ageable &a) const noexcept
 
bool isOlderThan (const Ageable &a) const noexcept
 
bool isYoungerThan (const Ageable &a) const noexcept
 
bool operator!= (const Ageable &a) const noexcept
 
bool operator< (const Ageable &a) const noexcept
 
bool operator<= (const Ageable &a) const noexcept
 
bool operator<= (const volatile Ageable &a) const volatile noexcept
 
bool operator== (const Ageable &a) const noexcept
 
bool operator> (const Ageable &a) const noexcept
 
bool operator> (const volatile Ageable &a) const volatile
 
bool operator>= (const Ageable &a) const noexcept
 
bool operator>= (const volatile Ageable &a) const volatile noexcept
 
constexpr void resetAge () noexcept
 
void setInfinitelyNew () noexcept
 
age_t time_value () const noexcept
 
age_t time_value () const volatile noexcept
 
Ageabletouch () noexcept
 
age_t update (age_t age) noexcept
 
age_t update (const Ageable &Other) noexcept
 
age_t update (const volatile Ageable &Other) volatile noexcept
 
- Public Member Functions inherited from Fiber::SaveableAttributes
void attributesHaveBeenSaved () const
 
bool attributesNeedSaving () const
 
- Public Member Functions inherited from MemCore::Attributes
MemCore::RefPtr< MemCore::ChunkBasegetAttribute (const std::string &name) const
 
const AgeablegetAttributeAge () const
 
std::pair< bool, T > getAttributeValue (const string &AttributeName, size_t ElementNumber=0) const
 
attributes_t & getAttributeValues ()
 
const attributes_t & getAttributeValues () const
 
size_t getNumberOfAttributes () const
 
bool hasAttribute (const std::string &name) const
 
int Iterate (const Functor &L) const
 
int iterate (Iterator &it) const
 
int iterate_attributes (const Functor &L) const
 
size_t NumberOfAttributes () const
 
void setAttribute (const std::string &name, const MemCore::RefPtr< MemCore::ChunkBase > &AttribData)
 
ResizableChunk< T > & setAttributeValue (const std::string &name, const T &AttribData)
 
ResizableChunk< T > & setAttributeValues (const std::string &name, const std::initializer_list< T > &AttribData)
 
const T & setValue (const T &AttribData, const std::string &name)
 
const T & setValue (const T &AttribData, const std::string &name, const std::string &Comment, const std::string &CommentPrefix="Comment")
 
string toString () const
 
const AgeabletouchAttributes () const
 
const AgeableupdateAttributeAge (const Ageable &A) const
 

Public Attributes

MemCore::RefPtr< MemCore::CachemyCache
 Reference to the cache object managing the memory occupied by the resulting data.
 
- Public Attributes inherited from Fiber::Field
ListRelativeToBinder< WeakPtr< CreativeArrayBase > > UnsavedCreators
 
- Public Attributes inherited from Fiber::Ownable< Field >
std::unordered_set< MemCore::WeakPtr< Container > > Owners
 The (internal) list of owners.
 
- Public Attributes inherited from Fiber::SaveableAttributes
MemCore::Ageable LastSavedAttributes
 

Additional Inherited Members

- Static Public Member Functions inherited from Fiber::Field
static const CAB_tCreativeArrayNullPtr ()
 
static const RefPtr< Field > & NullPtrField ()
 
- Static Public Member Functions inherited from MemCore::Ageable
static const AgeableInfinitelyNew () noexcept
 
static constexpr const AgeableInfinitelyOld () noexcept
 
static age_t now () noexcept
 
- Static Public Attributes inherited from Fiber::Field
static constexpr bool use_std__flat_map_for_fragments = false
 
- Protected Member Functions inherited from Fiber::Field
const RefPtr< CreativeArrayBase > & setCreatorViaFragmentIndex (FragmentIndex_t FI, const RefPtr< CreativeArrayBase > &CAB)
 
 ~Field ()
 Destructor.
 
- Protected Attributes inherited from Fiber::Field
MemCore::shared_mutex fragment_mutex
 
fragments_t fragments
 

Detailed Description

template<class FieldOperator>
class Fiber::ComputationalField< FieldOperator >

A field which contains computational operations that are executed on demand per fragment.

Data are created via the OnDemandCreator class.

A computational field will have at least one dependency, the InputField, from which it retrieves the fragmentation and dimensionality of the fragments. The provided FieldOperator may well define operations to involved additional fields.

The provided FieldOperator class export type definitions for the primary and result value, plus a computeFragment() member function that implements the actual iteration over multi-dimensional arrays. Such a FieldOperator may look like this:

struct FieldOperator
{
typedef double primary_value_type;
typedef double result_type;
template <int Dims>
bool computeFragment(MemArray<Dims, result_type>&Result,
const RefPtr<FragmentID>&myFragmentID)
{
do
{
Result[ Index ] = InputData[ Index ] * 42 + 3.1492;
}
while( Index.inc(Size) );
return true;
}
};
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34

And it would be called like this:

{
FieldOperator myFieldOperator;
}
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

A Field Operator may well include some data members, these will be available in the FieldOperator's computeFragment() function. For instance, such data members may include reference pointers to additional fields, from which the computeFragment() function retrieves data arrays using the given fragment ID. A typical example is a binary operator on fields.

Constructor & Destructor Documentation

◆ ComputationalField() [1/2]

template<class FieldOperator >
Fiber::ComputationalField< FieldOperator >::ComputationalField ( const FieldOperator &  FO,
const RefPtr< Field > &  InputField,
const MemCore::RefPtr< MemCore::Cache > &  theCache = MemCore::Cache::MemCache() 
)
inline

The Constructor wants an instance of the associated field operator and the primary input field.

Optionally an alternative cache object can be specified.

References Fiber::ComputationalField< FieldOperator >::createFieldFragments().

◆ ComputationalField() [2/2]

template<class FieldOperator >
Fiber::ComputationalField< FieldOperator >::ComputationalField ( const FieldOperator &  FO,
const Field InputField,
const MemCore::RefPtr< MemCore::Cache > &  theCache = MemCore::Cache::MemCache() 
)
inline

The Constructor wants an instance of the associated field operator and the primary input field.

Optionally an alternative cache object can be specified.

References Fiber::ComputationalField< FieldOperator >::createFieldFragments().

Member Function Documentation

◆ apply()

template<class FieldOperator >
bool Fiber::ComputationalField< FieldOperator >::apply ( const RefPtr< FragmentID > &  fid,
const RefPtr< CreativeArrayBase > &  CAB 
)
inline

The fragment iteration callback function.

Used internally via createFieldFragments();

This function checks the dimensionality of the given Creator and establishes an appropriate OnDemandCreator of the same dimensionality using the FragmentComputer.

References Fiber::ComputationalField< FieldOperator >::myCache, and Fiber::Field::setCreator().

Referenced by Fiber::ComputationalField< FieldOperator >::createFieldFragments().

◆ createFieldFragments()

template<class FieldOperator >
int Fiber::ComputationalField< FieldOperator >::createFieldFragments ( const Field SourceData)
inline

Create the fragments of this field, usually not to be called explicitly.

This function iterates over the fragments of the given source field and sets up Creator objects for the fragments of the current field. No actual operations are performed here.

This is usually done in the constructor of the ComputationalField, so there is no real need to call this function explicitly. However, if there was no field given during construction, then this function can be called at a later time to establish the computational field.

References Fiber::ComputationalField< FieldOperator >::apply().

Referenced by Fiber::ComputationalField< FieldOperator >::ComputationalField(), and Fiber::ComputationalField< FieldOperator >::ComputationalField().