Public Types | Public Member Functions | Related Functions

Field Class Reference

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

#include <Field.hpp>

List of all members.

Public Types

Public Member Functions

Related Functions

(Note that these are not member functions.)


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:

TransparentColoredSurface.cpp, and trimesh.cpp.


Member Function Documentation

bool 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:
TypeList The 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().

RefPtr<MemCore::ChunkBase> 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 > 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.
RefPtr<MemBase> Field::getData ( const RefPtr< FragmentID > &  FID = NullPtr()  )  const [inline]

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();

Referenced by Op::apply().

const type_info& Field::getElementType (  )  const [inline]

Retrieve the element type of this field, which is stored with the properties of this field.

See the getProperties() call for more information.

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

const FiberTypeBase& 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.

const type_info & 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.
int 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.
RefPtr< MemArrayProperties > 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.

RefPtr< SizeInterface > 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 Field::isType ( const TypeList_t TL  )  const [inline]

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

Parameters:
TL A list of types.

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

int Field::rank (  )  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.
void 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.
template<class T , int N>
bool 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).

bool 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
template<class T >
bool 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 Field::Speak ( int  indent = 0,
int  maxindent = -1 
) const

Informative debug message.

Parameters:
indent How much to indent during printf() calls.

Friends And Related Function Documentation

bool 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. ()