Commit 98cc61e5 authored by COULAUD Olivier's avatar COULAUD Olivier

Remove dead code, fix compilation error with OptiDis

parent 790b6440
...@@ -10,26 +10,32 @@ ...@@ -10,26 +10,32 @@
* @brief The FFmmOperations enum * @brief The FFmmOperations enum
* To chose which operation has to be performed. * To chose which operation has to be performed.
*/ */
///
/// \brief The FFmmOperations enum
/// To chose which operation has to be performed in the methode execute of the Fmm algorithm.
///
enum FFmmOperations { enum FFmmOperations {
FFmmP2P = (1 << 0), FFmmP2P = (1 << 0), ///< Particles to Particles operator (Near field)
FFmmP2M = (1 << 1), FFmmP2M = (1 << 1), ///< Particles to Multipole operator (Far field)
FFmmM2M = (1 << 2), FFmmM2M = (1 << 2), ///< Multipole to Multipole operator (Far field)
FFmmM2L = (1 << 3), FFmmM2L = (1 << 3), ///< Multipole to Local operator (Far field)
FFmmL2L = (1 << 4), FFmmL2L = (1 << 4), ///< Local to Local operator (Far field)
FFmmL2P = (1 << 5), FFmmL2P = (1 << 5), ///< Local to Particles operator (Far field)
FFmmP2L = (1 << 6), FFmmP2L = (1 << 6), ///< Particles to Local operator (Far field in Adaptive algorithm)
FFmmM2P = (1 << 7), FFmmM2P = (1 << 7), ///< Multipole to Particles operator (Far field in Adaptive algorithm)
// //
FFmmNearField = FFmmP2P, FFmmNearField = FFmmP2P, ///< Near field operator
FFmmFarField = (FFmmP2M|FFmmM2M|FFmmM2L|FFmmL2L|FFmmL2P|FFmmM2P|FFmmP2L), FFmmFarField = (FFmmP2M|FFmmM2M|FFmmM2L|FFmmL2L|FFmmL2P|FFmmM2P|FFmmP2L), ///< Only Far Field operators
// //
FFmmNearAndFarFields = (FFmmNearField|FFmmFarField) FFmmNearAndFarFields = (FFmmNearField|FFmmFarField) ///< Near and far field operators
}; };
std::string FFmmOperations_string(/*enum FFmmOperations*/ const unsigned int & value){ ///
/// \brief FFmmOperations_string converts the FFmmOperations (enum) in string
/// \param value the FFmmOperations
/// \return the string corresponding to the FFmmOperations
///
inline std::string FFmmOperations_string(/*enum FFmmOperations*/ const unsigned int & value){
//if (value & FFmmNearAndFarFields) return std::string("FFmmNearAndFarFields") ;
//if (value & FFmmFarField) return std::string("FFmmFarField") ;
//if (value & FFmmNearField) return std::string("FFmmNearField" );
std::string op(""); std::string op("");
if (value & FFmmP2P) if (value & FFmmP2P)
op += " FFmmP2P |"; op += " FFmmP2P |";
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <vector> #include <vector>
#include <memory>
#include "Utils/FAssert.hpp" #include "Utils/FAssert.hpp"
#include "Utils/FLog.hpp" #include "Utils/FLog.hpp"
...@@ -36,7 +37,6 @@ ...@@ -36,7 +37,6 @@
#include "Utils/FAlgorithmTimers.hpp" #include "Utils/FAlgorithmTimers.hpp"
#include <memory>
/** /**
* @author Berenger Bramas (berenger.bramas@inria.fr) * @author Berenger Bramas (berenger.bramas@inria.fr)
...@@ -861,37 +861,7 @@ protected: ...@@ -861,37 +861,7 @@ protected:
counterProc += 1; counterProc += 1;
} }
} }
// }
#ifdef USEQALGO
// set the reecived
// std::copy(currentChild, currentChild+8,
// std::begin(child_symbolics));
typename OctreeClass::Iterator octreeIterator(tree);
octreeIterator.gotoLeft();
// multipole_t* const real_tree_root_multipole
// = &((&upperCells[offsetRealTree-1])->getMultipoleData());
// const symbolic_data_t* const real_tree_root_symbolic
// = &(upperCells[offsetRealTree-1]);
CellClass** children = octreeIterator.getCurrentBox();
std::transform(currentChild, currentChild + 8,
std::begin(children),
[](const CellClass* c) {
return (c == nullptr)
? nullptr
: &(c->getMultipoleData());
});
// std::copy(currentChild, currentChild+8,
// std::begin(child_symbolics));
// std::copy(currentChild, currentChild+8,
// std::begin(children));
this->processPeriodicLevelsSEQ();
#else
// Build expansion at the rootCellFromProc // Build expansion at the rootCellFromProc
multipole_t* parent_multipole = &(rootCellFromProc.getMultipoleData()); multipole_t* parent_multipole = &(rootCellFromProc.getMultipoleData());
const symbolic_data_t* parent_symbolic = &(rootCellFromProc); const symbolic_data_t* parent_symbolic = &(rootCellFromProc);
...@@ -927,7 +897,6 @@ protected: ...@@ -927,7 +897,6 @@ protected:
/// Treat at root level the periodicity /// Treat at root level the periodicity
/// ///
this->processPeriodicLevels(); this->processPeriodicLevels();
#endif
} }
else { else {
// OTHER PROCESS (NOT 0) // OTHER PROCESS (NOT 0)
...@@ -1708,14 +1677,13 @@ protected: ...@@ -1708,14 +1677,13 @@ protected:
// set an other tree To store the result // set an other tree To store the result
// //
OctreeClass otherP2Ptree( tree->getHeight(), tree->getSubHeight(), OctreeClass otherP2Ptree( tree->getHeight(), tree->getSubHeight(),
tree->getBoxWidth(), tree->getBoxCenter() ); boxWidth, tree->getBoxCenter() );
// init // init
const int LeafIndex = OctreeHeight - 1; const int LeafIndex = OctreeHeight - 1;
const int SizeShape = P2PExclusionClass::SizeShape; const int SizeShape = P2PExclusionClass::SizeShape;
int shapeLeaf[SizeShape]{}; int shapeLeaf[SizeShape]{};
// memset(shapeLeaf,0,SizeShape*sizeof(int));
LeafData* const leafsDataArray = new LeafData[this->numberOfLeafs]; LeafData* const leafsDataArray = new LeafData[this->numberOfLeafs];
...@@ -1785,16 +1753,6 @@ protected: ...@@ -1785,16 +1753,6 @@ protected:
if(needOther){ //means that something need to be sent (or received) if(needOther){ //means that something need to be sent (or received)
leafsNeedOther.set(idxLeaf,true); leafsNeedOther.set(idxLeaf,true);
++countNeedOther; ++countNeedOther;
// std::cout << " Leaf "<< iterArray[idxLeaf].getCurrentGlobalCoordinate().getMortonIndex() << std::endl ;
// for(int i = 0 ; i < nbProcess ; ++i ){
// std::cout << " "<< i << " alreadySent " << alreadySent[i]<< " " << toSend[i].size() <<" : ";
// for(int j = 0 ; j < toSend[i].size() ; ++j ){
// std::cout << " " << toSend[i][j].getCurrentGlobalCoordinate().getMortonIndex() ;
// }
// std::cout << std::endl;
// }
} }
} }
} }
...@@ -1901,18 +1859,6 @@ protected: ...@@ -1901,18 +1859,6 @@ protected:
delete recvBuffer[idxProc]; delete recvBuffer[idxProc];
} }
delete[] globalReceiveMap; delete[] globalReceiveMap;
// DEBUG
//
// Check the new tree
// std::cout <<"otherP2Ptree " << std::endl;
// otherP2Ptree.forEachCellLeaf([&](CellClass* LeafCell, LeafClass* leaf){
// std::cout << LeafCell->getMortonIndex() <<" leaf " << leaf << " source " <<leaf->getSrc() << std::endl;
// } );
// std::cout << std::endl;
} }
// END MASTER // END MASTER
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
...@@ -1983,7 +1929,7 @@ protected: ...@@ -1983,7 +1929,7 @@ protected:
for(int idxLeafs = previous ; idxLeafs < endAtThisShape ; idxLeafs += chunckSize){ for(int idxLeafs = previous ; idxLeafs < endAtThisShape ; idxLeafs += chunckSize){
const int nbLeavesInTask = FMath::Min(endAtThisShape-idxLeafs, chunckSize); const int nbLeavesInTask = FMath::Min(endAtThisShape-idxLeafs, chunckSize);
#pragma omp task default(none) firstprivate(nbLeavesInTask,idxLeafs) shared(std::cout) #pragma omp task default(none) firstprivate(nbLeavesInTask,idxLeafs)
{ {
KernelClass* myThreadkernels = (kernels[omp_get_thread_num()]); KernelClass* myThreadkernels = (kernels[omp_get_thread_num()]);
...@@ -1997,7 +1943,7 @@ protected: ...@@ -1997,7 +1943,7 @@ protected:
// Compute L2P operator // Compute L2P operator
if(l2pEnabled){ if(l2pEnabled){
const local_expansion_t* leaf_local_expansion = &(currentIter.cell->getLocalExpansionData()); const local_expansion_t* leaf_local_expansion = &(currentIter.cell->getLocalExpansionData());
const symbolic_data_t* leaf_symbolic = currentIter.cell; const symbolic_data_t* leaf_symbolic = currentIter.cell;
myThreadkernels->L2P( myThreadkernels->L2P(
leaf_local_expansion, leaf_local_expansion,
leaf_symbolic, leaf_symbolic,
...@@ -2012,7 +1958,6 @@ protected: ...@@ -2012,7 +1958,6 @@ protected:
hasPeriodicLeaves, hasPeriodicLeaves,
currentIter.coord, LeafIndex, AllDirs); currentIter.coord, LeafIndex, AllDirs);
int periodicNeighborsCounter = 0; int periodicNeighborsCounter = 0;
auto nonPeriodicCounter = 0 ;
// //
// First treat P2P interactions the classical interaction // First treat P2P interactions the classical interaction
// For Periodic cells // For Periodic cells
...@@ -2025,7 +1970,7 @@ protected: ...@@ -2025,7 +1970,7 @@ protected:
constexpr int maxPeriodicNeighbors = 19; constexpr int maxPeriodicNeighbors = 19;
ContainerClass* periodicNeighbors[maxPeriodicNeighbors]{}; ContainerClass* periodicNeighbors[maxPeriodicNeighbors]{};
int periodicNeighborPositions[maxPeriodicNeighbors]; int periodicNeighborPositions[maxPeriodicNeighbors];
// std::array<FTreeCoordinate,maxPeriodicNeighbors> periodicOffsets{} ; //
// Move cells and particles // Move cells and particles
for(int idxNeig = 0 ; idxNeig < counter ; ++idxNeig){ for(int idxNeig = 0 ; idxNeig < counter ; ++idxNeig){
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
...@@ -2040,25 +1985,18 @@ protected: ...@@ -2040,25 +1985,18 @@ protected:
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 < periodicNeighbors[periodicNeighborsCounter]->getNbParticles() ; ++idxPart){ for(FSize idxPart = 0; idxPart < periodicNeighbors[periodicNeighborsCounter]->getNbParticles() ; ++idxPart){
// std::cout << " Xo " << positionsX[idxPart] << " " << positionsY[idxPart] << " " << positionsZ[idxPart] <<std::endl;
// std::cout << " Offset " << xoffset << " " << yoffset << " " << zoffset <<std::endl;
positionsX[idxPart] += xoffset; positionsX[idxPart] += xoffset;
positionsY[idxPart] += yoffset; positionsY[idxPart] += yoffset;
positionsZ[idxPart] += zoffset; positionsZ[idxPart] += zoffset;
// std::cout << " Xn " << positionsX[idxPart] << " " << positionsY[idxPart] << " " << positionsZ[idxPart] <<std::endl;
} }
// periodicOffsets[periodicNeighborsCounter] = offsets[idxNeig];
periodicNeighborPositions[periodicNeighborsCounter] = neighborPositions[idxNeig]; periodicNeighborPositions[periodicNeighborsCounter] = neighborPositions[idxNeig];
++periodicNeighborsCounter; ++periodicNeighborsCounter;
} }
else{ // set non periodic cells in neighbors and in neighborPositions else{ // set non periodic cells in neighbors and in neighborPositions
// nonPeriodicCounter versus idxNeig-periodicNeighborsCounter // nonPeriodicCounter versus idxNeig-periodicNeighborsCounter
// std::cout << nonPeriodicCounter <<" "<< idxNeig-periodicNeighborsCounter <<std::endl; //
neighbors[idxNeig-periodicNeighborsCounter] = neighbors[idxNeig]; neighbors[idxNeig-periodicNeighborsCounter] = neighbors[idxNeig];
neighborPositions[idxNeig-periodicNeighborsCounter] = neighborPositions[idxNeig]; neighborPositions[idxNeig-periodicNeighborsCounter] = neighborPositions[idxNeig];
++nonPeriodicCounter ;
} }
} }
// //
...@@ -2115,7 +2053,7 @@ protected: ...@@ -2115,7 +2053,7 @@ protected:
const int limitem1 = limite -1 ; const int limitem1 = limite -1 ;
FAssertLF(leafsNeedOtherData.getSize() < std::numeric_limits<int>::max()); FAssertLF(leafsNeedOtherData.getSize() < std::numeric_limits<int>::max());
const int nbLeafToProceed = int(leafsNeedOtherData.getSize()); const int nbLeafToProceed = int(leafsNeedOtherData.getSize());
// std::cout << "Treat communications " << nbLeafToProceed <<std::endl;
#pragma omp for schedule(dynamic, userChunkSize) #pragma omp for schedule(dynamic, userChunkSize)
for(int idxLeafs = 0 ; idxLeafs < nbLeafToProceed ; ++idxLeafs){ for(int idxLeafs = 0 ; idxLeafs < nbLeafToProceed ; ++idxLeafs){
LeafData currentIter = leafsNeedOtherData[idxLeafs]; LeafData currentIter = leafsNeedOtherData[idxLeafs];
...@@ -2127,16 +2065,15 @@ protected: ...@@ -2127,16 +2065,15 @@ protected:
// But we don't know if the is periodic cells // But we don't know if the is periodic cells
const int nbNeigh = this->getNeighborsIndexesPeriodic(currentIter.coord,limite, const int nbNeigh = this->getNeighborsIndexesPeriodic(currentIter.coord,limite,
indexesNeighbors,indexArray,AllDirs); indexesNeighbors,indexArray,AllDirs);
// std::cout << currentIter.coord.getMortonIndex() << " Cells comming from another process " << nbNeigh <<std::endl;
std::array<ContainerClass*,19> periodicNeighbors{}; std::array<ContainerClass*,19> periodicNeighbors{};
int nbPeriodicCells=0 ; int nbPeriodicCells = 0 ;
// std::cout <<idProcess<< " LEAF " << currentIter.cell->getMortonIndex() << " " << currentIter.coord << " " << nbNeigh <<std::endl;
//
// //
for(int idxNeigh = 0 ; idxNeigh < nbNeigh ; ++idxNeigh){ for(int idxNeigh = 0 ; idxNeigh < nbNeigh ; ++idxNeigh){
if(indexesNeighbors[idxNeigh] < (intervals[idProcess].leftIndex) || (intervals[idProcess].rightIndex) < indexesNeighbors[idxNeigh]){ if(indexesNeighbors[idxNeigh] < (intervals[idProcess].leftIndex) || (intervals[idProcess].rightIndex) < indexesNeighbors[idxNeigh]){
ContainerClass*const hypotheticNeighbor = otherP2Ptree.getLeafSrc(indexesNeighbors[idxNeigh]);
if(hypotheticNeighbor){ ContainerClass*const hypotheticNeighbor = otherP2Ptree.getLeafSrc(indexesNeighbors[idxNeigh]);
if(hypotheticNeighbor){
// we should check if the cells is periodic or not // we should check if the cells is periodic or not
neighbors[counter] = hypotheticNeighbor; neighbors[counter] = hypotheticNeighbor;
neighborPositions[counter] = indexArray[idxNeigh]; neighborPositions[counter] = indexArray[idxNeigh];
...@@ -2157,10 +2094,7 @@ protected: ...@@ -2157,10 +2094,7 @@ protected:
movePos = true ; movePos = true ;
} }
// std::cout << " ( " << indexesNeighbors[idxNeigh] << " " << coord3d << " offset= "
// <<offSet[0] << "," << offSet[1] << "," <<offSet[2] <<" )" ;
if(movePos){ if(movePos){
/// NEW NEW NEW NEW NEW NEW
// Put periodic cell into another cell (copy data) // Put periodic cell into another cell (copy data)
periodicNeighbors[nbPeriodicCells] = new ContainerClass(*hypotheticNeighbor) ; periodicNeighbors[nbPeriodicCells] = new ContainerClass(*hypotheticNeighbor) ;
// newPos = pos + ofsset // newPos = pos + ofsset
...@@ -2172,50 +2106,28 @@ protected: ...@@ -2172,50 +2106,28 @@ protected:
positionsY[idxPart] += offSet[1]; positionsY[idxPart] += offSet[1];
positionsZ[idxPart] += offSet[2]; positionsZ[idxPart] += offSet[2];
} }
#ifdef toto
std::cout << " MOVE CELL "<<idxNeigh<<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 <<idProcess << " ORI " << positionsXX[idxPart] << " "<< positionsYX[idxPart] << " "<< positionsZX[idxPart] <<std::endl;
std::cout <<idProcess << " OFSET " << offSet[0] << " "<< offSet[1] << " "<< offSet[2] <<std::endl;
std::cout <<idProcess << " Shift " << positionsX[idxPart] << " "<< positionsY[idxPart] << " "<< positionsZ[idxPart] <<std::endl;
#endif
neighbors[counter] = periodicNeighbors[nbPeriodicCells]; neighbors[counter] = periodicNeighbors[nbPeriodicCells];
// std::cout << " hypotheticNeighbor " << hypotheticNeighbor << " " <<neighbors[counter] << " " << periodicNeighbors[nbPeriodicCells] <<std::endl;
++nbPeriodicCells; ++nbPeriodicCells;
} }
else {
// std::cout << " NO MOVE CELL "<<idxNeigh<<std::endl;
}
++counter; ++counter;
} }
} }
} }
if(counter> 0){ // neighborPositions doesn't use) if(counter> 0){ // neighborPositions doesn't use)
// std::cout << " counter: "<< counter <<" nbPeriodicCells " << nbPeriodicCells<<std::endl << " --> P2PRemote" <<std::endl;; myThreadkernels.P2PRemote( currentIter.coord, currentIter.targets,
// for (int i = 0 ; i < counter ; ++i){ nullptr /*currentIter.sources*/, neighbors, neighborPositions, counter);
// std::cout << " " << neighbors[i] ; if(nbPeriodicCells >0){
// } //to Do
// std::cout <<std::endl; for(int i=0 ; i < nbPeriodicCells ; ++i){
myThreadkernels.P2PRemote( currentIter.coord, currentIter.targets, delete periodicNeighbors[i] ;
nullptr /*currentIter.sources*/, neighbors, neighborPositions, counter); }
if(nbPeriodicCells >0){ }
//to Do }
for(int i=0 ; i < nbPeriodicCells ; ++i){ } // end for loop
delete periodicNeighbors[i] ; }
}
}
}
} // end for loop
}
delete[] leafsDataArray; delete[] leafsDataArray;
FLOG(computation2Counter.tac()); FLOG(computation2Counter.tac());
...@@ -2466,6 +2378,7 @@ public: ...@@ -2466,6 +2378,7 @@ public:
void processPeriodicLevels(){ void processPeriodicLevels(){
FLOG( FLog::Controller.write("\tStart Periodic Pass\n").write(FLog::Flush); ); FLOG( FLog::Controller.write("\tStart Periodic Pass\n").write(FLog::Flush); );
FLOG(FTic counterTime); FLOG(FTic counterTime);
// the root level of the octree in the virtual array of cells // the root level of the octree in the virtual array of cells
const int rootLevel = offsetRealTree-1 ; const int rootLevel = offsetRealTree-1 ;
rootCellFromProc.setLevel(rootLevel+1); rootCellFromProc.setLevel(rootLevel+1);
......
...@@ -63,7 +63,7 @@ public: ...@@ -63,7 +63,7 @@ public:
using multipole_t = exp_impl<class multipole_tag, NRHS>; using multipole_t = exp_impl<class multipole_tag, NRHS>;
using local_expansion_t = exp_impl<class local_expansion_tag, NLHS>; using local_expansion_t = exp_impl<class local_expansion_tag, NLHS>;
multipole_t m_data {}; multipole_t m_data {};
local_expansion_t l_data {}; local_expansion_t l_data {};
bool hasMultipoleData() const noexcept { bool hasMultipoleData() const noexcept {
......
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