Commit 5c3609b2 authored by COULAUD Olivier's avatar COULAUD Olivier

try to remove compilation warnings with gccc 8

parent 3abae251
......@@ -70,8 +70,8 @@ int main(int argc, char ** argv){
counter.tic();
//
FmaRWParticle<FReal, 4,8> * particles = new FmaRWParticle<FReal, 4,8>[nbParticles];
memset(particles, 0, sizeof(FmaRWParticle<FReal, 4,8>) * nbParticles) ;
FmaRWParticle<FReal, 4,8> * particles = new FmaRWParticle<FReal, 4,8>[nbParticles]{};
// memset(particles, 0, sizeof(FmaRWParticle<FReal, 4,8>) * nbParticles) ;
//
double totalCharge = 0.0;
//
......
......@@ -214,8 +214,7 @@ public :
template <class T>
void fillArray(T* const inArray, const FSize count){
FAssertLF(currentIndex + FSize(sizeof(T))*count <= arrayCapacity );
// std::copy(&(array[currentIndex]),&(array[currentIndex])+count, inArray);
memcpy(inArray, &array[currentIndex], sizeof(T)*count);
std::memcpy(reinterpret_cast<char*>(inArray), &array[currentIndex], sizeof(T)*count);
currentIndex += sizeof(T)*count;
}
......
......@@ -6,11 +6,11 @@
#include <omp.h>
#include "../Utils/FGlobal.hpp"
#include "../Utils/FAssert.hpp"
#include "../Utils/FLog.hpp"
#include "Utils/FGlobal.hpp"
#include "Utils/FAssert.hpp"
#include "Utils/FLog.hpp"
#include "../Utils/FTic.hpp"
#include "Utils/FTic.hpp"
#include "Containers/FOctree.hpp"
#include "Containers/FVector.hpp"
......@@ -31,13 +31,13 @@
enum class Omp4_Priorities{
P2M = 9,
M2M = 8,
M2L_High = 7,
L2L = 6,
P2P_Big = 5,
M2L = 4,
L2P = 3,
P2M = 9,
M2M = 8,
M2L_High = 7,
L2L = 6,
P2P_Big = 5,
M2L = 4,
L2P = 3,
P2P_Small = 2
};
#ifdef OPENMP_SUPPORT_PRIORITY
......
......@@ -41,16 +41,23 @@ class FmaRWParticle {
FReal data[WRITE]{};
public:
static const int NBELEMENT = WRITE ;
// FmaRWParticle() = default;
FmaRWParticle() {
memset(data,0,WRITE);
}
// FmaRWParticle() = default;
FmaRWParticle() {}
// // memset(data,0,WRITE);
// }
FmaRWParticle(const FmaRWParticle& other)
{
std::copy(other.data, other.data + FmaRWParticle::NBELEMENT, data) ;
}
/** Copy operator */
FmaRWParticle& operator=(const FmaRWParticle& other){
std::copy(other.data, other.data + FmaRWParticle::NBELEMENT, data) ;
return *this;
}
// FmaRWParticle( FmaRWParticle&& o) noexcept : data(std::move(o.data)) { }
/// Get a FPoint<FReal> from the position
......
......@@ -2,20 +2,20 @@
#ifndef FMPITREEBUILDER_H
#define FMPITREEBUILDER_H
#include "../Utils/FMpi.hpp"
#include "../Utils/FQuickSortMpi.hpp"
#include "../Utils/FBitonicSort.hpp"
#include "../Utils/FTic.hpp"
#include "../Utils/FEnv.hpp"
#include "Utils/FMpi.hpp"
#include "Utils/FQuickSortMpi.hpp"
#include "Utils/FBitonicSort.hpp"
#include "Utils/FTic.hpp"
#include "Utils/FEnv.hpp"
#include "../Utils/FMemUtils.hpp"
#include "Utils/FMemUtils.hpp"
#include "../Containers/FVector.hpp"
#include "Containers/FVector.hpp"
#include "../Utils/FLeafBalance.hpp"
#include "../Utils/FEqualize.hpp"
#include "Utils/FLeafBalance.hpp"
#include "Utils/FEqualize.hpp"
#include "../Containers/FCoordinateComputer.hpp"
#include "Containers/FCoordinateComputer.hpp"
/**
* This class manage the loading of particles for the mpi version.
......@@ -52,14 +52,33 @@ public:
*/
struct IndexedParticle{
public:
MortonIndex index;
ParticleClass particle;
operator MortonIndex() const {
return this->index;
}
MortonIndex index{};
ParticleClass particle{};
operator MortonIndex() const {
return this->index;
}
// IndexedParticle(const IndexedParticle& rhs){
// index = rhs.index ;
// particle = rhs.particle ;
// }
// IndexedParticle(const IndexedParticle&& rhs){
// index = rhs.index ;
// particle = rhs.particle ;}
// To sort according to the mindex
bool operator<=(const IndexedParticle& rhs) const {
return this->index <= rhs.index;
}
// To sort according to the mindex
// IndexedParticle& operator=(const IndexedParticle& rhs) {
// index = rhs.index ;
// particle = rhs.particle ;
// return *this;
// }
};
//////////////////////////////////////////////////////////////////////////
// Methods to sort the particles
//////////////////////////////////////////////////////////////////////////
......
......@@ -2,16 +2,16 @@
#ifndef FTREEBUILDER_H
#define FTREEBUILDER_H
#include "../Utils/FGlobal.hpp"
#include "Utils/FGlobal.hpp"
#include "../Utils/FLog.hpp"
#include "../Utils/FQuickSort.hpp"
#include "../Utils/FTic.hpp"
#include "../Utils/FAssert.hpp"
#include "../Containers/FOctree.hpp"
#include "../Containers/FTreeCoordinate.hpp"
#include "Utils/FLog.hpp"
#include "Utils/FQuickSort.hpp"
#include "Utils/FTic.hpp"
#include "Utils/FAssert.hpp"
#include "Containers/FOctree.hpp"
#include "Containers/FTreeCoordinate.hpp"
#include "../Components/FBasicParticleContainer.hpp"
#include "Components/FBasicParticleContainer.hpp"
#include <omp.h>
......@@ -36,13 +36,26 @@ class FTreeBuilder{
private:
/** This class is the relation between particles and their morton idx */
struct IndexedParticle{
MortonIndex mindex;
FSize particlePositionInArray;
// To sort according to the mindex
MortonIndex mindex{};
FSize particlePositionInArray{};
//
// IndexedParticle(const IndexedParticle& rhs){
// mindex = rhs.mindex ;
// particlePositionInArray = rhs.particlePositionInArray ;}
// IndexedParticle(const IndexedParticle&& rhs){
// mindex = rhs.mindex ;
// particlePositionInArray = rhs.particlePositionInArray ;}
// To sort according to the mindex
bool operator<=(const IndexedParticle& rhs) const {
return this->mindex <= rhs.mindex;
}
// To sort according to the mindex
IndexedParticle& operator=(const IndexedParticle& rhs) {
mindex = rhs.mindex ;
particlePositionInArray = rhs.particlePositionInArray ;
return *this;
}
};
/** In order to keep all the created leaves */
......
......@@ -508,7 +508,7 @@ public:
const int inSize)
override
{
std::vector<ContainerClass*> neighbours;
std::vector<ContainerClass*> neighbours{};
for(int i = 0; i < inSize; ++i) {
if(neighborPositions[i] < 14) {
neighbours.push_back(inNeighbors[i]);
......
......@@ -103,8 +103,10 @@ inline void NonMutualParticles(const FReal targetX,const FReal targetY,const FRe
template <class FReal, class ContainerClass, class MatrixKernelClass, class ComputeClass, int NbFRealInComputeClass>
static void GenericFullMutual(ContainerClass* const FRestrict inTargets, ContainerClass* const inNeighbors[],
const int limiteNeighbors, const MatrixKernelClass *const MatrixKernel){
static void GenericFullMutual(ContainerClass* const FRestrict inTargets,
ContainerClass* const inNeighbors[],
const int limiteNeighbors,
const MatrixKernelClass *const MatrixKernel){
const FSize nbParticlesTargets = inTargets->getNbParticles();
const FReal*const targetsPhysicalValues = inTargets->getPhysicalValues();
......
......@@ -2,16 +2,16 @@
#ifndef FP2PPARTICLECONTAINERINDEXED_HPP
#define FP2PPARTICLECONTAINERINDEXED_HPP
#include "../../Containers/FVector.hpp"
#include "Containers/FVector.hpp"
#include "Components/FParticleType.hpp"
#include "FP2PParticleContainer.hpp"
#include "Components/FParticleType.hpp"
template<class FReal, int NRHS = 1, int NLHS = 1, int NVALS = 1>
class FP2PParticleContainerIndexed : public FP2PParticleContainer<FReal, NRHS,NLHS,NVALS, FSize> {
typedef FP2PParticleContainer<FReal, NRHS,NLHS,NVALS, FSize> Parent;
mutable FVector<FSize> indexes;
mutable FVector<FSize> indexes{};
public:
......
......@@ -344,8 +344,8 @@ protected:
void allocAndInit(){
// M2L transfer, there is a maximum of 3 neighbors in each direction,
// so 6 in each dimension
preM2LTransitions = new RotationM2LTransfer*[Parent::treeHeight];
memset(preM2LTransitions.getPtr(), 0, sizeof(FComplex<FReal>*) * (Parent::treeHeight));
preM2LTransitions = new RotationM2LTransfer*[Parent::treeHeight]{};
// memset(preM2LTransitions.getPtr(), 0, sizeof(FComplex<FReal>*) * (Parent::treeHeight));
// We start from the higher level
FReal treeWidthAtLevel = Parent::boxWidth;
for(int idxLevel = 0 ; idxLevel < Parent::treeHeight ; ++idxLevel ){
......@@ -431,8 +431,8 @@ public:
void multipoleToLocal(FComplex<FReal>*const FRestrict local_expansion_target, const FComplex<FReal>* const FRestrict multipole_exp_src,
const RotationM2LTransfer& transfer_M2L_rotation){
memset(rotation_Info.p_rot_multipole_exp, 0, RotationInfo::ZAxisExpensionSize(Parent::devP) * sizeof(FComplex<FReal>));
memset(rotation_Info.p_rot_local_exp, 0, RotationInfo::ZAxisExpensionSize(Parent::devP) * sizeof(FComplex<FReal>));
std::memset(reinterpret_cast<char*>(rotation_Info.p_rot_multipole_exp), 0, RotationInfo::ZAxisExpensionSize(Parent::devP) * sizeof(FComplex<FReal>));
std::memset(reinterpret_cast<char*>(rotation_Info.p_rot_local_exp), 0, RotationInfo::ZAxisExpensionSize(Parent::devP) * sizeof(FComplex<FReal>));
rotation_Rotate_multipole_expansion_terms(multipole_exp_src, transfer_M2L_rotation.rcc_outer, rotation_Info.p_rot_multipole_exp);
......
......@@ -32,24 +32,26 @@
*/
template <class FReal>
class FComplex {
//std::array<FReal,2> complex; //< Real & Imaginary
FReal complex[2]; //< Real & Imaginary
std::array<FReal,2> complex{}; //< Real & Imaginary
// FReal complex[2]{}; //< Real & Imaginary
public:
/** Default Constructor (set complex[0]&imaginary to 0) */
FComplex() {
complex[0] = 0;
complex[1] = 0;
}
FComplex() = default ;// complex({0.0,0.0}){}
//{
// complex[0] = 0;
// complex[1] = 0;
// }
/** Constructor with values
* @param inImag the imaginary
* @param inReal the complex[0]
*/
explicit FComplex(const FReal inReal, const FReal inImag) {
complex[0] = inReal;
complex[1] = inImag;
}
FComplex(const FReal inReal, const FReal inImag) : complex({inReal,inImag}){}
// {
// complex[0] = inReal;
// complex[1] = inImag;
// }
/** Copy constructor */
FComplex(const FComplex<FReal>& other){
......
......@@ -8,27 +8,27 @@
#include <cstdio>
#include "../../Src/Utils/FParameters.hpp"
#include "../../Src/Utils/FTic.hpp"
#include "Utils/FParameters.hpp"
#include "Utils/FTic.hpp"
#include "../../Src/Containers/FOctree.hpp"
#include "../../Src/Containers/FVector.hpp"
#include "Containers/FOctree.hpp"
#include "Containers/FVector.hpp"
#include "../../Src/Components/FSimpleLeaf.hpp"
#include "Components/FSimpleLeaf.hpp"
#include "../../Src/Utils/FPoint.hpp"
#include "Utils/FPoint.hpp"
#include "../../Src/Components/FTestParticleContainer.hpp"
#include "../../Src/Components/FTestCell.hpp"
#include "../../Src/Components/FTestKernels.hpp"
#include "Components/FTestParticleContainer.hpp"
#include "Components/FTestCell.hpp"
#include "Components/FTestKernels.hpp"
#include "../../Src/Core/FFmmAlgorithmOmp4.hpp"
#include "Core/FFmmAlgorithmOmp4.hpp"
#include "../../Src/Components/FBasicKernels.hpp"
#include "Components/FBasicKernels.hpp"
#include "../../Src/Files/FRandomLoader.hpp"
#include "Files/FRandomLoader.hpp"
#include "../../Src/Utils/FParameterNames.hpp"
#include "Utils/FParameterNames.hpp"
/** This program show an example of use of the fmm basic algo
* it also check that each particles is impacted each other particles
......
......@@ -59,15 +59,18 @@ class TestChebyshevMpiDirect : public FUTesterMpi<TestChebyshevMpiDirect>{
// Create octree
struct TestParticle : public FmaRWParticle<FReal, 8,8>{
FSize index;
FSize index{};
// const FPoint<FReal>& getPosition(){
// return position;
// }
// TestParticle(const TestParticle& tt) : FmaRWParticle<FReal, 8,8>(tt){
// index = tt.index;
// }
};
FSize nbParticles = loader.getMyNumberOfParticles();
TestParticle* const particles = new TestParticle[nbParticles];
memset(particles,0,sizeof(TestParticle)*nbParticles);
std::memset(reinterpret_cast<char*>(particles),0,sizeof(TestParticle)*nbParticles);
//idx (in file) of the first part that will be used by this proc.
FSize idxStart = loader.getStart();
......@@ -107,7 +110,7 @@ class TestChebyshevMpiDirect : public FUTesterMpi<TestChebyshevMpiDirect>{
FMath::FAccurater<FReal> fx, fy, fz;
FReal energy = 0.0;
FReal * datas = new FReal[loader.getNbRecordPerline()];
memset(datas,0,loader.getNbRecordPerline()*sizeof(FReal));
memset(reinterpret_cast<char*>(datas),0,loader.getNbRecordPerline()*sizeof(FReal));
tree.forEachLeaf([&](LeafClass* leaf){
const FReal*const potentials = leaf->getTargets()->getPotentials();
const FReal*const physicalValues = leaf->getTargets()->getPhysicalValues();
......@@ -127,7 +130,7 @@ class TestChebyshevMpiDirect : public FUTesterMpi<TestChebyshevMpiDirect>{
fy.add(datas[6],forcesY[idxPart]);
fz.add(datas[7],forcesZ[idxPart]);
energy += potentials[idxPart]*physicalValues[idxPart];
memset(datas,0,loader.getNbRecordPerline()*sizeof(FReal));
memset(reinterpret_cast<char*>(datas),0,loader.getNbRecordPerline()*sizeof(FReal));
}
else{
//It's a proc on my right that used to keep this part
......@@ -145,7 +148,7 @@ class TestChebyshevMpiDirect : public FUTesterMpi<TestChebyshevMpiDirect>{
potentials[idxPart],forcesX[idxPart],
forcesY[idxPart],forcesZ[idxPart]);
}
memset(datas,0,loader.getNbRecordPerline()*sizeof(FReal));
memset(reinterpret_cast<char*>(datas),0,loader.getNbRecordPerline()*sizeof(FReal));
}
//I already have this part
else{
......
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