FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
Public Types | Public Member Functions | Public Attributes | Friends | List of all members

An internal class that stores a couple of textual names. More...

#include <FieldSelector.hpp>

Inheritance diagram for Fiber::FieldSelector:
Fiber::GridSelector

Public Types

typedef std::pair< Fiber::Bundle::GridInfo_t, RefPtr< Fiber::Field > > FieldInfo_t
 

Public Member Functions

FieldSelectionSelection ()
 Yield the currently selected fields.
 
RefPtr< FieldSelectiongetSelectedFields () const
 
const FieldSelectionSelection () const
 
 FieldSelector ()
 Constructor.
 
 FieldSelector (const GridSelector &GS, const Info< Grid > &FieldSource)
 Construct from grid selector and result of grid selection.
 
 FieldSelector (const FieldSelector &FS)
 Construct from an existing FieldSelector.
 
 FieldSelector (const FieldSelector &FS, const string &fieldname, const TypeList_t &FT=TypeList_t())
 Construct from an existing FieldSelector with a new field name and optional type.
 
 FieldSelector (const BundlePtr &bpP, const double timeP, const string &gridNameP, const string &fieldNameP)
 
 FieldSelector (double &time, const BundlePtr &BP, const string &gridName, const string &fieldName)
 Construct a FieldSelector from the field found on the most recent Grid of the given bundle.
 
 ~FieldSelector ()
 Destructor.
 
bool requiresType (const type_info &what) const
 Check if this field selector requires the field to be of the specified type.
 
unsigned NumberOfAvailableFields () const
 Number of this fields provided here.
 
TypeList_tFieldTypes ()
 List of types that this field might provide or want.
 
const TypeList_tFieldTypes () const
 List of types that this field might provide or want.
 
template<class ... T>
void accept ()
 Define the types that this field accepts or provides.
 
void selectField (const string &fieldname, const TypeList_t &FT=TypeList_t())
 Select a singular field.
 
template<class T >
void selectTypedField (const string &fieldname)
 Select a field giving its type as template function argument.
 
void selectField (const string &fieldname, const Field &F)
 Select a field giving its type from a Field object.
 
FieldSelector operator() (const string &fieldname, const Field &F) const
 Create a new FieldSelector with same properties as the current one, but selecting a new type and field.
 
void selectField (const BundlePtr &BP, const double time, const string &gridName, const string &fieldName, const RefPtr< Grid > &G, const RefPtr< Slice > &S)
 Select a field with full context information.
 
void clearSelection ()
 Remove all field selection stored here.
 
RefPtr< Fiber::FieldIDmakeFieldID (Fiber::Representation &Rep) const
 Make a new field ID if none exists yet for the intrinsic field name.
 
bool setFieldSource (double time, const string &theFieldname)
 
bool findFieldSource (double time, const string &Fieldname)
 Set the field information from the field found on the most recent Grid in the given bundle, as stored in the FieldSelector.
 
bool findFieldSource (const BundlePtr &bpP, double timeP, const string &gridNameP, const string &fieldNameP)
 Set the field information from the field found on the most recent Grid in the given bundle.
 
string getFieldName () const
 Return the name of the currently selected field.
 
string getFieldname () const
 Return the name of the currently selected field.
 
string operator() () const
 Return the currently selected field name.
 
const RefPtr< Fiber::Grid > & GridSource () const
 The Grid object that was found to carry the selected field.
 
const RefPtr< Fiber::Grid > & getGrid () const
 The Grid object that was found to carry the selected field.
 
const WeakPtrSlicegetSlice () const
 Get the slice where the field selector refers to.
 
double getTime () const
 The time when this field was found most recently.
 
RefPtr< FieldgetField (const string &theName, int Level=0, const string &ChartName=string()) const
 Return a field of the given name in the Cartesian representation of the Vertices on the toplevel refinement level.
 
RefPtr< Fiber::FieldgetField (int Level=0, const string &ChartName=string()) const
 Return a field of the currently selected in the Cartesian representation of the Vertices on the toplevel refinement level.
 
RefPtr< FieldgetPositions (const RefPtr< ChartID > &theChartID) const
 Get the vertex positions in a specific chart.
 
RefPtr< FieldgetField (const RefPtr< ChartID > &theChartID, const string &fieldname) const
 
RefPtr< FieldgetField (const RefPtr< ChartID > &theChartID) const
 
RefPtr< FieldgetCartesianPositions () const
 Return the position field on the Grid which carries the current field.
 
RefPtr< RepresentationgetCartesianRepresentation (int Level=0) const
 Return the cartesian representation of the vertices that carries the current field.
 
bool operator! () const
 
 operator bool () const
 
- Public Member Functions inherited from Fiber::GridSelector
const string & getGridname () const
 Name of the selected grid (member function)
 
