FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
Rescale.hpp
1
2//
3// $Id: Rescale.hpp,v 1.1 2008/04/16 21:24:28 werner Exp $
4//
6#ifndef __BASEOP_RESCALE_HPP
7#define __BASEOP_RESCALE_HPP
8
9#include "gridopDllApi.h"
10#include <grid/Representation.hpp>
11
12#include <vector/LinearIpol.hpp>
13#include <vector/Interpolate.hpp>
14
15namespace Fiber
16{
17
18template <int Dims, typename Type>
20{
21
23 {
25 if (!Src)
26 return NullPtr();
27
30
33
34
35 FixedArray<double, Dims> IndexScale;
36 for(int i=0; i<Dims; i++)
37 {
38 IndexScale[i] = double(DimsSrc[i])/DestDims[i];
39 }
40
44 do
45 {
46 for(int i=0; i<Dims; i++)
47 EvalPoint[i] = MI[i]*IndexScale[i];
48
49 DestData[ MI ] = Ipol.eval();
50 }
51 while( MI.inc(DestDims) );
52
53 return Dst;
54 }
55
56static RefPtr<MemBase> rescale(double scale, const RefPtr<MemBase>&DataSrc, const MemBase::Creator_t&Crec)
57 {
59 if (!Src)
60 return NullPtr();
61
64
66 for(int i=0; i<Dims; i++)
67 {
68 DestDims[i] = index_t( scale*DimsSrc[i] );
69 }
70
73
77 do
78 {
79 for(int i=0; i<Dims; i++)
80 EvalPoint[i] = MI[i]/scale;
81
82 DestData[ MI ] = Ipol.eval();
83 }
84 while( MI.inc(DestDims) );
85
86 return Dst;
87 }
88};
89
90
96
97} // namespace Fiber
98
99#endif
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
RefPtr< MemBase > rescale(double scale, const RefPtr< MemBase > &Data, const MemBase::Creator_t &Crec)
Definition Rescale.cpp:15
IndexTypeConfig< sizeof(void *)>::index_t index_t
Define the index type as according to the size of a pointer, i.e.
Definition Index.hpp:22
std::nullptr_t NullPtr
Definition Rescale.hpp:20