Commit 338024f2 authored by Berenger Bramas's avatar Berenger Bramas

Update periodic mpi core to duplicate the containers before shifting the position

parent c5f970da
...@@ -1941,29 +1941,23 @@ protected: ...@@ -1941,29 +1941,23 @@ protected:
if( !offsets[idxNeig].equals(0,0,0) ){ // We need to move the cell if( !offsets[idxNeig].equals(0,0,0) ){ // We need to move the cell
// //
/// NEW NEW NEW NEW NEW NEW /// NEW NEW NEW NEW NEW NEW
// Put periodic cell into another cell (copy data) // Put periodic cell into another cell (copy data)
///// HERE HERE HERE HERE HERE periodicNeighbors[periodicNeighborsCounter] = new ContainerClass(*(neighbors[idxNeig])) ;
// ContainerClass * periodicLeaf = new ContainerClass(*(neighbors[idxNeig])) ; /// NEW NEW NEW NEW NEW NEW
// neighbors[idxNeig] = periodicLeaf ;
/// NEW NEW NEW NEW NEW NEW
// std::cout << neighbors[idxNeig] << " Offset: "<< offsets[idxNeig] << std::endl;
// newPos = pos + ofsset // newPos = pos + ofsset
FReal*const positionsX = neighbors[idxNeig]->getPositions()[0]; FReal*const positionsX = periodicNeighbors[periodicNeighborsCounter]->getPositions()[0];
FReal*const positionsY = neighbors[idxNeig]->getPositions()[1]; FReal*const positionsY = periodicNeighbors[periodicNeighborsCounter]->getPositions()[1];
FReal*const positionsZ = neighbors[idxNeig]->getPositions()[2]; FReal*const positionsZ = periodicNeighbors[periodicNeighborsCounter]->getPositions()[2];
FReal xoffset= boxWidth * FReal(offsets[idxNeig].getX()) ; FReal xoffset= boxWidth * FReal(offsets[idxNeig].getX()) ;
FReal yoffset= boxWidth * FReal(offsets[idxNeig].getY()) ; FReal yoffset= boxWidth * FReal(offsets[idxNeig].getY()) ;
FReal zoffset= boxWidth * FReal(offsets[idxNeig].getZ()) ; FReal zoffset= boxWidth * FReal(offsets[idxNeig].getZ()) ;
for(FSize idxPart = 0; idxPart < neighbors[idxNeig]->getNbParticles() ; ++idxPart){ for(FSize idxPart = 0; idxPart < periodicNeighbors[periodicNeighborsCounter]->getNbParticles() ; ++idxPart){
positionsX[idxPart] += xoffset; positionsX[idxPart] += xoffset;
positionsY[idxPart] += yoffset; positionsY[idxPart] += yoffset;
positionsZ[idxPart] += zoffset; positionsZ[idxPart] += zoffset;
// std::cout << neighbors[idxNeig]<< " " << positionsX[idxPart] << " "<< positionsY[idxPart] << " "<< positionsZ[idxPart] <<std::endl; }
}
periodicOffsets[periodicNeighborsCounter] = offsets[idxNeig]; periodicOffsets[periodicNeighborsCounter] = offsets[idxNeig];
periodicNeighbors[periodicNeighborsCounter] = neighbors[idxNeig];
periodicNeighborPositions[periodicNeighborsCounter] = neighborPositions[idxNeig]; periodicNeighborPositions[periodicNeighborsCounter] = neighborPositions[idxNeig];
++periodicNeighborsCounter; ++periodicNeighborsCounter;
} }
...@@ -1980,22 +1974,8 @@ protected: ...@@ -1980,22 +1974,8 @@ protected:
periodicNeighborPositions, periodicNeighborsCounter); periodicNeighborPositions, periodicNeighborsCounter);
for(int idxNeig = 0 ; idxNeig < periodicNeighborsCounter ; ++idxNeig){ for(int idxNeig = 0 ; idxNeig < periodicNeighborsCounter ; ++idxNeig){
FAssertLF( periodicNeighbors[idxNeig] ); delete periodicNeighbors[idxNeig] ;
FReal*const positionsX = periodicNeighbors[idxNeig]->getPositions()[0]; }
FReal*const positionsY = periodicNeighbors[idxNeig]->getPositions()[1];
FReal*const positionsZ = periodicNeighbors[idxNeig]->getPositions()[2];
FReal xoffset= boxWidth * FReal(periodicOffsets[idxNeig].getX()) ;
FReal yoffset= boxWidth * FReal(periodicOffsets[idxNeig].getY()) ;
FReal zoffset= boxWidth * FReal(periodicOffsets[idxNeig].getZ()) ;
for(FSize idxPart = 0; idxPart < periodicNeighbors[idxNeig]->getNbParticles() ; ++idxPart){
positionsX[idxPart] -= xoffset;
positionsY[idxPart] -= yoffset;
positionsZ[idxPart] -= zoffset;
}
// delete periodicNeighbors[idxNeig] ;
}
} }
// //
// Now treat P2P interaction with non periodic cells // Now treat P2P interaction with non periodic cells
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment