Fish - FiberLib for VISH 0.3
Fish - The Fiber Bundle API for the Vish Visualization Shell
Fiber::Skeleton Class Reference

A Skeleton is a set of Representation object, each of them accessed by an Representer object. More...

#include <Skeleton.hpp>

Inheritance diagram for Fiber::Skeleton:
Fiber::BaseSpace Fiber::RepresentationMap Fiber::SkeletonID Fiber::SaveableAttributes Fiber::Ownable< BaseSpace > MemCore::Intercube Fiber::FragmentIDCollectionProvider MemCore::Attributes Fiber::OwnerBase

Public Types

using FieldIterator_t = Representation::const_iterator_t
using SkeletonExcluder = unordered_set<size_t>
 To avoid recursion where a skeleton would inspect itself during recursive field iteration, remember the ObjectCountID of the used skeletons.
using RepresentationFieldIterator_t = std::function<bool(const Representer&theRepresenter, const Representation&R, const FieldID&, const Field&)>
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

 Skeleton ()=delete
 prevent default construction
 Skeleton (const Skeleton &)=delete
 prevent copy construction
void operator= (const Skeleton &)=delete
 prevent copy assignment
void clear ()
void extremeUnction () override
Representationoperator[] (const Representer &D)
RefPtr< RepresentationmakeRepresentation (const Representer &D)
Representationoperator[] (const BaseSpace &D)
int Dims () const override
 The topological dimensionality of this Skeleton.
RefPtr< FieldcreateIndirectedField (const Representer &WantRep, const RefPtr< Field > &RelativeIndices, const string &FieldName, const RefPtr< Field > &SourceField, const RefPtr< Field > &SourcePositions)
RefPtr< FieldgetField (const Representer &R, const RefPtr< FieldID > &Fid, const RefPtr< Atlas > &myAtlas=nullptr, const RepresenterList_t &SkipRepresenters={})
 Get a field relative to the specified representer.
RefPtr< FieldgetField (const Representer &R, const std::string &FieldName, const RefPtr< Atlas > &myAtlas=nullptr, const RepresenterList_t &SkipRepresenters={})
 Get a field relative to the specified representer.
RefPtr< FieldgetPositions (const Representer &R)
 Get the positions field in the given representation.
std::string xml () const override
std::string Name () const override
unsigned iterate_fields (const FieldIterator_t &F, SkeletonExcluder &SE) const
unsigned iterate_fields (const FieldIterator_t &F) const
 Iterate over all fields on all Representations of this Skeleton.
