diff --git a/Src/Components/FAbstractKernels.hpp b/Src/Components/FAbstractKernels.hpp index 351c1117d1ccfe7ebaf37296f4d4a60ce8761789..4e34880e6cb801414413c8abb22d92725e1914ea 100644 --- a/Src/Components/FAbstractKernels.hpp +++ b/Src/Components/FAbstractKernels.hpp @@ -154,7 +154,8 @@ public: * @param size the number of direct neighbors */ virtual void P2P(const FTreeCoordinate& inLeafPosition, - ContainerClass* const FRestrict targets, const ContainerClass* const FRestrict sources, + ContainerClass* const /*FRestrict*/ targets, + const ContainerClass* const /*FRestrict*/ sources, ContainerClass* const directNeighborsParticles[], const int neighborPositions[], const int size) = 0; diff --git a/Src/Components/FTestKernels.hpp b/Src/Components/FTestKernels.hpp index 7c1416e2c859931775a7997f73c12039bb0f8856..c9e80aa6733f7c44b0210c7f6c12d0f8972a8390 100644 --- a/Src/Components/FTestKernels.hpp +++ b/Src/Components/FTestKernels.hpp @@ -105,7 +105,8 @@ public: /** After Downward */ void P2P(const FTreeCoordinate& , - ContainerClass* const FRestrict targets, const ContainerClass* const FRestrict sources, + ContainerClass* const /*FRestrict*/ targets, + const ContainerClass* const /*FRestrict*/ sources, ContainerClass* const directNeighborsParticles[], const int /*positions*/[], const int inSize) override { // Each particles targeted is impacted by the particles sources long long int inc = sources->getNbParticles(); diff --git a/Src/Core/FFmmAlgorithmThreadBalance.hpp b/Src/Core/FFmmAlgorithmThreadBalance.hpp index a92ac28f05cc19009d334ebae9e714b0e3ab980f..81cfc7add4d952c17e3e45555d191b06b7ed2ab6 100644 --- a/Src/Core/FFmmAlgorithmThreadBalance.hpp +++ b/Src/Core/FFmmAlgorithmThreadBalance.hpp @@ -127,8 +127,15 @@ protected: ///////////////////////////////////////////////////////////////////////////// /** The workload contains what a thread need to perfom its interval of work */ struct Workload{ - typename OctreeClass::Iterator iterator; - int nbElements; + typename OctreeClass::Iterator iterator{}; + int nbElements{}; + // +// Workload(const Workload& load): iterator(load.iterator),nbElements(load.nbElements) +// {} +// Workload& operator=(const Workload& load) +// {iterator=load.iterator; nbElements=load.nbElements; +// return *this; +// } }; //< The work per thread for the P2M @@ -354,10 +361,10 @@ protected: #pragma omp task { if(workloadBufferThread[omp_get_thread_num()] == nullptr){ - workloadBufferThread[omp_get_thread_num()] = new WorkloadTemp[leafsNumber]; + workloadBufferThread[omp_get_thread_num()] = new WorkloadTemp[leafsNumber]{}; } WorkloadTemp* workloadBuffer = workloadBufferThread[omp_get_thread_num()]; - memset(workloadBuffer, 0, sizeof(struct WorkloadTemp)*leafsNumber); + std::memset(reinterpret_cast(workloadBuffer), 0, sizeof(struct WorkloadTemp)*leafsNumber); // Prepare the P2P leafsDataArray.reset(new LeafData[leafsNumber]); diff --git a/Src/Files/FMpiTreeBuilder.hpp b/Src/Files/FMpiTreeBuilder.hpp index 9db887c4e1dda300cd4b63b7a81cebcee320eced..900c1cfd1189013b7cd93b7098d2decc2a815f4f 100644 --- a/Src/Files/FMpiTreeBuilder.hpp +++ b/Src/Files/FMpiTreeBuilder.hpp @@ -58,6 +58,7 @@ public: operator MortonIndex() const { return this->index; } + // IndexedParticle & operator=(const IndexedParticle &) = default ; // IndexedParticle(const IndexedParticle& rhs){ // index = rhs.index ; // particle = rhs.particle ; @@ -296,9 +297,9 @@ public: << finalParticlesNumber << " particles\n"; FLog::Controller.flush(); ); IndexedParticle* particlesWithExtension = new IndexedParticle[finalParticlesNumber]; // Copy old data - memcpy(particlesWithExtension, (*workingArray), (*workingSize)*sizeof(IndexedParticle)); + std::memcpy(reinterpret_cast(particlesWithExtension), (*workingArray), (*workingSize)*sizeof(IndexedParticle)); // Copy received data - memcpy(particlesWithExtension + (*workingSize), receivedParticles.data(), receivedParticles.size()*sizeof(IndexedParticle)); + std::memcpy(reinterpret_cast(particlesWithExtension + (*workingSize)), receivedParticles.data(), receivedParticles.size()*sizeof(IndexedParticle)); // Move ptr delete[] (*workingArray); (*workingArray) = particlesWithExtension; @@ -316,7 +317,7 @@ public: //Copy all the particles (*particlesArrayInLeafOrder) = new ParticleClass[(*workingSize)]; for(FSize idxPart = 0 ; idxPart < (*workingSize) ; ++idxPart){ - memcpy(&(*particlesArrayInLeafOrder)[idxPart],&(*workingArray)[idxPart].particle,sizeof(ParticleClass)); + std::memcpy(reinterpret_cast(&(*particlesArrayInLeafOrder)[idxPart]),&(*workingArray)[idxPart].particle,sizeof(ParticleClass)); } // Assign the number of leaf (*leavesSize) = leavesInfo.getSize(); @@ -535,7 +536,7 @@ public: const FSize sourcePosition = FMath::Max(myObjective.first, myCurrentInter.first) - myCurrentInter.first; // We store from offset, and use nbPartsPerPackToRecv has the number // The reading position is the offset of the first leaf we own - memcpy(&particlesRecvBuffer[offsetToRecv], &particlesArrayInLeafOrder[leavesOffsetInParticles[sourcePosition]], + std::memcpy(reinterpret_cast(&particlesRecvBuffer[offsetToRecv]), &particlesArrayInLeafOrder[leavesOffsetInParticles[sourcePosition]], nbPartsPerPackToRecv[idxPack]*sizeof(ParticleClass)); } offsetToRecv += nbPartsPerPackToRecv[idxPack]; diff --git a/Src/Kernels/Chebyshev/FChebDenseKernel.hpp b/Src/Kernels/Chebyshev/FChebDenseKernel.hpp index 07e862bba015cf674a2d4e17e696076ec2041a52..6a2d5274914f80ef3c16197a7cd36a3faf38a67c 100644 --- a/Src/Kernels/Chebyshev/FChebDenseKernel.hpp +++ b/Src/Kernels/Chebyshev/FChebDenseKernel.hpp @@ -192,7 +192,8 @@ public: } void P2P(const FTreeCoordinate& inPosition, - ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict inSources, + ContainerClass* const /*FFRestrict */ inTargets, + const ContainerClass* const /*FFRestrict */ inSources, ContainerClass* const inNeighbors[], const int neighborPositions[], const int inSize) override { if(inTargets == inSources){ diff --git a/Src/Kernels/Chebyshev/FChebFlopsSymKernel.hpp b/Src/Kernels/Chebyshev/FChebFlopsSymKernel.hpp index 32a6e9d369714c95c0d72778c9578862b95f07b9..ef1b688ed31ba81450d12314445c25d4b63cdb70 100644 --- a/Src/Kernels/Chebyshev/FChebFlopsSymKernel.hpp +++ b/Src/Kernels/Chebyshev/FChebFlopsSymKernel.hpp @@ -246,8 +246,8 @@ public: void P2P(const FTreeCoordinate& /* LeafCellCoordinate */, // needed for periodic boundary conditions - ContainerClass* const FRestrict TargetParticles, - const ContainerClass* const FRestrict SourceParticles, + ContainerClass* const /*FFRestrict */ TargetParticles, + const ContainerClass* const /*FFRestrict */ SourceParticles, ContainerClass* const NeighborSourceParticles[], const int neighborPositions[], const int size) override diff --git a/Src/Kernels/Chebyshev/FChebKernel.hpp b/Src/Kernels/Chebyshev/FChebKernel.hpp index 1ca9c305da7fca8f9ddc5423de560747431257e8..5b3343c2b81fda5bcc86b028865ee01652989240 100644 --- a/Src/Kernels/Chebyshev/FChebKernel.hpp +++ b/Src/Kernels/Chebyshev/FChebKernel.hpp @@ -247,7 +247,8 @@ public: } void P2P(const FTreeCoordinate& inPosition, - ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict inSources, + ContainerClass* const /*FFRestrict */ inTargets, + const ContainerClass* const /*FFRestrict */ inSources, ContainerClass* const inNeighbors[], const int neighborPositions[], const int inSize) override diff --git a/Src/Kernels/Chebyshev/FChebSymKernel.hpp b/Src/Kernels/Chebyshev/FChebSymKernel.hpp index e1fbc1fe3f639a98e68f176251b0ddc304e374da..3ac76322b1b1cc7081ddd423e0512afb5a640d5f 100644 --- a/Src/Kernels/Chebyshev/FChebSymKernel.hpp +++ b/Src/Kernels/Chebyshev/FChebSymKernel.hpp @@ -475,7 +475,8 @@ public: } void P2P(const FTreeCoordinate& inPosition, - ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict inSources, + ContainerClass* const /*FFRestrict */ inTargets, + const ContainerClass* const /*FFRestrict */ inSources, ContainerClass* const inNeighbors[], const int neighborPositions[], const int inSize) override diff --git a/Src/Kernels/Chebyshev/FChebTensorialKernel.hpp b/Src/Kernels/Chebyshev/FChebTensorialKernel.hpp index 3c949ed85b3bb84ffcf662f48eef989f85f4694d..283729e86d67d973a3ae8cbfd37b0f30e23e3eae 100644 --- a/Src/Kernels/Chebyshev/FChebTensorialKernel.hpp +++ b/Src/Kernels/Chebyshev/FChebTensorialKernel.hpp @@ -195,7 +195,8 @@ public: } void P2P(const FTreeCoordinate& inPosition, - ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict inSources, + ContainerClass* const /*FFRestrict */ inTargets, + const ContainerClass* const /*FFRestrict */ inSources, ContainerClass* const inNeighbors[], const int neighborPositions[], const int inSize) override { if(inTargets == inSources){ diff --git a/Src/Kernels/Rotation/FRotationKernel.hpp b/Src/Kernels/Rotation/FRotationKernel.hpp index aada34efdfb9da1b15a55c3d45dfe6d8ba5355d8..344a48c05a9ee06b70d0a0375aeaa5fa2f86482c 100644 --- a/Src/Kernels/Rotation/FRotationKernel.hpp +++ b/Src/Kernels/Rotation/FRotationKernel.hpp @@ -1373,7 +1373,8 @@ public: * Calling this method in multi thread should be done carrefully. */ void P2P(const FTreeCoordinate& inPosition, - ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict inSources, + ContainerClass* const /*FFRestrict */ inTargets, + const ContainerClass* const /*FFRestrict */ inSources, ContainerClass* const inNeighbors[], const int neighborPositions[], const int inSize) override { if(inTargets == inSources){ diff --git a/Src/Kernels/Rotation/FRotationOriginalKernel.hpp b/Src/Kernels/Rotation/FRotationOriginalKernel.hpp index b3f796661a364157f95b0eeeebb17bc70773ae85..0273bb605ee2670dbd8792fbd58983e7f4fc676f 100644 --- a/Src/Kernels/Rotation/FRotationOriginalKernel.hpp +++ b/Src/Kernels/Rotation/FRotationOriginalKernel.hpp @@ -777,7 +777,8 @@ public: * Calling this method in multi thread should be done carrefully. */ void P2P(const FTreeCoordinate& inPosition, - ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict inSources, + ContainerClass* const /*FFRestrict */ inTargets, + const ContainerClass* const /*FFRestrict */ inSources, ContainerClass* const inNeighbors[], const int neighborPositions[], const int inSize) override { if(inTargets == inSources){ diff --git a/Src/Kernels/Spherical/FAbstractSphericalKernel.hpp b/Src/Kernels/Spherical/FAbstractSphericalKernel.hpp index 5c38dc8a2bfa3708a49483f834be2d258bb29624..df1d8be63b464bd9ae5537dbd4c6e3102538c395 100644 --- a/Src/Kernels/Spherical/FAbstractSphericalKernel.hpp +++ b/Src/Kernels/Spherical/FAbstractSphericalKernel.hpp @@ -229,7 +229,8 @@ public: * Calling this method in multi thread should be done carrefully. */ void P2P(const FTreeCoordinate& inPosition, - ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict inSources, + ContainerClass* const /*FFRestrict */ inTargets, + const ContainerClass* const /*FFRestrict */ inSources, ContainerClass* const inNeighbors[], const int neighborPositions[], const int inSize) override { if(inTargets == inSources){ diff --git a/Src/Kernels/Taylor/FTaylorKernel.hpp b/Src/Kernels/Taylor/FTaylorKernel.hpp index bc76487b67e206943d0f81df347c38f2a2a94882..332cae137931ee34dd6ebf28aebb1e5c92def74c 100644 --- a/Src/Kernels/Taylor/FTaylorKernel.hpp +++ b/Src/Kernels/Taylor/FTaylorKernel.hpp @@ -975,7 +975,8 @@ public: * Calling this method in multi thread should be done carrefully. */ void P2P(const FTreeCoordinate& inPosition, - ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict inSources, + ContainerClass* const /*FFRestrict */ inTargets, + const ContainerClass* const /*FFRestrict */ inSources, ContainerClass* const inNeighbors[], const int neighborPositions[], const int inSize) override { if(inTargets == inSources){ diff --git a/Src/Kernels/Taylor/FTaylorKernelSimple.hpp b/Src/Kernels/Taylor/FTaylorKernelSimple.hpp index 4d46d242a699b10887718b66d937c2628bdbc1b3..c849e281c016b67d6349f8d3cee1dfe8fa4990ed 100644 --- a/Src/Kernels/Taylor/FTaylorKernelSimple.hpp +++ b/Src/Kernels/Taylor/FTaylorKernelSimple.hpp @@ -854,7 +854,8 @@ public: * Calling this method in multi thread should be done carrefully. */ void P2P(const FTreeCoordinate& inPosition, - ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict inSources, + ContainerClass* const /*FFRestrict */ inTargets, + const ContainerClass* const /*FFRestrict */ inSources, ContainerClass* const inNeighbors[], const int neighborPositions[], const int inSize) override { if(inTargets == inSources){ diff --git a/Src/Kernels/Uniform/FUnifDenseKernel.hpp b/Src/Kernels/Uniform/FUnifDenseKernel.hpp index c5a7f86f04c6361e53629ec9b721c4d6fe56d75e..7de7b4cbe851256305543dd7b64d92e2502461cd 100644 --- a/Src/Kernels/Uniform/FUnifDenseKernel.hpp +++ b/Src/Kernels/Uniform/FUnifDenseKernel.hpp @@ -148,7 +148,8 @@ public: } void P2P(const FTreeCoordinate& inPosition, - ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict inSources, + ContainerClass* const /*FFRestrict */ inTargets, + const ContainerClass* const /*FFRestrict */ inSources, ContainerClass* const inNeighbors[], const int neighborPositions[], const int inSize) override { if(inTargets == inSources){ diff --git a/Src/Kernels/Uniform/FUnifKernel.hpp b/Src/Kernels/Uniform/FUnifKernel.hpp index 58adc254e43ffdef1b06331b0b4f7458510328a5..a5068aeac8ac257e049de6c71edebd0a14a8bfca 100644 --- a/Src/Kernels/Uniform/FUnifKernel.hpp +++ b/Src/Kernels/Uniform/FUnifKernel.hpp @@ -193,20 +193,29 @@ public: AbstractBaseClass::Interpolator->applyL2PGradient(LeafCellCenter, leafBoxWidth, localExp, TargetParticles); } - - + /// + /// \brief P2P Particle to particle operator + /// \param inPosition + /// \param inTargets + /// \param inSources + /// \param inNeighbors + /// \param neighborPositions + /// \param inSize + /// void P2P(const FTreeCoordinate& inPosition, - ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict inSources, - ContainerClass* const inNeighbors[], const int neighborPositions[], + ContainerClass* const /*FFRestrict */ inTargets, + const ContainerClass* const /*FRestrict*/ inSources, // no restrict inTargets == inSources) + ContainerClass* const inNeighbors[], + const int neighborPositions[], const int inSize) override { this->P2P(inPosition, inTargets, inSources, inNeighbors, neighborPositions, inSize, true); } - void P2P(const FTreeCoordinate& inPosition, - ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict inSources, + ContainerClass* const FRestrict inTargets, + const ContainerClass* const FRestrict inSources, // no restrict inTargets == inSources) ContainerClass* const inNeighbors[], const int neighborPositions[], const int inSize, bool do_inner) { @@ -225,8 +234,7 @@ public: } DirectInteractionComputer::P2PRemote(inTargets,inNeighbors,inSize,MatrixKernel); } - } - // Nearfield interactions are only computed within the target leaf + } // Nearfield interactions are only computed within the target leaf else if(LeafLevelSeparationCriterion==0){ DirectInteractionComputer::P2PRemote(inTargets,inNeighbors,inSize,MatrixKernel); } diff --git a/Src/Kernels/Uniform/FUnifTensorialKernel.hpp b/Src/Kernels/Uniform/FUnifTensorialKernel.hpp index 8614c43fa91fd7caf4a52538eeef6468b96919c4..b206937f6452a25bc1723cd919eda98587e4bc7e 100644 --- a/Src/Kernels/Uniform/FUnifTensorialKernel.hpp +++ b/Src/Kernels/Uniform/FUnifTensorialKernel.hpp @@ -253,7 +253,8 @@ public: } void P2P(const FTreeCoordinate& inPosition, - ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict inSources, + ContainerClass* const /*FFRestrict */ inTargets, + const ContainerClass* const /*FFRestrict */ inSources, ContainerClass* const inNeighbors[], const int neighborPositions[], const int inSize) override { // Standard FMM separation criterion, i.e. max 27 neighbor clusters per leaf diff --git a/Src/Utils/FQuickSortMpi.hpp b/Src/Utils/FQuickSortMpi.hpp index 6db97886a5c54761b610be3d91eff7cb1a933833..5ccd1d684f1850f127d9b9c5e9d2b4186a584ded 100644 --- a/Src/Utils/FQuickSortMpi.hpp +++ b/Src/Utils/FQuickSortMpi.hpp @@ -390,8 +390,8 @@ public: // Merge previous part and just received elements const IndexType fullNbLowerElementsRecv = nbLowerElementsRecv + nbLowerElements; SortType* fullLowerPart = new SortType[fullNbLowerElementsRecv]; - memcpy(fullLowerPart, workingArray, sizeof(SortType)* nbLowerElements); - memcpy(fullLowerPart + nbLowerElements, lowerPartRecv, sizeof(SortType)* nbLowerElementsRecv); + std::memcpy(reinterpret_cast(fullLowerPart), workingArray, sizeof(SortType)* nbLowerElements); + std::memcpy(reinterpret_cast(fullLowerPart + nbLowerElements), lowerPartRecv, sizeof(SortType)* nbLowerElementsRecv); delete[] workingArray; delete[] lowerPartRecv; workingArray = fullLowerPart; @@ -414,8 +414,8 @@ public: // Merge previous part and just received elements const IndexType fullNbGreaterElementsRecv = nbGreaterElementsRecv + nbGreaterElements; SortType* fullGreaterPart = new SortType[fullNbGreaterElementsRecv]; - memcpy(fullGreaterPart, workingArray + nbLowerElements, sizeof(SortType)* nbGreaterElements); - memcpy(fullGreaterPart + nbGreaterElements, greaterPartRecv, sizeof(SortType)* nbGreaterElementsRecv); + std::memcpy(reinterpret_cast(fullGreaterPart), workingArray + nbLowerElements, sizeof(SortType)* nbGreaterElements); + std::memcpy(reinterpret_cast(fullGreaterPart + nbGreaterElements), greaterPartRecv, sizeof(SortType)* nbGreaterElementsRecv); delete[] workingArray; delete[] greaterPartRecv; workingArray = fullGreaterPart; diff --git a/UTests/utestLagrangeMpi.cpp b/UTests/utestLagrangeMpi.cpp index da94dbb7852a540526dc5a7b52d6b3b4e850e098..526ef43a4fd256e1c66f9baf7dbc7ce8a9a1a54f 100644 --- a/UTests/utestLagrangeMpi.cpp +++ b/UTests/utestLagrangeMpi.cpp @@ -66,8 +66,7 @@ class TestLagrangeMpiDirect : public FUTesterMpi{ }; FSize nbParticles = loader.getMyNumberOfParticles(); - TestParticle* const particles = new TestParticle[nbParticles]; - memset(particles,0,sizeof(TestParticle)*nbParticles); + TestParticle* const particles = new TestParticle[nbParticles]{}; //idx (in file) of the first part that will be used by this proc. FSize idxStart = loader.getStart();