diff --git a/CMakeLists.txt b/CMakeLists.txt index 6540629d3d5ac64347b9ef451d361c4d741af256..62d4f6e740e254aa39aaa2713ed23c4463323b09 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,8 @@ SET(ScaLFMM_CXX_FLAGS "") # # Compile option # -Wall Wnosign-conversion -SET(ScaLFMM_CXX_FLAGS "-std=c++11 -Wshadow -Wpointer-arith -Wcast-qual -Wconversion -fpic") +SET(ScaLFMM_CXX_FLAGS "-std=c++11 -fpic -Wzero-as-null-pointer-constant -Wall ") +#-Wshadow -Wpointer-arith -Wcast-qual -Wconversion -Wall -Wnosign-conversion ") # # Test if openmp is here # diff --git a/ScalFMMConfig.cmake.in b/ScalFMMConfig.cmake.in index 8233e8b22e878f9d2ac07071614f340cc60100f9..2bc7d479fb019d0417b458272f0703c6f731776a 100644 --- a/ScalFMMConfig.cmake.in +++ b/ScalFMMConfig.cmake.in @@ -34,8 +34,8 @@ SET(ScalFMM_USE_SSE "@ScalFMM_USE_SSE@") SET(ScalFMM_FLAGS "@ScaLFMM_FLAGS_OPTI@") SET(ScalFMM_USE_ADDONS "@ScalFMM_USE_ADDONS@") SET(ScalFMM_USE_LOG "@ScalFMM_USE_LOG@") -#SET(ScalFMM_FLAGS "@@") -#SET(ScalFMM_FLAGS "@@") +#SET(ScalFMM_USE_SSE "@ScalFMM_USE_SSE@") +#SET(ScalFMM_USE_AVX "@ScalFMM_USE_AVX@") # SET(ScalFMM_DOC_TAGS "@CMAKE_BINARY_DIR@/Doc/scalfmm.tag") diff --git a/Src/Containers/FBlockAllocator.hpp b/Src/Containers/FBlockAllocator.hpp index 1302eac750f10e1cb3b2f8ad9dc440d22a4d9c2c..162e82a16ddc14ec5d00c0c4989a57c8d6a4fdd7 100644 --- a/Src/Containers/FBlockAllocator.hpp +++ b/Src/Containers/FBlockAllocator.hpp @@ -107,7 +107,7 @@ class FListBlockAllocator : public FAbstractBlockAllocator<ObjectClass>{ } } - return 0; + return nullptr; } int isEmpty() const{ diff --git a/Src/Containers/FList.hpp b/Src/Containers/FList.hpp index 09dbbfc90a1cd0d7bd0c28e0a4e5028fc597890d..8937ecbf75abe57a16f08e229d89fb0ce5f1f2f2 100755 --- a/Src/Containers/FList.hpp +++ b/Src/Containers/FList.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -28,7 +28,7 @@ * This class is a linked list container. * It is a very basic list to enable strong performance. * - * Please refere to unit test utestList.cpp to know more. + * Please refer to unit test utestList.cpp to know more. */ template< class Object > class FList { @@ -38,7 +38,7 @@ class FList { Node* next; //< Next node }; - Node* root; //< Root node, NULL if size is 0 + Node* root; //< Root node, nullptr if size is 0 int size; //< Elements in the list /** @@ -58,7 +58,7 @@ class FList { otherRoot = otherRoot->next; } // End with null - *myRoot = 0; + *myRoot = nullptr; this->size = other.size; } @@ -66,7 +66,7 @@ public: typedef Object ValueType; /**< data type of data in FVector */ /** Constructor (of an empty list) */ - FList() : root(0) , size(0) { + FList() : root(nullptr) , size(0) { } /** Desctructor */ @@ -92,7 +92,7 @@ public: * Copy constructor * @param other the source/original list */ - FList(const FList& other): root(0) , size(0) { + FList(const FList& other): root(nullptr) , size(0) { copy(other); } diff --git a/Src/Containers/FOctree.hpp b/Src/Containers/FOctree.hpp index 5a089291d102a24bcee10c6cd01a49b7fa569a72..99b66bf7b48a446c6f4be9cf069bee3b98e07685 100755 --- a/Src/Containers/FOctree.hpp +++ b/Src/Containers/FOctree.hpp @@ -112,17 +112,17 @@ public: */ FOctree(const int inHeight, const int inSubHeight, const FReal inBoxWidth, const FPoint& inBoxCenter) - : root(0), boxWidthAtLevel(new FReal[inHeight]), + : root(nullptr), boxWidthAtLevel(new FReal[inHeight]), height(inHeight) , subHeight(inSubHeight), leafIndex(this->height-1), boxCenter(inBoxCenter), boxCorner(inBoxCenter,-(inBoxWidth/2)), boxWidth(inBoxWidth) { FAssertLF(subHeight <= height - 1, "Subheight cannot be greater than height", __LINE__, __FILE__ ); // Does we only need one suboctree? if(subHeight == height - 1){ - root = new FSubOctreeWithLeafs< CellClass , ContainerClass, LeafClass,CellAllocatorClass>(0, 0, this->subHeight, 1); + root = new FSubOctreeWithLeafs< CellClass , ContainerClass, LeafClass,CellAllocatorClass>(nullptr, 0, this->subHeight, 1); } else {// if(subHeight < height - 1) - root = new FSubOctree< CellClass , ContainerClass, LeafClass,CellAllocatorClass>(0, 0, this->subHeight, 1); + root = new FSubOctree< CellClass , ContainerClass, LeafClass,CellAllocatorClass>(nullptr, 0, this->subHeight, 1); } FReal tempWidth = this->boxWidth; @@ -304,7 +304,7 @@ public: } Iterator() : currentLocalIndex(0),currentLocalLevel(0) { - current.tree = 0; + current.tree = nullptr; } /** Copy constructor @@ -777,13 +777,13 @@ public: const MortonIndex fullIndex = inIndex >> 3 * (inLevel + 1 - (workingTree.tree->getSubOctreeHeight() + workingTree.tree->getSubOctreePosition()) ); // point to next suboctree workingTree.tree = workingTree.middleTree->leafs(int(treeMiddleMask & fullIndex)); - if(!workingTree.tree) return 0; + if(!workingTree.tree) return nullptr; } // Be sure there is a parent allocated const int levelInTree = inLevel - workingTree.tree->getSubOctreePosition(); if( levelInTree && !workingTree.tree->cellsAt(levelInTree - 1)[~(~0x00LL << (3 * levelInTree )) & (inIndex>>3)]){ - return 0; + return nullptr; } // compute correct index in the array and return the @ in array @@ -991,7 +991,7 @@ public: const MortonIndex fullIndex = inIndex >> (3 * (leafIndex + 1 - (workingTree.tree->getSubOctreeHeight() + workingTree.tree->getSubOctreePosition()) ) ); // point to next suboctree workingTree.tree = workingTree.middleTree->leafs(int(treeSubLeafMask & fullIndex)); - if(!workingTree.tree) return 0; + if(!workingTree.tree) return nullptr; } // compute correct index in the array diff --git a/Src/Containers/FSubOctree.hpp b/Src/Containers/FSubOctree.hpp index 491c8c298482b2f11d41bc4b17928691d24f3efa..d164fe5adb2c94375200643e29efc29cc4cd37cd 100755 --- a/Src/Containers/FSubOctree.hpp +++ b/Src/Containers/FSubOctree.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -84,7 +84,7 @@ protected: } /** - * This function creats all the intermediates cells between + * This function creates all the intermediates cells between * a leaf and the root. * It is used after inserting a new leaf to have cells from leaf to root * when computing @@ -147,7 +147,7 @@ protected: // remove the last cells cellAllocator.deleteObject(this->cells[indexLevel][arrayIndex]); - this->cells[indexLevel][arrayIndex] = 0; + this->cells[indexLevel][arrayIndex] =nullptr; // progress upper --indexLevel; arrayIndex >>= 3; @@ -159,7 +159,7 @@ protected: // continue while we are not in the last level and our child are empty while(indexLevel >= 0 && memcmp(&this->cells[indexLevel+1][arrayIndex<<3], emptyArray, 8 * sizeof(CellClass*)) == 0 ){ cellAllocator.deleteObject( this->cells[indexLevel][arrayIndex] ); - this->cells[indexLevel][arrayIndex] = 0; + this->cells[indexLevel][arrayIndex] = nullptr; --indexLevel; arrayIndex >>= 3; @@ -183,7 +183,7 @@ public: */ FAbstractSubOctree(FAbstractSubOctree* const inParent, const int inIndexInParent, const int inSubOctreeHeight, const int inSubOctreePosition, const bool inIsLeafSubtree) : - cells(0), parent( inParent ), indexInParent(inIndexInParent), leftLeafIndex(1 << (3 * inSubOctreeHeight)), rightLeafIndex(-1), + cells(nullptr), parent( inParent ), indexInParent(inIndexInParent), leftLeafIndex(1 << (3 * inSubOctreeHeight)), rightLeafIndex(-1), subOctreeHeight( inSubOctreeHeight ), subOctreePosition( inSubOctreePosition ), isLeafSubtree(inIsLeafSubtree) { this->cells = new CellClass**[this->subOctreeHeight]; @@ -229,8 +229,8 @@ public: /** * Insert a particle on the subtree - * @param index the morton index of the particle to insert - * @param inParticle the particle to insert (must inherite from FAbstractParticle) + * @param index the Morton index of the particle to insert + * @param inParticle the particle to insert (must inherit from FAbstractParticle) * @param inParticle the inTreeHeight the height of the tree */ /*template<typename... Args> @@ -343,7 +343,7 @@ private: LeafClass** leafs; //< Leafs array public: - FSubOctreeWithLeafs(const FSubOctreeWithLeafs&) = delete; + FSubOctreeWithLeafs(const FSubOctreeWithLeafs&) = delete; FSubOctreeWithLeafs& operator=(const FSubOctreeWithLeafs&) = delete; /** @@ -417,7 +417,7 @@ public: if( this->leafs[arrayIndex] ){ // remove container delete this->leafs[arrayIndex]; - this->leafs[arrayIndex] = 0; + this->leafs[arrayIndex] = nullptr; return Parent::removeCellsFromLeaf( int(arrayIndex) ); } @@ -429,7 +429,7 @@ public: * @return the list of particles at this index */ ContainerClass* getLeafSrc(const int index){ LeafClass* const leaf = this->leafs[index]; - return (leaf ? leaf->getSrc(): 0); + return (leaf ? leaf->getSrc(): nullptr); } /** To get access to leafs elements @@ -437,7 +437,7 @@ public: * @return the list of particles at this index */ ContainerClass* getLeafTargets(const int index){ LeafClass* const leaf = this->leafs[index]; - return (leaf ? leaf->getTargets(): 0); + return (leaf ? leaf->getTargets(): nullptr); } /** To get access to leafs elements @@ -445,7 +445,7 @@ public: * @return the list of particles at this index */ const ContainerClass* getLeafSrc(const int index) const { LeafClass* const leaf = this->leafs[index]; - return (leaf ? leaf->getSrc(): 0); + return (leaf ? leaf->getSrc(): nullptr); } /** To get access to leafs elements @@ -453,7 +453,7 @@ public: * @return the list of particles at this index */ const ContainerClass* getLeafTargets(const int index) const { LeafClass* const leaf = this->leafs[index]; - return (leaf ? leaf->getTargets() : 0); + return (leaf ? leaf->getTargets() : nullptr); } LeafClass* getLeaf(const int index){ @@ -606,7 +606,7 @@ public: if( this->subleafs[arrayIndex]->removeLeaf(index, inTreeHeight) ){ // remove container delete this->subleafs[arrayIndex]; - this->subleafs[arrayIndex] = 0; + this->subleafs[arrayIndex] = nullptr; return Parent::removeCellsFromLeaf( int(arrayIndex) ); } diff --git a/Src/Containers/FVector.hpp b/Src/Containers/FVector.hpp index e1ae2785bd378f0cc99bb66c6e29630269387001..74f85085184ce80c02967f01198a73996ccae04d 100755 --- a/Src/Containers/FVector.hpp +++ b/Src/Containers/FVector.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -48,7 +48,7 @@ public: * @brief Constructor * Create a vector with a default size capacity */ - FVector() : array(0), capacity(DefaultSize), index(0) { + FVector() : array(nullptr), capacity(DefaultSize), index(0) { array = reinterpret_cast< ObjectType* >( new char[sizeof(ObjectType) * DefaultSize] ); } @@ -56,7 +56,7 @@ public: * @brief Constructor * @param inCapacity the memory to allocate */ - explicit FVector(const int inCapacity): array(0), capacity(inCapacity), index(0) { + explicit FVector(const int inCapacity): array(nullptr), capacity(inCapacity), index(0) { if( inCapacity ){ array = reinterpret_cast< ObjectType* >( new char[sizeof(ObjectType) * inCapacity]); } @@ -67,7 +67,7 @@ public: * @param other original vector * object must have an copy constructor */ - FVector(const FVector& other): array(0), capacity(other.capacity), index(other.index) { + FVector(const FVector& other): array(nullptr), capacity(other.capacity), index(other.index) { if( other.capacity ){ array = reinterpret_cast< ObjectType* >( new char[sizeof(ObjectType) * other.capacity]); // Copy each element @@ -132,7 +132,7 @@ public: } // Copy elements - ObjectType* const nextArray = reinterpret_cast< ObjectType* >( inCapacity ? new char[sizeof(ObjectType) * inCapacity] : 0); + ObjectType* const nextArray = reinterpret_cast< ObjectType* >( inCapacity ? new char[sizeof(ObjectType) * inCapacity] : nullptr); for(int idx = 0 ; idx < index ; ++idx){ new((void*)&nextArray[idx]) ObjectType(array[idx]); (&array[idx])->~ObjectType(); @@ -249,7 +249,7 @@ public: } /** To take values from C array but copy with = operator - * @param inArray the array to copie values + * @param inArray the array to copy values * @param inSize the size of the array */ void extractValues(const ObjectType*const inArray, const int inSize){ diff --git a/Src/Core/FFmmAlgorithmPeriodic.hpp b/Src/Core/FFmmAlgorithmPeriodic.hpp index f1adbbd2a16226405ea7cc2bcdbf73e9dc9cf907..f56b53d9872c06d264bda5180da906013fed3937 100755 --- a/Src/Core/FFmmAlgorithmPeriodic.hpp +++ b/Src/Core/FFmmAlgorithmPeriodic.hpp @@ -46,7 +46,7 @@ public: * */ FFmmAlgorithmPeriodic(OctreeClass* const inTree, const int inUpperLevel = 0) - : tree(inTree) , kernels(0), OctreeHeight(tree->getHeight()), + : tree(inTree) , kernels(nullptr), OctreeHeight(tree->getHeight()), nbLevelsAboveRoot(inUpperLevel), offsetRealTree(inUpperLevel + 3) { FAssertLF(tree, "tree cannot be null"); @@ -273,7 +273,7 @@ public: if( neighbors[idxNeig] && !offsets[idxNeig].equals(0,0,0) ){ // Put periodic neighbors into other array periodicNeighbors[idxNeig] = neighbors[idxNeig]; - neighbors[idxNeig] = 0; + neighbors[idxNeig] = nullptr; ++periodicNeighborsCounter; FReal*const positionsX = periodicNeighbors[idxNeig]->getWPositions()[0]; diff --git a/Src/Core/FFmmAlgorithmTask.hpp b/Src/Core/FFmmAlgorithmTask.hpp index 0c21ff31528f8a9785224bc779b6166aa50b9d80..8419122c1b12857c746f23335819d9f551290678 100755 --- a/Src/Core/FFmmAlgorithmTask.hpp +++ b/Src/Core/FFmmAlgorithmTask.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -56,7 +56,7 @@ public: * An assert is launched if one of the arguments is null */ FFmmAlgorithmTask(OctreeClass* const inTree, KernelClass* const inKernels) - : tree(inTree) , kernels(0), + : tree(inTree) , kernels(nullptr), MaxThreads(omp_get_max_threads()), OctreeHeight(tree->getHeight()) { diff --git a/Src/Core/FFmmAlgorithmThread.hpp b/Src/Core/FFmmAlgorithmThread.hpp index 09dcb9100dfc57fe1dfd63931dc1c26bfac7a085..552f33a105aaff351ceed09ada039e79d398a091 100755 --- a/Src/Core/FFmmAlgorithmThread.hpp +++ b/Src/Core/FFmmAlgorithmThread.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -66,7 +66,7 @@ public: * An assert is launched if one of the arguments is null */ FFmmAlgorithmThread(OctreeClass* const inTree, KernelClass* const inKernels) - : tree(inTree) , kernels(0), iterArray(0), leafsNumber(0), + : tree(inTree) , kernels(nullptr), iterArray(nullptr), leafsNumber(0), MaxThreads(omp_get_max_threads()), OctreeHeight(tree->getHeight()) { FAssertLF(tree, "tree cannot be null"); @@ -122,7 +122,7 @@ public: if((operationsToProceed & FFmmP2P) || (operationsToProceed & FFmmL2P)) directPass(); delete [] iterArray; - iterArray = 0; + iterArray = nullptr; } private: diff --git a/Src/Core/FFmmAlgorithmThreadProc.hpp b/Src/Core/FFmmAlgorithmThreadProc.hpp index 4727bbc2078ae69593cae0b1394b5d3f6ad7fdfe..6a2bf65476559174d12860b7e1b730ff48706539 100644 --- a/Src/Core/FFmmAlgorithmThreadProc.hpp +++ b/Src/Core/FFmmAlgorithmThreadProc.hpp @@ -164,7 +164,7 @@ public: } while(octreeIterator.moveRight()); myLastInterval.max = octreeIterator.getCurrentGlobalIndex(); } - iterArray = new typename OctreeClass::Iterator[numberOfLeafs]; + iterArray = new typename OctreeClass::Iterator[numberOfLeafs]; iterArrayComm = new typename OctreeClass::Iterator[numberOfLeafs]; FAssertLF(iterArray, "iterArray bad alloc"); FAssertLF(iterArrayComm, "iterArrayComm bad alloc"); @@ -216,8 +216,8 @@ public: // delete array delete [] iterArray; delete [] iterArrayComm; - iterArray = 0; - iterArrayComm = 0; + iterArray = nullptr; + iterArrayComm = nullptr; } private: @@ -946,7 +946,7 @@ private: octreeIterator = avoidGotoLeftIterator; delete leafsNeedOther[idxLevel]; - leafsNeedOther[idxLevel] = 0; + leafsNeedOther[idxLevel] = nullptr; // Compute this cells FLOG(computationCounter.tic()); @@ -1332,7 +1332,7 @@ for(int idxLevel = 2 ; idxLevel < OctreeHeight ; ++idxLevel ){ octreeIterator = avoidGotoLeftIterator; printf("Proc :: %d Lvl %d, numberOfCells : %d that need other datas \n",idProcess,idxLevel,numberOfCells); delete leafsNeedOther[idxLevel]; - leafsNeedOther[idxLevel] = 0; + leafsNeedOther[idxLevel] = nullptr; // Compute this cells FLOG(computationCounter.tic()); @@ -1977,7 +1977,7 @@ FLOG( FLog::Controller << "\t\t M2L Send : " << sendCounter.elapsed() << " s\n" otherP2Ptree.createLeaf(leafIndex)->getSrc()->restore((*recvBuffer[idxProc])); } delete recvBuffer[idxProc]; - recvBuffer[idxProc] = 0; + recvBuffer[idxProc] = nullptr; } } } diff --git a/Src/Core/FFmmAlgorithmThreadTsm.hpp b/Src/Core/FFmmAlgorithmThreadTsm.hpp index e42e8f3be508842c2f651e38ac60c2b1834e51ef..317001c7c7ad039ded46545bcd02c4f277a41c7e 100755 --- a/Src/Core/FFmmAlgorithmThreadTsm.hpp +++ b/Src/Core/FFmmAlgorithmThreadTsm.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -62,7 +62,7 @@ public: * An assert is launched if one of the arguments is null */ FFmmAlgorithmThreadTsm(OctreeClass* const inTree, KernelClass* const inKernels) - : tree(inTree) , kernels(0), iterArray(0), + : tree(inTree) , kernels(nullptr), iterArray(nullptr), MaxThreads(omp_get_max_threads()) , OctreeHeight(tree->getHeight()) { FAssertLF(tree, "tree cannot be null"); @@ -111,7 +111,7 @@ public: if((operationsToProceed & FFmmP2P) || (operationsToProceed & FFmmL2P)) directPass(); delete [] iterArray; - iterArray = 0; + iterArray = nullptr; } @@ -194,7 +194,7 @@ public: CellClass** const realChild = iterArray[idxCell].getCurrentChild(); CellClass* const currentCell = iterArray[idxCell].getCurrentCell(); for(int idxChild = 0 ; idxChild < 8 ; ++idxChild){ - potentialChild[idxChild] = 0; + potentialChild[idxChild] = nullptr; if(realChild[idxChild]){ if(realChild[idxChild]->hasSrcChild()){ currentCell->setSrcChildTrue(); @@ -260,7 +260,7 @@ public: ++counterWithSrc; } else{ - neighbors[idxRealNeighbors] = 0; + neighbors[idxRealNeighbors] = nullptr; } } if(counterWithSrc){ @@ -322,7 +322,7 @@ public: potentialChild[idxChild] = realChild[idxChild]; } else{ - potentialChild[idxChild] = 0; + potentialChild[idxChild] = nullptr; } } myThreadkernels->L2L( currentCell , potentialChild, idxLevel); diff --git a/Src/Core/FFmmAlgorithmTsm.hpp b/Src/Core/FFmmAlgorithmTsm.hpp index 22a745b2fb71b8fe741a7c60d74956db68cf1844..86df966b45a4cbeef8467558bf8a1466541e4522 100755 --- a/Src/Core/FFmmAlgorithmTsm.hpp +++ b/Src/Core/FFmmAlgorithmTsm.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -146,7 +146,7 @@ public: CellClass** const realChild = octreeIterator.getCurrentChild(); CellClass* const currentCell = octreeIterator.getCurrentCell(); for(int idxChild = 0 ; idxChild < 8 ; ++idxChild){ - potentialChild[idxChild] = 0; + potentialChild[idxChild] = nullptr; if(realChild[idxChild]){ if(realChild[idxChild]->hasSrcChild()){ currentCell->setSrcChildTrue(); @@ -205,7 +205,7 @@ public: ++counterWithSrc; } else{ - neighbors[idxRealNeighbors] = 0; + neighbors[idxRealNeighbors] = nullptr; } } if(counterWithSrc){ @@ -258,7 +258,7 @@ public: potentialChild[idxChild] = realChild[idxChild]; } else{ - potentialChild[idxChild] = 0; + potentialChild[idxChild] = nullptr; } } kernels->L2L( currentCell , potentialChild, idxLevel); diff --git a/Src/Files/FFmaGenericLoader.hpp b/Src/Files/FFmaGenericLoader.hpp index 60a15a8c0146fc79c88f8d4d1f21bb3afed17f7c..58dd61dc75f9b3cba889a282b952f37eaf7d19f0 100755 --- a/Src/Files/FFmaGenericLoader.hpp +++ b/Src/Files/FFmaGenericLoader.hpp @@ -180,7 +180,7 @@ protected: unsigned int typeData[2]; ///< {Size of the data to read, number of data on 1 line} private: FReal *tmpVal ; /// Temporary array to read data - int otherDataToRead ; ///< <<number of other data (>4)to read in a particle record + int otherDataToRead ; ///< <<number of other data (>4)to read in a particle record public: /** * The constructor need the file name @@ -323,7 +323,7 @@ public: * @param dataToRead is an array of type FReal. It contains all the values of a particles (for instance X,Y,Z,Q, .. * @param nbDataToRead number of value to read (I.e. size of the array) */ - void fillParticle(FReal* dataToRead, const int nbDataToRead){ + void fillParticle(FReal* dataToRead, const unsigned int nbDataToRead){ if(binaryFile){ file->read((char*)(dataToRead), sizeof(FReal)*nbDataToRead); if(nbDataToRead< typeData[1]){ @@ -332,12 +332,12 @@ public: } else{ - for (int i = 0 ; i <nbDataToRead; ++i){ + for (unsigned int i = 0 ; i <nbDataToRead; ++i){ (*this->file) >>dataToRead[i]; } if(nbDataToRead< typeData[1]){ FReal x; - for (int i = 0 ; i <typeData[1]-nbDataToRead; ++i){ + for (unsigned int i = 0 ; i <typeData[1]-nbDataToRead; ++i){ (*this->file) >> x ; } } @@ -686,7 +686,7 @@ public: int k = 0; for (int i = 0 ; i <N ; ++i){ // std::cout << "i "<< i << " "; - for (int jj= 0 ; jj<nbData ; ++jj, ++k){ + for (unsigned int jj= 0 ; jj<nbData ; ++jj, ++k){ (*this->file) << dataToWrite[k] << " "; // std::cout << dataToWrite[k]<< " "; } @@ -707,7 +707,6 @@ private: } void writerBinaryHeader(const FPoint ¢erOfBox,const FReal &boxWidth, const FSize &nbParticles, const unsigned int *typeFReal) { - int sizeOfElement; file->seekg (std::ios::beg); file->write((char*)typeFReal,2*sizeof(unsigned int)); if(typeFReal[0] != sizeof(FReal)){ diff --git a/Src/Files/FFmaScanfLoader.hpp b/Src/Files/FFmaScanfLoader.hpp index d4844a40bb2fc9dfe2e485e6231e816023d93e67..fb3955c7b0227dbf130ef4b7cf321127ac044d4b 100755 --- a/Src/Files/FFmaScanfLoader.hpp +++ b/Src/Files/FFmaScanfLoader.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -64,7 +64,7 @@ public: * @param filename the name of the file to open * you can test if file is successfuly open by calling hasNotFinished() */ - FFmaScanfLoader(const char* const filename): file(0){ + FFmaScanfLoader(const char* const filename): file(nullptr){ file = fopen(filename,"r"); // test if open if(this->file){ @@ -76,7 +76,7 @@ public: } else{ fclose(file); - file = NULL; + file = nullptr; } } else { @@ -97,7 +97,7 @@ public: * @return true if loader can work */ bool isOpen() const{ - return this->file != NULL; + return this->file != nullptr; } /** diff --git a/Src/Files/FRandomLoader.hpp b/Src/Files/FRandomLoader.hpp index b466937c9c70341dd805405eb3d524d9376d42b0..40f4da35b2b37d2235bec3c619d2d91613ca16a8 100755 --- a/Src/Files/FRandomLoader.hpp +++ b/Src/Files/FRandomLoader.hpp @@ -44,12 +44,12 @@ public: * @param inNbParticles Number of partcles to generate randomly * @param inBoxWidth the width of the box * @param inCenterOfBox the center of the box - * @param inSeed The seed for the random generator (default value time(0)) + * @param inSeed The seed for the random generator (default value time(nullptr)) * */ FRandomLoader(const size_t inNbParticles, const FReal inBoxWidth = 1.0, const FPoint& inCenterOfBox = FPoint(0,0,0), - const unsigned int inSeed = static_cast<long int>(time(0))) + const unsigned int inSeed = static_cast<long int>(time(nullptr))) : nbParticles(inNbParticles), boxWidth(inBoxWidth), centerOfBox(inCenterOfBox) { srand48(inSeed); } @@ -115,7 +115,7 @@ public: class FRandomLoaderTsm : public FRandomLoader { public: FRandomLoaderTsm(const size_t inNbParticles, const FReal inBoxWidth = 1.0, - const FPoint& inCenterOfBox = FPoint(0,0,0), const unsigned int inSeed = static_cast<unsigned int>(time(0))) + const FPoint& inCenterOfBox = FPoint(0,0,0), const unsigned int inSeed = static_cast<unsigned int>(time(nullptr))) : FRandomLoader(inNbParticles,inBoxWidth,inCenterOfBox,inSeed) { } diff --git a/Src/GroupTree/FGroupSeqAlgorithm.hpp b/Src/GroupTree/FGroupSeqAlgorithm.hpp index 2a4efd642ff40506acd2e82a96023d8f8e68bc66..33223e023f56bd00f82c9235db649c3d1bb10d46 100644 --- a/Src/GroupTree/FGroupSeqAlgorithm.hpp +++ b/Src/GroupTree/FGroupSeqAlgorithm.hpp @@ -102,7 +102,7 @@ protected: for(MortonIndex mindex = blockStartIdx ; mindex < blockEndIdx && iterChildCells != endChildCells; ++mindex){ CellClass* cell = (*iterCells)->getCell(mindex); if(cell){ - CellClass* child[8] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}; + CellClass* child[8] = {nullptr,nullptr,nullptr,nullptr,nullptr,nullptr,nullptr,nullptr}; for(int idxChild = 0 ; idxChild < 8 ; ++idxChild){ while(iterChildCells != endChildCells && (*iterChildCells)->getEndingIndex() < ((mindex<<3)+idxChild) ){ @@ -205,7 +205,7 @@ protected: const int counter = 1; kernels->M2L( cell , interactions, counter, idxLevel); - interactions[outsideInteractions[outInterIdx].outPosition] = NULL; + interactions[outsideInteractions[outInterIdx].outPosition] = nullptr; interactions[getOppositeInterIndex(outsideInteractions[outInterIdx].outPosition)] = cell; kernels->M2L( interCell , interactions, counter, idxLevel); } @@ -240,7 +240,7 @@ protected: for(MortonIndex mindex = blockStartIdx ; mindex < blockEndIdx && iterChildCells != endChildCells; ++mindex){ CellClass* cell = (*iterCells)->getCell(mindex); if(cell){ - CellClass* child[8] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}; + CellClass* child[8] = {nullptr,nullptr,nullptr,nullptr,nullptr,nullptr,nullptr,nullptr}; for(int idxChild = 0 ; idxChild < 8 ; ++idxChild){ while(iterChildCells != endChildCells && (*iterChildCells)->getEndingIndex() < ((mindex<<3)+idxChild) ){ @@ -372,7 +372,7 @@ protected: const int counter = 1; kernels->P2PRemote( FTreeCoordinate(outsideInteractions[outInterIdx].insideIndex, tree->getHeight()-1), &particles, &particles , interactions, counter); - interactions[outsideInteractions[outInterIdx].outPosition] = NULL; + interactions[outsideInteractions[outInterIdx].outPosition] = nullptr; interactions[getOppositeNeighIndex(outsideInteractions[outInterIdx].outPosition)] = &particles; kernels->P2PRemote( FTreeCoordinate(outsideInteractions[outInterIdx].outIndex, tree->getHeight()-1), &interParticles, &interParticles , interactions, counter); } diff --git a/Src/GroupTree/FGroupTree.hpp b/Src/GroupTree/FGroupTree.hpp index 12f570d2ad43c50431e6d48e2f09665d32067e05..36934073541f8b75d1faa4dd86d395aa7ff8d943 100644 --- a/Src/GroupTree/FGroupTree.hpp +++ b/Src/GroupTree/FGroupTree.hpp @@ -1,5 +1,7 @@ #ifndef FGROUPTREE_HPP #define FGROUPTREE_HPP +#include <list> +#include <functional> #include "../Utils/FAssert.hpp" #include "../Utils/FPoint.hpp" @@ -10,8 +12,7 @@ #include "FGroupOfParticles.hpp" #include "FGroupAttachedLeaf.hpp" -#include <list> -#include <functional> + template <class CellClass, class GroupAttachedLeafClass, unsigned NbAttributesPerParticle, class AttributeClass = FReal> class FGroupTree { diff --git a/Src/Kernels/Chebyshev/FChebFlopsSymKernel.hpp b/Src/Kernels/Chebyshev/FChebFlopsSymKernel.hpp index ba31a915e8b088719ef4a516687f5b8b4441c9ce..cfd9720fef95c1c155526272d51c4db577d1e6b2 100755 --- a/Src/Kernels/Chebyshev/FChebFlopsSymKernel.hpp +++ b/Src/Kernels/Chebyshev/FChebFlopsSymKernel.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -111,7 +111,7 @@ public: : MatrixKernel(new MatrixKernelClass()), SymHandler(new SymmetryHandler(MatrixKernel.getPtr(), Epsilon)), inTreeHeight(_inTreeHeight), flopsP2M(0), flopsM2M(0), flopsM2L(0), flopsL2L(0), flopsL2P(0), flopsP2P(0), - flopsPerLevelM2M(NULL), flopsPerLevelM2L(NULL), flopsPerLevelL2L(NULL) + flopsPerLevelM2M(nullptr), flopsPerLevelM2L(nullptr), flopsPerLevelL2L(nullptr) { countExp = new unsigned int [343]; flopsPerLevelM2M = new unsigned long long [inTreeHeight]; @@ -317,7 +317,7 @@ struct FChebFlopsSymKernel<CellClass, ContainerClass, MatrixKernelClass, ORDER> { // init all 343 item to zero, because effectively only 16 exist for (unsigned int t=0; t<343; ++t) { - K[t] = NULL; + K[t] = nullptr; LowRank[t] = 0; } @@ -341,7 +341,7 @@ struct FChebFlopsSymKernel<CellClass, ContainerClass, MatrixKernelClass, ORDER> ~SymmetryHandler() { for (unsigned int t=0; t<343; ++t) - if (K[ t]!=NULL) delete [] K[ t]; + if (K[ t]!=nullptr) delete [] K[ t]; } @@ -390,7 +390,7 @@ private: // store const unsigned int idx = (i+3)*7*7 + (j+3)*7 + (k+3); - assert(K[idx]==NULL); + assert(K[idx]==nullptr); K[idx] = new FReal [2*rank*nnodes]; LowRank[idx] = rank; for (unsigned int r=0; r<rank; ++r) diff --git a/Src/Kernels/Chebyshev/FChebM2LHandler.hpp b/Src/Kernels/Chebyshev/FChebM2LHandler.hpp index 729a3ccbf13947dee0aaec83255ce69f628cc292..782ef5963f2172387ea5c0a3f58779a3172c3e24 100755 --- a/Src/Kernels/Chebyshev/FChebM2LHandler.hpp +++ b/Src/Kernels/Chebyshev/FChebM2LHandler.hpp @@ -89,14 +89,14 @@ class FChebM2LHandler : FNoCopyable public: FChebM2LHandler(const FReal _epsilon) - : MatrixKernel(), U(NULL), C(NULL), B(NULL), epsilon(_epsilon), rank(0) + : MatrixKernel(), U(nullptr), C(nullptr), B(nullptr), epsilon(_epsilon), rank(0) {} ~FChebM2LHandler() { - if (U != NULL) delete [] U; - if (B != NULL) delete [] B; - if (C != NULL) delete [] C; + if (U != nullptr) delete [] U; + if (B != nullptr) delete [] B; + if (C != nullptr) delete [] C; } /** @@ -246,7 +246,7 @@ FChebM2LHandler<ORDER, MatrixKernelClass>::ComputeAndCompress(const FReal epsilo // allocate memory and compute 316 m2l operators FReal *_U, *_C, *_B; - _U = _B = NULL; + _U = _B = nullptr; _C = new FReal [nnodes*nnodes * ninteractions]; unsigned int counter = 0; for (int i=-3; i<=3; ++i) { @@ -336,7 +336,7 @@ FChebM2LHandler<ORDER, MatrixKernelClass>::ComputeAndCompressAndStoreInBinaryFil FTic time; time.tic(); // start computing process FReal *U, *C, *B; - U = C = B = NULL; + U = C = B = nullptr; const unsigned int rank = ComputeAndCompress(epsilon, U, C, B); // store into binary file const std::string filename(getFileName(epsilon)); @@ -359,9 +359,9 @@ FChebM2LHandler<ORDER, MatrixKernelClass>::ComputeAndCompressAndStoreInBinaryFil } else throw std::runtime_error("File could not be opened to write"); stream.close(); // free memory - if (U != NULL) delete [] U; - if (B != NULL) delete [] B; - if (C != NULL) delete [] C; + if (U != nullptr) delete [] U; + if (B != nullptr) delete [] B; + if (C != nullptr) delete [] C; // write info std::cout << "Compressed M2L operators ("<< rank << ") stored in binary file " << filename << " in " << time.tacAndElapsed() << "sec." << std::endl; diff --git a/Src/Kernels/Chebyshev/FChebSymKernel.hpp b/Src/Kernels/Chebyshev/FChebSymKernel.hpp index 8bd2deefb62ec8bafcf959c6bf971f91b7c0bb3c..2e53b3154dc771d9ac8e67c7c54ff8e036cbed00 100755 --- a/Src/Kernels/Chebyshev/FChebSymKernel.hpp +++ b/Src/Kernels/Chebyshev/FChebSymKernel.hpp @@ -9,7 +9,7 @@ #include "./FAbstractChebKernel.hpp" #include "./FChebInterpolator.hpp" // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -73,14 +73,14 @@ class FChebSymKernel */ void allocateMemoryForPermutedExpansions() { - assert(Loc==NULL && Mul==NULL && countExp==NULL); + assert(Loc==nullptr && Mul==nullptr && countExp==nullptr); Loc = new FReal* [343]; Mul = new FReal* [343]; countExp = new unsigned int [343]; - // set all 343 to NULL + // set all 343 to nullptr for (unsigned int idx=0; idx<343; ++idx) { - Mul[idx] = Loc[idx] = NULL; + Mul[idx] = Loc[idx] = nullptr; } // init only 16 of 343 possible translations due to symmetries @@ -88,7 +88,7 @@ class FChebSymKernel for (int j=0; j<=i; ++j) for (int k=0; k<=j; ++k) { const unsigned int idx = (i+3)*7*7 + (j+3)*7 + (k+3); - assert(Mul[idx]==NULL || Loc[idx]==NULL); + assert(Mul[idx]==nullptr || Loc[idx]==nullptr); Mul[idx] = new FReal [24 * nnodes]; Loc[idx] = new FReal [24 * nnodes]; } @@ -112,7 +112,7 @@ public: const FReal Epsilon) : AbstractBaseClass(inTreeHeight, inBoxWidth, inBoxCenter), SymHandler(new SymmetryHandlerClass(AbstractBaseClass::MatrixKernel.getPtr(), Epsilon, inBoxWidth, inTreeHeight)), - Loc(NULL), Mul(NULL), countExp(NULL) + Loc(nullptr), Mul(nullptr), countExp(nullptr) { this->allocateMemoryForPermutedExpansions(); @@ -139,7 +139,7 @@ public: FChebSymKernel(const FChebSymKernel& other) : AbstractBaseClass(other), SymHandler(other.SymHandler), - Loc(NULL), Mul(NULL), countExp(NULL) + Loc(nullptr), Mul(nullptr), countExp(nullptr) { this->allocateMemoryForPermutedExpansions(); } @@ -150,12 +150,12 @@ public: ~FChebSymKernel() { for (unsigned int t=0; t<343; ++t) { - if (Loc[t]!=NULL) delete [] Loc[t]; - if (Mul[t]!=NULL) delete [] Mul[t]; + if (Loc[t]!=nullptr) delete [] Loc[t]; + if (Mul[t]!=nullptr) delete [] Mul[t]; } - if (Loc!=NULL) delete [] Loc; - if (Mul!=NULL) delete [] Mul; - if (countExp!=NULL) delete [] countExp; + if (Loc!=nullptr) delete [] Loc; + if (Mul!=nullptr) delete [] Mul; + if (countExp!=nullptr) delete [] countExp; #ifdef LOG_TIMINGS std::cout << "- Permutation took " << t_m2l_1 << "s" @@ -402,7 +402,7 @@ public: for (unsigned int n=0; n<nnodes; ++n) PermMultiExp[pvectors[idx][n]] = MultiExp[n]; // mat-vec-mult (svd) - assert(K[pindices[idx]]!=NULL); + assert(K[pindices[idx]]!=nullptr); const int rank = LowRank[pindices[idx]]; FBlas::gemtv(nnodes, rank, FReal(1.), K[pindices[idx]]+rank*nnodes, PermMultiExp, Compressed); FBlas::gemv( nnodes, rank, scale, K[pindices[idx]], Compressed, PermLocalExp); diff --git a/Src/Kernels/Chebyshev/FChebSymM2LHandler.hpp b/Src/Kernels/Chebyshev/FChebSymM2LHandler.hpp index 6032dabb8a1350987d17c1c1a6ac4a5db9f74ddb..b24225822225362fd34939b9ff20dfc4e4266333 100755 --- a/Src/Kernels/Chebyshev/FChebSymM2LHandler.hpp +++ b/Src/Kernels/Chebyshev/FChebSymM2LHandler.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -389,7 +389,7 @@ static void precompute(const MatrixKernelClass *const MatrixKernel, const FReal // store { // allocate - assert(K[idx]==NULL); + assert(K[idx]==nullptr); K[idx] = new FReal [2*rank*nnodes]; // set low rank @@ -448,7 +448,7 @@ static void precompute(const MatrixKernelClass *const MatrixKernel, const FReal // store const unsigned int idx = (i+3)*7*7 + (j+3)*7 + (k+3); - assert(K[idx]==NULL); + assert(K[idx]==nullptr); K[idx] = new FReal [2*rank*nnodes]; LowRank[idx] = rank; for (unsigned int r=0; r<rank; ++r) @@ -616,13 +616,13 @@ public: // init all 343 item to zero, because effectively only 16 exist K = new FReal** [TreeHeight]; LowRank = new int* [TreeHeight]; - K[0] = NULL; K[1] = NULL; - LowRank[0] = NULL; LowRank[1] = NULL; + 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]; for (unsigned int t=0; t<343; ++t) { - K[l][t] = NULL; + K[l][t] = nullptr; LowRank[l][t] = 0; } } @@ -654,11 +654,11 @@ public: ~SymmetryHandler() { for (unsigned int l=0; l<TreeHeight; ++l) { - if (K[l]!=NULL) { - for (unsigned int t=0; t<343; ++t) if (K[l][t]!=NULL) delete [] K[l][t]; + if (K[l]!=nullptr) { + for (unsigned int t=0; t<343; ++t) if (K[l][t]!=nullptr) delete [] K[l][t]; delete [] K[l]; } - if (LowRank[l]!=NULL) delete [] LowRank[l]; + if (LowRank[l]!=nullptr) delete [] LowRank[l]; } delete [] K; delete [] LowRank; @@ -696,7 +696,7 @@ 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] = NULL; LowRank[idx] = 0; } + for (unsigned int idx=0; idx<343; ++idx) { K[idx] = nullptr; LowRank[idx] = 0; } precompute<ORDER>(MatrixKernel, FReal(2.), Epsilon, K, LowRank); // write to binary file //////////// @@ -711,7 +711,7 @@ static void ComputeAndCompressAndStoreInBinaryFile(const MatrixKernelClass *cons if (stream.good()) { stream.seekp(0); for (unsigned int idx=0; idx<343; ++idx) - if (K[idx]!=NULL) { + if (K[idx]!=nullptr) { // 1) write index stream.write(reinterpret_cast<char*>(&idx), sizeof(int)); // 2) write low rank (int) @@ -730,7 +730,7 @@ 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]!=NULL) delete [] K[t]; + for (unsigned int t=0; t<343; ++t) if (K[t]!=nullptr) delete [] K[t]; } @@ -763,7 +763,7 @@ void ReadFromBinaryFile(const FReal Epsilon, FReal* K[343], int LowRank[343]) istream.read(reinterpret_cast<char*>(&_idx), sizeof(int)); // loop to find 16 compressed m2l operators for (int idx=0; idx<343; ++idx) { - K[idx] = NULL; + K[idx] = nullptr; LowRank[idx] = 0; // if it exists if (idx == _idx) { diff --git a/Src/Kernels/Chebyshev/FChebSymTensorialM2LHandler.hpp b/Src/Kernels/Chebyshev/FChebSymTensorialM2LHandler.hpp index fd775e19078a506392277e5da70c8b9e1813deb5..038686df061c8e28f72ef9f023be1c736ab08506 100755 --- a/Src/Kernels/Chebyshev/FChebSymTensorialM2LHandler.hpp +++ b/Src/Kernels/Chebyshev/FChebSymTensorialM2LHandler.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -385,7 +385,7 @@ static void precompute(const int idxK, const FReal CellWidth, // store { // allocate - assert(K[idx]==NULL); + assert(K[idx]==nullptr); K[idx] = new FReal [2*rank*nnodes]; // set low rank @@ -409,7 +409,7 @@ static void precompute(const int idxK, const FReal CellWidth, //// store recompressed UV //const unsigned int idx = (i+3)*7*7 + (j+3)*7 + (k+3); - //assert(K[idx]==NULL); + //assert(K[idx]==nullptr); //K[idx] = new FReal [2*rank*nnodes]; //LowRank[idx] = rank; //FBlas::copy(rank*nnodes, UU, K[idx]); @@ -440,7 +440,7 @@ static void precompute(const int idxK, const FReal CellWidth, // store const unsigned int idx = (i+3)*7*7 + (j+3)*7 + (k+3); - assert(K[idx]==NULL); + assert(K[idx]==nullptr); K[idx] = new FReal [2*rank*nnodes]; LowRank[idx] = rank; for (unsigned int r=0; r<rank; ++r) @@ -547,7 +547,7 @@ public: LowRank[d] = new int [343]; for (unsigned int t=0; t<343; ++t) { - K[d][t] = NULL; + K[d][t] = nullptr; LowRank[d][t] = 0; } } @@ -576,7 +576,7 @@ public: ~SymmetryHandler() { for (unsigned int d=0; d<NCMP; ++d) - for (unsigned int t=0; t<343; ++t) if (K[d][t]!=NULL) delete [] K[d][t]; + for (unsigned int t=0; t<343; ++t) if (K[d][t]!=nullptr) delete [] K[d][t]; } @@ -630,13 +630,13 @@ public: for (unsigned int d=0; d<NCMP; ++d) { K[d] = new FReal** [TreeHeight]; LowRank[d] = new int* [TreeHeight]; - K[d][0] = NULL; K[d][1] = NULL; - LowRank[d][0] = NULL; LowRank[d][1] = NULL; + K[d][0] = nullptr; K[d][1] = nullptr; + LowRank[d][0] = nullptr; LowRank[d][1] = nullptr; for (unsigned int l=2; l<TreeHeight; ++l) { K[d][l] = new FReal* [343]; LowRank[d][l] = new int [343]; for (unsigned int t=0; t<343; ++t) { - K[d][l][t] = NULL; + K[d][l][t] = nullptr; LowRank[d][l][t] = 0; } } @@ -671,11 +671,11 @@ public: { for (unsigned int d=0; d<NCMP; ++d) { for (unsigned int l=0; l<TreeHeight; ++l) { - if (K[d][l]!=NULL) { - for (unsigned int t=0; t<343; ++t) if (K[d][l][t]!=NULL) delete [] K[d][l][t]; + if (K[d][l]!=nullptr) { + for (unsigned int t=0; t<343; ++t) if (K[d][l][t]!=nullptr) delete [] K[d][l][t]; delete [] K[d][l]; } - if (LowRank[d][l]!=NULL) delete [] LowRank[d][l]; + if (LowRank[d][l]!=nullptr) delete [] LowRank[d][l]; } delete [] K[d]; delete [] LowRank[d]; @@ -716,7 +716,7 @@ public: // // compute and compress //////////// // FReal* K[343]; // int LowRank[343]; -// for (unsigned int idx=0; idx<343; ++idx) { K[idx] = NULL; LowRank[idx] = 0; } +// for (unsigned int idx=0; idx<343; ++idx) { K[idx] = nullptr; LowRank[idx] = 0; } // precompute<ORDER,MatrixKernelClass>(FReal(2.), Epsilon, K, LowRank); // // // write to binary file //////////// @@ -731,7 +731,7 @@ public: // if (stream.good()) { // stream.seekp(0); // for (unsigned int idx=0; idx<343; ++idx) -// if (K[idx]!=NULL) { +// if (K[idx]!=nullptr) { // // 1) write index // stream.write(reinterpret_cast<char*>(&idx), sizeof(int)); // // 2) write low rank (int) @@ -750,7 +750,7 @@ public: // // << " in " << time.tacAndElapsed() << "sec." << std::endl; // // // free memory ///////////////////// -// for (unsigned int t=0; t<343; ++t) if (K[t]!=NULL) delete [] K[t]; +// for (unsigned int t=0; t<343; ++t) if (K[t]!=nullptr) delete [] K[t]; //} // // @@ -783,7 +783,7 @@ public: // istream.read(reinterpret_cast<char*>(&_idx), sizeof(int)); // // loop to find 16 compressed m2l operators // for (int idx=0; idx<343; ++idx) { -// K[idx] = NULL; +// K[idx] = nullptr; // LowRank[idx] = 0; // // if it exists // if (idx == _idx) { diff --git a/Src/Kernels/Chebyshev/FChebTensorialM2LHandler.hpp b/Src/Kernels/Chebyshev/FChebTensorialM2LHandler.hpp index 2850d3cee4da787eb5fde845511f267351c81153..85c543bc9eaabfde25814ad1da75df26f4c86e49 100755 --- a/Src/Kernels/Chebyshev/FChebTensorialM2LHandler.hpp +++ b/Src/Kernels/Chebyshev/FChebTensorialM2LHandler.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -110,7 +110,7 @@ class FChebTensorialM2LHandler<ORDER,MatrixKernelClass,HOMOGENEOUS> : FNoCopyabl public: FChebTensorialM2LHandler(const MatrixKernelClass *const MatrixKernel, const unsigned int, const FReal, const FReal _epsilon) - : U(NULL), B(NULL), epsilon(_epsilon), rank(0) + : U(nullptr), B(nullptr), epsilon(_epsilon), rank(0) { // measure time FTic time; time.tic(); @@ -120,7 +120,7 @@ public: // allocate C C = new FReal*[ncmp]; for (unsigned int d=0; d<ncmp; ++d) - C[d]=NULL; + C[d]=nullptr; for (unsigned int d=0; d<ncmp; ++d) if (C[d]) throw std::runtime_error("Compressed M2L operator already set"); @@ -139,10 +139,10 @@ public: ~FChebTensorialM2LHandler() { - if (U != NULL) delete [] U; - if (B != NULL) delete [] B; + if (U != nullptr) delete [] U; + if (B != nullptr) delete [] B; for (unsigned int d=0; d<ncmp; ++d) - if (C[d] != NULL) delete [] C[d]; + if (C[d] != nullptr) delete [] C[d]; } /** @@ -243,7 +243,7 @@ public: U = new FReal*[TreeHeight]; B = new FReal*[TreeHeight]; for (unsigned int l=0; l<TreeHeight; ++l){ - B[l]=NULL; U[l]=NULL; + B[l]=nullptr; U[l]=nullptr; } // allocate C @@ -251,7 +251,7 @@ public: for (unsigned int l=0; l<TreeHeight; ++l){ C[l] = new FReal*[ncmp]; for (unsigned int d=0; d<ncmp; ++d) - C[l][d]=NULL; + C[l][d]=nullptr; } for (unsigned int l=0; l<TreeHeight; ++l) { @@ -277,12 +277,12 @@ public: ~FChebTensorialM2LHandler() { - if (rank != NULL) delete [] rank; + if (rank != nullptr) delete [] rank; for (unsigned int l=0; l<TreeHeight; ++l) { - if (U[l] != NULL) delete [] U[l]; - if (B[l] != NULL) delete [] B[l]; + if (U[l] != nullptr) delete [] U[l]; + if (B[l] != nullptr) delete [] B[l]; for (unsigned int d=0; d<ncmp; ++d) - if (C[l][d] != NULL) delete [] C[l][d]; + if (C[l][d] != nullptr) delete [] C[l][d]; } } @@ -489,7 +489,7 @@ unsigned int ComputeAndCompress(const MatrixKernelClass *const MatrixKernel, // FTic time; time.tic(); // // start computing process // FReal *U, *C, *B; -// U = C = B = NULL; +// U = C = B = nullptr; // const unsigned int rank = ComputeAndCompress(epsilon, U, C, B); // // store into binary file // const std::string filename(getFileName(epsilon)); @@ -512,9 +512,9 @@ unsigned int ComputeAndCompress(const MatrixKernelClass *const MatrixKernel, // } else throw std::runtime_error("File could not be opened to write"); // stream.close(); // // free memory -// if (U != NULL) delete [] U; -// if (B != NULL) delete [] B; -// if (C != NULL) delete [] C; +// if (U != nullptr) delete [] U; +// if (B != nullptr) delete [] B; +// if (C != nullptr) delete [] C; // // write info // std::cout << "Compressed M2L operators ("<< rank << ") stored in binary file " << filename // << " in " << time.tacAndElapsed() << "sec." << std::endl; diff --git a/Src/Kernels/Spherical/FAbstractSphericalKernel.hpp b/Src/Kernels/Spherical/FAbstractSphericalKernel.hpp index 379953303785b1a135127772ee6fe1ba4e87091f..72832596783cadac6329c39e74bcbfde86c7a0a7 100755 --- a/Src/Kernels/Spherical/FAbstractSphericalKernel.hpp +++ b/Src/Kernels/Spherical/FAbstractSphericalKernel.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -113,8 +113,8 @@ public: widthAtLeafLevelDiv2(widthAtLeafLevel/2), boxCorner(inBoxCenter.getX()-(inBoxWidth/2),inBoxCenter.getY()-(inBoxWidth/2),inBoxCenter.getZ()-(inBoxWidth/2)), harmonic(inDevP), - preL2LTransitions(0), - preM2MTransitions(0) { + preL2LTransitions(nullptr), + preM2MTransitions(nullptr) { allocAndInit(); } diff --git a/Src/Kernels/Spherical/FHarmonic.hpp b/Src/Kernels/Spherical/FHarmonic.hpp index 0b3e3aed47a3301c5c30b365d444cd35aa625b1e..f6ecb3086a6f9f0192835a3d537aab25d249cc9d 100755 --- a/Src/Kernels/Spherical/FHarmonic.hpp +++ b/Src/Kernels/Spherical/FHarmonic.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -144,16 +144,16 @@ public: explicit FHarmonic(const int inDevP) : devP(inDevP),expSize(int(((inDevP)+1) * ((inDevP)+2) * 0.5)), nExpSize((inDevP + 1) * (inDevP + 1)), - harmonic(0), cosSin(0), legendre(0), thetaDerivatedResult(0), - sphereHarmoInnerCoef(0), sphereHarmoOuterCoef(0), preExpRedirJ(0) { + harmonic(nullptr), cosSin(nullptr), legendre(nullptr), thetaDerivatedResult(nullptr), + sphereHarmoInnerCoef(nullptr), sphereHarmoOuterCoef(nullptr), preExpRedirJ(nullptr) { allocAndInit(); } FHarmonic(const FHarmonic& other) : devP(other.devP),expSize(other.expSize), nExpSize(other.expSize), - harmonic(0), cosSin(0), legendre(0), thetaDerivatedResult(0), - sphereHarmoInnerCoef(0), sphereHarmoOuterCoef(0), preExpRedirJ(0) { + harmonic(nullptr), cosSin(nullptr), legendre(nullptr), thetaDerivatedResult(nullptr), + sphereHarmoInnerCoef(nullptr), sphereHarmoOuterCoef(nullptr), preExpRedirJ(nullptr) { allocAndInit(); } diff --git a/Src/Kernels/Spherical/FSphericalBlockBlasKernel.hpp b/Src/Kernels/Spherical/FSphericalBlockBlasKernel.hpp index c9ed1026fdeb3bffbedf88c688bbdafb4e049ac2..8217d0574d76918b88901f6fb2a3b4ec5b7d5255 100755 --- a/Src/Kernels/Spherical/FSphericalBlockBlasKernel.hpp +++ b/Src/Kernels/Spherical/FSphericalBlockBlasKernel.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -140,7 +140,7 @@ public: BlockSize(inBlockSize), multipoleMatrix(new FComplexe[inBlockSize * FF_MATRIX_COLUMN_DIM]), localMatrix(new FComplexe[inBlockSize * FF_MATRIX_ROW_DIM]), - preM2LTransitions(0){ + preM2LTransitions(nullptr){ allocAndInit(); } diff --git a/Src/Kernels/Spherical/FSphericalCell.hpp b/Src/Kernels/Spherical/FSphericalCell.hpp index 47f860466a2ac48c5acc8c4bba06286e906c536a..1b6de975fd9be4034788cc67f7799aa762e1fa42 100755 --- a/Src/Kernels/Spherical/FSphericalCell.hpp +++ b/Src/Kernels/Spherical/FSphericalCell.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -61,14 +61,14 @@ public: /** Default constructor */ FSphericalCell() - : multipole_exp(0), local_exp(0){ + : multipole_exp(nullptr), local_exp(nullptr){ multipole_exp = new FComplexe[PoleSize]; local_exp = new FComplexe[LocalSize]; } /** Constructor */ FSphericalCell(const FSphericalCell& other) - : multipole_exp(0), local_exp(0){ + : multipole_exp(nullptr), local_exp(nullptr){ multipole_exp = new FComplexe[PoleSize]; local_exp = new FComplexe[LocalSize]; (*this) = other; diff --git a/Src/Kernels/Spherical/FSphericalKernel.hpp b/Src/Kernels/Spherical/FSphericalKernel.hpp index adeb9a1cf3730a6a7a45c1593d1876ef1929e48a..026e63f13b4126561830c8f4167437af08d2ae50 100755 --- a/Src/Kernels/Spherical/FSphericalKernel.hpp +++ b/Src/Kernels/Spherical/FSphericalKernel.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -76,7 +76,7 @@ public: FSphericalKernel(const int inDevP, const int inTreeHeight, const FReal inBoxWidth, const FPoint& inBoxCenter) : Parent(inDevP, inTreeHeight, inBoxWidth, inBoxCenter), devM2lP(int(((inDevP*2)+1) * ((inDevP*2)+2) * 0.5)), - preM2LTransitions(0) { + preM2LTransitions(nullptr) { allocAndInit(); } diff --git a/Src/Kernels/Uniform/FUnifInterpolator.hpp b/Src/Kernels/Uniform/FUnifInterpolator.hpp index 48304884035c5fd6e225d81686f446f53287dcbf..c2984fab6516711ecbcf860c47a714c4967016f2 100755 --- a/Src/Kernels/Uniform/FUnifInterpolator.hpp +++ b/Src/Kernels/Uniform/FUnifInterpolator.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -427,7 +427,7 @@ inline void FUnifInterpolator<ORDER,MatrixKernelClass>::applyL2P(const FPoint& c const FReal*const positionsY = inParticles->getPositions()[1]; const FReal*const positionsZ = inParticles->getPositions()[2]; - const unsigned int nParticles = inParticles->getNbParticles(); + const int nParticles = inParticles->getNbParticles(); for(int idxPart = 0 ; idxPart < nParticles ; ++ idxPart){ diff --git a/Src/Kernels/Uniform/FUnifM2LHandler.hpp b/Src/Kernels/Uniform/FUnifM2LHandler.hpp index ed021ef96934d6c042eeb3a95440773dd880848d..4ae1537f609a3d05fc2d99bf6223432e14f1a054 100644 --- a/Src/Kernels/Uniform/FUnifM2LHandler.hpp +++ b/Src/Kernels/Uniform/FUnifM2LHandler.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -53,7 +53,7 @@ static void Compute(const MatrixKernelClass *const MatrixKernel, const FReal Cel TensorType::setRoots(FPoint(0.,0.,0.), CellWidth, X); // allocate memory and compute 316 m2l operators - FReal *_C; + FReal *_C; FComplexe *_FC; // reduce storage from nnodes^2=order^6 to (2order-1)^3 @@ -197,7 +197,7 @@ class FUnifM2LHandler<ORDER,HOMOGENEOUS> public: template <typename MatrixKernelClass> FUnifM2LHandler(const MatrixKernelClass *const MatrixKernel, const unsigned int, const FReal) - : FC(NULL), opt_rc(rc/2+1), Dft() + : FC(nullptr), Dft(), opt_rc(rc/2+1) { // init DFT const int steps[dimfft] = {rc}; diff --git a/Src/Utils/FDft.hpp b/Src/Utils/FDft.hpp index ae50fb3d3b9133169053f169292a2af7b596e12e..38227a5ffb8c005413947b8d7039087e891250a4 100644 --- a/Src/Utils/FDft.hpp +++ b/Src/Utils/FDft.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -331,7 +331,7 @@ public: // perform ifft fftw_execute( plan_c2r_ ); - for(unsigned int s=0; s<dim*nsteps_; ++s) + for( int s=0; s<dim*nsteps_; ++s) data_[s]/=nsteps_; // the fft from fftw is not scaled !!!!!!!! // write sampled data diff --git a/Src/Utils/FGenerateDistribution.hpp b/Src/Utils/FGenerateDistribution.hpp index ad4509039755a9a77ef4a3d49872c470263026ef..0effa88cb8eec6ae75ddb49fe01db6515829839f 100644 --- a/Src/Utils/FGenerateDistribution.hpp +++ b/Src/Utils/FGenerateDistribution.hpp @@ -17,7 +17,7 @@ // return drand48(); //} ; void initRandom() { - srand48( static_cast<long int>(time(0))) ; + srand48( static_cast<long int>(time(nullptr))) ; } ; FReal getRandom() { return static_cast<FReal>(drand48()); diff --git a/Src/Utils/FSmartPointer.hpp b/Src/Utils/FSmartPointer.hpp index 71608df9fdcbeca8fb8f6f862840db0e8aa2a609..e6c972b1a77927fa959b3cc3895a3b8642bf600e 100755 --- a/Src/Utils/FSmartPointer.hpp +++ b/Src/Utils/FSmartPointer.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -36,16 +36,16 @@ public: typedef ClassType ValueType; /** Empty constructor */ - FSmartPointer() : pointer(0), counter(0) { + FSmartPointer() : pointer(nullptr), counter(nullptr) { } /** Constructor from the memory pointer */ - FSmartPointer(ClassType* const inPointer) : pointer(0), counter(0) { + FSmartPointer(ClassType* const inPointer) : pointer(nullptr), counter(nullptr) { assign(inPointer); } /** Constructor from a smart pointer */ - FSmartPointer(const FSmartPointer& inPointer) : pointer(0), counter(0) { + FSmartPointer(const FSmartPointer& inPointer) : pointer(nullptr), counter(nullptr) { assign(inPointer); } @@ -91,14 +91,14 @@ public: else if(MemoryType == FSmartPointerMemory) delete pointer; delete counter; } - pointer = 0; - counter = 0; + pointer = nullptr; + counter = nullptr; } } /** To know if the smart pointer is pointing to a memory */ bool isAssigned() const{ - return pointer != 0; + return pointer != nullptr; } /** Is last => counter == 0 */ diff --git a/Src/Utils/FTrace.hpp b/Src/Utils/FTrace.hpp index d814f05ff1ae4c9de6a0a62b306294fe3395f1f1..7429b21fd22ccd1b9b4ad41b6bd8503a88ea6103 100755 --- a/Src/Utils/FTrace.hpp +++ b/Src/Utils/FTrace.hpp @@ -1,5 +1,5 @@ // =================================================================================== -// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner +// Copyright ScalFmm 2011 INRIA // olivier.coulaud@inria.fr, berenger.bramas@inria.fr // This software is a computer program whose purpose is to compute the FMM. // @@ -42,12 +42,12 @@ public: class FRegion { public: - FRegion(const char*, const char*, const char* = 0, const int = 0){} + FRegion(const char*, const char*, const char* = nullptr, const int = 0){} void end(){} }; class FFunction { public: - FFunction(const char*, const char*, const char* = 0, const int = 0){} + FFunction(const char*, const char*, const char* = nullptr, const int = 0){} }; }; diff --git a/Tests/Utils/testChebM2Lprecomputation.cpp b/Tests/Utils/testChebM2Lprecomputation.cpp index 503caf43f822718e8293c10cf2b931bb238d497d..67ab5527585aafc1e8e681db732f745d98bd337c 100755 --- a/Tests/Utils/testChebM2Lprecomputation.cpp +++ b/Tests/Utils/testChebM2Lprecomputation.cpp @@ -1,17 +1,17 @@ // =================================================================================== -// Ce LOGICIEL "ScalFmm" est couvert par le copyright Inria 20xx-2012. -// Inria détient tous les droits de propriété sur le LOGICIEL, et souhaite que -// la communauté scientifique l'utilise afin de le tester et de l'évaluer. -// Inria donne gracieusement le droit d'utiliser ce LOGICIEL. Toute utilisation -// dans un but lucratif ou à des fins commerciales est interdite sauf autorisation -// expresse et préalable d'Inria. -// Toute utilisation hors des limites précisées ci-dessus et réalisée sans l'accord -// expresse préalable d'Inria constituerait donc le délit de contrefaçon. -// Le LOGICIEL étant un produit en cours de développement, Inria ne saurait assurer -// aucune responsabilité et notamment en aucune manière et en aucun cas, être tenu -// de répondre d'éventuels dommages directs ou indirects subits par l'utilisateur. -// Tout utilisateur du LOGICIEL s'engage à communiquer à Inria ses remarques -// relatives à l'usage du LOGICIEL +// Copyright ScalFmm 2011 INRIA +// olivier.coulaud@inria.fr, berenger.bramas@inria.fr +// This software is a computer program whose purpose is to compute the FMM. +// +// This software is governed by the CeCILL-C and LGPL licenses and +// abiding by the rules of distribution of free software. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public and CeCILL-C Licenses for more details. +// "http://www.cecill.info". +// "http://www.gnu.org/licenses". // =================================================================================== // ==== CMAKE ===== @@ -64,7 +64,7 @@ int main(int argc, char* argv[]) /* // allocate memory FReal *Qu, *C, *Qb; - Qu = Qb = C = NULL; + Qu = Qb = C = nullptr; unsigned int ninteractions = 0; //////////////////////////////////////////////// @@ -106,15 +106,15 @@ int main(int argc, char* argv[]) //////////////////////////////////////////////// // free memory - if (C != NULL) delete [] C; - if (Qu != NULL) delete [] Qu; - if (Qb != NULL) delete [] Qb; + if (C != nullptr) delete [] C; + if (Qu != nullptr) delete [] Qu; + if (Qb != nullptr) delete [] Qb; */ //////////////////////////////////////////////// // allocate memory FReal *Qu1, *C1, *Qb1; - Qu1 = Qb1 = C1 = NULL; + Qu1 = Qb1 = C1 = nullptr; //////////////////////////////////////////////// std::cout << "\nAssembly of an " << nnodes << "x" << nnodes << " M2L operator"; time.tic(); @@ -135,7 +135,7 @@ int main(int argc, char* argv[]) //////////////////////////////////////////////// // get a copy C2 of the M2L operator C1 FReal *Qu2, *C2, *Qb2; - Qu2 = Qb2 = C2 = NULL; + Qu2 = Qb2 = C2 = nullptr; C2 = new FReal [nnodes * nnodes]; FBlas::copy(nnodes*nnodes, C1, C2); // Omega_x^{1/2} C2 Omega_y^{1/2} @@ -164,13 +164,13 @@ int main(int argc, char* argv[]) //////////////////////////////////////////////// // free memory - if (C1 != NULL) delete [] C1; - if (Qu1 != NULL) delete [] Qu1; - if (Qb1 != NULL) delete [] Qb1; + if (C1 != nullptr) delete [] C1; + if (Qu1 != nullptr) delete [] Qu1; + if (Qb1 != nullptr) delete [] Qb1; - if (C2 != NULL) delete [] C2; - if (Qu2 != NULL) delete [] Qu2; - if (Qb2 != NULL) delete [] Qb2; + if (C2 != nullptr) delete [] C2; + if (Qu2 != nullptr) delete [] Qu2; + if (Qb2 != nullptr) delete [] Qb2; return 0; diff --git a/Tests/Utils/testChebTensorProduct.cpp b/Tests/Utils/testChebTensorProduct.cpp index a4acfff2810d1485bbef94b3ffb2dc325c6d8ec8..5766e00668989a3a07b406038edeb3de540ad785 100755 --- a/Tests/Utils/testChebTensorProduct.cpp +++ b/Tests/Utils/testChebTensorProduct.cpp @@ -1,17 +1,18 @@ // =================================================================================== -// Ce LOGICIEL "ScalFmm" est couvert par le copyright Inria 20xx-2012. -// Inria détient tous les droits de propriété sur le LOGICIEL, et souhaite que -// la communauté scientifique l'utilise afin de le tester et de l'évaluer. -// Inria donne gracieusement le droit d'utiliser ce LOGICIEL. Toute utilisation -// dans un but lucratif ou à des fins commerciales est interdite sauf autorisation -// expresse et préalable d'Inria. -// Toute utilisation hors des limites précisées ci-dessus et réalisée sans l'accord -// expresse préalable d'Inria constituerait donc le délit de contrefaçon. -// Le LOGICIEL étant un produit en cours de développement, Inria ne saurait assurer -// aucune responsabilité et notamment en aucune manière et en aucun cas, être tenu -// de répondre d'éventuels dommages directs ou indirects subits par l'utilisateur. -// Tout utilisateur du LOGICIEL s'engage à communiquer à Inria ses remarques -// relatives à l'usage du LOGICIEL +// =================================================================================== +// Copyright ScalFmm 2011 INRIA +// olivier.coulaud@inria.fr, berenger.bramas@inria.fr +// This software is a computer program whose purpose is to compute the FMM. +// +// This software is governed by the CeCILL-C and LGPL licenses and +// abiding by the rules of distribution of free software. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public and CeCILL-C Licenses for more details. +// "http://www.cecill.info". +// "http://www.gnu.org/licenses". // =================================================================================== // ==== CMAKE =====