const string & getGridName () const
 
 GridSelector ()
 Default Construct.
 
 GridSelector (const string &gridname, const Fiber::BundlePtr &Source=Fiber::BundlePtr(NullPtr()))
 Construct from gridname and bundle.
 
 GridSelector (const Fiber::BundlePtr &Source, const string &gridname)
 Construct from bundle and gridname.
 
 GridSelector (const GridSelector &Source, const string &gridname)
 Construct from GridSelector and gridname.
 
 GridSelector (const string &gridname, const GridSelector &Source)
 Construct from GridSelector and gridname.
 
 ~GridSelector ()
 Destructor.
 
GridSelector operator[] (const string &gridname) const
 Operator syntax for constructing a new GridSelector from an existing one and a new gridname.
 
const string & Gridname () const
 Return the name of the currently selected Grid.
 
const Fiber::BundlePtrBundleSource () const
 Provide the original bundle of from where the Grid was selected.
 
const Fiber::BundlePtrgetBundle () const
 Provide the original bundle of from where the Grid was selected.
 
bool hasValidGrid () const
 check for validity, bundle pointer must be valid and grid name.
 
 operator bool () const
 check for validity
 
bool selectGrid (const string &name)
 Select a certain grid out of the given spacetime.
 
Info< GridfindMostRecentGrid (const Fiber::BundlePtr &theSpacetime, double time) const
 Return the time, slice and grid that is most recent to the given time for the selected grid.
 
Info< GridfindMostRecentGrid (double time, const Fiber::BundlePtr &theSpacetime=Fiber::BundlePtr(NullPtr())) const
 Find the Grid that is most recent for the given time.
 
Info< SkeletongetRefinementLevel (double time, int Level, int IndexDepth, const BundlePtr &SpaceTime=BundlePtr(NullPtr()))
 Retrieve a skeleton for the given refinement level for the current time.
 
Info< GridfindPrev (double time, const BundlePtr &theSpacetime=BundlePtr(NullPtr())) const
 Return the Grid that is just previous to the given time.
 
Info< GridfindNext (double time, const BundlePtr &theSpacetime=BundlePtr(NullPtr())) const
 Return the Grid that is just next after the given time.
 
Fiber::Gridoperator[] (double time)
 
RefPtr< Fiber::Gridoperator() (double time, const Fiber::BundlePtr &theSpacetime=Fiber::BundlePtr(NullPtr())) const
 Convenience function to easily retrieve just the most recent Grid for a given time.
 
RefPtr< Fiber::Gridoperator() (double time, const GridSelector &GS)
 
bool hasProperty (const BundleProperty &theProperty) const
 Check this GridSelector for a certain property.
 
bool providesFieldTypes (const Fiber::TypeList_t &AcceptedFields) const
 Check which field types are supported by the grid that is selected by the current grid selector.
 

Public Attributes

Info< GridFieldSource
 Meta-Information - from where did we get the selected field? The base class, GridSelector, specifies information on how to find a certain Grid.
 
SkeletonID mySkeletonID
 Specify the source of this field, on which grid does it live? By default, this are the vertices.
 
- Public Attributes inherited from Fiber::GridSelector
BundlePtr theSourceBundle
 The bundle that was used to retrieve the grid name, meaning: the selected grid name is ensured to exist on this bundle.
 
string theGridname
 Name of the selected grid.
 

Friends

BUNDLE_API bool operator== (const FieldSelector &L, const FieldSelector &R)
 Compare two field selectors.
 
bool operator!= (const FieldSelector &L, const FieldSelector &R)
 Check if two field selectors differ.
 

Detailed Description

An internal class that stores a couple of textual names.

It is to be used for selecting a field out of a selection of fields.

Examples
ColoredLines.cpp, ComputeNormals.cpp, PolychromeSurface.cpp, Sphere.cpp, and TransparentColoredSurface.cpp.

Constructor & Destructor Documentation

◆ FieldSelector() [1/2]

Fiber::FieldSelector::FieldSelector ( const FieldSelector FS)

Construct from an existing FieldSelector.

Note that the FieldSelection will be empty, not copied from the existing FieldSelector!

◆ FieldSelector() [2/2]

Fiber::FieldSelector::FieldSelector ( double time,
const BundlePtr BP,
const string &  gridName,
const string &  fieldName 
)

Construct a FieldSelector from the field found on the most recent Grid of the given bundle.

The respective time will be provided in the time argument.

References findFieldSource(), and getTime().

Member Function Documentation

◆ accept()

template<class ... T>
void Fiber::FieldSelector::accept ( )
inline

Define the types that this field accepts or provides.

F.accept<float>();
F.accept<double>();
An internal class that stores a couple of textual names.
Definition FieldSelector.hpp:18

