FiberVISH  0.2
Fish-TheFiberBundleAPIfortheVishVisualizationShell
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Attributes | Related Functions | List of all members
Fiber::Field Class Reference

A Field is a collection of CreativeArrayBase pointers which are accessed via FragmentID objects. More...

#include <Field.hpp>

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

Public Types

enum  CreationFailAlternative { Fail, Persistent, Discardable }
 
using CAB_t = RefPtr< CreativeArrayBase >
 
typedef WeakPtr< Field,
Field::reference_domain_t > 
WeakFieldPtr_t
 
using NamedFragment = std::tuple< 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 Member Functions

void extremeUnction () override
 
void clear ()
 Remove all fragments of this Field.
 
int getNumericalID (const RefPtr< FragmentID > &fid)
 
int findNumericalID (const RefPtr< FragmentID > &fid) const
 
int 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)
 
const RefPtr
< FragmentIDCollection > & 
getFragmentIDCollection () const
 
DynamicSize getFragmentLayout () const
 
const
FragmentIDCollection::FragmentIDs_t & 
getFragmentIDs () 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 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< 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<int DIMS>
 Field (const MultiIndex< DIMS > &NumberOfFragments, const string &FragmentNamePrefix)
 Create a field with a multi-dimensional regular layout for the fragments.
 
template<int 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 , int 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 , int 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 , int 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 , int 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. More...
 
template<class T , int 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. More...
 
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_t & setPersistentData (const RefPtr< MemBase > &Mb, const RefPtr< FragmentID > &=NullPtr(), const RefPtr< MemCore::Cache > &Cache=MemCore::Cache::MemCache())
 Set data for a certain field fragment that is always kept in memory, the cache reference is just use to trace memory utilization. More...
 
const CAB_t & setPersistentDataByName (const RefPtr< MemBase > &Mb, const string &FragmentName, const RefPtr< MemCore::Cache > &Cache=MemCore::Cache::MemCache())
 
