[2798] | 1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
[931] | 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 |
---|
[3305] | 11 | * Copyright (c) 2004-2012 HUBzero Foundation, LLC |
---|
[931] | 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> |
---|
[2844] | 21 | |
---|
[1028] | 22 | #include <RpOutcome.h> |
---|
[931] | 23 | |
---|
| 24 | namespace Rappture { |
---|
| 25 | |
---|
[2844] | 26 | class DX |
---|
| 27 | { |
---|
[931] | 28 | public: |
---|
| 29 | DX(); |
---|
[2844] | 30 | |
---|
| 31 | DX(Rappture::Outcome& result, const char *filename); |
---|
| 32 | |
---|
[931] | 33 | DX(const DX& rpdx); |
---|
[2844] | 34 | |
---|
[931] | 35 | DX& operator=(const DX& rpdx); |
---|
[2844] | 36 | |
---|
[931] | 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 | */ |
---|
[2844] | 45 | virtual DX& interpolate(int *newAxisLen); |
---|
[931] | 46 | |
---|
[2844] | 47 | int n() const |
---|
| 48 | { |
---|
| 49 | return _n; |
---|
[1325] | 50 | } |
---|
[2844] | 51 | |
---|
| 52 | int rank() const |
---|
| 53 | { |
---|
| 54 | return _rank; |
---|
[1325] | 55 | } |
---|
[2844] | 56 | |
---|
| 57 | int shape() const |
---|
| 58 | { |
---|
| 59 | return _shape; |
---|
[1325] | 60 | } |
---|
[2844] | 61 | |
---|
| 62 | const float *delta() const |
---|
| 63 | { |
---|
| 64 | // FIXME: Delta is always three numbers. |
---|
| 65 | return _delta; |
---|
[1325] | 66 | } |
---|
[2844] | 67 | |
---|
| 68 | const float *max() const |
---|
| 69 | { |
---|
| 70 | return _max; |
---|
[1325] | 71 | } |
---|
[2844] | 72 | |
---|
| 73 | const float *origin() const |
---|
| 74 | { |
---|
| 75 | return _origin; |
---|
[1325] | 76 | } |
---|
[2844] | 77 | |
---|
| 78 | const float * positions() const |
---|
| 79 | { |
---|
| 80 | return _positions; |
---|
[1325] | 81 | } |
---|
[2844] | 82 | |
---|
| 83 | const int *axisLen() const |
---|
| 84 | { |
---|
| 85 | return _axisLen; |
---|
[1325] | 86 | } |
---|
[2844] | 87 | |
---|
| 88 | const float *data() const |
---|
| 89 | { |
---|
| 90 | return _data; |
---|
[1325] | 91 | } |
---|
[2844] | 92 | |
---|
| 93 | float dataMin() const |
---|
| 94 | { |
---|
| 95 | return _dataMin; |
---|
[1325] | 96 | } |
---|
[2844] | 97 | |
---|
| 98 | float dataMax() const |
---|
| 99 | { |
---|
| 100 | return _dataMax; |
---|
[1325] | 101 | } |
---|
[2844] | 102 | |
---|
| 103 | float nzero_min() const |
---|
| 104 | { |
---|
| 105 | return _nzero_min; |
---|
[1325] | 106 | } |
---|
[931] | 107 | |
---|
[2844] | 108 | private: |
---|
| 109 | void findPosMax(); |
---|
| 110 | void collectDataStats(); |
---|
| 111 | void getInterpPos(); |
---|
| 112 | void getInterpData(); |
---|
[931] | 113 | |
---|
| 114 | float _dataMin; |
---|
| 115 | float _dataMax; |
---|
| 116 | float _nzero_min; |
---|
[2844] | 117 | int _numAxis; ///< same as _shape if _rank == 1 |
---|
| 118 | int *_axisLen; ///< number of points on each axis |
---|
| 119 | float *_data; |
---|
[931] | 120 | |
---|
[2844] | 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 |
---|
[931] | 128 | |
---|
| 129 | Object _dxobj; |
---|
| 130 | }; |
---|
| 131 | |
---|
[2844] | 132 | } |
---|
[931] | 133 | |
---|
| 134 | #endif |
---|