| 1 |
tim |
1118 |
#ifndef _OTHERVISITOR_H_ |
| 2 |
|
|
#define _OTHERVISITOR_H_ |
| 3 |
|
|
#include <set> |
| 4 |
|
|
#include <string> |
| 5 |
|
|
#include <vector> |
| 6 |
|
|
|
| 7 |
|
|
#include "BaseVisitor.hpp" |
| 8 |
|
|
#include "StuntDouble.hpp" |
| 9 |
|
|
using namespace std; |
| 10 |
|
|
|
| 11 |
|
|
//IgnoreVisitor will turn on the ignoring flag of the stuntdouble |
| 12 |
|
|
class IgnoreVisitor : public BaseVisitor{ |
| 13 |
|
|
public: |
| 14 |
|
|
IgnoreVisitor() : BaseVisitor() {visitorName = "IgnoreVisitor";} |
| 15 |
|
|
|
| 16 |
|
|
virtual void visit(Atom* atom); |
| 17 |
|
|
virtual void visit(DirectionalAtom* datom); |
| 18 |
|
|
virtual void visit(RigidBody* rb); |
| 19 |
|
|
|
| 20 |
|
|
void addIgnoreType(const string& type) {itList.insert(type);} |
| 21 |
|
|
virtual const string toString(); |
| 22 |
|
|
|
| 23 |
|
|
protected: |
| 24 |
|
|
bool isIgnoreType(const string& name); |
| 25 |
|
|
void internalVisit(StuntDouble* sd); |
| 26 |
|
|
set<string> itList; //ignore type list; |
| 27 |
|
|
}; |
| 28 |
|
|
|
| 29 |
|
|
|
| 30 |
|
|
class WrappingVisitor : public BaseVisitor{ |
| 31 |
|
|
public: |
| 32 |
|
|
WrappingVisitor(SimInfo* info) : BaseVisitor() { |
| 33 |
|
|
this->info = info; |
| 34 |
|
|
visitorName = "WrappingVisitor"; |
| 35 |
|
|
} |
| 36 |
|
|
virtual void visit(Atom* atom); |
| 37 |
|
|
virtual void visit(DirectionalAtom* datom); |
| 38 |
|
|
virtual void visit(RigidBody* rb); |
| 39 |
|
|
|
| 40 |
|
|
protected: |
| 41 |
|
|
void internalVisit(StuntDouble* sd); |
| 42 |
|
|
SimInfo* info; |
| 43 |
|
|
}; |
| 44 |
|
|
|
| 45 |
|
|
|
| 46 |
|
|
class IntVec3 { |
| 47 |
|
|
public: |
| 48 |
|
|
IntVec3(){} |
| 49 |
|
|
IntVec3(int i, int j, int k){ |
| 50 |
|
|
vec[0] = i; |
| 51 |
|
|
vec[1] = j; |
| 52 |
|
|
vec[2] = k; |
| 53 |
|
|
} |
| 54 |
|
|
|
| 55 |
|
|
double vec[3]; |
| 56 |
|
|
double& operator[](int index) {return vec[index];} |
| 57 |
|
|
}; |
| 58 |
|
|
|
| 59 |
|
|
class ReplicateVisitor : public BaseVisitor{ |
| 60 |
|
|
public: |
| 61 |
|
|
ReplicateVisitor(SimInfo* info, IntVec3 replicateOpt); |
| 62 |
|
|
virtual void visit(Atom* atom); |
| 63 |
|
|
virtual void visit(DirectionalAtom* datom); |
| 64 |
|
|
virtual void visit(RigidBody* rb); |
| 65 |
|
|
|
| 66 |
|
|
virtual const string toString(); |
| 67 |
|
|
protected: |
| 68 |
|
|
void internalVisit(StuntDouble* sd); |
| 69 |
|
|
void replicate(vector<AtomInfo*>& infoList, AtomData* data, double boxM[3][3]); |
| 70 |
|
|
|
| 71 |
|
|
private: |
| 72 |
|
|
vector<IntVec3> dir; |
| 73 |
|
|
SimInfo* info; |
| 74 |
|
|
IntVec3 replicateOpt; |
| 75 |
|
|
}; |
| 76 |
|
|
|
| 77 |
|
|
class XYZVisitor : public BaseVisitor{ |
| 78 |
|
|
public: |
| 79 |
|
|
XYZVisitor(SimInfo* info, bool printDipole = true); |
| 80 |
|
|
|
| 81 |
|
|
virtual void visit(Atom* atom); |
| 82 |
|
|
virtual void visit(DirectionalAtom* datom); |
| 83 |
|
|
virtual void visit(RigidBody* rb); |
| 84 |
|
|
|
| 85 |
|
|
void writeFrame(ostream& outStream); |
| 86 |
|
|
void clear() {frame.clear();} |
| 87 |
|
|
|
| 88 |
|
|
protected: |
| 89 |
|
|
void internalVisit(StuntDouble* sd); |
| 90 |
|
|
bool isIgnore(StuntDouble* sd); |
| 91 |
|
|
|
| 92 |
|
|
private: |
| 93 |
|
|
SimInfo* info; |
| 94 |
|
|
vector<string> frame; |
| 95 |
|
|
bool printDipole; |
| 96 |
|
|
}; |
| 97 |
|
|
|
| 98 |
|
|
|
| 99 |
|
|
class PrepareVisitor : public BaseVisitor{ |
| 100 |
|
|
public: |
| 101 |
|
|
PrepareVisitor() : BaseVisitor() {visitorName = "prepareVisitor";} |
| 102 |
|
|
|
| 103 |
|
|
virtual void visit(Atom* atom) {internalVisit(atom);} |
| 104 |
|
|
virtual void visit(DirectionalAtom* datom) {internalVisit(datom);} |
| 105 |
|
|
virtual void visit(RigidBody* rb) {internalVisit(rb);} |
| 106 |
|
|
|
| 107 |
|
|
protected: |
| 108 |
|
|
void internalVisit(StuntDouble* sd); |
| 109 |
|
|
}; |
| 110 |
|
|
|
| 111 |
|
|
|
| 112 |
|
|
#endif //_OTHERVISITOR_H_ |