Commit f5a3da89 authored by COULAUD Olivier's avatar COULAUD Olivier

Remove all warnings with gcc 8: memset et memcopy une now...

Remove all warnings with gcc 8: memset et memcopy une now reinterpret_cay<char*> and we remove restrict fir target and source in p2P
parent 5277ea01
......@@ -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;
......
......@@ -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();
......
......@@ -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<char*>(workloadBuffer), 0, sizeof(struct WorkloadTemp)*leafsNumber);
// Prepare the P2P
leafsDataArray.reset(new LeafData[leafsNumber]);
......
......@@ -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<char*>(particlesWithExtension), (*workingArray), (*workingSize)*sizeof(IndexedParticle));
// Copy received data
memcpy(particlesWithExtension + (*workingSize), receivedParticles.data(), receivedParticles.size()*sizeof(IndexedParticle));
std::memcpy(reinterpret_cast<char*>(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<char*>(&(*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<char*>(&particlesRecvBuffer[offsetToRecv]), &particlesArrayInLeafOrder[leavesOffsetInParticles[sourcePosition]],
nbPartsPerPackToRecv[idxPack]*sizeof(ParticleClass));
}
offsetToRecv += nbPartsPerPackToRecv[idxPack];
......
......@@ -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){
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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){
......
......@@ -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){
......
......@@ -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){
......
......@@ -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){
......
......@@ -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){
......
......@@ -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){
......
......@@ -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){
......
......@@ -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<FReal, MatrixKernelClass::NCMP, NVALS>::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<FReal,MatrixKernelClass::NCMP, NVALS>::P2PRemote(inTargets,inNeighbors,inSize,MatrixKernel);
}
......
......@@ -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
......
......@@ -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<char*>(fullLowerPart), workingArray, sizeof(SortType)* nbLowerElements);
std::memcpy(reinterpret_cast<char*>(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<char*>(fullGreaterPart), workingArray + nbLowerElements, sizeof(SortType)* nbGreaterElements);
std::memcpy(reinterpret_cast<char*>(fullGreaterPart + nbGreaterElements), greaterPartRecv, sizeof(SortType)* nbGreaterElementsRecv);
delete[] workingArray;
delete[] greaterPartRecv;
workingArray = fullGreaterPart;
......
......@@ -66,8 +66,7 @@ class TestLagrangeMpiDirect : public FUTesterMpi<TestLagrangeMpiDirect>{
};
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();
......
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