FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
ArrayInterpolator.hpp
1
2//
3// $Id: ArrayInterpolator.hpp,v 1.1 2007/08/28 22:54:18 werner Exp $
4//
6#ifndef __FIBER_ARRAYINTERPOLATOR_HPP
7#define __FIBER_ARRAYINTERPOLATOR_HPP
8
9#include "FieldAPI.h"
10#include <memcore/RefPtr.hpp>
11#include <memcore/Interface.hpp>
12
13#include <fiber/vector/MultiArray.hpp>
14
15#include <typeinfo>
16
17namespace Fiber
18{
19 using std::type_info;
20
21 using MemCore::RefPtr;
23
28class FIELD_API ArrayInterpolator : public MemCore::Interface<ArrayInterpolator>
29{
30public:
31 virtual ~ArrayInterpolator();
32
34 virtual int CoordRank() const = 0;
35
37 virtual int FieldRank() const = 0;
38
39 virtual bool getInterpolatedValue(double result[], int nElements, const double coords[], int nCoords) const = 0;
40};
41
45template <int N>
47{
48public:
50
51 virtual bool getValue(double result[], int nElements, const IpolPoint_t&P) const = 0;
52
53 int CoordRank() const override
54 {
55 return N;
56 }
57
58 bool getInterpolatedValue(double result[], int nElements, const double coords[], int nCoords) const override
59 {
60 if (nCoords != N)
61 return false;
62
63 return getValue( result, nElements, *static_cast<IpolPoint_t*>(coords) );
64 }
65};
66
67#if 0
68template <int N, class T>
69 class CubicInterpolator : public DimensionalInterpolator
70 {
71 public:
73
74 typedef Interpolate<N, T, CubicIpol<T>, double> CubicIpol_t;
75
76 StorageInterpolator(const MemCore::WeakPtr<MemArrayStorage>&MA)
77 : myMemArray(MA)
78 {}
79
80 ~StorageInterpolator()
81 {}
82
83 int FieldRank() const override
84 {
85 typedef FiberInfo<T> FiberInfo_t;
86 return FiberInfo_t::MULTIPLICITY;
87// return myMemArray->getFiberType()->multiplicity();
88 }
89
90 bool getValue(double result[], int nElements, const IpolPoint_t&P) const override
91 {
92 if (!myMemArray)
93 return false;
94
95 CubicIpol_t ccip(myMemArray->myMultiArray, P);
96 const T&t = ccip.eval();
97 int i = 0;
98 typedef FiberInfo<T> FiberInfo_t;
99
100 for(; i<FiberInfo_t::MULTIPLICITY; i++)
101 {
102 result[i] = FiberInfo_t::getComponent(t, i);
103 }
104 return true;
105 }
106 };
107#endif
108
109
110} /* namespace Fiber */
111
112#endif /* __FIBER_ARRAYINTERPOLATOR_HPP */
A field's interpolator is an interface for this specific field.
Definition ArrayInterpolator.hpp:29
virtual int CoordRank() const =0
Number of dimensions of the base manifold.
virtual int FieldRank() const =0
Number of elements per point.
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
Abstract N-dimensional interpolator class.
Definition ArrayInterpolator.hpp:47
int CoordRank() const override
Number of dimensions of the base manifold.
Definition ArrayInterpolator.hpp:53
const T & getValue(index_t i) const
Get the value, readonly.
Definition vector/Iterator.hpp:718
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2