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 "rappture2.h" |
---|
21 | #include <dx/dx.h> |
---|
22 | #include <RpOutcome.h> |
---|
23 | |
---|
24 | namespace Rappture { |
---|
25 | |
---|
26 | class DX { |
---|
27 | public: |
---|
28 | DX(); |
---|
29 | DX(Rappture::Outcome &result, const char* filename); |
---|
30 | DX(const DX& rpdx); |
---|
31 | DX& operator=(const DX& rpdx); |
---|
32 | virtual ~DX(); |
---|
33 | |
---|
34 | /* |
---|
35 | virtual double value(double x, double y, double z, |
---|
36 | double outside=NAN) const; |
---|
37 | virtual double valueMin() const; |
---|
38 | virtual double valueMax() const; |
---|
39 | */ |
---|
40 | virtual DX& interpolate(int* newAxisLen); |
---|
41 | |
---|
42 | int n(void) const { |
---|
43 | return _n; |
---|
44 | } |
---|
45 | int rank(void) const { |
---|
46 | return _rank; |
---|
47 | } |
---|
48 | int shape(void) const { |
---|
49 | return _shape; |
---|
50 | } |
---|
51 | const float* delta(void) const { |
---|
52 | // FIXME: Delta is always three numbers. |
---|
53 | return _delta; |
---|
54 | } |
---|
55 | const float *max(void) const { |
---|
56 | return _max; |
---|
57 | } |
---|
58 | const float *origin(void) const { |
---|
59 | return _origin; |
---|
60 | } |
---|
61 | const float * positions(void) const { |
---|
62 | return _positions; |
---|
63 | } |
---|
64 | const int *axisLen(void) const { |
---|
65 | return _axisLen; |
---|
66 | } |
---|
67 | const float *data(void) const { |
---|
68 | return _data; |
---|
69 | } |
---|
70 | float dataMin(void) const { |
---|
71 | return _dataMin; |
---|
72 | } |
---|
73 | float dataMax(void) const { |
---|
74 | return _dataMax; |
---|
75 | } |
---|
76 | float nzero_min(void) const { |
---|
77 | return _nzero_min; |
---|
78 | } |
---|
79 | |
---|
80 | protected: |
---|
81 | |
---|
82 | private: |
---|
83 | float _dataMin; |
---|
84 | float _dataMax; |
---|
85 | float _nzero_min; |
---|
86 | int _numAxis; // same as _shape if _rank == 1 |
---|
87 | int *_axisLen; // number of points on each axis |
---|
88 | float* _data; |
---|
89 | |
---|
90 | int _n; // number of points in the position array |
---|
91 | int _rank; // number of dimensions in each item |
---|
92 | int _shape; // array of the extents of each dimension |
---|
93 | float* _positions; // array holding the x,y,z coord of each point |
---|
94 | float* _delta; // array holding deltas of the uniform mesh |
---|
95 | float* _max; // array hodling coord of most distant pt from origin |
---|
96 | float* _origin; // array holding coord of origin |
---|
97 | |
---|
98 | Object _dxobj; |
---|
99 | |
---|
100 | void __findPosMax(); |
---|
101 | void __collectDataStats(); |
---|
102 | void __getInterpPos(); |
---|
103 | void __getInterpData(); |
---|
104 | |
---|
105 | |
---|
106 | }; |
---|
107 | |
---|
108 | } // namespace Rappture |
---|
109 | |
---|
110 | #endif |
---|