ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/ZconsVisitor.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/ZconsVisitor.cpp (file contents):
Revision 1119 by tim, Mon Apr 19 17:44:48 2004 UTC vs.
Revision 1140 by tim, Wed Apr 28 22:34:02 2004 UTC

# Line 112 | Line 112 | ZConsVisitor::ZConsVisitor(SimInfo* info) : BaseVisito
112      }
113    }
114  
115 <  zconsReader = new ZConsReader(zconsFilename);
115 >  zconsReader = new ZConsReader(info);
116  
117    if (zconsReader->hasNextFrame())
118    zconsReader->readNextFrame();
# Line 153 | Line 153 | Molecule* ZConsVisitor::findZconsMol(int index){
153    Molecule* mols;
154    mols = info->molecules;
155    for(int i =0; i < info->n_mol; i++)
156 <    if(index = mols[i].getMyIndex())
156 >    if(index == mols[i].getMyIndex())
157        return &mols[i];
158  
159    return NULL;
# Line 180 | Line 180 | void ZConsVisitor::update(){
180      natoms = zconsMol[i]->getNAtoms();
181      atoms = zconsMol[i]->getMyAtoms();    
182      for(int j =0; j < natoms; j++)
183 <      zconsState[atoms[i]->getIndex()] = state;
183 >      zconsState[atoms[j]->getIndex()] = state;
184    }
185    
186   }
# Line 193 | Line 193 | void ZConsVisitor::getZconsPos(double time){
193  
194    while(true){
195      tempTime = zconsReader->getCurTime();
196 <  
196 >
197 >    zconsPos = zconsReader->getZConsPos();
198 >    
199      if(tempTime >= time)
200        return;
201      
202      zconsReader->readNextFrame();
203 <    zconsPos = zconsReader->getZConsPos();
203 >
204    }
205  
206   }
# Line 209 | Line 211 | void ZConsVisitor::internalVisit(StuntDouble* sd, cons
211    AtomInfo* atomInfo;
212    vector<AtomInfo*>::iterator iter;
213  
214 +  
215    //if there is not atom data, just skip it
216    data = sd->getProperty("ATOMDATA");
217 <  if(data != NULL)
217 >  if(data != NULL){
218      atomData = dynamic_cast<AtomData*>(data);  
219      if(atomData == NULL)
220        return;
221 +  }
222    else
223      return;
224  
225    for(atomInfo  = atomData->beginAtomInfo(iter); atomInfo; atomInfo = atomData->nextAtomInfo(iter))
226 <    atomInfo->AtomType = prefix + atomInfo->AtomType;
226 >    (atomInfo->AtomType).insert(0, prefix);
227   }
228  
229  
230   bool ZConsVisitor::isZconstraint(int index, string& prefix){
231    map<int, ZConsState>::iterator i;
232 <
232 >  string prefixString[] = {"ZF", "ZM"};
233 >  
234    i = zconsState.find(index);
235    if(i !=zconsState.end()){
236 <    prefix = (*i).second;
236 >    prefix = prefixString[(*i).second];
237      return true;
238    }
239    else{
# Line 247 | Line 252 | const string ZConsVisitor::toString(){
252    sprintf(buffer ,"Visitor name: %s\n", visitorName.c_str());
253    result += buffer;
254    
255 <  sprintf(buffer , "number of zconstraint molecule :%d\n", zconsMol.size());
255 >  sprintf(buffer , "number of zconstraint molecule: %d\n", zconsMol.size());
256    result += buffer;
257  
258    sprintf(buffer , "zconstraint tolerance = %lf\n", zconsTol);
# Line 260 | Line 265 | const string ZConsVisitor::toString(){
265    result += buffer;
266    
267    for(size_t i = 0; i < zconsMol.size(); ++i){
268 <    sprintf(buffer ,"zconstraint molecule[%d] = \n", zconsMol[i]->getMyIndex());
268 >    sprintf(buffer ,"zconstraint molecule[%d] = %d\n", i, zconsMol[i]->getMyIndex());
269      result += buffer;
270  
271    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines