Commit a991bebc authored by COULAUD Olivier's avatar COULAUD Olivier

Add CMAKE_CXX_STANDARD, fix some issues detected by sonarQube

parent 26e3813d
......@@ -13,7 +13,6 @@ set(FUSE_LIST " MPI;BLAS;FFT;STARPU;CUDA;OPENCL;OMP4;SSE;AVX;AVX2;MIC;MPI2")
# Project Declaration
#===========================================================================
project(SCALFMM C CXX )
# check if compiling into source directories
string(COMPARE EQUAL "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" insource)
if(insource)
......@@ -28,7 +27,7 @@ INCLUDE(CMakeDependentOption)
# Add to check CPU info
include(GetCpuInfos)
GetCpuInfos()
#
#===========================================================================
# Version Number
#===========================================================================
......@@ -39,6 +38,10 @@ set(SCALFMM_MINOR_VERSION 0)
set(SCALFMM_PATCH_VERSION rc0)
set(SCALFMM_VERSION "${SCALFMM_MAJOR_VERSION}.${SCALFMM_MINOR_VERSION}.${SCALFMM_PATCH_VERSION}" )
SET(CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_STANDARD 14)
set( MORSE_DISTRIB_DIR "" CACHE PATH "Directory of MORSE distribution")
if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/")
......@@ -140,7 +143,7 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/
message(STATUS "CXX ${CMAKE_CXX_COMPILER_ID}" )
# Set scalfmm to default libraries
set(SCALFMM_LIBRARIES "")
set(SCALFMM_CXX_FLAGS "-std=c++14 -fpic -Wall")
set(SCALFMM_CXX_FLAGS "-fpic -Wall")
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/Contribs")
#
#
......
This diff is collapsed.
......@@ -9,8 +9,8 @@
#include "FChebTensor.hpp"
#include "../Interpolation/FInterpSymmetries.hpp"
#include "Kernels/Interpolation/FInterpSymmetries.hpp"
#include "Kernels/Interpolation/FInterpMatrixKernel.hpp"
#include "FChebM2LHandler.hpp"
#include "Utils/FAca.hpp"
......@@ -156,6 +156,10 @@ static void precompute(const MatrixKernelClass *const MatrixKernel, const FReal
if (INFO!=0){
std::stringstream stream;
stream << INFO;
delete [] U ;
delete [] WORK ;
delete [] VT ;
delete [] S ;
throw std::runtime_error("SVD did not converge with " + stream.str());
}
rank = FSvd::getRank(S, aca_rank, Epsilon);
......@@ -348,7 +352,12 @@ public:
/** Destructor */
~SymmetryHandler()
{
for (unsigned int t=0; t<343; ++t) if (K[t]!=nullptr) delete [] K[t];
for (unsigned int t=0; t<343; ++t){
if (K[t]!=nullptr){
delete [] K[t];
}
}
}
......@@ -396,8 +405,10 @@ public:
// init all 343 item to zero, because effectively only 16 exist
K = new FReal** [TreeHeight];
LowRank = new int* [TreeHeight];
K[0] = nullptr; K[1] = nullptr;
LowRank[0] = nullptr; LowRank[1] = nullptr;
K[0] = nullptr;
K[1] = nullptr;
LowRank[0] = nullptr;
LowRank[1] = nullptr;
for (unsigned int l=2; l<TreeHeight; ++l) {
K[l] = new FReal* [343];
LowRank[l] = new int [343];
......@@ -435,10 +446,17 @@ public:
{
for (unsigned int l=0; l<TreeHeight; ++l) {
if (K[l]!=nullptr) {
for (unsigned int t=0; t<343; ++t) if (K[l][t]!=nullptr) delete [] K[l][t];
for (unsigned int t=0; t<343; ++t) {
if (K[l][t]!=nullptr){
delete [] K[l][t];
}
}
delete [] K[l];
}
if (LowRank[l]!=nullptr) delete [] LowRank[l];
if (LowRank[l]!=nullptr) {
delete [] LowRank[l];
}
}
delete [] K;
delete [] LowRank;
......@@ -476,7 +494,8 @@ static void ComputeAndCompressAndStoreInBinaryFile(const MatrixKernelClass *cons
// compute and compress ////////////
FReal* K[343];
int LowRank[343];
for (unsigned int idx=0; idx<343; ++idx) { K[idx] = nullptr; LowRank[idx] = 0; }
for (unsigned int idx=0; idx<343; ++idx)
{ K[idx] = nullptr; LowRank[idx] = 0; }
precompute<FReal,ORDER>(MatrixKernel, FReal(2.), Epsilon, K, LowRank);
// write to binary file ////////////
......@@ -510,7 +529,11 @@ static void ComputeAndCompressAndStoreInBinaryFile(const MatrixKernelClass *cons
// << " in " << time.tacAndElapsed() << "sec." << std::endl;
// free memory /////////////////////
for (unsigned int t=0; t<343; ++t) if (K[t]!=nullptr) delete [] K[t];
for (unsigned int t=0; t<343; ++t) {
if (K[t]!=nullptr) {
delete [] K[t];
}
}
}
......
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