| 54 |
|
#include "visitors/RigidBodyVisitor.hpp" |
| 55 |
|
#include "visitors/OtherVisitor.hpp" |
| 56 |
|
#include "visitors/ZconsVisitor.hpp" |
| 57 |
– |
#include "visitors/SelectionVisitor.hpp" |
| 57 |
|
#include "selection/SelectionEvaluator.hpp" |
| 58 |
+ |
#include "selection/SelectionManager.hpp" |
| 59 |
+ |
#include "visitors/LipidTransVisitor.hpp" |
| 60 |
+ |
|
| 61 |
|
using namespace oopse; |
| 62 |
|
|
| 63 |
|
int main(int argc, char* argv[]){ |
| 101 |
|
|
| 102 |
|
//creat visitor list |
| 103 |
|
CompositeVisitor* compositeVisitor = new CompositeVisitor(); |
| 102 |
– |
|
| 103 |
– |
//creat ignore visitor |
| 104 |
– |
if(args_info.ignore_given ||args_info.water_flag){ |
| 104 |
|
|
| 106 |
– |
IgnoreVisitor* ignoreVisitor = new IgnoreVisitor(info); |
| 107 |
– |
|
| 108 |
– |
for(int i = 0; i < args_info.ignore_given; i++) |
| 109 |
– |
ignoreVisitor->addIgnoreType(args_info.ignore_arg[i]); |
| 110 |
– |
|
| 111 |
– |
//ignore water |
| 112 |
– |
if(args_info.water_flag){ |
| 113 |
– |
ignoreVisitor->addIgnoreType("SSD"); |
| 114 |
– |
ignoreVisitor->addIgnoreType("SSD1"); |
| 115 |
– |
ignoreVisitor->addIgnoreType("SSD_E"); |
| 116 |
– |
ignoreVisitor->addIgnoreType("SSD_RF"); |
| 117 |
– |
ignoreVisitor->addIgnoreType("TIP3P_RB_0"); |
| 118 |
– |
ignoreVisitor->addIgnoreType("TIP4P_RB_0"); |
| 119 |
– |
ignoreVisitor->addIgnoreType("TIP5P_RB_0"); |
| 120 |
– |
ignoreVisitor->addIgnoreType("SPCE_RB_0"); |
| 121 |
– |
ignoreVisitor->addIgnoreType("DPD_RB_0"); |
| 122 |
– |
} |
| 123 |
– |
|
| 124 |
– |
compositeVisitor->addVisitor(ignoreVisitor, 1000); |
| 125 |
– |
} |
| 126 |
– |
|
| 105 |
|
//creat RigidBody Visitor |
| 106 |
|
if(args_info.rigidbody_flag){ |
| 107 |
|
RBCOMVisitor* rbCOMVisitor = new RBCOMVisitor(info); |
| 108 |
|
compositeVisitor->addVisitor(rbCOMVisitor, 900); |
| 109 |
|
} |
| 110 |
|
|
| 133 |
– |
//create selection visitor |
| 134 |
– |
//if (args_info.selection_given){ |
| 135 |
– |
// SelectionVisitor* selectionVisitor = new SelectionVisitor(info, args_info.selection_arg); |
| 136 |
– |
// compositeVisitor->addVisitor(selectionVisitor, 850); |
| 137 |
– |
//} |
| 138 |
– |
|
| 139 |
– |
SelectionEvaluator* evaluator = NULL; |
| 140 |
– |
if (args_info.selection_given) { |
| 141 |
– |
evaluator = new SelectionEvaluator(info); |
| 142 |
– |
assert(evaluator); |
| 143 |
– |
evaluator->loadScriptString( args_info.selection_arg); |
| 144 |
– |
|
| 145 |
– |
} |
| 146 |
– |
|
| 111 |
|
//creat SSD atom visitor |
| 112 |
|
SSDAtomVisitor* ssdVisitor = new SSDAtomVisitor(info); |
| 113 |
|
compositeVisitor->addVisitor(ssdVisitor, 800); |
| 143 |
|
WrappingVisitor* wrappingVisitor = new WrappingVisitor(info); |
| 144 |
|
compositeVisitor->addVisitor(wrappingVisitor, 400); |
| 145 |
|
} |
| 146 |
< |
|
| 146 |
> |
|
| 147 |
|
//creat replicate visitor |
| 148 |
|
if(args_info.repeatX_given > 0 || args_info.repeatY_given > 0 ||args_info.repeatY_given > 0){ |
| 149 |
|
Vector3i replicateOpt(args_info.repeatX_arg, args_info.repeatY_arg, args_info.repeatZ_arg); |
| 150 |
|
ReplicateVisitor* replicateVisitor = new ReplicateVisitor(info, replicateOpt); |
| 151 |
|
compositeVisitor->addVisitor(replicateVisitor, 300); |
| 152 |
|
} |
| 153 |
< |
|
| 153 |
> |
|
| 154 |
> |
|
| 155 |
> |
//create rotation visitor |
| 156 |
> |
if (args_info.refsele_given&& args_info.originsele_given) { |
| 157 |
> |
compositeVisitor->addVisitor(new LipidTransVisitor(info, args_info.originsele_arg, args_info.refsele_arg), 250); |
| 158 |
> |
} else if (args_info.refsele_given || args_info.originsele_given) { |
| 159 |
> |
std::cerr << "Both of --refsele and --originsele should appear by pair" << std::endl; |
| 160 |
> |
exit(1); |
| 161 |
> |
} |
| 162 |
> |
|
| 163 |
|
//creat xyzVisitor |
| 164 |
< |
XYZVisitor* xyzVisitor = new XYZVisitor(info); |
| 164 |
> |
XYZVisitor* xyzVisitor; |
| 165 |
> |
if (args_info.selection_given) { |
| 166 |
> |
xyzVisitor = new XYZVisitor(info, args_info.selection_arg); |
| 167 |
> |
} else { |
| 168 |
> |
xyzVisitor = new XYZVisitor(info); |
| 169 |
> |
} |
| 170 |
|
compositeVisitor->addVisitor(xyzVisitor, 200); |
| 171 |
|
|
| 172 |
|
std::cout << compositeVisitor->toString(); |
| 189 |
|
Molecule* mol; |
| 190 |
|
StuntDouble* integrableObject; |
| 191 |
|
RigidBody* rb; |
| 192 |
< |
|
| 215 |
< |
if (evaluator && !evaluator->isDynamic()) { |
| 216 |
< |
info->getSelectionManager()->setSelectionSet(evaluator->evaluate()); |
| 217 |
< |
} |
| 218 |
< |
|
| 192 |
> |
|
| 193 |
|
for (int i = 0; i < nframes; i += args_info.frame_arg){ |
| 194 |
|
dumpReader->readFrame(i); |
| 195 |
|
|
| 213 |
|
//update visitor |
| 214 |
|
compositeVisitor->update(); |
| 215 |
|
|
| 216 |
< |
//if dynamic, we need to re-evaluate the selection |
| 243 |
< |
if (evaluator && evaluator->isDynamic()) { |
| 244 |
< |
info->getSelectionManager()->setSelectionSet(evaluator->evaluate()); |
| 245 |
< |
} |
| 246 |
< |
|
| 216 |
> |
|
| 217 |
|
//visit stuntdouble |
| 218 |
|
for (mol = info->beginMolecule(miter); mol != NULL; mol = info->nextMolecule(miter)) { |
| 219 |
|
for (integrableObject = mol->beginIntegrableObject(iiter); integrableObject != NULL; |