1 |
tim |
1625 |
#ifndef VISITOR_ATOMDATA_HPP |
2 |
|
|
#define VISITOR_ATOMDATA_HPP |
3 |
tim |
1816 |
#include <string> |
4 |
|
|
#include <vector> |
5 |
tim |
1818 |
|
6 |
tim |
1625 |
#include "utils/GenericData.hpp" |
7 |
tim |
1818 |
#include "math/Vector3.hpp" |
8 |
tim |
1625 |
|
9 |
|
|
namespace oopse { |
10 |
|
|
|
11 |
|
|
struct AtomInfo { |
12 |
tim |
1816 |
std::string AtomType; |
13 |
tim |
1818 |
Vector3d pos; |
14 |
|
|
Vector3d dipole; |
15 |
tim |
1625 |
}; |
16 |
|
|
|
17 |
|
|
class AtomData : public GenericData{ |
18 |
tim |
1818 |
public: |
19 |
tim |
1625 |
|
20 |
tim |
1818 |
AtomData(const std::string& id = "ATOMDATA") : GenericData(id) {} |
21 |
tim |
1625 |
|
22 |
tim |
1818 |
~AtomData() { |
23 |
|
|
std::vector<AtomInfo*>::iterator i; |
24 |
|
|
AtomInfo* atomInfo; |
25 |
|
|
|
26 |
|
|
for(atomInfo = beginAtomInfo(i); atomInfo; atomInfo = nextAtomInfo(i)) { |
27 |
|
|
delete atomInfo; |
28 |
|
|
} |
29 |
|
|
data.clear(); |
30 |
|
|
} |
31 |
|
|
|
32 |
|
|
void addAtomInfo(AtomInfo* info) {data.push_back(info);} |
33 |
|
|
|
34 |
|
|
void clearAllAtomInfo(); |
35 |
|
|
|
36 |
|
|
AtomInfo* beginAtomInfo(std::vector<AtomInfo*>::iterator& i){ |
37 |
|
|
i = data.begin(); |
38 |
|
|
return i != data.end()? *i : NULL; |
39 |
|
|
} |
40 |
|
|
|
41 |
|
|
AtomInfo* nextAtomInfo(std::vector<AtomInfo*>::iterator& i){ |
42 |
|
|
++i; |
43 |
|
|
return i != data.end()? *i: NULL; |
44 |
|
|
} |
45 |
|
|
|
46 |
|
|
std::vector<AtomInfo*> getData() {return data;} |
47 |
|
|
|
48 |
|
|
int getSize() {return data.size();} |
49 |
|
|
|
50 |
|
|
protected: |
51 |
|
|
|
52 |
|
|
std::vector<AtomInfo*> data; |
53 |
tim |
1625 |
}; |
54 |
|
|
|
55 |
|
|
|
56 |
|
|
} |
57 |
|
|
#endif //VISITOR_ATOMDATA_HPP |