FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
FieldInterpolator.hpp
1#ifndef _FieldInterpolator_HPP
2#define _FieldInterpolator_HPP
3
4#include <fish/fiber/vector/Interpolate.hpp>
5#include <fish/fiber/vector/LinearIpol.hpp>
6#include <fish/fiber/vector/CubicIpol.hpp>
7#include <aerie/AnalyticFunction.hpp>
8#include <fish/fiber/baseop/RectilinearInterpolation.hpp>
9#include <fish/fiber/baseop/LocalFromWorldPoint.hpp>
10
11namespace Fiber
12{
15{
16protected:
17 RefPtr<Field> TheField;
18
19public:
20 // supported interpolation types, used as template parameter in the FielInterpolator class
21 enum InterpolType{LINEAR, CUBIC, RECTILINEAR, ANALYTIC, EIGENLINEAR, EIGENCUBIC};
22
24 :TheField(TheFieldP)
25 {}
26
27// typedef pair<Eagle::PhysicalSpace::point, RefPtr<FragmentID> > FragmentedPoint_t;
29
30 // convenience function
31 RefPtr< MemBase > getArray(const FragmentedPoint_t& localPoint, const double time )
32 {
33// const string&FragName = localPoint.second;
34 //const Eagle::PhysicalSpace::point &float_index = localPoint.first;
35
36// RefPtr<FragmentID> FragID;
37//
38// if(FragName.compare("") != 0 )
39// FragID = new FragmentID( FragName );
40
41 return TheField->getCreator( localPoint.frag_id )->create();
42 }
43};
44
49template<typename FieldType, typename CoordType, int InterpolType>
51{
52public:
55 {}
56
57 FieldType doIt( const FragmentedPoint_t& localPoint, const CoordType& worldlocation, const double time )
58 {
59 puts("template<FieldType>::Interpolator::doIt() no valid Interpolation type specialization");
60
61 FieldType data;
62 return data;
63 }
64};
65
66template<typename FieldType, typename CoordType>
68{
70public:
73
76 FieldType doIt( const FragmentedPoint_t& localPoint, const CoordType& worldlocation, const double time )
77 {
78 RefPtr<MemArray<CoordType::Dims, FieldType> > ToIntArr = getArray(localPoint, time);
80
81 FieldType data;
82 LinearInterpolator_t MyInterpolator(*ToIntArr, localPoint.local_point);
83
84 data = MyInterpolator.eval();
85
86 return data;
87 }
88};
89
90template<typename FieldType, typename CoordType>
92{
93public:
96
99 FieldType doIt( const FragmentedPoint_t& localPoint, const CoordType& worldlocation, const double time )
100 {
101 assert(CoordType::Dims == 3);
102 RefPtr<MemArray<3, FieldType> > ToIntArr = getArray(localPoint, time);
103 assert( ToIntArr );
104
105 FieldType data;
106 RectilinearInterpolation::rectilinear_interpolation(localPoint.local_point, TheField, data);
107 return data;
108 }
109};
110
111template<typename FieldType, typename CoordType>
113{
115public:
118
121 FieldType doIt( const FragmentedPoint_t& localPoint, const CoordType& worldlocation, const double time )
122 {
123 RefPtr<MemArray<CoordType::Dims, FieldType> > ToIntArr =getArray(localPoint, time);
124 assert( ToIntArr );
125
126 FieldType data;
127
128 CubicInterpolator_t MyInterpolator(*ToIntArr, localPoint.local_point);
129 data = MyInterpolator.eval();
130
131 return data;
132 }
133};
134
135template<typename FieldType, typename CoordType>
137{
139
140public:
143
146 FieldType doIt( const FragmentedPoint_t& localPoint, const CoordType& worldlocation, const double time )
147 {
148 FieldType data;
149
151 {
153 data = AF(time, worldlocation);
154 }
155 else
156 {
157 puts("Interpolator<FieldType, Dims, InterpolatorBase::ANALYTIC>::doIt() ERROR: No analytic equation!");
158 }
159
160 return data;
161 }
162};
163
164
166{
167public:
168 tvector unique_orientation;
169
171 : unique_orientation ( unique_orientationP )
172 {}
173
174 tvector limit( const tvector& T) const
175 {
176 //std:: cout << "EigenVectorFlipper::limit() orientation: " << unique_orientation << std::endl;
177
178 if( dot( T, unique_orientation ) < 0)
179 return -T;
180
181 return T;
182 }
183};
184
185template<typename CoordType>
187{
189
190 tvector unique_orientation;
191
192public:
193
196 , unique_orientation(1.0, 0.0, 0.0)
197{}
198
199 void setOrientation(tvector& unique_orientationP )
200 {
201 unique_orientation = unique_orientationP;
202 }
203
206 tvector doIt( const FragmentedPoint_t& localPoint, const CoordType& worldlocation, const double time )
207 {
208 RefPtr<MemArray<CoordType::Dims, tvector> > ToIntArr = getArray(localPoint, time);
209 assert( ToIntArr );
210
211 EigenVectorFlipper EigenDelimiter( unique_orientation );
212
213 tvector data;
215
216 data = MyInterpolator.eval();
217
218 return data;
219 }
220};
221
222template<typename CoordType>
224{
226
227 tvector unique_orientation;
228
229public:
230
233 , unique_orientation(1.0, 0.0, 0.0)
234{}
235
236 void setOrientation(tvector& unique_orientationP )
237 {
238 unique_orientation = unique_orientationP;
239 }
240
243 tvector doIt( const FragmentedPoint_t& localPoint, const CoordType& worldlocation, const double time )
244 {
245 RefPtr<MemArray<CoordType::Dims, tvector> > ToIntArr = getArray(localPoint, time);
246 assert( ToIntArr );
247
248 EigenVectorFlipper EigenDelimiter( unique_orientation );
249
250 tvector data;
252
253 data = MyInterpolator.eval();
254
255 return data;
256 }
257};
258
259} // namespace Fiber
260
261#endif //_FieldInterpolator_HPP
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
Definition FieldInterpolator.hpp:166
Definition FieldInterpolator.hpp:15
FieldType doIt(const FragmentedPoint_t &localPoint, const CoordType &worldlocation, const double time)
worldlocation and time are required of the parameters.
Definition FieldInterpolator.hpp:146
FieldType doIt(const FragmentedPoint_t &localPoint, const CoordType &worldlocation, const double time)
Only the localPoint is really required of the parameters.
Definition FieldInterpolator.hpp:121
FieldType doIt(const FragmentedPoint_t &localPoint, const CoordType &worldlocation, const double time)
Only the localPoint is really required of the parameters.
Definition FieldInterpolator.hpp:76
FieldType doIt(const FragmentedPoint_t &localPoint, const CoordType &worldlocation, const double time)
Only the localPoint is really required of the parameters.
Definition FieldInterpolator.hpp:99
tvector doIt(const FragmentedPoint_t &localPoint, const CoordType &worldlocation, const double time)
Only the localPoint is really required of the parameters.
Definition FieldInterpolator.hpp:243
tvector doIt(const FragmentedPoint_t &localPoint, const CoordType &worldlocation, const double time)
Only the localPoint is really required of the parameters.
Definition FieldInterpolator.hpp:206
The FieldInterpolation class provides a function to do data interpolation on a data field.
Definition FieldInterpolator.hpp:51
vector dot(const bivector &a, const vector &b)
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
Definition LocalFromWorldPoint.hpp:39