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

The main entity holding all information. More...

#include <Bundle.hpp>

Inheritance diagram for Fiber::Bundle:
MemCore::Intercube MemCore::Attributes MemCore::Ageable

Classes

struct  Notifier
 Mechanism to have notifier objects listening to changes on the Bundle, whatever nature those changes might be. More...
 

Public Types

typedef
MemCore::LoaderRegistry
< Bundle
Loader
 
typedef Info< SliceSliceInfo_t
 The information as returned by a query for Slices.
 
typedef Info< GridGridInfo_t
 The information as returned by a query for Grids.
 
typedef Info< SkeletonSkeletonInfo_t
 The information as returned by a query for Skeletons.
 
typedef std::pair< double, double > Range_t
 

Public Member Functions

const RefPtr< GridList > & getGridList () const
 
const set< WeakPtr< GridID > > & getGridIdentifiers () const
 
void announceModification () const
 Announce that "something" has been changed on this Bundle.
 
void addNotifier (const RefPtr< Notifier > &N)
 
void bind (const RefPtr< Binder > &theBinder)
 
MemCore::SaveParameters::SaveError bindTo (const string &url, const RefPtr< MemCore::InterfaceBase > &A=nullptr, const RefPtr< MemCore::InterfaceBase > &B=nullptr)
 Bind this Bundle object to a file such that all objects can be swapped in and out. More...
 
MemCore::SaveParameters::SaveError bindToNew (const string &url, const RefPtrStorageTransformations &ST)
 Bind to a newly created file. More...
 
MemCore::SaveParameters::SaveError bindToNew (const string &url)
 
const RefPtr< Binder > & getBinder () const
 
bool isBound () const
 Check if this bundle is bound.
 
std::string boundUrl () const
 The URL of the storage device to which this Bundle is bound.
 
bool sync () const
 Flushes all bundle-associated memory buffers and writes them to disk without releasing the memory. More...
 
bool merge (const RefPtr< LoaderParameters > &LP)
 Merge data from an external device (file, URL, ...) to the current Bundle object. More...
 
bool merge (const string &url, bool detect_sequence=false)
 
 Bundle ()
 Constructor.
 
