1 | |
---|
2 | /* |
---|
3 | * ---------------------------------------------------------------------- |
---|
4 | * Rappture::DXWriter |
---|
5 | * |
---|
6 | * Rappture DXWriter object for forming dx files nanovis can read |
---|
7 | * |
---|
8 | * ====================================================================== |
---|
9 | * AUTHOR: Derrick S. Kearney, Purdue University |
---|
10 | * Copyright (c) 2004-2012 HUBzero Foundation, LLC |
---|
11 | * |
---|
12 | * See the file "license.terms" for information on usage and |
---|
13 | * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
14 | * ====================================================================== |
---|
15 | */ |
---|
16 | #ifndef RAPPTURE_DX_WRITER_H |
---|
17 | #define RAPPTURE_DX_WRITER_H |
---|
18 | |
---|
19 | #include <RpOutcome.h> |
---|
20 | #include <RpSimpleBuffer.h> |
---|
21 | |
---|
22 | namespace Rappture { |
---|
23 | |
---|
24 | class DXWriter { |
---|
25 | public: |
---|
26 | DXWriter(); |
---|
27 | DXWriter(double* data, size_t nmemb, size_t rank, size_t shape); |
---|
28 | DXWriter(const DXWriter& rpdx); |
---|
29 | DXWriter& operator=(const DXWriter& rpdx); |
---|
30 | virtual ~DXWriter(); |
---|
31 | |
---|
32 | virtual DXWriter& origin(double* o); |
---|
33 | virtual DXWriter& delta(double* d); |
---|
34 | virtual DXWriter& counts(size_t *p); |
---|
35 | |
---|
36 | virtual DXWriter& append(double* value); |
---|
37 | |
---|
38 | virtual DXWriter& data(double *d, size_t nmemb=1); |
---|
39 | virtual DXWriter& pos(double *p, size_t nmemb=1); |
---|
40 | virtual DXWriter& write(FILE *stream); |
---|
41 | virtual DXWriter& write(const char* fname); |
---|
42 | virtual DXWriter& write(char *str); |
---|
43 | virtual size_t size() const; |
---|
44 | |
---|
45 | virtual size_t rank(size_t rank=0); |
---|
46 | virtual size_t shape(size_t shape=0); |
---|
47 | protected: |
---|
48 | |
---|
49 | private: |
---|
50 | |
---|
51 | SimpleDoubleBuffer _dataBuf; |
---|
52 | SimpleDoubleBuffer _posBuf; |
---|
53 | |
---|
54 | size_t _rank; // number of dimensions in each item |
---|
55 | size_t _shape; // array of the extents of each dimension |
---|
56 | |
---|
57 | size_t* _positions; // array holding the number of x,y,z points |
---|
58 | double* _delta; // array holding deltas of the uniform mesh |
---|
59 | double* _origin; // array holding coord of origin |
---|
60 | |
---|
61 | DXWriter& _writeDxToBuffer(SimpleCharBuffer &dxfile); |
---|
62 | }; |
---|
63 | |
---|
64 | } // namespace Rappture |
---|
65 | |
---|
66 | #endif // RAPPTURE_DX_WRITER_H |
---|