FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
ExtractSlice.hpp
1#ifndef __FIBEROPERATIONS_EXTRACT_SLICE
2#define __FIBEROPERATIONS_EXTRACT_SLICE
3
4#include <field/MemBase.hpp>
5#include <meta/LIST.hpp>
6#include "SliceSelection.hpp"
7
8namespace Fiber
9{
10
11template <class Array2D>
13{
15
16 result_t result;
17 Array2D & dst;
18
20 : result( new Array2D(Dims) )
21 , dst( *result )
22 {
23
24 }
25
26 template <class ElementType>
27 void collect(const MultiIndex<2>&Dims, const ElementType&T)
28 {
29 dst[ Dims ] = T;
30 }
31
32static result_t Invalid()
33 {
34 return MemCore::NullPtr();
35 }
36};
37
38template <class Operator, class Array3D>
40{
41
42static typename Operator::result_t get(const MultiIndex<3>&Dims,
45 {
47 if (!src)
48 return Operator::Invalid();
49
50 index_t Xsize = Dims[ GO.X ];
51 index_t Ysize = Dims[ GO.Y ];
52
53 Operator Op( MIndex(Xsize, Ysize) );
54
55 const Array3D&Src = *src;
56
57 for(index_t iy = 0; iy<Ysize; iy++)
58 for(index_t ix = 0; ix<Xsize; ix++)
59 {
61 P[GO.X] += ix; P[GO.Y] += iy; P[GO.Z] += SliceID;
62
64 Pdst[ 0 ] = ix;
65 Pdst[ 1 ] = iy;
66
67 Op.collect( Pdst, Src[ P ] );
68 }
69
70 return Op.result;
71 }
72};
73
74template <class Operator, class Array3D, class NEXT>
75struct ExtractSlice<Operator, META::LIST<Array3D, NEXT> >
76{
77
78static typename Operator::result_t get(const MultiIndex<3>&Dims,
81 {
82 if (typename Operator::result_t result =
84 {
85 return result;
86 }
88 }
89};
90
91template <class Operator>
93{
94
95static typename Operator::result_t get(const MultiIndex<3>&Dims,
98 {
99 return Operator::Invalid();
100 }
101};
102
103} // namespace Fiber
104
105#endif //__FIBEROPERATIONS_EXTRACT_SLICE
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
std::nullptr_t NullPtr
Definition ExtractSlice.hpp:13
Definition ExtractSlice.hpp:40