Commit 6f0a20e5 authored by COULAUD Olivier's avatar COULAUD Olivier

Set nullptr to prevent warning (-Wzero-as-null-pointer-constant)

remove warnings  in FFmaGEnericLoader (sign vs unsigned )
parent e83ac238
......@@ -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
#
......
......@@ -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")
......
......@@ -107,7 +107,7 @@ class FListBlockAllocator : public FAbstractBlockAllocator<ObjectClass>{
}
}
return 0;
return nullptr;
}
int isEmpty() const{
......
// ===================================================================================
// 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);
}
......
......@@ -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
......
// ===================================================================================
// 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) );
}
......
// ===================================================================================
// 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){
......
......@@ -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];
......
// ===================================================================================
// 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())
{
......
// ===================================================================================
// 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:
......
......@@ -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;
}
}
}
......
// ===================================================================================
// 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);
......
// ===================================================================================
// 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);
......
......@@ -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 &centerOfBox,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)){
......
// ===================================================================================
// 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;
}
/**
......
......@@ -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) {
}
......
......@@ -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);
}
......
#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 {
......
// ===================================================================================
// 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)
......
......@@ -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;