unsigned iterate_fields (const RepresentationFieldIterator_t &F, SkeletonExcluder &SE) const
unsigned iterate_fields (const RepresentationFieldIterator_t &F) const
 Iterate over all fields on all Representations of this Skeleton, also providing information on the Representation and Representer (e.g.
template<is_field_identifier... FieldIdentifiers>
auto getFields (const Representer &R, FieldIdentifiers... theFieldIdentifiers)
 Get a number of fields at once from a Skeleton and a Representer such as a chart object:
template<is_field_identifier... FieldIdentifiers>
auto getFieldFragmentCreators (const Representer &R, const RefPtr< FragmentID > &fID, FieldIdentifiers... theFieldIdentifiers)
 Get a set of array creators at once from a Skeleton and a Representer such as a chart object, all for the same fragment as specified by the fragment ID (which is a nullptr for an unfragmented field):
RefPtrRepresentation_t operator() (const Representer &D) const
 Use operator () to query a representation.
RefPtrRepresentation_t operator() (const BaseSpace &D)
int size () const
 Return the number of representations available here.
int iterate (ConstIterator &) const
 Inspect all elements of this map.
int iterate (Iterator &)
 Iterate over all elements of this map.
int iterate (const std::function< bool(const Representer &, const Representation &)> &F) const
 Immutable iteration via std::function.
int iterate (const std::function< bool(const Representer &, Representation &)> &F)
 Mutable iteration via std::function.
RefPtr< FragmentIDCollectiongetFragmentIDCollection () const override
 Get the FragmentIDCollection that is responsible for all fields of this Representation.
Public Member Functions inherited from Fiber::BaseSpace
void addDependency (const MemCore::WeakPtr< BaseSpaceDependency > &)
 Add an object that will be dependent on the existence of this base space.
 BaseSpace ()
 Constructor.
virtual ~BaseSpace ()
 Virtual destructor.
Public Member Functions inherited from Fiber::Ownable< BaseSpace >
void x_updateOwnershipAge (const MemCore::Ageable &theNewAge) override
 Forward some age to all Owners.
void insertOwner (const 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.
 Ownable ()
 Default constructor, empty Ownership list.
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 Fiber::RepresentationMap
void clear ()
RefPtrRepresentation_t makeRepresentation (const Representer &D)
Representationoperator[] (const Representer &D)
 Retrieve (and possibly create) a Representation.
Representationoperator[] (const BaseSpace &D)
RefPtrRepresentation_t findRepresentation (const Representer &D) const
 Query a representation.
RefPtrRepresentation_t findRepresentation (const BaseSpace &D)
RefPtrRepresentation_t operator() (const Representer &D) const
 Use operator () to query a representation.
RefPtrRepresentation_t operator() (const BaseSpace &D)
int DataRank () const
RefPtr< SizeInterfacegetSize () const
 Get the data dimensionality of this Skeleton, which is taken from the positions field of the first representation, whatever it is.
RefPtr< SizeInterfacegetFragmentSize (const RefPtr< FragmentID > &Fid) const
int size () const
 Return the number of representations available here.
int getNumberOfRepresentations () const
 Return the number of representations available here.
std::tuple< Representer, RefPtrRepresentation_t, RefPtr< FragmentIDCollection > > getFragmentIDCollectionRepresentation () const
RefPtr< FragmentIDfindFragmentIDByName (const std::string &FragmentName) const
DynamicSize getFragmentLayout () const
int iterate (ConstIterator &) const
 Inspect all elements of this map.
int iterate (Iterator &)
 Iterate over all elements of this map.
int iterate (const std::function< bool(const Representer &, const Representation &)> &F) const
 Immutable iteration via std::function.
int iterate (const std::function< bool(const Representer &, Representation &)> &F)
 Mutable iteration via std::function.
template<class Functor>
int iterate_representations (const Functor &F) const
 Iterate over all representations using a functor or lambda function:
template<class Functor>
int iterate_all (const Functor &F) const
 Iterate over everything contained here.
int getMemoryUsage (memsize_t &UsedMemory, memsize_t &WantedMemory) const
 Get memory usage.
void Speak (int indent=0, int maxindent=-1) const
 Informative debug message.
string xml () const
Public Member Functions inherited from Fiber::SkeletonID
 SkeletonID (int dimension, int index_depth=0)
 Constructor via dimensionality and index depth.
 SkeletonID (const std::nullptr_t &)
 SkeletonID (const DynamicSize &theDomainSize, int IndexDepth, const DynamicSize &theRefinementSize)
 SkeletonID (const SkeletonID &Sid, int index_depth_increment)
 Construct a skeleton ID with the same properties but its index depth incremented by a certain amount.
 ~SkeletonID ()
 Destructor.
const SkeletonIDID () const
 Shortcut to ease type conversion in child classes.
bool operator< (const SkeletonID &S) const
 Ordering operator, mostly used for stl::map.
int IndexDepth () const
 Index depth of this skeleton.
const DynamicSizeDomainSize () const
const DynamicSizeSize () const
const DynamicSizeRefinementSize () const
const DynamicSizegetRefinementSize () const
template<class T>
DynamicSizesetSize (int N, const T values[])
template<class T>
DynamicSizesetRefinementSize (int N, const T values[])
template<int N>
auto setSize (const MultiIndex< N > &I)
template<int N>
DynamicSizesetRefinementSize (const MultiIndex< N > &I)
int Dims () const
 Dimensionality of this skeleton.
int getRank () const
 Dimensionality of this skeleton.
bool hasCompatibleHigherDims (const DynamicSize &DS) const
int NumberOfRefinementLevels () const
 Number of available refinement levels This usually matches Dims, but in case of Dims=0 also allows a refinement level.
index_t Refinement (unsigned int i) const
bool isIsotropicRefinementFactor (index_t F) const
 Check if the given skeleton ID corresponds to a refinement by factor F in all dimensions.
index_t getHomogeneousLevel () const
 IF this skeleton ID refers to a refinement level that is same in all dimensions, return that single integer.
index_t getTotalRefinement () const
unsigned getDomainSize (unsigned i) const
bool setSize (unsigned i, index_t extension)
template<int N>
bool setSize (MultiIndex< N > &MI) const
bool setSize (const DynamicSize &DS) const
const DynamicSizesetRefinementSize (const DynamicSize &DS)
bool setRefinement (unsigned i, index_t extension)
void setIsotropicRefinement (index_t ref_level)
 Set the same refinement level in all dimensions of the skeleton dimensionality.
bool hasRefinement ()
std::string Name () const
 Create a textual representation of the inherent parameters of the Skeleton ID.
bool operator! () const
 check for mere validity of this SkeletonID
 operator bool () const
 check for validity of this SkeletonID
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

Protected Types

using RepresenterList_t = std::unordered_set<Representer>

Protected Member Functions

 ~Skeleton ()
 Destructor.
RefPtr< FieldgetFieldRecursion (const Representer &R, const string &FieldName, const RefPtr< Atlas > &myAtlas, RepresenterList_t &SkipRepresenters)
template<is_field_identifier firstFieldIdentifier_t, is_field_identifier... FieldIdentifiers>
void getFieldsRecursion (const Representer &R, RefPtr< Field > *Rit, firstFieldIdentifier_t firstFieldIdentifier, FieldIdentifiers... theFieldIdentifiers)

Friends

class SkeletonMap
std::string to_string (const Skeleton &S)

(Note that these are not member symbols.)

using pSkeleton = RefPtr<Skeleton>
 Shortcut for a strong pointer to a Skeleton object.
typedef WeakPtr< Skeleton > wSkeleton
 Shortcut for a weak pointer to a Skeleton object.

Additional Inherited Members

Static Public Member Functions inherited from Fiber::SkeletonID
static SkeletonID nextRefinement (const SkeletonID &Sid, int refinement_increment)
 Create a SkeletonID that is refined by a certain increment.
static SkeletonID refinedSkeleton (const SkeletonID &Sid, int refinement_value)
 Create a SkeletonID that is refined by a certain value.
Public Attributes inherited from Fiber::Ownable< BaseSpace >
std::unordered_set< MemCore::WeakPtr< Container > > Owners
 The (internal) list of owners.
Public Attributes inherited from Fiber::SaveableAttributes
MemCore::Ageable LastSavedAttributes

Detailed Description

A Skeleton is a set of Representation object, each of them accessed by an Representer object.

It defines the Skeleton Space of a discretized Grid. Allows to store sets as mappings from Domain objects to corresponding Representations of the underlying discretized space.

Note, that Skeleton inherits all operators and functions to create and access Representations from the RepresentationMap!

// e.g.: create cartesian vertex representation:
// note that there are convenience function for that in Grid
Grid &G = ...;
SkeletonID vertices_id(0,1);
Skeleton& vertices = G[ vertices_id ];
RefPtr< Chart > cartesian = grid->makeCartesianChart();
Representation& vertices_as_cartesian = vertices[ *cartesian ];
A Grid is a set of Skeleton objects, each of them accessed via some unique SkeletonID object.
Definition Grid.hpp:60
A Representation is a set of Field objects, each of them accessed via some FieldID identifier.
Definition Representation.hpp:101
SkeletonID(int dimension, int index_depth=0)
Constructor via dimensionality and index depth.
Definition SkeletonID.cpp:7
StrongPtr< Object, ObjectBase > RefPtr
// e.g.: create a relative vertex selection representation using a skeleton instead of a chart:
SkeletonID vertex_selection_id(0,3);
Skeleton& vertex_selection = (*grid)[ vertex_selection_id ];
RefPtr< Skeleton > vertices = grid->findVertices();
// relative
Representation& vertex_selection_as_vertices = vertex_selection[ vertices ];

Skeleton objects can be created only through a SkeletonMap, the base class of a Grid object.

Member Function Documentation

◆ createIndirectedField()

RefPtr< Field > Fiber::Skeleton::createIndirectedField ( const Representer & WantRep,
const RefPtr< Field > & RelativeIndices,
const string & FieldName,
const RefPtr< Field > & SourceField,
const RefPtr< Field > & SourcePositions )
Parameters
SourcePositionsThe Positions field from the same representation where the SourceField came from.

References createIndirectedField(), getFragmentIDCollection(), Fiber::FragmentID::Name(), and Fiber::pullData().

Referenced by createIndirectedField().

◆ Dims()

int Fiber::Skeleton::Dims ( ) const
overridevirtual

◆ getField() [1/2]

RefPtr< Field > Fiber::Skeleton::getField ( const Representer & R,
const RefPtr< FieldID > & Fid,
const RefPtr< Atlas > & myAtlas = nullptr,
const RepresenterList_t & SkipRepresenters = {} )

Get a field relative to the specified representer.

This function might involve some coordinate transformation or re-indexing if the queried field does not yet exist relative to the given representer.

Parameters
RThe identifier of the representation in which the field is requested. For instance, this may be a chart object (a coordinate system).
FidA field identifier, it must match exactly.

References Fiber::Representation::findField(), Fiber::RepresentationMap::findRepresentation(), getField(), and Fiber::FiberTypeIndex::rank.

Referenced by Fiber::Grid::establishSkeletonFilter(), getField(), and getPositions().

◆ getField() [2/2]

RefPtr< Field > Fiber::Skeleton::getField ( const Representer & R,
const std::string & FieldName,
const RefPtr< Atlas > & myAtlas = nullptr,
const RepresenterList_t & SkipRepresenters = {} )

Get a field relative to the specified representer.

This function might involve some coordinate transformation or re-indexing if the queried field does not yet exist relative to the given representer.

Parameters
RThe identifier of the representation in which the field is requested. For instance, this may be a chart object (a coordinate system). Given a ChartID, a Chart object, suitable as Representer, can be retrieved from a Grid object.
FidA field identifier, it is sufficient if the name matches.

◆ getFieldFragmentCreators()

template<is_field_identifier... FieldIdentifiers>
auto Fiber::Skeleton::getFieldFragmentCreators ( const Representer & R,
const RefPtr< FragmentID > & fID,
FieldIdentifiers... theFieldIdentifiers )
inline

Get a set of array creators at once from a Skeleton and a Representer such as a chart object, all for the same fragment as specified by the fragment ID (which is a nullptr for an unfragmented field):

Skeleton&that;
RefPtr< Chart > cartesianChart;
const auto&[alphaC,betaC,gammaC] = that.getFieldFragmentCreators(cartesianChart;, fID, "alpha", "beta", "gamma");
auto getFieldFragmentCreators(const Representer &R, const RefPtr< FragmentID > &fID, FieldIdentifiers... theFieldIdentifiers)
Get a set of array creators at once from a Skeleton and a Representer such as a chart object,...
Definition Skeleton.hpp:303
See also
getFields()

References getFields().

◆ getFields()

template<is_field_identifier... FieldIdentifiers>
auto Fiber::Skeleton::getFields ( const Representer & R,
FieldIdentifiers... theFieldIdentifiers )
inline

Get a number of fields at once from a Skeleton and a Representer such as a chart object:

Skeleton&that;
RefPtr< Chart > cartesianChart;
auto F = that.getFields(that,cartesianChart, "alpha", "beta", "gamma");
const auto&[alpha,beta,gamma] = that.getFields(R, "alpha", "beta", "gamma");
__gnu_cxx::__promote_2< _Tpa, _Tpb >::__type beta(_Tpa __a, _Tpb __b)
auto getFields(const Representer &R, FieldIdentifiers... theFieldIdentifiers)
Get a number of fields at once from a Skeleton and a Representer such as a chart object:
Definition Skeleton.hpp:280
See also
getFieldFragmentCreators()

Referenced by getFieldFragmentCreators().

◆ getFragmentIDCollection()

Get the FragmentIDCollection that is responsible for all fields of this Representation.

This will be the FragmentIDCollection of the first Representation that has one.

Reimplemented from Fiber::RepresentationMap.

Referenced by createIndirectedField(), and Wizt::RecursiveSeaBed::isInside().

◆ getPositions()

RefPtr< Field > Fiber::Skeleton::getPositions ( const Representer & R)
inline

Get the positions field in the given representation.

This function simply calls getField() with FieldName=FIBER_POSITIONS.

References getField().

◆ iterate_fields() [1/2]

unsigned Fiber::Skeleton::iterate_fields ( const FieldIterator_t & F) const
inline

Iterate over all fields on all Representations of this Skeleton.

Note that the same field may appear multiple times - this function does NOT perform any uniqueness checks, such must be done in the FieldIterator itself.

◆ iterate_fields() [2/2]

unsigned Fiber::Skeleton::iterate_fields ( const RepresentationFieldIterator_t & F) const
inline

Iterate over all fields on all Representations of this Skeleton, also providing information on the Representation and Representer (e.g.

a chart).

◆ Name()

std::string Fiber::Skeleton::Name ( ) const
inlineoverridevirtual

Implements Fiber::BaseSpace.

◆ xml()

string Fiber::Skeleton::xml ( ) const
overridevirtual

Implements Fiber::BaseSpace.