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