1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | /* |
---|
3 | * ---------------------------------------------------------------------- |
---|
4 | * Rappture::DX |
---|
5 | * |
---|
6 | * Rappture DX object for file reading and interacting |
---|
7 | * with libDX and friends. |
---|
8 | * |
---|
9 | * ====================================================================== |
---|
10 | * AUTHOR: Derrick S. Kearney, Purdue University |
---|
11 | * Copyright (c) 2005-2008 Purdue Research Foundation |
---|
12 | * |
---|
13 | * See the file "license.terms" for information on usage and |
---|
14 | * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
15 | * ====================================================================== |
---|
16 | */ |
---|
17 | #ifndef RAPPTURE_DX_H |
---|
18 | #define RAPPTURE_DX_H |
---|
19 | |
---|
20 | #include <dx/dx.h> |
---|
21 | |
---|
22 | #include <RpOutcome.h> |
---|
23 | |
---|
24 | namespace Rappture { |
---|
25 | |
---|
26 | class DX |
---|
27 | { |
---|
28 | public: |
---|
29 | DX(); |
---|
30 | |
---|
31 | DX(Rappture::Outcome& result, const char *filename); |
---|
32 | |
---|
33 | DX(const DX& rpdx); |
---|
34 | |
---|
35 | DX& operator=(const DX& rpdx); |
---|
36 | |
---|
37 | virtual ~DX(); |
---|
38 | |
---|
39 | /* |
---|
40 | virtual double value(double x, double y, double z, |
---|
41 | double outside=NAN) const; |
---|
42 | virtual double valueMin() const; |
---|
43 | virtual double valueMax() const; |
---|
44 | */ |
---|
45 | virtual DX& interpolate(int *newAxisLen); |
---|
46 | |
---|
47 | int n() const |
---|
48 | { |
---|
49 | return _n; |
---|
50 | } |
---|
51 | |
---|
52 | int rank() const |
---|
53 | { |
---|
54 | return _rank; |
---|
55 | } |
---|
56 | |
---|
57 | int shape() const |
---|
58 | { |
---|
59 | return _shape; |
---|
60 | } |
---|
61 | |
---|
62 | const float *delta() const |
---|
63 | { |
---|
64 | // FIXME: Delta is always three numbers. |
---|
65 | return _delta; |
---|
66 | } |
---|
67 | |
---|
68 | const float *max() const |
---|
69 | { |
---|
70 | return _max; |
---|
71 | } |
---|
72 | |
---|
73 | const float *origin() const |
---|
74 | { |
---|
75 | return _origin; |
---|
76 | } |
---|
77 | |
---|
78 | const float * positions() const |
---|
79 | { |
---|
80 | return _positions; |
---|
81 | } |
---|
82 | |
---|
83 | const int *axisLen() const |
---|
84 | { |
---|
85 | return _axisLen; |
---|
86 | } |
---|
87 | |
---|
88 | const float *data() const |
---|
89 | { |
---|
90 | return _data; |
---|
91 | } |
---|
92 | |
---|
93 | float dataMin() const |
---|
94 | { |
---|
95 | return _dataMin; |
---|
96 | } |
---|
97 | |
---|
98 | float dataMax() const |
---|
99 | { |
---|
100 | return _dataMax; |
---|
101 | } |
---|
102 | |
---|
103 | float nzero_min() const |
---|
104 | { |
---|
105 | return _nzero_min; |
---|
106 | } |
---|
107 | |
---|
108 | private: |
---|
109 | void findPosMax(); |
---|
110 | void collectDataStats(); |
---|
111 | void getInterpPos(); |
---|
112 | void getInterpData(); |
---|
113 | |
---|
114 | float _dataMin; |
---|
115 | float _dataMax; |
---|
116 | float _nzero_min; |
---|
117 | int _numAxis; ///< same as _shape if _rank == 1 |
---|
118 | int *_axisLen; ///< number of points on each axis |
---|
119 | float *_data; |
---|
120 | |
---|
121 | int _n; ///< number of points in the position array |
---|
122 | int _rank; ///< number of dimensions in each item |
---|
123 | int _shape; ///< array of the extents of each dimension |
---|
124 | float *_positions; ///< array holding the x,y,z coord of each point |
---|
125 | float *_delta; ///< array holding deltas of the uniform mesh |
---|
126 | float *_max; ///< array hodling coord of most distant pt from origin |
---|
127 | float *_origin; ///< array holding coord of origin |
---|
128 | |
---|
129 | Object _dxobj; |
---|
130 | }; |
---|
131 | |
---|
132 | } |
---|
133 | |
---|
134 | #endif |
---|