FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
FieldSelector.hpp
1#ifndef __FIBER_FIELDSELECTOR_HPP
2#define __FIBER_FIELDSELECTOR_HPP
3
4#include "BundleAPI.h"
5#include <grid/Grid.hpp>
6#include "GridSelector.hpp"
7#include "FieldSelection.hpp"
8
9namespace Fiber
10{
11
18{
23 RefPtr<FieldSelection> MySelectedFields;
24
25public:
26
35
42
46 FieldSelection&Selection();
47
48 RefPtr<FieldSelection> getSelectedFields() const
49 {
50 return MySelectedFields;
51 }
52
53 const FieldSelection&Selection() const;
54
57
61 FieldSelector(const GridSelector&GS, const Info<Grid>&FieldSource);
62
69
74 FieldSelector(const FieldSelector&FS, const string&fieldname, const TypeList_t&FT = TypeList_t() );
75
76 FieldSelector(const BundlePtr&bpP, const double timeP, const string& gridNameP, const string& fieldNameP);
77
83 FieldSelector(double&time, const BundlePtr&BP, const string& gridName, const string&fieldName);
84
87
95 bool requiresType(const type_info&what) const
96 {
97 if (!MySelectedFields)
98 return true;
99
100 return MySelectedFields->requiresType(what);
101 }
102
104 unsigned NumberOfAvailableFields() const;
105
108 {
109 return Selection().FieldTypes();
110 }
111
113 const TypeList_t&FieldTypes() const
114 {
115 return Selection().FieldTypes();
116 }
117
126 template <class ...T>
127 void accept()
128 {
129 AcceptType<T...>::accept( FieldTypes() );
130
131// return Selection().setFieldType( Selection().getFieldName(), FiberType<T>::getFiberType(), append );
132// SelectedFields().setType<T>(true);
133// Fiber::AcceptType<T>::accept( AcceptableFieldTypes );
134 }
135
137 friend BUNDLE_API bool operator==(const FieldSelector&L, const FieldSelector&R);
138
140 friend bool operator!=(const FieldSelector&L, const FieldSelector&R)
141 {
142 return !(L==R);
143 }
144
152 void selectField(const string&fieldname, const TypeList_t&FT = TypeList_t() );
153
157 template <class T>
158 void selectTypedField(const string&fieldname)
159 {
160 selectField( fieldname, Fiber::TypeList( FiberType<T>::getFiberType() ) );
161 }
162
166 void selectField(const string&fieldname, const Field&F)
167 {
168 if (WeakPtr<FiberTypeBase> FTB = F.getElementFiberType() )
169 selectField( fieldname, FTB );
170 else
171 selectField( fieldname );
172 }
173
178 FieldSelector operator()(const string&fieldname, const Field&F) const
179 {
180 if (WeakPtr<FiberTypeBase> FTB = F.getElementFiberType() )
181 return FieldSelector(*this, fieldname, FTB);
182
183 return FieldSelector(*this, fieldname);
184 }
185
191 void selectField(const BundlePtr&BP, const double time, const string& gridName, const string&fieldName,
192 const RefPtr<Grid>&G, const RefPtr<Slice>&S)
193 {
194 selectField( fieldName );
195 FieldSource = Info<Grid>( time, S, G);
196 selectGrid(gridName);
197 theSourceBundle = BP;
198 }
199
203 void clearSelection();
204
210 {
211 return Rep.makeFieldID( getFieldName() );
212 }
213
214 bool setFieldSource(double time, const string&theFieldname);
215
220 bool findFieldSource(double time, const string&Fieldname);
221
226 bool findFieldSource(const BundlePtr&bpP, double timeP, const string& gridNameP, const string&fieldNameP);
227
229 string getFieldName() const;
230
232 string getFieldname() const
233 {
234 return getFieldName();
235 }
236
238 string operator()() const
239 {
240 return getFieldName();
241 }
242
244
252 {
253 return FieldSource.getGrid();
254 }
255
263 {
264 return FieldSource.getGrid();
265 }
266
270 const WeakPtrSlice&getSlice() const
271 {
272 return FieldSource.getSlice();
273 }
274
276 double getTime() const
277 {
278 return FieldSource.getTime();
279 }
280
304 RefPtr<Field> getField(const string&theName, int Level=0, const string&ChartName = string()) const;
305
319 RefPtr<Fiber::Field> getField(int Level=0, const string&ChartName = string()) const
320 {
321 return getField( getFieldName(), Level );
322 }
323
327 RefPtr<Field> getPositions(const RefPtr<ChartID>&theChartID) const;
328
329 RefPtr<Field> getField(const RefPtr<ChartID>&theChartID, const string&fieldname) const;
330
331 RefPtr<Field> getField(const RefPtr<ChartID>&theChartID) const
332 {
333 return getField( theChartID, getFieldName() );
334 }
335
340 RefPtr<Field> getCartesianPositions() const;
341
351 RefPtr<Representation> getCartesianRepresentation(int Level=0) const;
352
353 bool operator!() const;
354
355 operator bool() const
356 {
357 return !!*this;
358 }
359};
360
361
362
363} /* namespace Fiber */
364
365#endif /* __FIBER_FIELDSELECTOR_HPP */
Convenience class that implements a pointer to a Bundle object but adds some useful member funtions t...
Definition Bundle.hpp:779
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
Description of types, which is meta-information like what is the number of elements of some array-lik...
Definition FiberType.hpp:61
An abstract selection of fields, that is given by names of fields and possible types for each field.
Definition FieldSelection.hpp:23
An internal class that stores a couple of textual names.
Definition FieldSelector.hpp:18
RefPtr< Fiber::Field > getField(int Level=0, const string &ChartName=string()) const
Return a field of the currently selected in the Cartesian representation of the Vertices on the tople...
Definition FieldSelector.hpp:319
friend bool operator!=(const FieldSelector &L, const FieldSelector &R)
Check if two field selectors differ.
Definition FieldSelector.hpp:140
const WeakPtrSlice & getSlice() const
Get the slice where the field selector refers to.
Definition FieldSelector.hpp:270
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.
Definition FieldSelector.hpp:191
string getFieldname() const
Return the name of the currently selected field.
Definition FieldSelector.hpp:232
SkeletonID mySkeletonID
Specify the source of this field, on which grid does it live? By default, this are the vertices.
Definition FieldSelector.hpp:41
const TypeList_t & FieldTypes() const
List of types that this field might provide or want.
Definition FieldSelector.hpp:113
Info< Grid > FieldSource
Meta-Information - from where did we get the selected field? The base class, GridSelector,...
Definition FieldSelector.hpp:34
bool requiresType(const type_info &what) const
Check if this field selector requires the field to be of the specified type.
Definition FieldSelector.hpp:95
double getTime() const
The time when this field was found most recently.
Definition FieldSelector.hpp:276
void accept()
Define the types that this field accepts or provides.
Definition FieldSelector.hpp:127
void selectTypedField(const string &fieldname)
Select a field giving its type as template function argument.
Definition FieldSelector.hpp:158
const RefPtr< Fiber::Grid > & getGrid() const
The Grid object that was found to carry the selected field.
Definition FieldSelector.hpp:262
void selectField(const string &fieldname, const Field &F)
Select a field giving its type from a Field object.
Definition FieldSelector.hpp:166
RefPtr< Fiber::FieldID > makeFieldID(Fiber::Representation &Rep) const
Make a new field ID if none exists yet for the intrinsic field name.
Definition FieldSelector.hpp:209
const RefPtr< Fiber::Grid > & GridSource() const
The Grid object that was found to carry the selected field.
Definition FieldSelector.hpp:251
TypeList_t & FieldTypes()
List of types that this field might provide or want.
Definition FieldSelector.hpp:107
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 fiel...
Definition FieldSelector.hpp:178
string operator()() const
Return the currently selected field name.
Definition FieldSelector.hpp:238
A Field is a collection of CreativeArrayBase reference pointers which are accessed via FragmentID obj...
Definition Field.hpp:245
Context information to select a grid from within a bundle.
Definition GridSelector.hpp:26
A Representation is a set of Field objects, each of them accessed via some FieldID identifier.
Definition Representation.hpp:101
Identifier for Skeletons within a Grid.
Definition SkeletonID.hpp:24
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
bool operator==(const MultipleStringSelection &a, const MultipleStringSelection &b)
A template helper class to provide an easier syntax for allowing certain field types to be accepted b...
Definition FiberType.hpp:267
Definition fs/init.hpp:20
A set of types.
Definition FiberType.hpp:213