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 { |
10 |
– |
public: |
12 |
|
std::string AtomType; |
13 |
< |
double pos[3]; |
14 |
< |
double dipole[3]; |
13 |
> |
Vector3d pos; |
14 |
> |
Vector3d dipole; |
15 |
|
}; |
16 |
|
|
17 |
|
class AtomData : public GenericData{ |
18 |
< |
public: |
18 |
< |
AtomData(const string& id = "ATOMDATA") : GenericData(id) {} |
19 |
< |
~AtomData() { |
20 |
< |
std::vector<AtomInfo*>::iterator i; |
21 |
< |
AtomInfo* atomInfo; |
18 |
> |
public: |
19 |
|
|
20 |
< |
for(atomInfo = beginAtomInfo(i); atomInfo; atomInfo = nextAtomInfo(i)) |
24 |
< |
delete atomInfo; |
20 |
> |
AtomData(const std::string& id = "ATOMDATA") : GenericData(id) {} |
21 |
|
|
22 |
< |
data.clear(); |
23 |
< |
} |
24 |
< |
void addAtomInfo(AtomInfo* info) {data.push_back(info);} |
25 |
< |
void clearAllAtomInfo(); |
26 |
< |
AtomInfo* beginAtomInfo(vector<AtomInfo*>::iterator& i){ |
27 |
< |
i = data.begin(); |
28 |
< |
return i != data.end()? *i : NULL; |
29 |
< |
} |
30 |
< |
AtomInfo* nextAtomInfo(vector<AtomInfo*>::iterator& i){ |
31 |
< |
++i; |
32 |
< |
return i != data.end()? *i: NULL; |
33 |
< |
} |
34 |
< |
std::vector<AtomInfo*> getData() {return data;} |
35 |
< |
int getSize() {return data.size();} |
36 |
< |
protected: |
37 |
< |
std::vector<AtomInfo*> data; |
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 |
|
|