template<class T , int N>
const CAB_t & setPersistentData (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. More...
 
template<class T , int N>
const CAB_t & setPersistentData (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. More...
 
template<class T >
const CAB_t & setPersistentData1D (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. More...
 
 ~Field ()
 Destructor.
 
RefPtr< MemArrayPropertiesgetProperties () const
 Return properties associated with this field. More...
 
const type_info & getFieldStorageType () const
 Get the type of the field. More...
 
const type_info & getElementType () const
 Retrieve the element type of this field, which is stored with the properties of this field. More...
 
MemCore::WeakPtr< FiberTypeBasegetElementFiberType () const
 
int getMemoryUsage (memsize_t &UsedMemory, memsize_t &WantedMemory) const
 Get the memory occupied by this field (and all of its fragments). More...
 
bool isType (const TypeList_t &TL) const
 Check if the type of this field is contained in the given type list. More...
 
const FiberTypeBasegetFiberType () const
 Retrieve the fiber type that is associated with this field. More...
 
bool addFiberType (TypeList_t &TypeList) const
 Add the type used by this field to the given TypeList. More...
 
const RefPtr< CreativeArrayBase > & setCreator (const RefPtr< CreativeArrayBase > &FFC, const RefPtr< FragmentID > &=NullPtr())
 Sets the creator for an unfragmented field. More...
 
const RefPtr< CreativeArrayBase > & setCreatorByName (const RefPtr< CreativeArrayBase > &FFC, const string &FragmentName)
 
template<class Functor >
FunctionalCreatorsetLambda (const Functor &F, const RefPtr< FragmentID > &fid=NullPtr())
 Set a lambda function as on-demand creator for a Field, such as in: More...
 
template<class Functor >
FunctionalCreatorsetLambda (const RefPtr< FragmentID > &fid, const Functor &F)
 
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. More...
 
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 (int NumericalID) const
 
RefPtr< CreativeArrayBasegetCreator (int 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. More...
 
RefPtr< MemBasegetDataByNumericalID (int NumericalID) const
 Get some fragment's data via its numerical fragment ID. More...
 
 DEPRECATED ("Use function getDataByNumericalID() instead", RefPtr< MemBase > getData(int 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. More...
 
RefPtr< CreativeArrayBasegetFirstCreator () const
 In case this is field is fragmented, but there is only one fragment, return the ID of this singular fragment. More...
 
RefPtr< FragmentIDgetFirstFragmentID () const
 Get the first fragment ID. More...
 
RefPtr< MemCore::ChunkBasegetChunk (const RefPtr< FragmentID > &FID=NullPtr()) const
 Return the stored memory chunk associated with this array. More...
 
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
 
unsigned iterate (const FragmentIterator_t &FI, bool parallel=false) const
 Iterate over fragments of a field using std::function .
 
unsigned iterate (bool parallel, const FragmentIterator_t &FI) const
 Same as iterate(const FragmentIterator_t&, bool), just other order of arguments for convenience.
 
unsigned iterate_parallel (const FragmentIterator_t &FI) const
 Iterate over all fragments in parallel. More...
 
unsigned iterate (FragmentIndexIterator &FFI, const WeakPtr< FragmentSelector > &FS=NullPtr()) const
 Iterate over the fragments of a field using the integer ID of each fragment.
 
int Dims () const
 The dimensionality of the field, taken from the getProperties(). More...
 
RefPtr< SizeInterfacegetSize () const
 The size of the field, which is the sum of all fragments. More...
 
bool isCompatible (const Field &F)
 
void Speak (int indent=0, int maxindent=-1) const
 Informative debug message. More...
 
string xml () const
 
RefPtr< CreativeArrayBasecreateCreator (const RefPtr< MemBase > &Data, const RefPtr< FragmentID > &=NullPtr(), CreationFailAlternative=CreationFailAlternative::Discardable, 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::Discardable, const WeakPtr< MemCore::Cache > &theCache=MemCore::Cache::MemCache())
 
RefPtr< MemBasecreateData (const DynamicSize &N, const type_info &T, const RefPtr< FragmentID > &fid=NullPtr(), Field::CreationFailAlternative FailMode=Field::CreationFailAlternative::Discardable, const WeakPtr< MemCore::Cache > &theCache=MemCore::Cache::MemCache())
 
template<int N, class T >
RefPtr< ReferencingMemArray< N,
T > > 
createData (const MultiIndex< N > &M, const RefPtr< FragmentID > &fid=NullPtr(), Field::CreationFailAlternative FailMode=Field::CreationFailAlternative::Discardable, const WeakPtr< MemCore::Cache > &theCache=MemCore::Cache::MemCache())
 
template<int Dims>
MultiIndex< Dims > & setFragmentOffset (const string &FragmentName, const MultiIndex< Dims > &Offset)
 Set a fragment's index offset.
 
std::tuple< Field *, RefPtr
< FragmentID > > 
operator<< (const RefPtr< FragmentID > &Fid)
 
std::tuple< Field *, RefPtr
< FragmentID > > 
operator<< (const string &FragmentName)
 
- Public Member Functions inherited from Fiber::Ownable< Field >
void 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::SaveableAttributes
void attributesHaveBeenSaved () const
 
bool attributesNeedSaving () const
 
- Public Member Functions inherited from MemCore::Attributes
MemCore::RefPtr
< MemCore::ChunkBase
getAttribute (const std::string &name) const
 
attributes_t & getAttributeValues ()
 
const attributes_t & getAttributeValues () const
 
size_t getNumberOfAttributes () const
 
bool hasAttribute (const std::string &name) const
 
int iterate (Iterator &it) const
 
int Iterate (const Functor &L) 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)
 
string toString () const
 
const AgeabletouchAttributes () const
 
const AgeableupdateAttributeAge (const Ageable &A) const
 

Static Public Member Functions

static const CAB_t & CreativeArrayNullPtr ()
 
static const RefPtr< Field > & NullPtrField ()
 

Public Attributes

ListRelativeToBinder< WeakPtr
< CreativeArrayBase > > 
UnsavedCreators
 
- Public Attributes inherited from Fiber::Ownable< Field >
std::unordered_set
< MemCore::WeakPtr< Container > > 
Owners
 The (internal) list of owners. More...
 
- Public Attributes inherited from Fiber::SaveableAttributes
MemCore::Ageable LastSavedAttributes
 

Protected Types

typedef MemCore::RefMap
< unsigned, CreativeArrayBase
fragments_t
 

Protected Attributes

std::mutex fragment_mutex
 
fragments_t fragments
 

Related Functions

(Note that these are not member functions.)

bool validate (int FragmentNumber) const
 Check if a given fragment number is valid within this field.
 
bool setDiscardableData (const RefPtr< MemBase > &Mb, const RefPtr< MemCore::Cache > &Cache=MemCore::Cache::MemCache(), const RefPtr< FragmentID > &=NullPtr())
 A simplied function for data that can be discarded at any time. More...
 

Detailed Description

A Field is a collection of CreativeArrayBase pointers which are accessed via FragmentID objects.

Each entry describes a fragment of the entire field.

A field is a dataset which is given on various points of a topological space. It consists of a collection of multidimensional arrays (class MultiArray) with same dimensionality. If there is only one such multidimensional array, then the field is called contiguous, otherwise it is fragmented.

Note that the dimensionality of the arrays only corresponds to the dimensions of the topological space if that one is regular. Otherwise, the arrays will just be one-dimensional

The field class provides aging (a counter telling when it has been modified) and deferred data loading via external I/O layers (which can be added at runtime).

In other words, the data of the field are logically available as multidimensional arrays. As a special case, these data may also be portioned in multiple fragments, which are multidimensional arrays themselves. For instance, this may be useful for data from a domain-decomposed parallel computation. The fragments do not necessarily need to cover the entire domain. A sparse cover may be used to describe one level of an adaptive mesh. Mixing fragments of different dimensionality makes no sense.

A section of the fiber bundle is a Field plus coordinates.

Examples:
ComputeNormals.cpp, TransparentColoredSurface.cpp, trimesh.cpp, XF_LineSetFragmented.cpp, and XF_LineSetHierarchical.cpp.

Constructor & Destructor Documentation

template<class T , int N>
Fiber::Field::Field ( const MemCore::MemVector< T > &  Data,
const MultiIndex< N > &  Size,
const RefPtr< FragmentIDCollection > &  theFragmentIDCollection = nullptr 
)
inline

Construct an unfragmented field from a MemVector and a MultiIndex.

Implicitly creates a MemArray of the proper dimension.

template<class T , int N>
Fiber::Field::Field ( const MemCore::RefPtr< MemCore::TypedChunk< T >> &  Data,
const MultiIndex< N > &  Size,
const RefPtr< FragmentIDCollection > &  theFragmentIDCollection = nullptr 
)
inline

Construct an unfragmented field from a Chunk of data and multidimensional index.

Implicitly creates a MemArray.

Member Function Documentation

bool Fiber::Field::addFiberType ( TypeList_t TypeList) const
inline

Add the type used by this field to the given TypeList.

The type is supposed to be stored with the properties of this field, see the getProperties() function for more information. This function does NOT load or create any data associated with this Field.

Parameters
TypeListThe list of types that shall on return contain the type of this field.
Returns
false if no type information is available, and consequently no type could be added.

Referenced by Wizt::FieldObject::update().

template<int N, class T >
RefPtr<ReferencingMemArray<N, T> > Fiber::Field::createData ( const MultiIndex< N > &  M,
const RefPtr< FragmentID > &  fid = NullPtr(),
Field::CreationFailAlternative  FailMode = Field::CreationFailAlternative::Discardable,
const WeakPtr< MemCore::Cache > &  theCache = MemCore::Cache::MemCache() 
)
inline
RefPtr<MemArray<3, double> >
T = createData<3,double>({3,3,3});
int Fiber::Field::Dims ( ) const

The dimensionality of the field, taken from the getProperties().

Returns
If no field fragments are defined or the field is constant (no dimensionality), a negative value is returned.

References getProperties().

RefPtr<MemCore::ChunkBase> Fiber::Field::getChunk ( const RefPtr< FragmentID > &  FID = NullPtr()) const
inline

Return the stored memory chunk associated with this array.

Will only work of the data for this fragment is contiguous.

RefPtr< CreativeArrayBase > Fiber::Field::getCreator ( const RefPtr< FragmentID > &  fid = NullPtr()) const

Get the creator of an unfragmented field.

Returns
NullPtr(), if there are only field fragments or no creator is available.

Referenced by Fiber::FieldSaver::apply(), Fiber::fsFieldSaver::apply(), Fiber::SaveImage::apply(), Fiber::FEM::GetFirstFieldSize::apply(), getCompatibleCreatorF(), getData(), Wizt::ShaderFields::getShaderDefinitions(), and Fiber::PartialDerivative().

RefPtr< MemBase > Fiber::Field::getData ( const RefPtr< FragmentID > &  FID = NullPtr()) const

Get the data of a contigous field.

Returns Null if the data could not be created or the field is fragmented. For fragmented fields, use iterate();

References getCreator().

Referenced by Fiber::GridEvaluator::evalFloatIndices(), and Fiber::pullFragments().

RefPtr< MemBase > Fiber::Field::getDataByNumericalID ( int  NumericalID) const

Get some fragment's data via its numerical fragment ID.

In general, this function will return the field's first fragment data and return a valid result regardless of the field being unfragmented or fragmented. In contrast, function getData() will yield a valid result only if the field is unfragmented. However, numerical IDs are just associated with fragments and in some cases a fragment number zero may no exist at all. Thus it is possible that a field with many fragments yields invalid data on getDataByNumericalID(0)

const type_info & Fiber::Field::getElementType ( ) const
const FiberTypeBase& Fiber::Field::getFiberType ( ) const
inline

Retrieve the fiber type that is associated with this field.

It is stored with the properties of this field, see the getProperties() function for more information.

Referenced by getMemoryUsage().

const type_info & Fiber::Field::getFieldStorageType ( ) const

Get the type of the field.

Returns
If no data type information is available, e.g. no field data available at all, then typeid (void) is returned.
Note
The type returned here refers to the type information of the entire field, not of the field's elements! Use getElementType() to retrieve this information.
RefPtr< CreativeArrayBase > Fiber::Field::getFirstCreator ( ) const

In case this is field is fragmented, but there is only one fragment, return the ID of this singular fragment.

Will return Null otherwise.

Referenced by getFirstData().

RefPtr< MemBase > Fiber::Field::getFirstData ( ) const

In case this is field is fragmented, but there is only one fragment, return the ID of this singular fragment.

Will return Null otherwise.

References getFirstCreator().

RefPtr< FragmentID > Fiber::Field::getFirstFragmentID ( ) const

Get the first fragment ID.

This function is useful only for special cases when a field is fragmented into a single fragment and this property is required. In all other cases, iteration over all fragments is highly recommended. This is pretty much always the case.

int Fiber::Field::getMemoryUsage ( memsize_t UsedMemory,
memsize_t WantedMemory 
) const

Get the memory occupied by this field (and all of its fragments).

Note that if fragments are shared then they will be counted twice here.

Returns
Indicates whether this field has loaded any memory objects at all, actually how many fragments here have loaded data.

References getFiberType(), and Fiber::FiberTypeBase::mem_size().

RefPtr< MemArrayProperties > Fiber::Field::getProperties ( ) const

Return properties associated with this field.

Note that properties are stored with field fragments as an Interface. All fragments are supposed to provide compatible properties, so this function returns the first one found with an arbitrary fragment.

Referenced by Dims(), and getElementType().

RefPtr< SizeInterface > Fiber::Field::getSize ( ) const

The size of the field, which is the sum of all fragments.

Returns
A NullPtr() will be returned if the size cannot be determined, e.g. due to inconsistent rank of fragments, or no fragments existing here at all.
bool Fiber::Field::isType ( const TypeList_t TL) const
inline

Check if the type of this field is contained in the given type list.

Parameters
TLA list of types.

References Fiber::containsType().

Referenced by Wizt::FieldObject::update().

unsigned Fiber::Field::iterate_parallel ( const FragmentIterator_t FI) const
inline

Iterate over all fragments in parallel.

Same as iterate(,true);

const RefPtr< CreativeArrayBase > & Fiber::Field::setCreator ( const RefPtr< CreativeArrayBase > &  FFC,
const RefPtr< FragmentID > &  fid = NullPtr() 
)

Sets the creator for an unfragmented field.

An eventually existing creator is overwritten.

Note
Setting an unfragmented field creator does not make sense for fragmented fields. So if nFragments() is larger than one, this function does not make anything meaningfull.

Referenced by Fiber::ComputationalField< FieldOperator >::apply(), Field(), Fiber::PartialDerivative(), and setDiscardableData().

template<class Functor >
FunctionalCreator& Fiber::Field::setLambda ( const Functor F,
const RefPtr< FragmentID > &  fid = NullPtr() 
)
inline

Set a lambda function as on-demand creator for a Field, such as in:

RefPtr<Field> ResultField;
ResultField->setLambda( []() -> RefPtr<MemBase>
{
return new MemArray<...>(...);
}
);

Special attention must be given to the captures of the lambda function to avoid dangling references, strong pointers and references to MemBase instances.

const Field::CAB_t & Fiber::Field::setPersistentData ( const RefPtr< MemBase > &  Mb,
const RefPtr< FragmentID > &  fid = NullPtr(),
const RefPtr< MemCore::Cache > &  Cache = MemCore::Cache::MemCache() 
)

Set data for a certain field fragment that is always kept in memory, the cache reference is just use to trace memory utilization.

As such, all data added to the cache this way will contribute to the overall memory counting, even though the data added here cannot be removed from memory.

Todo:
Revise this API

Referenced by Field(), and Fiber::pullFragments().

template<class T , int N>
const CAB_t& Fiber::Field::setPersistentData ( const MemCore::RefPtr< Chunk< T > > &  Mb,
const MultiIndex< N > &  Dimensions,
const RefPtr< FragmentID > &  FragID = NullPtr(),
const RefPtr< MemCore::Cache > &  Cache = MemCore::Cache::MemCache() 
)
inline

A convenience function to set a field's data from a Chunk of data.

Calls setPersistentData(), as data will be kept forever in memory and never discared (use with care).

template<class T , int N>
const CAB_t& Fiber::Field::setPersistentData ( Chunk< T > *  Mb,
const MultiIndex< N > &  Dimensions,
const RefPtr< FragmentID > &  FragID = NullPtr(),
const RefPtr< MemCore::Cache > &  Cache = MemCore::Cache::MemCache() 
)
inline

A convenience function to set a field's data from a Chunk of data.

Calls setPersistentData(), as data will be kept forever in memory and never discared (use with care).

template<class T >
const CAB_t& Fiber::Field::setPersistentData1D ( const MemCore::RefPtr< Chunk< T > > &  data,
const RefPtr< FragmentID > &  FragID = NullPtr(),
const RefPtr< MemCore::Cache > &  Cache = MemCore::Cache::MemCache() 
)
inline

A convenience function to set a field's data from a Chunk of data, interpreting them as one-dimensional.

Calls setPersistentData(), as data will be kept forever in memory and never discarded (use with care). Use setPersistentData() to specify another dimensionality that shall be imposed on this data set.

In general, avoid using calls to setPersistentData() and derive from a CreatorBase class instead, such that data may be discarded and re-created on demand if memory is short.

void Fiber::Field::Speak ( int  indent = 0,
int  maxindent = -1 
) const

Informative debug message.

Parameters
indentHow much to indent during printf() calls.

Friends And Related Function Documentation

bool Fiber::Field::setDiscardableData ( const RefPtr< MemBase > &  Mb,
const RefPtr< MemCore::Cache > &  Cache = MemCore::Cache::MemCache(),
const RefPtr< FragmentID > &  fid = NullPtr() 
)
related

A simplied function for data that can be discarded at any time.

It makes use of the AlzheimerCreator. ()

References setCreator().