ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/visitors/OtherVisitor.cpp
(Generate patch)

Comparing branches/development/src/visitors/OtherVisitor.cpp (file contents):
Revision 1871 by gezelter, Fri May 10 14:59:13 2013 UTC vs.
Revision 1875 by gezelter, Fri May 17 14:41:42 2013 UTC

# Line 121 | Line 121 | namespace OpenMD {
121    //----------------------------------------------------------------------------//
122  
123    ReplicateVisitor::ReplicateVisitor(SimInfo *info, Vector3i opt) :
124 <    BaseVisitor() {
124 >    BaseVisitor(), replicateOpt(opt) {
125        this->info = info;
126        visitorName = "ReplicateVisitor";
127      this->replicateOpt = opt;
127  
128        //generate the replicate directions
129        for( int i = 0; i <= replicateOpt[0]; i++ ) {
# Line 185 | Line 184 | namespace OpenMD {
184      std::vector<AtomInfo *>::iterator i;
185  
186      for( dirIter = dir.begin(); dirIter != dir.end(); ++dirIter ) {
187 <      for( i = infoList.begin(); i != infoList.end(); i++ ) {
187 >      for( i = infoList.begin(); i != infoList.end(); ++i ) {
188          newAtomInfo = new AtomInfo();
189          *newAtomInfo = *(*i);
190  
# Line 200 | Line 199 | namespace OpenMD {
199    const std::string ReplicateVisitor::toString() {
200      char                            buffer[65535];
201      std::string                     result;
203    std::set<std::string>::iterator i;
202  
203 +
204      sprintf(buffer,
205 <            "------------------------------------------------------------------\n");
205 >            "--------------------------------------------------------------\n");
206      result += buffer;
207  
208      sprintf(buffer, "Visitor name: %s\n", visitorName.c_str());
# Line 224 | Line 223 | namespace OpenMD {
223      result += buffer;
224  
225      sprintf(buffer,
226 <            "------------------------------------------------------------------\n");
226 >            "--------------------------------------------------------------\n");
227      result += buffer;
228  
229      return result;
# Line 236 | Line 235 | namespace OpenMD {
235                                            evaluator(info), doPositions_(true),
236                                            doVelocities_(false),
237                                            doForces_(false), doVectors_(false),
238 <                                          doCharges_(false) {
238 >                                          doCharges_(false),
239 >                                          doElectricFields_(false) {
240      this->info = info;
241      visitorName = "XYZVisitor";
242      
# Line 250 | Line 250 | namespace OpenMD {
250    XYZVisitor::XYZVisitor(SimInfo *info, const std::string& script) :
251      BaseVisitor(), seleMan(info), evaluator(info), doPositions_(true),
252      doVelocities_(false), doForces_(false), doVectors_(false),
253 <    doCharges_(false) {
253 >    doCharges_(false), doElectricFields_(false) {
254      
255      this->info = info;
256      visitorName = "XYZVisitor";
# Line 350 | Line 350 | namespace OpenMD {
350      std::vector<std::string>::iterator i;
351      char buffer[1024];
352      
353 <    if (frame.size() == 0)
353 >    if (frame.empty())
354        std::cerr << "Current Frame does not contain any atoms" << std::endl;
355      
356      //total number of atoms  
# Line 403 | Line 403 | namespace OpenMD {
403    
404    void PrepareVisitor::internalVisit(Atom *atom) {
405      GenericData *data;
406    AtomData *   atomData;
406      
407      //if visited property is  existed, remove it
408      data = atom->getPropertyByName("VISITED");
# Line 416 | Line 415 | namespace OpenMD {
415      data = atom->getPropertyByName("ATOMDATA");
416  
417      if (data != NULL) {
418 <      atomData = dynamic_cast<AtomData *>(data);
418 >      AtomData* atomData = dynamic_cast<AtomData *>(data);
419  
420        if (atomData != NULL)
421          atom->removeProperty("ATOMDATA");
# Line 491 | Line 490 | namespace OpenMD {
490      std::string rbName;
491      std::vector<Atom *> myAtoms;
492      std::vector<Atom *>::iterator atomIter;
494    GenericData* data;
495    AtomData* atomData;
496    AtomInfo* atomInfo;
493      std::vector<AtomInfo *>::iterator i;
494 +    AtomData* atomData;
495  
496      rbName = rb->getType();
497      
498      if (waterTypeList.find(rbName) != waterTypeList.end()) {
499        myAtoms = rb->getAtoms();
500 <
500 >      
501        for( atomIter = myAtoms.begin(); atomIter != myAtoms.end();
502             ++atomIter ) {
503 <        data = (*atomIter)->getPropertyByName("ATOMDATA");
503 >        GenericData* data = (*atomIter)->getPropertyByName("ATOMDATA");
504          
505          if (data != NULL) {
506            atomData = dynamic_cast<AtomData *>(data);
# Line 513 | Line 510 | namespace OpenMD {
510          } else
511            continue;
512          
513 <        for( atomInfo = atomData->beginAtomInfo(i); atomInfo;
513 >        for( AtomInfo* atomInfo = atomData->beginAtomInfo(i); atomInfo;
514               atomInfo = atomData->nextAtomInfo(i) ) {
515            atomInfo->atomTypeName = trimmedName(atomInfo->atomTypeName);
516 <        } //end for(atomInfo)
517 <      }     //end for(atomIter)
518 <    }         //end if (waterTypeList.find(rbName) != waterTypeList.end())
516 >        }
517 >      }
518 >    }
519    }
520  
521    std::string WaterTypeVisitor::trimmedName(const std::string&atomTypeName) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines