1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | /** |
---|
3 | * Copyright (c) 2004-2013 HUBzero Foundation, LLC |
---|
4 | * |
---|
5 | * Authors: |
---|
6 | * Insoo Woo <iwoo@purdue.edu> |
---|
7 | */ |
---|
8 | #ifndef NV_ZINC_BLENDE_RECONSTRUCTOR_H |
---|
9 | #define NV_ZINC_BLENDE_RECONSTRUCTOR_H |
---|
10 | |
---|
11 | #include <istream> |
---|
12 | |
---|
13 | #include <vrmath/Vector3f.h> |
---|
14 | |
---|
15 | namespace nv { |
---|
16 | |
---|
17 | class ZincBlendeVolume; |
---|
18 | |
---|
19 | class ZincBlendeReconstructor |
---|
20 | { |
---|
21 | public: |
---|
22 | /** |
---|
23 | * @brief Load Zinc blende binary volume data and create ZincBlendeVolume with the file |
---|
24 | * @param fileName Zinc blende file name, which data is generated by NEMO-3D |
---|
25 | */ |
---|
26 | ZincBlendeVolume *loadFromFile(const char *fileName); |
---|
27 | |
---|
28 | /** |
---|
29 | * @brief Load Zinc blende binary volume data and create ZincBlendeVolume with the file |
---|
30 | * @param stream Zinc blende binary volume data, which data is generated by NEMO-3D and transferred from nanoscale |
---|
31 | */ |
---|
32 | ZincBlendeVolume *loadFromStream(std::istream& stream); |
---|
33 | |
---|
34 | ZincBlendeVolume *loadFromMemory(const void *dataBlock); |
---|
35 | |
---|
36 | /** |
---|
37 | * @brief Create ZincBlendVolume with output data of NEMO-3D |
---|
38 | * @param origin the start position of the volume data |
---|
39 | * @param delta the delta value among atoms |
---|
40 | * @param width the width of unit cells in the data |
---|
41 | * @param height the height of unit cells in the data |
---|
42 | * @param depth the depth of unit cells in the data |
---|
43 | * @param data the memory block of output data of NEMO-3D |
---|
44 | */ |
---|
45 | ZincBlendeVolume *buildUp(const vrmath::Vector3f& origin, const vrmath::Vector3f& delta, |
---|
46 | int width, int height, int depth, void *data); |
---|
47 | |
---|
48 | ZincBlendeVolume *buildUp(const vrmath::Vector3f& origin, const vrmath::Vector3f& delta, |
---|
49 | int width, int height, int depth, |
---|
50 | int datacount, double emptyvalue, void *data); |
---|
51 | |
---|
52 | /** |
---|
53 | * @brief Return a singleton instance |
---|
54 | */ |
---|
55 | static ZincBlendeReconstructor *getInstance(); |
---|
56 | |
---|
57 | private: |
---|
58 | ZincBlendeReconstructor(); |
---|
59 | |
---|
60 | ~ZincBlendeReconstructor(); |
---|
61 | |
---|
62 | /** |
---|
63 | * @brief Get a line from file. It is used for reading header because header is written in ascii. |
---|
64 | */ |
---|
65 | void getLine(std::istream& stream); |
---|
66 | void getLine(const unsigned char*& stream); |
---|
67 | |
---|
68 | char _buff[255]; |
---|
69 | |
---|
70 | /// A ZincBlendeReconstructor Singleton instance |
---|
71 | static ZincBlendeReconstructor *_instance; |
---|
72 | }; |
---|
73 | |
---|
74 | } |
---|
75 | |
---|
76 | #endif |
---|