Attention une mise à jour du serveur va être effectuée le vendredi 16 avril entre 12h et 12h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit 482dd10c authored by COULAUD Olivier's avatar COULAUD Olivier

Manage periodic shift in cells comming from another processor

parent 338024f2
......@@ -25,9 +25,9 @@
#include "Utils/FEnv.hpp"
#include "Utils/FMpi.hpp"
#ifdef _OPENMP
#include <omp.h>
#endif
#include "FCoreCommon.hpp"
#include "FP2PExclusion.hpp"
......@@ -2021,8 +2021,8 @@ protected:
FAssertLF(leafsNeedOtherData.getSize() < std::numeric_limits<int>::max());
const int nbLeafToProceed = int(leafsNeedOtherData.getSize());
//#pragma omp for schedule(dynamic, userChunkSize)
#pragma omp single
#pragma omp for schedule(dynamic, userChunkSize)
//#pragma omp single
for(int idxLeafs = 0 ; idxLeafs < nbLeafToProceed ; ++idxLeafs){
LeafData currentIter = leafsNeedOtherData[idxLeafs];
......@@ -2035,7 +2035,6 @@ protected:
indexesNeighbors,indexArray,AllDirs);
// std::cout << currentIter.coord.getMortonIndex() << " Cells comming from another process " << nbNeigh <<std::endl;
std::array<ContainerClass*,19> periodicNeighbors{};
std::array<std::array<FReal,3>,19> periodicOffset{};
int nbPeriodicCells=0 ;
// Pourquoi pas de decallage de boite ??,
......@@ -2047,7 +2046,7 @@ protected:
neighbors[counter] = hypotheticNeighbor;
neighborPositions[counter] = indexArray[idxNeigh];
FTreeCoordinate coord3d(indexesNeighbors[idxNeigh] );
std::array<FReal,3> & offSet = periodicOffset[nbPeriodicCells];
std::array<FReal,3> offSet{};
bool movePos = false ;
coord3d-=currentIter.coord ;
if (std::abs(coord3d.getX()) == limitem1 ){ // it's a periodic cell)
......@@ -2066,22 +2065,21 @@ protected:
// std::cout << " ( " << indexesNeighbors[idxNeigh] << " " << coord3d << " offset= "
// <<offSet[0] << "," << offSet[1] << "," <<offSet[2] <<" )" ;
if(movePos){
periodicNeighbors[nbPeriodicCells] = hypotheticNeighbor;
/// NEW NEW NEW NEW NEW NEW
// Put periodic cell into another cell (copy data)
///// HERE HERE HERE HERE HERE
// ContainerClass * periodicNeighbors[nbPeriodicCells] = new ContainerClass(*(neighbors[idxNeig])) ;
/// NEW NEW NEW NEW NEW NEW
FReal*const positionsX = hypotheticNeighbor->getPositions()[0];
FReal*const positionsY = hypotheticNeighbor->getPositions()[1];
FReal*const positionsZ = hypotheticNeighbor->getPositions()[2];
for(FSize idxPart = 0; idxPart < hypotheticNeighbor->getNbParticles() ; ++idxPart){
positionsX[idxPart] += offSet[0];
positionsY[idxPart] += offSet[1];
positionsZ[idxPart] += offSet[2];
// std::cout <<indexesNeighbors[idxNeigh] << " " << positionsX[idxPart] << " "<< positionsY[idxPart] << " "<< positionsZ[idxPart] <<std::endl;
}
++nbPeriodicCells;
periodicNeighbors[nbPeriodicCells] = new ContainerClass(*(neighbors[idxNeigh])) ;
// newPos = pos + ofsset
FReal*const positionsX = periodicNeighbors[nbPeriodicCells]->getPositions()[0];
FReal*const positionsY = periodicNeighbors[nbPeriodicCells]->getPositions()[1];
FReal*const positionsZ = periodicNeighbors[nbPeriodicCells]->getPositions()[2];
for(FSize idxPart = 0; idxPart < periodicNeighbors[nbPeriodicCells]->getNbParticles() ; ++idxPart){
positionsX[idxPart] += offSet[0];
positionsY[idxPart] += offSet[1];
positionsZ[idxPart] += offSet[2];
// std::cout <<indexesNeighbors[idxNeigh] << " " << positionsX[idxPart] << " "<< positionsY[idxPart] << " "<< positionsZ[idxPart] <<std::endl;
}
++nbPeriodicCells;
neighbors[counter] = periodicNeighbors[nbPeriodicCells];
}
++counter;
}
......@@ -2098,22 +2096,11 @@ protected:
if(nbPeriodicCells >0){
//to Do
for(int i=0 ; i < nbPeriodicCells ; ++i){
auto hypotheticNeighbor = periodicNeighbors[i] ;
auto & offSet = periodicOffset[i];
FReal*const positionsX = hypotheticNeighbor->getPositions()[0];
FReal*const positionsY = hypotheticNeighbor->getPositions()[1];
FReal*const positionsZ = hypotheticNeighbor->getPositions()[2];
for(FSize idxPart = 0; idxPart < hypotheticNeighbor->getNbParticles() ; ++idxPart){
positionsX[idxPart] -= offSet[0];
positionsY[idxPart] -= offSet[1];
positionsZ[idxPart] -= offSet[2];
}
delete periodicNeighbors[i] ;
}
}
}
} // end for loop
#pragma omp barrier
}
delete[] leafsDataArray;
......
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