Commit d303c1c9 authored by COULAUD Olivier's avatar COULAUD Olivier

fix problems, but the bug is still here in periodic

parent 482dd10c
......@@ -1922,6 +1922,7 @@ protected:
hasPeriodicLeaves,
currentIter.coord, LeafIndex, AllDirs);
int periodicNeighborsCounter = 0;
auto nonPeriodicCounter = 0 ;
//
// First treat P2P interactions the classical interaction
// For Periodic cells
......@@ -1931,19 +1932,17 @@ protected:
//
if(hasPeriodicLeaves){
// Current cell has periodic cells
constexpr int maxPeriodicNeighbors = 19;
constexpr int maxPeriodicNeighbors = 26;
ContainerClass* periodicNeighbors[maxPeriodicNeighbors]{};
int periodicNeighborPositions[maxPeriodicNeighbors];
std::array<FTreeCoordinate,maxPeriodicNeighbors> periodicOffsets{} ;
// std::array<FTreeCoordinate,maxPeriodicNeighbors> periodicOffsets{} ;
// Move cells and particles
for(int idxNeig = 0 ; idxNeig < counter ; ++idxNeig){
if( !offsets[idxNeig].equals(0,0,0) ){ // We need to move the cell
//
/// NEW NEW NEW NEW NEW NEW
// Put periodic cell into another cell (copy data)
periodicNeighbors[periodicNeighborsCounter] = new ContainerClass(*(neighbors[idxNeig])) ;
/// NEW NEW NEW NEW NEW NEW
// newPos = pos + ofsset
FReal*const positionsX = periodicNeighbors[periodicNeighborsCounter]->getPositions()[0];
FReal*const positionsY = periodicNeighbors[periodicNeighborsCounter]->getPositions()[1];
......@@ -1957,13 +1956,16 @@ protected:
positionsZ[idxPart] += zoffset;
}
periodicOffsets[periodicNeighborsCounter] = offsets[idxNeig];
// periodicOffsets[periodicNeighborsCounter] = offsets[idxNeig];
periodicNeighborPositions[periodicNeighborsCounter] = neighborPositions[idxNeig];
++periodicNeighborsCounter;
}
else{ // set non periodic cells in neighbors and in neighborPositions
// nonPeriodicCounter versus idxNeig-periodicNeighborsCounter
std::cout << nonPeriodicCounter <<" "<< idxNeig-periodicNeighborsCounter <<std::endl;
neighbors[idxNeig-periodicNeighborsCounter] = neighbors[idxNeig];
neighborPositions[idxNeig-periodicNeighborsCounter] = neighborPositions[idxNeig];
++nonPeriodicCounter ;
}
}
//
......@@ -1983,7 +1985,7 @@ protected:
//
myThreadkernels->P2P( currentIter.coord, currentIter.targets,
currentIter.sources, neighbors,
neighborPositions, counter - periodicNeighborsCounter);
neighborPositions, counter-periodicNeighborsCounter);
}
}
......@@ -2021,8 +2023,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];
......@@ -2034,7 +2036,7 @@ protected:
const int nbNeigh = this->getNeighborsIndexesPeriodic(currentIter.coord,limite,
indexesNeighbors,indexArray,AllDirs);
// std::cout << currentIter.coord.getMortonIndex() << " Cells comming from another process " << nbNeigh <<std::endl;
std::array<ContainerClass*,19> periodicNeighbors{};
std::array<ContainerClass*,26> periodicNeighbors{};
int nbPeriodicCells=0 ;
// Pourquoi pas de decallage de boite ??,
......@@ -2067,7 +2069,7 @@ protected:
if(movePos){
/// NEW NEW NEW NEW NEW NEW
// Put periodic cell into another cell (copy data)
periodicNeighbors[nbPeriodicCells] = new ContainerClass(*(neighbors[idxNeigh])) ;
periodicNeighbors[nbPeriodicCells] = new ContainerClass(*(hypotheticNeighbor)) ;
// newPos = pos + ofsset
FReal*const positionsX = periodicNeighbors[nbPeriodicCells]->getPositions()[0];
FReal*const positionsY = periodicNeighbors[nbPeriodicCells]->getPositions()[1];
......@@ -2076,8 +2078,17 @@ protected:
positionsX[idxPart] += offSet[0];
positionsY[idxPart] += offSet[1];
positionsZ[idxPart] += offSet[2];
// std::cout <<indexesNeighbors[idxNeigh] << " " << positionsX[idxPart] << " "<< positionsY[idxPart] << " "<< positionsZ[idxPart] <<std::endl;
}
#ifdef toto
std::cout << " MOVE CELLS "<<std::endl;
FReal*const positionsXX = hypotheticNeighbor->getPositions()[0];
FReal*const positionsYX = hypotheticNeighbor->getPositions()[1];
FReal*const positionsZX = hypotheticNeighbor->getPositions()[2];
auto idxPart = 0 ;
std::cout <<neighborPositions[idxNeigh] << " Shift " << positionsX[idxPart] << " "<< positionsY[idxPart] << " "<< positionsZ[idxPart] <<std::endl;
std::cout <<neighborPositions[idxNeigh] << " ORI " << positionsXX[idxPart] << " "<< positionsYX[idxPart] << " "<< positionsZX[idxPart] <<std::endl;
std::cout <<neighborPositions[idxNeigh] << " OFSET " << offSet[0] << " "<< offSet[1] << " "<< offSet[2] <<std::endl;
#endif
++nbPeriodicCells;
neighbors[counter] = periodicNeighbors[nbPeriodicCells];
}
......@@ -2086,11 +2097,7 @@ protected:
}
}
// std::cout << " counter: "<< counter <<std::endl << " -->";
if(counter){
// for( int i =0 ; i < nbPeriodicCells ; ++i){
// std::cout << " " << neighbors[i];
// }
// std::cout << std::endl;
if(counter){ // neighborPositions doesn't use)
myThreadkernels.P2PRemote( currentIter.coord, currentIter.targets,
currentIter.sources, neighbors, neighborPositions, counter);
if(nbPeriodicCells >0){
......
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