◆ getCartesianRepresentation()

RefPtr< Representation > Fiber::FieldSelector::getCartesianRepresentation ( int  Level = 0) const

Return the cartesian representation of the vertices that carries the current field.

Use the

string getFieldName() const
Return the name of the currently selected field.
Definition FieldSelector.cpp:99
A Representation is a set of Field objects, each of them accessed via some FieldID identifier.
Definition Representation.hpp:101

operation to retrieve an actual Field.

References FieldSource, Fiber::Info< Grid >::getGrid(), Fiber::GridSelector::getGridname(), Fiber::Info< Slice >::getTime(), and Fiber::GridSelector::theSourceBundle.

◆ getField() [1/2]

RefPtr< Field > Fiber::FieldSelector::getField ( const string &  theName,
int  Level = 0,
const string &  ChartName = string() 
) const

Return a field of the given name in the Cartesian representation of the Vertices on the toplevel refinement level.

This general function is useful to retrieve a field on the current grid which is not identical with the selected one.

Parameters
LevelMay retrieve a field from a refinement level, using the most recent refinement level available. For more complex functionality, for instance getting the field of a refinement level most closely to the current one (instead of the most recent), or for retrieving the past and future refinement levels for temporal interpolation. This simple function here implements the level search in the following way:
double T = FieldSource.getTime();
Info<Skeleton> iS = theSourceBundle->findPreviousRefinementLevel(T, getGridname(), Level);
RefPtr<Representation> LevelRep = iS.getCartesianRepresentation();
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
Info< Grid > FieldSource
Meta-Information - from where did we get the selected field? The base class, GridSelector,...
Definition FieldSelector.hpp:34
BundlePtr theSourceBundle
The bundle that was used to retrieve the grid name, meaning: the selected grid name is ensured to exi...
Definition GridSelector.hpp:33
const string & getGridname() const
Name of the selected grid (member function)
Definition GridSelector.hpp:39
double getTime() const
Get the associated time value.
Definition SliceInfo.hpp:39

References FieldSource, Fiber::Info< Grid >::getGrid(), Fiber::GridSelector::getGridname(), Fiber::Info< Slice >::getTime(), mySkeletonID, and Fiber::GridSelector::theSourceBundle.

◆ getField() [2/2]

RefPtr< Fiber::Field > Fiber::FieldSelector::getField ( int  Level = 0,
const string &  ChartName = string() 
) const
inline

Return a field of the currently selected in the Cartesian representation of the Vertices on the toplevel refinement level.

Note
Be cautious about using AMR levels; the Field may not originate from the same Grid as getGrid() function yields. It is safer to use the getCartesianRepresentation() function to retrieve consistent data fields, in particular consistent coordinates and data fields.

◆ getGrid()

const RefPtr< Fiber::Grid > & Fiber::FieldSelector::getGrid ( ) const
inline

The Grid object that was found to carry the selected field.

Note that there is no requirement to query fields from just that grid where the field was found. It can as well be queried on another Grid as well, just then it's not ensured that such a field would exist there.

◆ GridSource()

const RefPtr< Fiber::Grid > & Fiber::FieldSelector::GridSource ( ) const
inline

The Grid object that was found to carry the selected field.

Note that there is no requirement to query fields from just that grid where the field was found. It can as well be queried on another Grid as well, just then it's not ensured that such a field would exist there.

◆ requiresType()

bool Fiber::FieldSelector::requiresType ( const type_info what) const
inline

Check if this field selector requires the field to be of the specified type.

Note that if no field selection has been specified, then all types will be "required" and this function returns true.

◆ selectField() [1/2]

void Fiber::FieldSelector::selectField ( const BundlePtr BP,
const double  time,
const string &  gridName,
const string &  fieldName,
const RefPtr< Grid > &  G,
const RefPtr< Slice > &  S 
)
inline

Select a field with full context information.

Only property that is left to set is the accepted types, to be set with accept().

◆ selectField() [2/2]

void Fiber::FieldSelector::selectField ( const string &  fieldname,
const TypeList_t FT = TypeList_t() 
)

Select a singular field.

Removes all others field, only one will remain here. More control and adding multiple fields requires using the SelectedFields() member function.

References getFieldName(), Selection(), and Fiber::FieldSelection::setUniqueField().

Referenced by FieldSelector(), and findFieldSource().

Member Data Documentation

◆ FieldSource

Info<Grid> Fiber::FieldSelector::FieldSource

Meta-Information - from where did we get the selected field? The base class, GridSelector, specifies information on how to find a certain Grid.

The FieldSource now actually provides the result of such a search process, and tells concretely which Grid has been found using the parameters of the base class, the Grid Selector.

Referenced by findFieldSource(), getCartesianPositions(), getCartesianRepresentation(), getField(), and getPositions().