| 2 |
|
#include "AtomVisitor.hpp" |
| 3 |
|
#include "DirectionalAtom.hpp" |
| 4 |
|
#include "MatVec3.h" |
| 5 |
+ |
#include "RigidBody.hpp" |
| 6 |
|
|
| 7 |
+ |
void BaseAtomVisitor::visit(RigidBody* rb){ |
| 8 |
+ |
//vector<Atom*> myAtoms; |
| 9 |
+ |
//vector<Atom*>::iterator atomIter; |
| 10 |
+ |
|
| 11 |
+ |
//myAtoms = rb->getAtoms(); |
| 12 |
+ |
|
| 13 |
+ |
//for(atomIter = myAtoms.begin(); atomIter != myAtoms.end(); ++atomIter) |
| 14 |
+ |
// (*atomIter)->accept(this); |
| 15 |
+ |
} |
| 16 |
+ |
|
| 17 |
|
void BaseAtomVisitor::setVisited(Atom* atom){ |
| 18 |
|
GenericData* data; |
| 19 |
|
data = atom->getProperty("VISITED"); |
| 54 |
|
bool haveAtomData; |
| 55 |
|
|
| 56 |
|
//if atom is not SSD atom, just skip it |
| 57 |
< |
if(!strcmp(datom->getType(), "SSD")) |
| 57 |
> |
if(strcmp(datom->getType(), "SSD")) |
| 58 |
|
return; |
| 59 |
|
|
| 60 |
|
data = datom->getProperty("ATOMDATA"); |
| 140 |
|
|
| 141 |
|
} |
| 142 |
|
|
| 143 |
+ |
const string SSDAtomVisitor::toString(){ |
| 144 |
+ |
char buffer[65535]; |
| 145 |
+ |
string result; |
| 146 |
+ |
|
| 147 |
+ |
sprintf(buffer ,"------------------------------------------------------------------\n"); |
| 148 |
+ |
result += buffer; |
| 149 |
+ |
|
| 150 |
+ |
sprintf(buffer ,"Visitor name: %s\n", visitorName.c_str()); |
| 151 |
+ |
result += buffer; |
| 152 |
+ |
|
| 153 |
+ |
sprintf(buffer , "Visitor Description: Convert SSD into 4 differnet atoms\n"); |
| 154 |
+ |
result += buffer; |
| 155 |
+ |
|
| 156 |
+ |
sprintf(buffer ,"------------------------------------------------------------------\n"); |
| 157 |
+ |
result += buffer; |
| 158 |
+ |
|
| 159 |
+ |
return result; |
| 160 |
+ |
} |
| 161 |
+ |
|
| 162 |
+ |
//----------------------------------------------------------------------------// |
| 163 |
+ |
|
| 164 |
|
void DefaultAtomVisitor::visit(Atom* atom){ |
| 165 |
|
AtomData* atomData; |
| 166 |
|
AtomInfo* atomInfo; |
| 170 |
|
return; |
| 171 |
|
|
| 172 |
|
atomInfo =new AtomInfo; |
| 173 |
+ |
|
| 174 |
+ |
atomData = new AtomData; |
| 175 |
+ |
atomData->setID("ATOMDATA"); |
| 176 |
|
|
| 177 |
|
atom->getPos(pos); |
| 178 |
|
atomInfo->AtomType = atom->getType(); |
| 183 |
|
atomInfo->dipole[1] = 0.0; |
| 184 |
|
atomInfo->dipole[2] = 0.0; |
| 185 |
|
|
| 186 |
< |
atomData = new AtomData; |
| 187 |
< |
atomData->setID("ATOMDATA"); |
| 186 |
> |
|
| 187 |
> |
atomData->addAtomInfo(atomInfo); |
| 188 |
> |
|
| 189 |
|
atom->addProperty(atomData); |
| 190 |
|
|
| 191 |
|
setVisited(atom); |
| 202 |
|
datom->getPos(pos); |
| 203 |
|
datom->getU(u); |
| 204 |
|
|
| 205 |
+ |
atomData = new AtomData; |
| 206 |
+ |
atomData->setID("ATOMDATA"); |
| 207 |
|
atomInfo =new AtomInfo; |
| 208 |
|
|
| 209 |
|
atomInfo->AtomType = datom->getType(); |
| 214 |
|
atomInfo->dipole[1] = u[1]; |
| 215 |
|
atomInfo->dipole[2] = u[2]; |
| 216 |
|
|
| 217 |
< |
atomData = new AtomData; |
| 218 |
< |
atomData->setID("ATOMDATA"); |
| 217 |
> |
atomData->addAtomInfo(atomInfo); |
| 218 |
> |
|
| 219 |
|
datom->addProperty(atomData); |
| 220 |
|
|
| 221 |
|
setVisited(datom); |
| 222 |
|
} |
| 223 |
< |
|
| 223 |
> |
|
| 224 |
> |
|
| 225 |
> |
const string DefaultAtomVisitor::toString(){ |
| 226 |
> |
char buffer[65535]; |
| 227 |
> |
string result; |
| 228 |
> |
|
| 229 |
> |
sprintf(buffer ,"------------------------------------------------------------------\n"); |
| 230 |
> |
result += buffer; |
| 231 |
> |
|
| 232 |
> |
sprintf(buffer ,"Visitor name: %s\n", visitorName.c_str()); |
| 233 |
> |
result += buffer; |
| 234 |
> |
|
| 235 |
> |
sprintf(buffer , "Visitor Description: copy atom infomation into atom data\n"); |
| 236 |
> |
result += buffer; |
| 237 |
> |
|
| 238 |
> |
sprintf(buffer ,"------------------------------------------------------------------\n"); |
| 239 |
> |
result += buffer; |
| 240 |
> |
|
| 241 |
> |
return result; |
| 242 |
> |
} |