1 |
#ifndef VISITOR_ATOMDATA_HPP |
2 |
#define VISITOR_ATOMDATA_HPP |
3 |
#include <string> |
4 |
#include <vector> |
5 |
|
6 |
#include "utils/GenericData.hpp" |
7 |
#include "math/Vector3.hpp" |
8 |
|
9 |
namespace oopse { |
10 |
|
11 |
struct AtomInfo { |
12 |
std::string AtomType; |
13 |
Vector3d pos; |
14 |
Vector3d dipole; |
15 |
}; |
16 |
|
17 |
class AtomData : public GenericData{ |
18 |
public: |
19 |
|
20 |
AtomData(const std::string& id = "ATOMDATA") : GenericData(id) {} |
21 |
|
22 |
~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 |
}; |
54 |
|
55 |
|
56 |
} |
57 |
#endif //VISITOR_ATOMDATA_HPP |