FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
FishField.hpp
1#ifndef __FISH_BONE_FIELD_HPP
2#define __FISH_BONE_FIELD_HPP
3
4#include "FishGrid.hpp"
5
6#include <ocean/plankton/VObject.hpp>
7#include <ocean/plankton/VPipeline.hpp>
8
9#include <ocean/shrimp/VStringList.hpp>
10#include <ocean/shrimp/VTime.hpp>
11
12#include <bundle/FieldSelector.hpp>
13
14#include <meta/LIST.hpp>
15#include <meta/NativeTypeList.hpp>
16
17#include "FieldInputCreator.hpp"
18
19
20namespace Wizt
21{
23
28template <>
29class fishbone_API VOutput<Fiber::Field> : public VOutput<FieldSelector>
30{
31public:
35 VOutput(const WeakPtr<VObject>&Source,
36 const string&initial_name,
38
39 VOutput(const VObject::Deferred&D);
40
44 template <class T>
46 {
48 (*this) << Context >> F;
49
50// AcceptType<T> xxx(F.FieldTypes());
51
52 F.accept<T>();
53
54// F.setType( Fiber::FiberType< T >::getFiberType() );
55// F.AcceptableFieldTypes.insert( Fiber::FiberType< T >::getFiberType().self() );
56
57// const VOutputAssignmentContext<Fiber::Field>&f = (*this) << Context;
58// const VOutputAssignmentContext<Fiber::FieldSelector>&f = (*this) << Context;
59// f << F;
60
61 (*this) << Context << F;
62 return true;
63 }
64};
65
66
67
71template <>
73{
74
75
76static bool setValueFromText(FieldSelector&i, const string&s);
77
78static string Text(const FieldSelector&F);
79
80};
81
82template <>
84{
85public:
86static void init(FieldSelector&)
87 {}
88
89static bool setValueFromText(FieldSelector&i, const string&s)
90 {
92 }
93};
94
95template <>
97{
98public:
99static void init(Fiber::Field&)
100 {}
101
102static bool setValueFromText(Fiber::Field&i, const string&s)
103 {
104 return false;
105 }
106};
107
111{
112public:
113 virtual ~FieldValueConstraint();
114
115 bool isConnectable(const VParameter&Output, const VParameter&Input) const override;
116};
117
118
124template <>
125struct fishbone_API TypedSlot<Fiber::Field> : TypedSlot<FieldSelector>
126{
133 TypedSlot(VSlotContainer*that, const string&slotname, int prior=0);
134
140 TypedSlot<VTime> getTimeSlot() const;
141
143 template <class T>
145 {
146 if (!*this) return false;
147
149 RefPtr<VValue<FieldSelector> > VVF = (*this)->getGlobalValue();
150 if (!VVF) return false;
151
153
154 VF.accept<T>();
155
156 return true;
157 }
158
162 string getFieldname(const RefPtr<ValuePool>&VP) const;
163
164};
165
166
167template <>
168struct fishbone_API VSlotContainer::in<Fiber::Field, VSlotContainer::InvalidExpertLevel, void> : public TypedSlot<Fiber::Field>
169{
170 in(VSlotContainer*that, const string&name, int expertLevel=0)
171 : TypedSlot<Fiber::Field>(that, name, expertLevel)
172 {}
173
174 ~in();
175};
176
177
192template <>
193struct fishbone_API Fish<Fiber::Field> : public virtual Fish<double>
194{
195protected:
197
198public:
199 enum
200 {
204 NumberOfInputFields = 1
205 };
206
208 Fish(const string&field, int ExpertLevel=0);
209
211 template <class ...T>
213 {
214 if (!MyField) return false;
215
217 RefPtr<VValue<FieldSelector> > VVF = MyField->getGlobalValue();
218 if (!VVF) return false;
219
221
222 VF.accept<T...>();
223
224 return true;
225 }
226
229 {
230 this->setExpertLevel( MyField, EL);
231 }
232
234 ~Fish();
235
236
239 {
240 this->registerOutput( MyField );
241 }
242
246 string Fieldname(const RefPtr<ValuePool>&VP) const;
247
252 {
253 return Fieldname(VP);
254 }
255
257 RefPtr<Fiber::Field> getField(const RefPtr<ValuePool>&VP) const;
258
262 RefPtr<Fiber::Field> getField(const RefPtr<ValuePool>&VP, const string&theFieldName) const;
263
267 RefPtr<Fiber::Field> getFieldRepresentation(const RefPtr<Fiber::Representation>&LevelRep,
268 const RefPtr<ValuePool>&VP,
270 Fiber::Grid&SourceGrid,
271 Fiber::Slice&DestGridSlice, const string&HelperDestGridName,
272 bool StoreResult = true);
273
278 {
279 return getField(VP, "Positions");
280 }
281
282 FieldSelector getFieldSelector(const RefPtr<ValuePool>&VP) const;
283
285 double getTime(const RefPtr<ValuePool>&VP, const RefPtr<Fiber::Bundle>&SpaceTime) const override;
286
305 {
306 return MyField.getTimeSlot();
307 }
308
313 {
314 return MyField.getSource();
315 }
316
327 const RefPtr<ValuePool>&VP) const;
328
329
331 getRefinementLevel(int Level,
332 const RefPtr<ValuePool>&VP,
333 int IndexDepth = 0,
335 const override ;
336
337
339 findMostRecentGrid(FieldSelector&GS, const RefPtr<ValuePool>&VP, const Fiber::BundlePtr&SpaceTime = Fiber::BundlePtr(NullPtr() )) const;
340
350 findMostRecentGrid(const RefPtr<ValuePool>&VP, const Fiber::BundlePtr&SpaceTime = Fiber::BundlePtr( NullPtr() ) ) const;
351
352 using Fish<double>::IterateLevels;
353
373 bool IterateLevels(LevelIterator&LI, const RefPtr<ValuePool>&Context,
375
376
377};
378
383template <class ...FieldTypes>
384struct TypedField : public Fish<Fiber::Field>
385{
386 using InputTypes = META::LIST<FieldTypes...>;
387
388 TypedField(const string&field, int ExpertLevel=0)
390 {
391 this->acceptType<FieldTypes...>();
392 }
393};
394
395} // namespace Wizt
396
397#endif /* __FISH_BONE_FIELD_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
An internal class that stores a couple of textual names.
Definition FieldSelector.hpp:18
A Field is a collection of CreativeArrayBase reference pointers which are accessed via FragmentID obj...
Definition Field.hpp:245
A Grid is a set of Skeleton objects, each of them accessed via some unique SkeletonID object.
Definition Grid.hpp:60
Information per time slice, mainly a set of Grid objects that are accessed via GridID objects.
Definition Slice.hpp:36
Definition FishField.hpp:111
bool provides(const RefPtr< ValuePool > &Context=NullPtr())
Specify which types will be provided by this output field.
Definition FishField.hpp:45
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
std::nullptr_t NullPtr
note: cannot derive from FloatingSkeletonRenderer as long as independent base class TriangleRenderer ...
The information as returned by a query for Grids.
Definition GridInfo.hpp:21
RefPtr< VManagedObject > getSource() const
Get the source object of this field slot, can be used to check if the field is connected to a source ...
Definition FishField.hpp:312
TypedSlot< VTime > getTimeSlot() const
Return the associated time slot from the source object.
Definition FishField.hpp:304
Fish(const string &field, int ExpertLevel=0)
Constructor, specify slot name for this field.
Definition FishField.cpp:143
RefPtr< Fiber::Field > getCoordinates(const RefPtr< ValuePool > &VP) const
Get the coordinates on this Grid.
Definition FishField.hpp:277
void registerFieldAsOutput()
Make field visible as output.
Definition FishField.hpp:238
double getTime(const RefPtr< ValuePool > &VP, const RefPtr< Fiber::Bundle > &SpaceTime) const override
Get the time from the current field selector.
bool acceptType()
Tell this field to accept certain types.
Definition FishField.hpp:212
void setFieldExpertLevel(int EL)
Set the expert level of this slot.
Definition FishField.hpp:228
string getFieldname(const RefPtr< ValuePool > &VP) const
Get the name of the selected field.
Definition FishField.hpp:251
Construct a Fish object that can operate on various types of a field.
Definition FishField.hpp:385
bool acceptType()
Tell this field to accept certain types.
Definition FishField.hpp:144