Difference for src/ComputePmeCUDAMgr.h from version 1.1 to 1.2

version 1.1version 1.2
Line 48
Line 48
   // Finish up, must be called after "done" is returned by addAtoms.   // Finish up, must be called after "done" is returned by addAtoms.
   // Only the last thread that gets the "done" signal from addAtoms can enter here.   // Only the last thread that gets the "done" signal from addAtoms can enter here.
   void finish() {   void finish() {
     // Lock so that no thread can run addAtoms() between calls to finish() and clear() 
     CmiLock(lock_); 
     if (overflowEnd-overflowStart > 0) {     if (overflowEnd-overflowStart > 0) {
       resize_((void **)&atom, numAtoms, atomCapacity, sizeof(CudaAtom));       resize_((void **)&atom, numAtoms, atomCapacity, sizeof(CudaAtom));
       if (useIndex) resize_((void **)&atomIndex, numAtoms, atomIndexCapacity, sizeof(int));       if (useIndex) resize_((void **)&atomIndex, numAtoms, atomIndexCapacity, sizeof(int));
Line 65
Line 63
   void clear() {   void clear() {
     patchPos.clear();     patchPos.clear();
     numAtoms = 0;         numAtoms = 0;    
     // Unlock, OK to run addAtoms() again 
     CmiUnlock(lock_); 
   }   }
  
   void lock() {CmiLock(lock_);} 
  
   void unlock() {CmiUnlock(lock_);} 
  
   // Return pointer to atom data   // Return pointer to atom data
   CudaAtom* getAtoms() {   CudaAtom* getAtoms() {
     return atom;     return atom;
Line 97
Line 89
     return atomIndex;     return atomIndex;
   }   }
  
   // // Setup estimate for number of atoms 
   // void setupNumAtomsEstimate(int numAtomsEstimate) { 
   //   CmiLock(lock); 
   //   resize((void **)&atom, numAtomsEstimate, atomCapacity, sizeof(CudaAtom)); 
   //   CmiUnlock(lock); 
   // } 
  
 protected: protected:
   // Atom array   // Atom array
   CudaAtom* atom;   CudaAtom* atom;
Line 135
Line 120
  
   // Resize array with 1.5x extra storage   // Resize array with 1.5x extra storage
   void resize_(void **array, int sizeRequested, int& arrayCapacity, const int sizeofType) {   void resize_(void **array, int sizeRequested, int& arrayCapacity, const int sizeofType) {
     const int oldSize = arrayCapacity;     // If array is not NULL and has enough capacity => we have nothing to do
     void* old = NULL;     if (*array != NULL && arrayCapacity >= sizeRequested) return;
     if (*array != NULL && arrayCapacity < sizeRequested) { 
       old = alloc_(sizeofType*sizeRequested);     // Otherwise, allocate new array
       memcpy_(old, *array, oldSize*sizeofType);     int newArrayCapacity = (int)(sizeRequested*1.5);
      void* newArray = alloc_(sizeofType*newArrayCapacity);
  
      if (*array != NULL) {
        // We have old array => copy contents to new array
        memcpy_(newArray, *array, arrayCapacity*sizeofType);
        // De-allocate old array
       dealloc_(*array);       dealloc_(*array);
       *array = NULL; 
     } 
     if (*array == NULL) { 
       arrayCapacity = (int)(sizeRequested*1.5); 
       *array = alloc_(sizeofType*arrayCapacity); 
       if (old != NULL) { 
         memcpy_(*array, old, oldSize*sizeofType); 
         dealloc_(old); 
       } 
     }     }
  
      // Set new capacity and array pointer
      arrayCapacity = newArrayCapacity;
      *array = newArray;
   }   }
  
   virtual void memcpy_(void *dst, const void* src, const int size) {   virtual void memcpy_(void *dst, const void* src, const int size) {


Legend:
Removed in v.1.1 
changed lines
 Added in v.1.2



Made by using version 1.53 of cvs2html