ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/mdtools/md_code/InitializeFromFile.cpp
(Generate patch)

Comparing trunk/mdtools/md_code/InitializeFromFile.cpp (file contents):
Revision 212 by chuckv, Fri Dec 13 21:17:00 2002 UTC vs.
Revision 254 by chuckv, Thu Jan 30 20:03:37 2003 UTC

# Line 11 | Line 11
11   #include "ReadWrite.hpp"
12   #include "simError.h"
13  
14 + #ifdef IS_MPI
15 + #include "mpiSimulation.hpp"
16 + #endif // is_mpi
17  
18   InitializeFromFile :: InitializeFromFile( char *in_name ){
19   #ifdef IS_MPI
# Line 68 | Line 71 | void InitializeFromFile :: read_xyz( SimInfo* the_entr
71  
72    char *eof_test; // ptr to see when we reach the end of the file
73    char *parseErr;
74 +  int procIndex;
75  
76 +  entry_plug = the_entry_plug;
77  
73  entry_plug = the_entry_plug
78  
75
79   #ifndef IS_MPI
80    eof_test = fgets(read_buffer, sizeof(read_buffer), c_in_file);
81    if( eof_test == NULL ){
# Line 158 | Line 161 | void InitializeFromFile :: read_xyz( SimInfo* the_entr
161      // Check to see that the number of atoms in the intial configuration file is the
162      // same as declared in simBass.
163      
164 <    if( n_atoms != entry_plug->mpiSim->getTotAtoms() ){
164 >    if( n_atoms != mpiSim->getTotAtoms() ){
165        sprintf( painCave.errMsg,
166                 "Initialize from File error. %s n_atoms, %d, "
167                 "does not match the BASS file's n_atoms, %d.\n",
# Line 179 | Line 182 | void InitializeFromFile :: read_xyz( SimInfo* the_entr
182    
183      // Read Proc 0 share of the xyz file...
184      masterIndex = 0;
185 <    for( i=0; i <= entry_plug->mpiSim->getMyAtomEnd(); i++){
185 >    for( i=0; i <= mpiSim->getMyAtomEnd(); i++){
186      
187        eof_test = fgets(read_buffer, sizeof(read_buffer), c_in_file);
188        if(eof_test == NULL){
# Line 204 | Line 207 | void InitializeFromFile :: read_xyz( SimInfo* the_entr
207  
208    sprintf(checkPointMsg,
209            "Node 0 has successfully read positions from input file.");
210 <  mpiCheckPoint();
210 >  MPIcheckPoint();
211  
212 <  for (procIndex = 1; procIndex < entryPlug->mpiSim->getNumberProcessors();
212 >  for (procIndex = 1; procIndex < mpiSim->getNumberProcessors();
213           procIndex++){
214      if (worldRank == 0) {
215  
# Line 230 | Line 233 | void InitializeFromFile :: read_xyz( SimInfo* the_entr
233        sendError = 0;
234        mpiErr = MPI_Send(&sendError,1,MPI_INT,procIndex,MPI_ANY_TAG,MPI_COMM_WORLD);
235        
236 <      for ( i = nodeAtomStart; i <= nodeAtomEnd, i++){
236 >      for ( i = nodeAtomsStart; i <= nodeAtomsEnd; i++){
237          eof_test = fgets(read_buffer, sizeof(read_buffer), c_in_file);
238          if(eof_test == NULL){
239            
# Line 249 | Line 252 | void InitializeFromFile :: read_xyz( SimInfo* the_entr
252          mpiErr = MPI_Send(read_buffer,BUFFERSIZE,MPI_CHAR,procIndex,MPI_ANY_TAG,MPI_COMM_WORLD);
253          mpiErr = MPI_Recv(&sendError,1,MPI_INT,procIndex,MPI_ANY_TAG,MPI_COMM_WORLD,
254                            istatus);
255 <        if (sendError) mpiCheckpoint();
255 >        if (sendError) MPIcheckPoint();
256  
257          masterIndex++;
258        }
# Line 257 | Line 260 | void InitializeFromFile :: read_xyz( SimInfo* the_entr
260  
261  
262      else if(worldRank == procIndex){
263 <      nodeAtomStart = entry_plug->mpiSim->getMyAtomStart();
264 <      nodeAtomEnd = entry_plug->mpiSim->getMyAtomEnd();
263 >      nodeAtomsStart = mpiSim->getMyAtomStart();
264 >      nodeAtomsEnd = mpiSim->getMyAtomEnd();
265        mpiErr = MPI_Send(&nodeAtomsStart,1,MPI_INT,0,MPI_ANY_TAG,MPI_COMM_WORLD);
266        mpiErr = MPI_Send(&nodeAtomsEnd,1,MPI_INT,0,MPI_ANY_TAG,MPI_COMM_WORLD);
267        
268        mpiErr = MPI_Recv(&sendError,1,MPI_INT,0,MPI_ANY_TAG,MPI_COMM_WORLD,
269                 istatus);
270 <      if (sendError) mpiCheckpoint();
270 >      if (sendError) MPIcheckPoint();
271  
272 <      for ( i = 0; i < entry_plug->n_atoms, i++){
272 >      for ( i = 0; i < entry_plug->n_atoms; i++){
273  
274          mpiErr = MPI_Recv(&read_buffer,BUFFERSIZE,MPI_CHAR,0,MPI_ANY_TAG,MPI_COMM_WORLD,
275                            istatus);
276          
277 <        if(!strcmp(read_buffer, "ERROR")) mpiCheckPoint();
277 >        if(!strcmp(read_buffer, "ERROR")) MPIcheckPoint();
278          
279          parseErr = parseDumpLine( read_buffer, i );
280          if( parseErr != NULL ){
# Line 288 | Line 291 | void InitializeFromFile :: read_xyz( SimInfo* the_entr
291        }
292      }
293      sprintf(checkPointMsg,"Node %d received initial configuration.",procIndex);
294 <    mpiCheckPoint();
294 >    MPIcheckPoint();
295    }
296  
297   #endif
298   }
299  
300  
301 < char* IntitializeFromFile::parseDumpLine(char* readLine, int atomIndex){
301 > char* InitializeFromFile::parseDumpLine(char* readLine, int atomIndex){
302  
303    char *foo; // the pointer to the current string token
304    
# Line 311 | Line 314 | char* IntitializeFromFile::parseDumpLine(char* readLin
314    int n_atoms;
315  
316   #ifdef IS_MPI
317 <  n_atoms = entry_plug->mpiSim->getTotAtoms();
317 >  n_atoms = mpiSim->getTotAtoms();
318   #else
319    n_atoms = entry_plug->n_atoms;
320 < #endi // is_mpi
320 > #endif // is_mpi
321  
322  
323    // set the string tokenizer

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines