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

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

parent c5f970da
......@@ -1942,28 +1942,22 @@ protected:
//
/// NEW NEW NEW NEW NEW NEW
// Put periodic cell into another cell (copy data)
///// HERE HERE HERE HERE HERE
// ContainerClass * periodicLeaf = new ContainerClass(*(neighbors[idxNeig])) ;
// neighbors[idxNeig] = periodicLeaf ;
periodicNeighbors[periodicNeighborsCounter] = new ContainerClass(*(neighbors[idxNeig])) ;
/// NEW NEW NEW NEW NEW NEW
// std::cout << neighbors[idxNeig] << " Offset: "<< offsets[idxNeig] << std::endl;
// newPos = pos + ofsset
FReal*const positionsX = neighbors[idxNeig]->getPositions()[0];
FReal*const positionsY = neighbors[idxNeig]->getPositions()[1];
FReal*const positionsZ = neighbors[idxNeig]->getPositions()[2];
FReal*const positionsX = periodicNeighbors[periodicNeighborsCounter]->getPositions()[0];
FReal*const positionsY = periodicNeighbors[periodicNeighborsCounter]->getPositions()[1];
FReal*const positionsZ = periodicNeighbors[periodicNeighborsCounter]->getPositions()[2];
FReal xoffset= boxWidth * FReal(offsets[idxNeig].getX()) ;
FReal yoffset= boxWidth * FReal(offsets[idxNeig].getY()) ;
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;
positionsY[idxPart] += yoffset;
positionsZ[idxPart] += zoffset;
// std::cout << neighbors[idxNeig]<< " " << positionsX[idxPart] << " "<< positionsY[idxPart] << " "<< positionsZ[idxPart] <<std::endl;
}
periodicOffsets[periodicNeighborsCounter] = offsets[idxNeig];
periodicNeighbors[periodicNeighborsCounter] = neighbors[idxNeig];
periodicNeighborPositions[periodicNeighborsCounter] = neighborPositions[idxNeig];
++periodicNeighborsCounter;
}
......@@ -1980,21 +1974,7 @@ protected:
periodicNeighborPositions, periodicNeighborsCounter);
for(int idxNeig = 0 ; idxNeig < periodicNeighborsCounter ; ++idxNeig){
FAssertLF( 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] ;
delete periodicNeighbors[idxNeig] ;
}
}
//
......
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