void DeferredConstructor ()
 Deferred Constructor (. More...
 
 ~Bundle ()
 Destructor. More...
 
int save (const string &url, const RefPtr< LoaderProgress > &SaveProgress=nullptr, const RefPtrStorageTransformations &ST=NullPtr())
 
RefPtr< GridIDoperator() (const string &gridname) const
 Query a GridID from a name.
 
RefPtr< GridIDoperator[] (const string &gridname) const
 Create a GridID from a name.
 
int getGridnames (GridList::stringset_t &Gridnames) const
 Query all the grid names that lurk around at this Bundle.
 
size_t getNumberOfGrids () const
 Get the number of grids defined on this Grid.
 
const RefPtr< GlobalCharts > & getAtlas () const
 
double minTime () const
 Return the minimal time, i.e. More...
 
double maxTime () const
 Return the maximal time, i.e. More...
 
SliceInfo_t firstSlice () const
 Return the first slice in this bundle.
 
bool accessFirstSlice () const
 Access the first slice of this bundle, which implies loading or creating any metadata as associated with this bundle.
 
Sliceoperator[] (double time)
 Access one-dimensional index space, possibly creating an Slice entry.
 
Sliceoperator[] (const ParameterSet &)
 Access n-dimensional index space, possibly creating an Slice entry.
 
SlicePtr operator() (double &time) const
 Query the one-dimensional index space for a Slice entry.
 
SlicePtr findPrev (double &time) const
 
SlicePtr findNext (double &time) const
 
SliceInfo_t prev (double time) const
 Return the time slice just before the given time.
 
SliceInfo_t next (double time) const
 Return the time slice just next after the given time.
 
RefPtr< Gridoperator() (double time, const string &gridname) const
 Query the one-dimensional index space for a Grid.
 
RefPtr< Gridoperator() (double time, const RefPtr< GridID > &GridID) const
 Query the one-dimensional index space for a Grid.
 
Slice::grids_t::value_type getUniqueGrid (double time)
 
RefPtr< GridnewGrid () const
 Create a new Grid object that lives on this Bundle, but is not yet associated to any time, and yet unnamed. More...
 
Info< GridfindFirst (const string &gridname, bool OnlyInspectLoadedSlices=false) const
 Find the first occurence of a Grid object in the Bundle. More...
 
Info< GridfindLast (const string &gridname, bool OnlyInspectLoadedSlices=false) const
 Find the last occurence of a Grid object in the Bundle. More...
 
int NumberOfGrids (const string &gridname, bool OnlyInspectLoadedSlices) const
 Return the number of Grid instances found on this Bundle. More...
 
int NumberOfGrids (double T0, double T1, const string &gridname, bool OnlyInspectLoadedSlices) const
 Return the number of Grid instances found on this Bundle in the given time range. More...
 
int NumberOfGridInstances (double T0, double T1, const string &gridname, bool OnlyInspectLoadedSlices) const
 
int getNrSlicesOfGridInTimeRange (double time_min, double time_max, const string &grid_name, bool loaded_slices_only) const
 
GridInfo_t findMostRecentGrid (double time, const string &gridname) const
 Return information when the requested grid was found most recently.
 
GridInfo_t findMostRecentGrid (double time, const RefPtr< GridID > &gridid) const
 Return information when the requested grid was found most recently.
 
Info< GridfindPrev (double time, const string &gridname) const
 Find the latest existence of the grid object that exists at the current time. More...
 
Info< GridfindPrev (double time, const RefPtr< GridID > &gridname) const
 
GridInfo_t findPreviousGrid (double time, const string &gridname) const
 
GridInfo_t findPreviousGrid (double time, const RefPtr< GridID > &GID) const
 
Info< GridfindNext (double time, const string &gridname) const
 Find the next grid object that exists after the current time. More...
 
Info< GridfindNext (double time, const RefPtr< GridID > &gridname) const
 
int iterateBackward (double &time, const string &gridname, EvolutionIterator< Grid > &GEI, bool IterateOnlyLoadedSlices) const
 Starting with the given time, find all grids that reside before this time until the GridEvolutionIterator returns false or there are no more such grids. More...
 
int iterateForward (double &time, const string &gridname, EvolutionIterator< Grid > &GEI, bool IterateOnlyLoadedSlices) const
 Starting with the given time, find all grids that reside after this time until the GridEvolutionIterator returns false or there are no more such grids. More...
 
SkeletonInfo_t findPreviousRefinementLevel (double &T, const string &gridname, int Level, EvolutionIterator< Skeleton > *EIS, int IndexDepth)
 
SkeletonInfo_t findPreviousRefinementLevel (double &T, const string &gridname, int Level, int IndexDepth=0)
 Find the most recent refinement level of an adaptive mesh, which resides at a time before the current one.
 
SkeletonInfo_t findPreviousRefinementLevel (double &T, const string &gridname, int Level, EvolutionIterator< Skeleton > &EIS, int IndexDepth=0)
 
SkeletonInfo_t findNextRefinementLevel (double &T, const string &gridname, int Level, int IndexDepth=0)
 
RefPtr< Sliceoperator() (const ParameterSet &) const
 Query the n-dimensional index space for a Slice entry.
 
int sizeP1D () const
 The size of the one-dimensional parameter space. More...
 
const ParameterListAllParameters () const
 
int iterate (const ParameterList &PL, EvolutionIterator< Slice > &SI) const
 General iteration over all Slices contained in this Bundle.
 
int iterate (const string &gridname, EvolutionIterator< Grid > &GEI, bool IterateOnlyLoadedSlices) const
 Iterate over all instances of a Grid, possibly restrained to only those Slices that have already been loaded.
 
template<class Functor >
int iterate_timeslices (bool DoLoadAllSlices, const Functor &F) const
 
       Lambda iterator for bundles, provides Slices:

iterate_timeslices(false, [](double t, const Slice&S) { Verbose(0) << " Data at T=" << t; return true; } );

 
Range_t getTimeRange (const string &Gridname, bool OnlyInspectAlreadyLoadedSlices=false)
 Get the time range of a particular Grid.
 
int getMemoryUsage (memsize_t &UsedMemory, memsize_t &WantedMemory) const
 Get the memory occupied by this Bundle (and all of its Grids). More...
 
string xml () const
 
void extremeUnction () override
 
- 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 RefPtr< Bundleload (bool &success, const RefPtr< LoaderParameters > &ld, const RefPtr< Bundle > &B=NullPtr())
 Load a Bundle object or append new data to an existing Bundle. More...
 
static RefPtr< Bundleload (bool &success, const string &url, const RefPtr< Bundle > &B=NullPtr(), const RefPtr< LoaderProgress > &Progress=NullPtr(), bool detect_sequence=false)
 
static RefPtr< Bundleload (const string &url, const RefPtr< LoaderProgress > &Progress=NullPtr())
 

Public Attributes

std::set< RefPtr< Notifier > > myNotifiers
 

Friends

class Slice
 

Related Functions

(Note that these are not member functions.)

template<class ObjectLevel >
class BUNDLE_API EvolutionIterator
 Generic template definition for iterators over objects on many time steps. More...
 

Detailed Description

The main entity holding all information.

A Bundle is a set of Slice objects, each of them accessed via some floating-point value, which is usually interpreted as time.

Note: by inheritance, the Bundle object allows to query GridID's from strings as well, see class GridList for details.

Examples:
XF_SimpleFileBinding.cpp.

Constructor & Destructor Documentation

Fiber::Bundle::~Bundle ( )

Destructor.

puts("Bundle::~Bundle() start clearance ");fflush(stdout);

Member Function Documentation

MemCore::SaveParameters::SaveError Fiber::Bundle::bindTo ( const string &  url,
const RefPtr< MemCore::InterfaceBase > &  A = nullptr,
const RefPtr< MemCore::InterfaceBase > &  B = nullptr 
)

Bind this Bundle object to a file such that all objects can be swapped in and out.

Parameters are either Binder::Parameters ór StorageTransformations, in arbitrary order.

MemCore::SaveParameters::SaveError Fiber::Bundle::bindToNew ( const string &  url,
const RefPtrStorageTransformations &  ST 
)

Bind to a newly created file.

Similar to bindTo with Binder::Parameters::AppendFile=false.

void Fiber::Bundle::DeferredConstructor ( )

Deferred Constructor (.

See also
MemCore::DeferredInitializationTrait<Bundle>) This function is called as soon as a strong reference has been established on the Bundle object. The Deferred Constructor contains functions that set a weak pointer to the Bundle object. This must not be done until a strong reference point has been set to the Bundle.
Info< Grid > Fiber::Bundle::findFirst ( const string &  gridname,
bool  OnlyInspectLoadedSlices = false 
) const

Find the first occurence of a Grid object in the Bundle.

Parameters
OnlyInspectLoadedSlicesInspect only slices that exist in memory, i.e. don't try to load data from disk.
See also
findLast()
Info< Grid > Fiber::Bundle::findLast ( const string &  gridname,
bool  OnlyInspectLoadedSlices = false 
) const

Find the last occurence of a Grid object in the Bundle.

Parameters
OnlyInspectLoadedSlicesInspect only slices that exist in memory, i.e. don't try to load data from disk.
See also
findFirst()
Info< Grid > Fiber::Bundle::findNext ( double  time,
const string &  gridname 
) const

Find the next grid object that exists after the current time.

See also
findPrevious()
Info< Grid > Fiber::Bundle::findPrev ( double  time,
const string &  gridname 
) const

Find the latest existence of the grid object that exists at the current time.

See also
findNext()
int Fiber::Bundle::getMemoryUsage ( memsize_t UsedMemory,
memsize_t WantedMemory 
) const

Get the memory occupied by this Bundle (and all of its Grids).

Not that if a Grid is shared on another location then it will be counted twice here. Use the MemCache::Cache function to determine the actual memory usage.

int Fiber::Bundle::iterateBackward ( double &  time,
const string &  gridname,
EvolutionIterator< Grid > &  GEI,
bool  IterateOnlyLoadedSlices 
) const

Starting with the given time, find all grids that reside before this time until the GridEvolutionIterator returns false or there are no more such grids.

Parameters
timeThe initial time, will be modified(!) during traversal towards the first Grid found
IterateOnlyLoadedSlicesSpecify if the iteration shall only be performed over those Slices that have already been loaded.

Referenced by Fiber::LineSet::ExtractTrajectories().

int Fiber::Bundle::iterateForward ( double &  time,
const string &  gridname,
EvolutionIterator< Grid > &  GEI,
bool  IterateOnlyLoadedSlices 
) const

Starting with the given time, find all grids that reside after this time until the GridEvolutionIterator returns false or there are no more such grids.

Parameters
timeThe initial time, will be modified(!) during traversal towards the first Grid found
IterateOnlyLoadedSlicesSpecify if the iteration shall only be performed over those Slices that have already been loaded.
RefPtr< Bundle > Fiber::Bundle::load ( bool &  success,
const RefPtr< LoaderParameters > &  ld,
const RefPtr< Bundle > &  B = NullPtr() 
)
static

Load a Bundle object or append new data to an existing Bundle.

Creates a new Bundle object from an external device, as specified by the LoaderParameters, e.g. a file or an URL.

Parameters
successBoolean that informs about the success of the load action. An eventual error code can be found in the LoaderParameters argument
ldCollection of all information that is required for loading data. Includes things like filename, interaction callback object and possible error code retrieval.
BPointer to an eventually existing bundle.

References MemCore::LoaderRegistry< class >::load().

double Fiber::Bundle::maxTime ( ) const

Return the maximal time, i.e.

the highest coordinate value of the one-dimensional parameter space.

Referenced by Wizt::FishObject::updateBundleInformation().

bool Fiber::Bundle::merge ( const RefPtr< LoaderParameters > &  LP)

Merge data from an external device (file, URL, ...) to the current Bundle object.

The Bundle object must already be referenced via a strong reference pointer.

References MemCore::LoaderRegistry< class >::load().

double Fiber::Bundle::minTime ( ) const

Return the minimal time, i.e.

the lowest coordinate value of the one-dimensional parameter space.

Referenced by Wizt::FishObject::updateBundleInformation().

RefPtr<Grid> Fiber::Bundle::newGrid ( ) const
inline

Create a new Grid object that lives on this Bundle, but is not yet associated to any time, and yet unnamed.

It is thus ready for later insertion into some Slice on this Bundle.

Referenced by Fiber::LineSet::ExtractTrajectories(), and Fiber::SplitMeshEdges().

int Fiber::Bundle::NumberOfGrids ( const string &  gridname,
bool  OnlyInspectLoadedSlices 
) const

Return the number of Grid instances found on this Bundle.

Parameters
OnlyInspectLoadedSlicesInspect only slices that exist in memory, i.e. don't try to load data from disk.
int Fiber::Bundle::NumberOfGrids ( double  T0,
double  T1,
const string &  gridname,
bool  OnlyInspectLoadedSlices 
) const

Return the number of Grid instances found on this Bundle in the given time range.

Parameters
OnlyInspectLoadedSlicesInspect only slices that exist in memory, i.e. don't try to load data from disk.
int Fiber::Bundle::sizeP1D ( ) const
inline

The size of the one-dimensional parameter space.

For instance, this is the number of time slices in a time evolution.

bool Fiber::Bundle::sync ( ) const

Flushes all bundle-associated memory buffers and writes them to disk without releasing the memory.

This call only makes sense if the bundle is bound to some URL (isBound()).

Returns
false if the Bundle is not bound or there was an error during writing.

Friends And Related Function Documentation

template<class ObjectLevel >
class BUNDLE_API EvolutionIterator
related

Generic template definition for iterators over objects on many time steps.

The generic template is not used at all, it is only used to provide a pretty name for the specific iterators, which are EvolutionIterator<Slice>, EvolutionIterator<Grid>, EvolutionIterator<Skeleton>, EvolutionIterator<Field> , Slice