FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | Related Symbols | 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< BundleLoader
 
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.
 
using grid_iterator = std::function< bool(double t, const GridID &id, Grid &g)>
 
typedef std::pair< double, doubleRange_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.
 
MemCore::SaveParameters::SaveError bindToNew (const string &url, const RefPtrStorageTransformations &ST)
 Bind to a newly created file.
 
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 RefPtr< MemCore::LoaderProgress > &SaveProgress=nullptr) const
 Flushes all bundle-associated memory buffers and writes them to disk without releasing the memory.
 
bool merge (const RefPtr< LoaderParameters > &LP)
 Merge data from an external device (file, URL, ...) to the current Bundle object.
 
bool merge (const string &url)
 
bool merge (const list< string > &urls)
 
 Bundle ()
 Constructor.
 
void DeferredConstructor ()
 Deferred Constructor (.
 
 ~Bundle ()
 Destructor.
 
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.
 
double maxTime () const
 Return the maximal time, i.e.
 
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.
 
Info< GridfindFirst (const string &gridname, bool OnlyInspectLoadedSlices=false) const
 Find the first occurence of a Grid object in the Bundle.
 
Info< GridfindLast (const string &gridname, bool OnlyInspectLoadedSlices=false) const
 Find the last occurence of a Grid object in the Bundle.
 
int NumberOfGrids (const string &gridname, bool OnlyInspectLoadedSlices) const
 Return the number of Grid instances found on this Bundle.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
int iterate (const string &gridname, const EvolutionIterator< Grid >::functor &GEI, bool IterateOnlyLoadedSlices) const
 Iterate over all instances of a Grid, possibly restrained to only those.
 
int iterate (const RefPtr< GridID > &id, const grid_iterator &gi, bool IterateOnlyLoadedSlices=false) 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
 
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).
 
string xml () const
 
void extremeUnction () override
 
- 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::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 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
 

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.
 
static RefPtr< Bundleload (bool &success, const list< string > &urls, const RefPtr< Bundle > &B=nullptr, const RefPtr< LoaderProgress > &Progress=nullptr)
 A simplified version to load a Bundle without detailed error information availlable (which would be in the LoaderParameters argument of the alternative functions).
 
static std::pair< RefPtr< Bundle >, std::string > load (const list< string > &urls, const RefPtr< LoaderProgress > &Progress=nullptr)
 Convenience function to load a bundle from a given list of urls, returning a pair of a bundle pointer and error message string which contains possible errors.
 
static RefPtr< Bundleload (bool &success, const string &url, const RefPtr< Bundle > &B=nullptr, const RefPtr< LoaderProgress > &Progress=nullptr)
 
static RefPtr< Bundleload (const string &url, const RefPtr< LoaderProgress > &Progress=nullptr)
 
- Static Public Member Functions inherited from MemCore::Ageable
static const AgeableInfinitelyNew () noexcept
 
static constexpr const AgeableInfinitelyOld () noexcept
 
static age_t now () noexcept
 

Public Attributes

std::set< RefPtr< Notifier > > myNotifiers
 

Friends

class Slice
 

Related Symbols

(Note that these are not member symbols.)

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

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
ModifyingPointCloudRange.cpp.

Constructor & Destructor Documentation

◆ ~Bundle()

Fiber::Bundle::~Bundle ( )

Destructor.

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

Member Function Documentation

◆ bindTo()

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.

References MemCore::Intercube::iterateInterfaces().

◆ bindToNew()

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.

◆ DeferredConstructor()

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.

◆ findFirst()

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

References std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::begin(), and std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::end().

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

References std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::rbegin(), and std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::rend().

◆ findNext()

Info< Grid > Fiber::Bundle::findNext ( double  time,
const string &  gridname 
) const

◆ findPrev()

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

◆ getMemoryUsage()

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.

References std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::begin(), and std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::end().

◆ iterate_timeslices()

template<class Functor >
int Fiber::Bundle::iterate_timeslices ( bool  DoLoadAllSlices,
const Functor F 
) const
inline
       Lambda iterator for bundles, provides Slices:

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

References Eagle::P1().

◆ iterateBackward()

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.

References std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::begin(), std::count(), std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::end(), and std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::upper_bound().

◆ iterateForward()

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.

References std::count(), std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::end(), and std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::lower_bound().

◆ load() [1/2]

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 and the LoaderParameters::load_failure member for a human-readable description.
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.

Note: Check ld->load_failure for detailed error messages.

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

Referenced by Wizt::FiberNutrition::checkBundleDigestibility().

◆ load() [2/2]

static std::pair< RefPtr< Bundle >, std::string > Fiber::Bundle::load ( const list< string > &  urls,
const RefPtr< LoaderProgress > &  Progress = nullptr 
)
inlinestatic

Convenience function to load a bundle from a given list of urls, returning a pair of a bundle pointer and error message string which contains possible errors.

Use like this:

const auto&[ myBundle, LoadError ] = Bundle::load( {"myFile.f5"} );
static RefPtr< Bundle > load(bool &success, const RefPtr< LoaderParameters > &ld, const RefPtr< Bundle > &B=nullptr)
Load a Bundle object or append new data to an existing Bundle.
Definition Bundle.cpp:139
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34

◆ maxTime()

double Fiber::Bundle::maxTime ( ) const

Return the maximal time, i.e.

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

References std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::rbegin(), and std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::size().

◆ merge()

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.

Error information is provided in LP->LoaderParameters::load_failure on return false.

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

◆ minTime()

double Fiber::Bundle::minTime ( ) const

Return the minimal time, i.e.

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

References std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::begin(), and std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::size().

◆ newGrid()

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.

◆ NumberOfGrids() [1/2]

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.

References std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::begin(), and std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::end().

◆ NumberOfGrids() [2/2]

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.

References std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::lower_bound(), std::swap(), and std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::upper_bound().

◆ sizeP1D()

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.

References std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::size().

◆ sync()

bool Fiber::Bundle::sync ( const RefPtr< MemCore::LoaderProgress > &  SaveProgress = nullptr) 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.