diff --git a/Src/Core/FCoreCommon.hpp b/Src/Core/FCoreCommon.hpp index 171b74b9487f7f9cdb86fb854782923950f77a28..c6ad2f02764da8052fc380de08651af3457bd2f7 100644 --- a/Src/Core/FCoreCommon.hpp +++ b/Src/Core/FCoreCommon.hpp @@ -10,26 +10,32 @@ * @brief The FFmmOperations enum * 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 { - FFmmP2P = (1 << 0), - FFmmP2M = (1 << 1), - FFmmM2M = (1 << 2), - FFmmM2L = (1 << 3), - FFmmL2L = (1 << 4), - FFmmL2P = (1 << 5), - FFmmP2L = (1 << 6), - FFmmM2P = (1 << 7), + FFmmP2P = (1 << 0), ///< Particles to Particles operator (Near field) + FFmmP2M = (1 << 1), ///< Particles to Multipole operator (Far field) + FFmmM2M = (1 << 2), ///< Multipole to Multipole operator (Far field) + FFmmM2L = (1 << 3), ///< Multipole to Local operator (Far field) + FFmmL2L = (1 << 4), ///< Local to Local operator (Far field) + FFmmL2P = (1 << 5), ///< Local to Particles operator (Far field) + FFmmP2L = (1 << 6), ///< Particles to Local operator (Far field in Adaptive algorithm) + FFmmM2P = (1 << 7), ///< Multipole to Particles operator (Far field in Adaptive algorithm) // - FFmmNearField = FFmmP2P, - FFmmFarField = (FFmmP2M|FFmmM2M|FFmmM2L|FFmmL2L|FFmmL2P|FFmmM2P|FFmmP2L), + FFmmNearField = FFmmP2P, ///< Near field operator + 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(""); if (value & FFmmP2P) op += " FFmmP2P |"; diff --git a/Src/Core/FFmmAlgorithmThreadProcPeriodic.hpp b/Src/Core/FFmmAlgorithmThreadProcPeriodic.hpp index cd39d40d5efd41ca0b537e33ad7cef58aa5faffc..a024ad0b412de7cd5b046ec49c6d2ff774507d7a 100644 --- a/Src/Core/FFmmAlgorithmThreadProcPeriodic.hpp +++ b/Src/Core/FFmmAlgorithmThreadProcPeriodic.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include "Utils/FAssert.hpp" #include "Utils/FLog.hpp" @@ -36,7 +37,6 @@ #include "Utils/FAlgorithmTimers.hpp" -#include /** * @author Berenger Bramas (berenger.bramas@inria.fr) @@ -861,37 +861,7 @@ protected: 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 multipole_t* parent_multipole = &(rootCellFromProc.getMultipoleData()); const symbolic_data_t* parent_symbolic = &(rootCellFromProc); @@ -927,7 +897,6 @@ protected: /// Treat at root level the periodicity /// this->processPeriodicLevels(); -#endif } else { // OTHER PROCESS (NOT 0) @@ -1708,14 +1677,13 @@ protected: // set an other tree To store the result // OctreeClass otherP2Ptree( tree->getHeight(), tree->getSubHeight(), - tree->getBoxWidth(), tree->getBoxCenter() ); + boxWidth, tree->getBoxCenter() ); // init const int LeafIndex = OctreeHeight - 1; const int SizeShape = P2PExclusionClass::SizeShape; int shapeLeaf[SizeShape]{}; - // memset(shapeLeaf,0,SizeShape*sizeof(int)); LeafData* const leafsDataArray = new LeafData[this->numberOfLeafs]; @@ -1785,16 +1753,6 @@ protected: if(needOther){ //means that something need to be sent (or received) leafsNeedOther.set(idxLeaf,true); ++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: delete recvBuffer[idxProc]; } 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 " <getSrc() << std::endl; -// } ); -// std::cout << std::endl; } // END MASTER /////////////////////////////////////////////////// @@ -1983,7 +1929,7 @@ protected: for(int idxLeafs = previous ; idxLeafs < 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()]); @@ -1997,7 +1943,7 @@ protected: // Compute L2P operator if(l2pEnabled){ 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( leaf_local_expansion, leaf_symbolic, @@ -2012,7 +1958,6 @@ protected: hasPeriodicLeaves, currentIter.coord, LeafIndex, AllDirs); int periodicNeighborsCounter = 0; - auto nonPeriodicCounter = 0 ; // // First treat P2P interactions the classical interaction // For Periodic cells @@ -2025,7 +1970,7 @@ protected: constexpr int maxPeriodicNeighbors = 19; ContainerClass* periodicNeighbors[maxPeriodicNeighbors]{}; int periodicNeighborPositions[maxPeriodicNeighbors]; -// std::array 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 @@ -2040,25 +1985,18 @@ protected: FReal yoffset= boxWidth * FReal(offsets[idxNeig].getY()) ; FReal zoffset= boxWidth * FReal(offsets[idxNeig].getZ()) ; for(FSize idxPart = 0; idxPart < periodicNeighbors[periodicNeighborsCounter]->getNbParticles() ; ++idxPart){ - // std::cout << " Xo " << positionsX[idxPart] << " " << positionsY[idxPart] << " " << positionsZ[idxPart] <::max()); const int nbLeafToProceed = int(leafsNeedOtherData.getSize()); - // std::cout << "Treat communications " << nbLeafToProceed <getNeighborsIndexesPeriodic(currentIter.coord,limite, indexesNeighbors,indexArray,AllDirs); - // std::cout << currentIter.coord.getMortonIndex() << " Cells comming from another process " << nbNeigh < periodicNeighbors{}; - int nbPeriodicCells=0 ; - // std::cout <getMortonIndex() << " " << currentIter.coord << " " << nbNeigh <getPositions()[0]; - FReal*const positionsYX = hypotheticNeighbor->getPositions()[1]; - FReal*const positionsZX = hypotheticNeighbor->getPositions()[2]; - auto idxPart = 0 ; - std::cout < 0){ // neighborPositions doesn't use) - // std::cout << " counter: "<< counter <<" nbPeriodicCells " << nbPeriodicCells< P2PRemote" <0){ - //to Do - for(int i=0 ; i < nbPeriodicCells ; ++i){ - delete periodicNeighbors[i] ; - } - } - } - } // end for loop - } - + myThreadkernels.P2PRemote( currentIter.coord, currentIter.targets, + nullptr /*currentIter.sources*/, neighbors, neighborPositions, counter); + if(nbPeriodicCells >0){ + //to Do + for(int i=0 ; i < nbPeriodicCells ; ++i){ + delete periodicNeighbors[i] ; + } + } + } + } // end for loop + } + delete[] leafsDataArray; - + FLOG(computation2Counter.tac()); @@ -2466,6 +2378,7 @@ public: void processPeriodicLevels(){ FLOG( FLog::Controller.write("\tStart Periodic Pass\n").write(FLog::Flush); ); FLOG(FTic counterTime); + // the root level of the octree in the virtual array of cells const int rootLevel = offsetRealTree-1 ; rootCellFromProc.setLevel(rootLevel+1); diff --git a/Src/Kernels/Chebyshev/FChebCell.hpp b/Src/Kernels/Chebyshev/FChebCell.hpp index 97d0d3d50f02c351b7bb88d73b05fa97b5627cd7..b38aaa3a08a96ab668f6b13c14fd9246c99b8e64 100644 --- a/Src/Kernels/Chebyshev/FChebCell.hpp +++ b/Src/Kernels/Chebyshev/FChebCell.hpp @@ -63,7 +63,7 @@ public: using multipole_t = exp_impl; using local_expansion_t = exp_impl; - multipole_t m_data {}; + multipole_t m_data {}; local_expansion_t l_data {}; bool hasMultipoleData() const noexcept {