Fish - FiberLib for VISH 0.3
Fish - The Fiber Bundle API for the Vish Visualization Shell

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_t & FieldTypes ()
 List of types that this field might provide or want.
const TypeList_t & FieldTypes () 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 stringgetGridname () const
 Name of the selected grid (member function).
const stringgetGridName () 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 stringGridname () 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?
SkeletonID mySkeletonID
 Specify the source of this field, on which grid does it live?
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, 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!

References FieldSelector(), Fiber::GridSelector::GridSelector(), FieldSource, and mySkeletonID.

◆ 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(), getTime(), and mySkeletonID.

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>();
void accept()
Define the types that this field accepts or provides.
Definition FieldSelector.hpp:127
FieldSelector()
Constructor.
Definition FieldSelector.cpp:6

References FieldTypes().

Referenced by Wizt::Fish< Fiber::Field >::acceptType(), Wizt::TypedSlot< Fiber::Field >::acceptType(), Wizt::FieldFunctor< Operation, GridInspectorType >::FieldOperation(), and Wizt::VOutput< Fiber::Field >::provides().

◆ 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::GridSelector::getGridname(), 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();
Info< Grid > FieldSource
Meta-Information - from where did we get the selected field?
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
StrongPtr< Object, ObjectBase > RefPtr
Generic template namespace class for results of find() functions throughout the Bundle.
Definition Info.hpp:17

References FieldSource, Fiber::GridSelector::getGridname(), mySkeletonID, and Fiber::GridSelector::theSourceBundle.

Referenced by Wizt::BinaryFieldOperatorObject< TheBinaryOperator, NamingOperator, PrimaryValueType, SecondaryValueType, ResultValueType >::FieldOperation(), and getField().

◆ 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.

References getField(), and getFieldName().

◆ 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.

References FieldSource.

Referenced by Wizt::BinaryFieldOperatorObject< TheBinaryOperator, NamingOperator, PrimaryValueType, SecondaryValueType, ResultValueType >::FieldOperation().

◆ 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.

References FieldSource.

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

References FieldSource, selectField(), Fiber::GridSelector::selectGrid(), and Fiber::GridSelector::theSourceBundle.

◆ 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(), Wizt::FieldFunctor< Operation, GridInspectorType >::FieldOperation(), findFieldSource(), selectField(), selectField(), and selectTypedField().

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 FieldSelector(), FieldSelector(), FieldSelector(), findFieldSource(), getCartesianPositions(), getCartesianRepresentation(), getField(), getGrid(), getPositions(), getSlice(), getTime(), GridSource(), operator==, and selectField().

◆ mySkeletonID

SkeletonID Fiber::FieldSelector::mySkeletonID

Specify the source of this field, on which grid does it live?

By default, this are the vertices.

Referenced by FieldSelector(), FieldSelector(), FieldSelector(), FieldSelector(), FieldSelector(), and getField().