diff --git a/Src/Arranger/FOctreeArrangerProc.hpp b/Src/Arranger/FOctreeArrangerProc.hpp index cc8f8648e50adb309ba221a7c8df579b5892c9c3..c1cfe4f1044afa1ab2cafdaf6620142abaf508dc 100644 --- a/Src/Arranger/FOctreeArrangerProc.hpp +++ b/Src/Arranger/FOctreeArrangerProc.hpp @@ -135,7 +135,7 @@ public: // send for(int idxProc = 0 ; idxProc < comm.processCount() ; ++idxProc){ if(idxProc != comm.processId() && allcounter[idxProc * comm.processCount() + comm.processId()]){ - FMpi::MpiAssert( MPI_Irecv(&toReceive[indexToReceive[idxProc]], allcounter[idxProc * comm.processCount() + comm.processId()] * sizeof(ParticleClass), MPI_BYTE, + FMpi::MpiAssert( MPI_Irecv(&toReceive[indexToReceive[idxProc]], allcounter[idxProc * comm.processCount() + comm.processId()] * int(sizeof(ParticleClass)), MPI_BYTE, idxProc, 0, comm.getComm(), &requests[iterRequests++]), __LINE__ ); hasToRecvFrom += 1; } @@ -146,7 +146,7 @@ public: // recv for(int idxProc = 0 ; idxProc < comm.processCount() ; ++idxProc){ if(idxProc != comm.processId() && toMove[idxProc].getSize()){ - FMpi::MpiAssert( MPI_Isend(toMove[idxProc].data(), toMove[idxProc].getSize() * sizeof(ParticleClass), MPI_BYTE, + FMpi::MpiAssert( MPI_Isend(toMove[idxProc].data(), toMove[idxProc].getSize() * int(sizeof(ParticleClass)), MPI_BYTE, idxProc, 0, comm.getComm(), &requests[iterRequests++]), __LINE__ ); } } diff --git a/Src/Containers/FOctree.hpp b/Src/Containers/FOctree.hpp index 45dbfa8a7a183c5bd40449a3268623b657811802..bdd3cbe9368d85489894b538856218029396cc31 100644 --- a/Src/Containers/FOctree.hpp +++ b/Src/Containers/FOctree.hpp @@ -75,10 +75,10 @@ class FOctree : protected FAssertable { * @param inRelativePosition a position from the corner of the box * @return the box num at the leaf level that contains inRelativePosition */ - long getTreeCoordinate(const FReal inRelativePosition) const { + int getTreeCoordinate(const FReal inRelativePosition) const { FDEBUG( fassert(inRelativePosition >= 0 && inRelativePosition < this->boxWidth, "Particle out of box", __LINE__, __FILE__) ); const FReal indexFReal = inRelativePosition / this->boxWidthAtLevel[this->leafIndex]; - const long index = long(FMath::dfloor(indexFReal)); + const int index = int(FMath::dfloor(indexFReal)); if( index && FMath::LookEqual(inRelativePosition, this->boxWidthAtLevel[this->leafIndex] * FReal(index) ) ){ return index - 1; } @@ -203,14 +203,14 @@ public: class Iterator : protected FAssertable { SubOctreeTypes current; //< Current suboctree - long currentLocalIndex; //< Current index (array position) in the current_suboctree.cells[ currentLocalLevel ] + int currentLocalIndex; //< Current index (array position) in the current_suboctree.cells[ currentLocalLevel ] int currentLocalLevel; //< Current level in the current suboctree /** * To know what is the left limit on the current level on the current subtree * @retrun suboctree.left_limit >> 3 * diff(leaf_index, current_index). */ - static long TransposeIndex(const long indexInLeafLevel, const int distanceFromLeafLevel) { + static int TransposeIndex(const int indexInLeafLevel, const int distanceFromLeafLevel) { return indexInLeafLevel >> (3 * distanceFromLeafLevel); } @@ -368,8 +368,8 @@ public: bool moveRight(){ // Function variables SubOctreeTypes workingTree = this->current; // To cover parent other sub octre - long workingLevel = this->currentLocalLevel; // To know where we are - long workingIndex = this->currentLocalIndex; // To know where we are + int workingLevel = this->currentLocalLevel; // To know where we are + int workingIndex = this->currentLocalIndex; // To know where we are // -- First we have to go in a tree where we can move on the right -- // Number of time we go into parent subtree @@ -396,7 +396,7 @@ public: // While we are not on a allocated cell while( true ){ // Test element on the right (test brothers) - const long rightLimite = (workingIndex | 7) + 1; + const int rightLimite = (workingIndex | 7) + 1; while( workingIndex < rightLimite && !workingTree.tree->cellsAt(workingLevel)[workingIndex]){ ++workingIndex; } @@ -417,7 +417,7 @@ public: while( workingLevel != objectiveLevel ){ ++workingLevel; workingIndex <<= 3; - const long rightLimite = (workingIndex | 7); // not + 1 because if the 7th first are null it must be the 8th! + const int rightLimite = (workingIndex | 7); // not + 1 because if the 7th first are null it must be the 8th! while( workingIndex < rightLimite && !workingTree.tree->cellsAt(workingLevel)[workingIndex]){ ++workingIndex; } @@ -654,19 +654,19 @@ public: FTreeCoordinate center; center.setPositionFromMorton(inIndex, inLevel); - const long limite = FMath::pow(2,inLevel); + const int limite = FMath::pow(2,inLevel); int idxNeighbors = 0; // We test all cells around - for(long idxX = -1 ; idxX <= 1 ; ++idxX){ - if(!FMath::Between(center.getX() + idxX,0l,limite)) continue; + for(int idxX = -1 ; idxX <= 1 ; ++idxX){ + if(!FMath::Between(center.getX() + idxX,0,limite)) continue; - for(long idxY = -1 ; idxY <= 1 ; ++idxY){ - if(!FMath::Between(center.getY() + idxY,0l,limite)) continue; + for(int idxY = -1 ; idxY <= 1 ; ++idxY){ + if(!FMath::Between(center.getY() + idxY,0,limite)) continue; - for(long idxZ = -1 ; idxZ <= 1 ; ++idxZ){ - if(!FMath::Between(center.getZ() + idxZ,0l,limite)) continue; + for(int idxZ = -1 ; idxZ <= 1 ; ++idxZ){ + if(!FMath::Between(center.getZ() + idxZ,0,limite)) continue; // if we are not on the current cell if( !(!idxX && !idxY && !idxZ) ){ @@ -738,18 +738,18 @@ public: const FTreeCoordinate parentCell(workingCell.getX()>>1,workingCell.getY()>>1,workingCell.getZ()>>1); // Limite at parent level number of box (split by 2 by level) - const long limite = FMath::pow(2,inLevel-1); + const int limite = FMath::pow(2,inLevel-1); int idxNeighbors = 0; // We test all cells around - for(long idxX = -1 ; idxX <= 1 ; ++idxX){ - if(!FMath::Between(parentCell.getX() + idxX,0l,limite)) continue; + for(int idxX = -1 ; idxX <= 1 ; ++idxX){ + if(!FMath::Between(parentCell.getX() + idxX,0,limite)) continue; - for(long idxY = -1 ; idxY <= 1 ; ++idxY){ - if(!FMath::Between(parentCell.getY() + idxY,0l,limite)) continue; + for(int idxY = -1 ; idxY <= 1 ; ++idxY){ + if(!FMath::Between(parentCell.getY() + idxY,0,limite)) continue; - for(long idxZ = -1 ; idxZ <= 1 ; ++idxZ){ - if(!FMath::Between(parentCell.getZ() + idxZ,0l,limite)) continue; + for(int idxZ = -1 ; idxZ <= 1 ; ++idxZ){ + if(!FMath::Between(parentCell.getZ() + idxZ,0,limite)) continue; // if we are not on the current cell if( idxX || idxY || idxZ ){ @@ -808,14 +808,14 @@ public: const FTreeCoordinate parentCell(workingCell.getX()>>1,workingCell.getY()>>1,workingCell.getZ()>>1); // Limite at parent level number of box (split by 2 by level) - const long limite = FMath::pow(2,inLevel-1); + const int limite = FMath::pow(2,inLevel-1); int idxNeighbors = 0; // We test all cells around - for(long idxX = -1 ; idxX <= 1 ; ++idxX){ - for(long idxY = -1 ; idxY <= 1 ; ++idxY){ - for(long idxZ = -1 ; idxZ <= 1 ; ++idxZ){ + for(int idxX = -1 ; idxX <= 1 ; ++idxX){ + for(int idxY = -1 ; idxY <= 1 ; ++idxY){ + for(int idxZ = -1 ; idxZ <= 1 ; ++idxZ){ // if we are not on the current cell if( idxX || idxY || idxZ ){ @@ -918,19 +918,19 @@ public: FTreeCoordinate center; center.setPositionFromMorton(inIndex, inLevel); - const long limite = FMath::pow(2,inLevel); + const int limite = FMath::pow(2,inLevel); int idxNeighbors = 0; // We test all cells around - for(long idxX = -1 ; idxX <= 1 ; ++idxX){ - if(!FMath::Between(center.getX() + idxX,0l,limite)) continue; + for(int idxX = -1 ; idxX <= 1 ; ++idxX){ + if(!FMath::Between(center.getX() + idxX,0,limite)) continue; - for(long idxY = -1 ; idxY <= 1 ; ++idxY){ - if(!FMath::Between(center.getY() + idxY,0l,limite)) continue; + for(int idxY = -1 ; idxY <= 1 ; ++idxY){ + if(!FMath::Between(center.getY() + idxY,0,limite)) continue; - for(long idxZ = -1 ; idxZ <= 1 ; ++idxZ){ - if(!FMath::Between(center.getZ() + idxZ,0l,limite)) continue; + for(int idxZ = -1 ; idxZ <= 1 ; ++idxZ){ + if(!FMath::Between(center.getZ() + idxZ,0,limite)) continue; // if we are not on the current cell if( idxX || idxY || idxZ ){ @@ -961,16 +961,16 @@ public: FTreeCoordinate center; center.setPositionFromMorton(inIndex, inLevel); - const long limite = FMath::pow(2,inLevel); + const int limite = FMath::pow(2,inLevel); int idxNeighbors = 0; // We test all cells around - for(long idxX = -1 ; idxX <= 1 ; ++idxX){ + for(int idxX = -1 ; idxX <= 1 ; ++idxX){ - for(long idxY = -1 ; idxY <= 1 ; ++idxY){ + for(int idxY = -1 ; idxY <= 1 ; ++idxY){ - for(long idxZ = -1 ; idxZ <= 1 ; ++idxZ){ + for(int idxZ = -1 ; idxZ <= 1 ; ++idxZ){ // if we are not on the current cell if( idxX || idxY || idxZ ){ diff --git a/Src/Containers/FSubOctree.hpp b/Src/Containers/FSubOctree.hpp index 989ab476ef8c118f0ed151120c206b36256a665c..9f691bd89617fe725eaa838158be4bdb2218e0b1 100644 --- a/Src/Containers/FSubOctree.hpp +++ b/Src/Containers/FSubOctree.hpp @@ -39,10 +39,10 @@ protected: CellClass*** cells; //< Potential cells, cells are allocated only if needed FAbstractSubOctree* const parent; //< Parent suboctree (null for root) - const long indexInParent; //< This is the index of the current octree in the parent's array + const int indexInParent; //< This is the index of the current octree in the parent's array - long leftLeafIndex; //< The leaf at the left position (this is the array index to start when iterate) - long rightLeafIndex; //< The leaf at the right position (this is the last array index when iterate) + int leftLeafIndex; //< The leaf at the left position (this is the array index to start when iterate) + int rightLeafIndex; //< The leaf at the right position (this is the last array index when iterate) const int subOctreeHeight; //< Height of this suboctree const int subOctreePosition; //< Level of the current suboctree in the global tree (0 if node) @@ -107,7 +107,7 @@ protected: * for example it updates the leaf array marges and calls createPreviousCells() * @param arrayIndex the position of the new leaf in the leafs array */ - void newLeafInserted(const long arrayIndex, const MortonIndex inLeafCellIndex, const FTreeCoordinate& host, const FReal* const inBoxWidthAtLevel){ + void newLeafInserted(const int arrayIndex, const MortonIndex inLeafCellIndex, const FTreeCoordinate& host, const FReal* const inBoxWidthAtLevel){ createPreviousCells(arrayIndex,inLeafCellIndex, host, inBoxWidthAtLevel); // Update if this is the bottom left if(arrayIndex < this->leftLeafIndex) this->leftLeafIndex = arrayIndex; @@ -120,7 +120,7 @@ protected: * this cell too and go upper, etc. * @return true if there is no more cells in this tree */ - bool removeCellsFromLeaf( long arrayIndex ){ + bool removeCellsFromLeaf( int arrayIndex ){ // last array index int indexLevel = this->subOctreeHeight - 1; @@ -172,7 +172,7 @@ public: * @param inSubOctreeHeight Height of this suboctree * @param inSubOctreePosition Level of the current suboctree in the global tree (1 if upper tree) */ - FAbstractSubOctree(FAbstractSubOctree* const inParent, const long inIndexInParent, + 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), subOctreeHeight( inSubOctreeHeight ), subOctreePosition( inSubOctreePosition ), isLeafSubtree(inIsLeafSubtree) { @@ -181,7 +181,7 @@ public: fassert(this->cells, "Allocation failled", __LINE__, __FILE__); // We start at a sub-level - 8^1 - long cellsAtlevel = 8; + int cellsAtlevel = 8; for( int indexLevel = 0 ; indexLevel < this->subOctreeHeight ; ++indexLevel ){ this->cells[indexLevel] = new CellClass*[cellsAtlevel]; fassert(this->cells[indexLevel], "Allocation failled", __LINE__, __FILE__); @@ -199,11 +199,11 @@ public: * Delete cells arrays and allocated cells */ virtual ~FAbstractSubOctree(){ - long mostRight = rightLeafIndex; - long mostLeft = leftLeafIndex; + int mostRight = rightLeafIndex; + int mostLeft = leftLeafIndex; for( int indexLevel = this->subOctreeHeight - 1 ; indexLevel >= 0 ; --indexLevel ){ - for( long indexCells = mostLeft ; indexCells <= mostRight ; ++indexCells ){ + for( int indexCells = mostLeft ; indexCells <= mostRight ; ++indexCells ){ if(this->cells[indexLevel][indexCells]){ //delete this->cells[indexLevel][indexCells]; } @@ -251,14 +251,14 @@ public: /** Return the more left leaf index * the smallest index on the leafs array * @return leftLeafIndex */ - long getLeftLeafIndex() const { + int getLeftLeafIndex() const { return leftLeafIndex; } /** Return the more right leaf index * the biggest index on the leafs array * @return rightLeafIndex */ - long getRightLeafIndex() const { + int getRightLeafIndex() const { return rightLeafIndex; } @@ -292,7 +292,7 @@ public: * This index can is part of the morton index of the cells contains * in this suboctree * @return indexInParent */ - long getIndexInParent() const{ + int getIndexInParent() const{ return indexInParent; } @@ -341,16 +341,16 @@ public: * @param inSubOctreeHeight Height of this suboctree * @param inSubOctreePosition Level of the current suboctree in the global tree (1 if upper tree) */ - FSubOctreeWithLeafs(FAbstractSubOctree<ParticleClass,CellClass,ContainerClass,LeafClass>* const inParent, const long inIndexInParent, + FSubOctreeWithLeafs(FAbstractSubOctree<ParticleClass,CellClass,ContainerClass,LeafClass>* const inParent, const int inIndexInParent, const int inSubOctreeHeight, const int inSubOctreePosition) : FAbstractSubOctree<ParticleClass,CellClass,ContainerClass,LeafClass>(inParent, inIndexInParent, inSubOctreeHeight, inSubOctreePosition, true) { - const long cellsAtLeafLevel = 1 << (3 * inSubOctreeHeight); + const int cellsAtLeafLevel = 1 << (3 * inSubOctreeHeight); this->leafs = new LeafClass*[cellsAtLeafLevel]; fassert(this->leafs, "Allocation failled", __LINE__, __FILE__); - for( long indexLeaf = 0 ; indexLeaf < cellsAtLeafLevel ; ++indexLeaf ){ + for( int indexLeaf = 0 ; indexLeaf < cellsAtLeafLevel ; ++indexLeaf ){ this->leafs[indexLeaf] = 0; } } @@ -378,7 +378,7 @@ public: if( !this->leafs[arrayIndex] ){ this->leafs[arrayIndex] = new LeafClass(); - FAbstractSubOctree<ParticleClass,CellClass,ContainerClass,LeafClass>::newLeafInserted( long(arrayIndex) , index, host, inBoxWidthAtLevel); + FAbstractSubOctree<ParticleClass,CellClass,ContainerClass,LeafClass>::newLeafInserted( int(arrayIndex) , index, host, inBoxWidthAtLevel); } // add particle to leaf list this->leafs[arrayIndex]->push(inParticle); @@ -395,7 +395,7 @@ public: delete this->leafs[arrayIndex]; this->leafs[arrayIndex] = 0; - return FAbstractSubOctree<ParticleClass,CellClass,ContainerClass,LeafClass>::removeCellsFromLeaf( long(arrayIndex) ); + return FAbstractSubOctree<ParticleClass,CellClass,ContainerClass,LeafClass>::removeCellsFromLeaf( int(arrayIndex) ); } return false; } @@ -473,11 +473,11 @@ public: * @param inSubOctreeHeight Height of this suboctree * @param inSubOctreePosition Level of the current suboctree in the global tree (0 if upper tree) */ - FSubOctree(FAbstractSubOctree<ParticleClass,CellClass,ContainerClass,LeafClass>* const inParent, const long inIndexInParent, + FSubOctree(FAbstractSubOctree<ParticleClass,CellClass,ContainerClass,LeafClass>* const inParent, const int inIndexInParent, const int inSubOctreeHeight, const int inSubOctreePosition) : FAbstractSubOctree<ParticleClass,CellClass,ContainerClass,LeafClass>(inParent, inIndexInParent, inSubOctreeHeight, inSubOctreePosition, false) { - const long cellsAtLeafLevel = 1 << (3 * inSubOctreeHeight); + const int cellsAtLeafLevel = 1 << (3 * inSubOctreeHeight); this->subleafs = new FAbstractSubOctree<ParticleClass,CellClass,ContainerClass,LeafClass>*[cellsAtLeafLevel]; fassert(this->subleafs, "Allocation failled", __LINE__, __FILE__); @@ -490,7 +490,7 @@ public: * Destructor dealloc all suboctrees leafs & leafs array */ virtual ~FSubOctree(){ - const long cellsAtLeafLevel = 1 << (3 * this->subOctreeHeight); + const int cellsAtLeafLevel = 1 << (3 * this->subOctreeHeight); for( int indexLeaf = 0 ; indexLeaf < cellsAtLeafLevel ; ++indexLeaf ){ if(this->subleafs[indexLeaf]) delete this->subleafs[indexLeaf]; } @@ -512,11 +512,11 @@ public: // Next suboctree is a middle suboctree if(inTreeHeight > nextSubOctreeHeight + nextSubOctreePosition){ - this->subleafs[arrayIndex] = new FSubOctree(this,long(arrayIndex),nextSubOctreeHeight,nextSubOctreePosition); + this->subleafs[arrayIndex] = new FSubOctree(this,int(arrayIndex),nextSubOctreeHeight,nextSubOctreePosition); } // Or next suboctree contains the reail leaf! else{ - this->subleafs[arrayIndex] = new FSubOctreeWithLeafs<ParticleClass,CellClass,ContainerClass,LeafClass>(this,long(arrayIndex),nextSubOctreeHeight,nextSubOctreePosition); + this->subleafs[arrayIndex] = new FSubOctreeWithLeafs<ParticleClass,CellClass,ContainerClass,LeafClass>(this,int(arrayIndex),nextSubOctreeHeight,nextSubOctreePosition); } const FTreeCoordinate hostAtLevel( @@ -525,7 +525,7 @@ public: host.getZ() >> (inTreeHeight - nextSubOctreePosition )); // We need to inform parent class - FAbstractSubOctree<ParticleClass,CellClass,ContainerClass,LeafClass>::newLeafInserted( long(arrayIndex), index >> (3 * (inTreeHeight-nextSubOctreePosition) ), hostAtLevel, inBoxWidthAtLevel); + FAbstractSubOctree<ParticleClass,CellClass,ContainerClass,LeafClass>::newLeafInserted( int(arrayIndex), index >> (3 * (inTreeHeight-nextSubOctreePosition) ), hostAtLevel, inBoxWidthAtLevel); } // Ask next suboctree to insert the particle this->subleafs[arrayIndex]->insert( index, host, inParticle, inTreeHeight, inBoxWidthAtLevel); @@ -542,7 +542,7 @@ public: delete this->subleafs[arrayIndex]; this->subleafs[arrayIndex] = 0; - return FAbstractSubOctree<ParticleClass,CellClass,ContainerClass,LeafClass>::removeCellsFromLeaf( long(arrayIndex) ); + return FAbstractSubOctree<ParticleClass,CellClass,ContainerClass,LeafClass>::removeCellsFromLeaf( int(arrayIndex) ); } return false; } diff --git a/Src/Containers/FTreeCoordinate.hpp b/Src/Containers/FTreeCoordinate.hpp index 261c8afe4d5287861e4806df09078fad06d11c67..7641d6db472febc7f7626d38084e589550320e28 100644 --- a/Src/Containers/FTreeCoordinate.hpp +++ b/Src/Containers/FTreeCoordinate.hpp @@ -15,9 +15,9 @@ */ class FTreeCoordinate{ private: - long x; //< x box-th position - long y; //< y box-th position - long z; //< z box-th position + int x; //< x box-th position + int y; //< y box-th position + int z; //< z box-th position public: /** Default constructor (position = {0,0,0})*/ @@ -30,7 +30,7 @@ public: * @param inY the y * @param inZ the z */ - explicit FTreeCoordinate(const long inX,const long inY,const long inZ) + explicit FTreeCoordinate(const int inX,const int inY,const int inZ) : x(inX), y(inY), z(inZ){ } @@ -67,7 +67,7 @@ public: * @param inY the new y * @param inZ the new z */ - void setPosition(const long inX,const long inY,const long inZ){ + void setPosition(const int inX,const int inY,const int inZ){ this->x = inX; this->y = inY; this->z = inZ; @@ -77,7 +77,7 @@ public: * X Getter * @return this->x */ - long getX() const{ + int getX() const{ return this->x; } @@ -85,7 +85,7 @@ public: * Y Getter * @return this->y */ - long getY() const{ + int getY() const{ return this->y; } @@ -93,7 +93,7 @@ public: * Z Getter * @return this->z */ - long getZ() const{ + int getZ() const{ return this->z; } @@ -101,7 +101,7 @@ public: * X Setter, simply change x position * @param the new x */ - void setX(const long inX){ + void setX(const int inX){ this->x = inX; } @@ -109,7 +109,7 @@ public: * Y Setter, simply change y position * @param the new y */ - void setY(const long inY){ + void setY(const int inY){ this->y = inY; } @@ -117,7 +117,7 @@ public: * Z Setter, simply change z position * @param the new z */ - void setZ(const long inZ){ + void setZ(const int inZ){ this->z = inZ; } @@ -163,11 +163,11 @@ public: this->z = 0; for(int indexLevel = 0; indexLevel < inLevel ; ++indexLevel){ - z |= long(inIndex & mask); + z |= int(inIndex & mask); inIndex >>= 1; - y |= long(inIndex & mask); + y |= int(inIndex & mask); inIndex >>= 1; - x |= long(inIndex & mask); + x |= int(inIndex & mask); mask <<= 1; } diff --git a/Src/Core/FFmmAlgorithmThreadProc.hpp b/Src/Core/FFmmAlgorithmThreadProc.hpp index 74e0640fdf6b73706c3a6c2139308d931c7458d2..71219fba6da9d3cf4a3defed34fe1fca2fb570e4 100644 --- a/Src/Core/FFmmAlgorithmThreadProc.hpp +++ b/Src/Core/FFmmAlgorithmThreadProc.hpp @@ -162,8 +162,8 @@ public: } // We get the min/max indexes from each procs - FMpi::MpiAssert( MPI_Allgather( myIntervals, sizeof(Interval) * OctreeHeight, MPI_BYTE, - workingIntervalsPerLevel, sizeof(Interval) * OctreeHeight, MPI_BYTE, MPI_COMM_WORLD), __LINE__ ); + FMpi::MpiAssert( MPI_Allgather( myIntervals, int(sizeof(Interval)) * OctreeHeight, MPI_BYTE, + workingIntervalsPerLevel, int(sizeof(Interval)) * OctreeHeight, MPI_BYTE, MPI_COMM_WORLD), __LINE__ ); } // run; @@ -578,7 +578,7 @@ private: toSend[idxLevel * nbProcess + idxProc][idxLeaf].getCurrentCell()->serializeUp(sendBuffer[idxLevel * nbProcess + idxProc][idxLeaf].data); } - FMpi::MpiAssert( MPI_Isend( sendBuffer[idxLevel * nbProcess + idxProc], toSendAtProcAtLevel * sizeof(CellToSend) , MPI_BYTE , + FMpi::MpiAssert( MPI_Isend( sendBuffer[idxLevel * nbProcess + idxProc], toSendAtProcAtLevel * int(sizeof(CellToSend)) , MPI_BYTE , idxProc, FMpi::TagLast + idxLevel, MPI_COMM_WORLD, &requests[iterRequest++]) , __LINE__ ); } @@ -586,7 +586,7 @@ private: if(toReceiveFromProcAtLevel){ recvBuffer[idxLevel * nbProcess + idxProc] = new CellToSend[toReceiveFromProcAtLevel]; - FMpi::MpiAssert( MPI_Irecv(recvBuffer[idxLevel * nbProcess + idxProc], toReceiveFromProcAtLevel * sizeof(CellToSend), MPI_BYTE, + FMpi::MpiAssert( MPI_Irecv(recvBuffer[idxLevel * nbProcess + idxProc], toReceiveFromProcAtLevel * int(sizeof(CellToSend)), MPI_BYTE, idxProc, FMpi::TagLast + idxLevel, MPI_COMM_WORLD, &requests[iterRequest++]) , __LINE__ ); } } @@ -919,7 +919,7 @@ private: } // Box limite - const long limite = 1 << (this->OctreeHeight - 1); + const int limite = 1 << (this->OctreeHeight - 1); // pointer to send typename OctreeClass::Iterator* toSend[nbProcess]; memset(toSend, 0, sizeof(typename OctreeClass::Iterator*) * nbProcess ); @@ -993,7 +993,7 @@ private: if(globalReceiveMap[idxProc * nbProcess + idProcess]){ recvBuffer[idxProc] = reinterpret_cast<ParticleClass*>(new char[sizeof(ParticleClass) * globalReceiveMap[idxProc * nbProcess + idProcess]]); - FMpi::MpiAssert( MPI_Irecv(recvBuffer[idxProc], globalReceiveMap[idxProc * nbProcess + idProcess]*sizeof(ParticleClass), MPI_BYTE, + FMpi::MpiAssert( MPI_Irecv(recvBuffer[idxProc], globalReceiveMap[idxProc * nbProcess + idProcess]*int(sizeof(ParticleClass)), MPI_BYTE, idxProc, FMpi::TagFmmP2P, MPI_COMM_WORLD, &requests[iterRequest++]) , __LINE__ ); } } @@ -1010,7 +1010,7 @@ private: currentIndex += toSend[idxProc][idxLeaf].getCurrentListSrc()->getSize(); } - FMpi::MpiAssert( MPI_Isend( sendBuffer[idxProc], sizeof(ParticleClass) * partsToSend[idxProc] , MPI_BYTE , + FMpi::MpiAssert( MPI_Isend( sendBuffer[idxProc], int(sizeof(ParticleClass)) * partsToSend[idxProc] , MPI_BYTE , idxProc, FMpi::TagFmmP2P, MPI_COMM_WORLD, &requests[iterRequest++]) , __LINE__ ); } @@ -1174,7 +1174,7 @@ private: MortonIndex neighborsIndex[26]; int previous = 0; // Box limite - const long limite = 1 << (this->OctreeHeight - 1); + const int limite = 1 << (this->OctreeHeight - 1); for(int idxShape = 0 ; idxShape < SizeShape ; ++idxShape){ const int endAtThisShape = shapeLeaf[idxShape] + previous; @@ -1232,19 +1232,19 @@ private: } - int getNeighborsIndexes(const MortonIndex centerIndex, const long limite, MortonIndex indexes[26]) const{ + int getNeighborsIndexes(const MortonIndex centerIndex, const int limite, MortonIndex indexes[26]) const{ FTreeCoordinate center; center.setPositionFromMorton(centerIndex, OctreeHeight - 1); int idxNeig = 0; // We test all cells around - for(long idxX = -1 ; idxX <= 1 ; ++idxX){ - if(!FMath::Between(center.getX() + idxX,0l, limite)) continue; + for(int idxX = -1 ; idxX <= 1 ; ++idxX){ + if(!FMath::Between(center.getX() + idxX,0, limite)) continue; - for(long idxY = -1 ; idxY <= 1 ; ++idxY){ - if(!FMath::Between(center.getY() + idxY,0l, limite)) continue; + for(int idxY = -1 ; idxY <= 1 ; ++idxY){ + if(!FMath::Between(center.getY() + idxY,0, limite)) continue; - for(long idxZ = -1 ; idxZ <= 1 ; ++idxZ){ - if(!FMath::Between(center.getZ() + idxZ,0l, limite)) continue; + for(int idxZ = -1 ; idxZ <= 1 ; ++idxZ){ + if(!FMath::Between(center.getZ() + idxZ,0, limite)) continue; // if we are not on the current cell if( idxX || idxY || idxZ ){ @@ -1264,18 +1264,18 @@ private: const FTreeCoordinate parentCell(workingCell.getX()>>1,workingCell.getY()>>1,workingCell.getZ()>>1); // Limite at parent level number of box (split by 2 by level) - const long limite = FMath::pow(2,inLevel-1); + const int limite = FMath::pow(2,inLevel-1); int idxNeighbors = 0; // We test all cells around - for(long idxX = -1 ; idxX <= 1 ; ++idxX){ - if(!FMath::Between(parentCell.getX() + idxX,0l,limite)) continue; + for(int idxX = -1 ; idxX <= 1 ; ++idxX){ + if(!FMath::Between(parentCell.getX() + idxX,0,limite)) continue; - for(long idxY = -1 ; idxY <= 1 ; ++idxY){ - if(!FMath::Between(parentCell.getY() + idxY,0l,limite)) continue; + for(int idxY = -1 ; idxY <= 1 ; ++idxY){ + if(!FMath::Between(parentCell.getY() + idxY,0,limite)) continue; - for(long idxZ = -1 ; idxZ <= 1 ; ++idxZ){ - if(!FMath::Between(parentCell.getZ() + idxZ,0l,limite)) continue; + for(int idxZ = -1 ; idxZ <= 1 ; ++idxZ){ + if(!FMath::Between(parentCell.getZ() + idxZ,0,limite)) continue; // if we are not on the current cell if( idxX || idxY || idxZ ){ diff --git a/Src/Core/FFmmAlgorithmThreadProcPeriodic.hpp b/Src/Core/FFmmAlgorithmThreadProcPeriodic.hpp index aa69fb6a5576cd5dc766f68fa274e72be237717e..8a1e7e7d59cde13d1ae3fac7cb6770681748ddc9 100644 --- a/Src/Core/FFmmAlgorithmThreadProcPeriodic.hpp +++ b/Src/Core/FFmmAlgorithmThreadProcPeriodic.hpp @@ -166,8 +166,8 @@ public: } // We get the min/max indexes from each procs - FMpi::MpiAssert( MPI_Allgather( myIntervals, sizeof(Interval) * OctreeHeight, MPI_BYTE, - workingIntervalsPerLevel, sizeof(Interval) * OctreeHeight, MPI_BYTE, MPI_COMM_WORLD), __LINE__ ); + FMpi::MpiAssert( MPI_Allgather( myIntervals, int(sizeof(Interval)) * OctreeHeight, MPI_BYTE, + workingIntervalsPerLevel, int(sizeof(Interval)) * OctreeHeight, MPI_BYTE, MPI_COMM_WORLD), __LINE__ ); } // run; @@ -654,7 +654,7 @@ private: toSend[idxLevel * nbProcess + idxProc][idxLeaf].getCurrentCell()->serializeUp(sendBuffer[idxLevel * nbProcess + idxProc][idxLeaf].data); } - FMpi::MpiAssert( MPI_Isend( sendBuffer[idxLevel * nbProcess + idxProc], toSendAtProcAtLevel * sizeof(CellToSend) , MPI_BYTE , + FMpi::MpiAssert( MPI_Isend( sendBuffer[idxLevel * nbProcess + idxProc], toSendAtProcAtLevel * int(sizeof(CellToSend)) , MPI_BYTE , idxProc, FMpi::TagLast + idxLevel, MPI_COMM_WORLD, &requests[iterRequest++]) , __LINE__ ); } @@ -662,7 +662,7 @@ private: if(toReceiveFromProcAtLevel){ recvBuffer[idxLevel * nbProcess + idxProc] = new CellToSend[toReceiveFromProcAtLevel]; - FMpi::MpiAssert( MPI_Irecv(recvBuffer[idxLevel * nbProcess + idxProc], toReceiveFromProcAtLevel * sizeof(CellToSend), MPI_BYTE, + FMpi::MpiAssert( MPI_Irecv(recvBuffer[idxLevel * nbProcess + idxProc], toReceiveFromProcAtLevel * int(sizeof(CellToSend)), MPI_BYTE, idxProc, FMpi::TagLast + idxLevel, MPI_COMM_WORLD, &requests[iterRequest++]) , __LINE__ ); } } @@ -1002,7 +1002,7 @@ private: } // Box limite - const long limite = 1 << (this->OctreeHeight - 1); + const int limite = 1 << (this->OctreeHeight - 1); // pointer to send typename OctreeClass::Iterator* toSend[nbProcess]; memset(toSend, 0, sizeof(typename OctreeClass::Iterator*) * nbProcess ); @@ -1075,7 +1075,7 @@ private: if(globalReceiveMap[idxProc * nbProcess + idProcess]){ recvBuffer[idxProc] = reinterpret_cast<ParticleClass*>(new char[sizeof(ParticleClass) * globalReceiveMap[idxProc * nbProcess + idProcess]]); - FMpi::MpiAssert( MPI_Irecv(recvBuffer[idxProc], globalReceiveMap[idxProc * nbProcess + idProcess]*sizeof(ParticleClass), MPI_BYTE, + FMpi::MpiAssert( MPI_Irecv(recvBuffer[idxProc], globalReceiveMap[idxProc * nbProcess + idProcess]*int(sizeof(ParticleClass)), MPI_BYTE, idxProc, FMpi::TagFmmP2P, MPI_COMM_WORLD, &requests[iterRequest++]) , __LINE__ ); } } @@ -1092,7 +1092,7 @@ private: currentIndex += toSend[idxProc][idxLeaf].getCurrentListSrc()->getSize(); } - FMpi::MpiAssert( MPI_Isend( sendBuffer[idxProc], sizeof(ParticleClass) * partsToSend[idxProc] , MPI_BYTE , + FMpi::MpiAssert( MPI_Isend( sendBuffer[idxProc], int(sizeof(ParticleClass)) * partsToSend[idxProc] , MPI_BYTE , idxProc, FMpi::TagFmmP2P, MPI_COMM_WORLD, &requests[iterRequest++]) , __LINE__ ); } @@ -1256,7 +1256,7 @@ private: //MortonIndex neighborsIndex[26]; int previous = 0; // Box limite - const long limite = 1 << (this->OctreeHeight - 1); + const int limite = 1 << (this->OctreeHeight - 1); for(int idxShape = 0 ; idxShape < SizeShape ; ++idxShape){ const int endAtThisShape = shapeLeaf[idxShape] + previous; @@ -1323,22 +1323,22 @@ private: } - int getNeighborsIndexes(const MortonIndex centerIndex, const long limite, MortonIndex indexes[26]) const{ + int getNeighborsIndexes(const MortonIndex centerIndex, const int limite, MortonIndex indexes[26]) const{ FTreeCoordinate relativePositions[26]; return getNeighborsIndexes(centerIndex, limite, indexes, relativePositions); } - int getNeighborsIndexes(const MortonIndex centerIndex, const long limite, MortonIndex indexes[26], FTreeCoordinate inRelativePositions[26]) const{ + int getNeighborsIndexes(const MortonIndex centerIndex, const int limite, MortonIndex indexes[26], FTreeCoordinate inRelativePositions[26]) const{ FTreeCoordinate center; center.setPositionFromMorton(centerIndex, OctreeHeight - 1); int idxNeig = 0; // We test all cells around - for(long idxX = -1 ; idxX <= 1 ; ++idxX){ + for(int idxX = -1 ; idxX <= 1 ; ++idxX){ - for(long idxY = -1 ; idxY <= 1 ; ++idxY){ + for(int idxY = -1 ; idxY <= 1 ; ++idxY){ - for(long idxZ = -1 ; idxZ <= 1 ; ++idxZ){ + for(int idxZ = -1 ; idxZ <= 1 ; ++idxZ){ // if we are not on the current cell if( idxX || idxY || idxZ ){ FTreeCoordinate other(center.getX() + idxX,center.getY() + idxY,center.getZ() + idxZ); @@ -1374,13 +1374,13 @@ private: const FTreeCoordinate parentCell(workingCell.getX()>>1,workingCell.getY()>>1,workingCell.getZ()>>1); // Limite at parent level number of box (split by 2 by level) - const long limite = FMath::pow(2,inLevel-1); + const int limite = FMath::pow(2,inLevel-1); int idxNeighbors = 0; // We test all cells around - for(long idxX = -1 ; idxX <= 1 ; ++idxX){ - for(long idxY = -1 ; idxY <= 1 ; ++idxY){ - for(long idxZ = -1 ; idxZ <= 1 ; ++idxZ){ + for(int idxX = -1 ; idxX <= 1 ; ++idxX){ + for(int idxY = -1 ; idxY <= 1 ; ++idxY){ + for(int idxZ = -1 ; idxZ <= 1 ; ++idxZ){ // if we are not on the current cell if( idxX || idxY || idxZ ){ diff --git a/Src/Extensions/FExtendCoordinate.hpp b/Src/Extensions/FExtendCoordinate.hpp index 4dc999f29a7fd467f8e1e4482287b07fb7e3ab03..3caf4f6ee10a4e1363dfc7bce7031eade9f79e6f 100644 --- a/Src/Extensions/FExtendCoordinate.hpp +++ b/Src/Extensions/FExtendCoordinate.hpp @@ -42,7 +42,7 @@ public: } /** To set the position from 3 FReals */ - void setCoordinate(const long inX, const long inY, const long inZ) { + void setCoordinate(const int inX, const int inY, const int inZ) { this->coordinate.setX(inX); this->coordinate.setY(inY); this->coordinate.setZ(inZ); diff --git a/Src/Files/FFmaBinLoader.hpp b/Src/Files/FFmaBinLoader.hpp index 0d2d2eccdb6644f7d2a5833fa7b42485d9809b16..a1f84974375f8b5048f4b643fd96c9ed6592a335 100644 --- a/Src/Files/FFmaBinLoader.hpp +++ b/Src/Files/FFmaBinLoader.hpp @@ -44,7 +44,7 @@ protected: FReal boxWidth; //< the box width read from file FSize nbParticles; //< the number of particles read from file - int removeWarning; + size_t removeWarning; public: /** diff --git a/Src/Files/FMpiFmaLoader.hpp b/Src/Files/FMpiFmaLoader.hpp index c6858fed9fd8615341862c2f3817fec583ad3b6c..47a460bc7a8824366bb362278d8d61b3d062ad9d 100644 --- a/Src/Files/FMpiFmaLoader.hpp +++ b/Src/Files/FMpiFmaLoader.hpp @@ -119,7 +119,7 @@ public: } else { FILE* file(fopen(filename, "rb")); - int removeWarning(0); + size_t removeWarning(0); // test if open if(file != NULL) { int sizeOfElement(0); diff --git a/Src/Files/FMpiTreeBuilder.hpp b/Src/Files/FMpiTreeBuilder.hpp index 25a428404fe33dd55c26bd541c9d58af27cdf6ca..e07df9bbf0ff23eb05b9224693bdcdf03f113115 100644 --- a/Src/Files/FMpiTreeBuilder.hpp +++ b/Src/Files/FMpiTreeBuilder.hpp @@ -26,9 +26,9 @@ private: /** This method has been tacken from the octree * it computes a tree coordinate (x or y or z) from real position */ - static long getTreeCoordinate(const FReal inRelativePosition, const FReal boxWidthAtLeafLevel) { + static int getTreeCoordinate(const FReal inRelativePosition, const FReal boxWidthAtLeafLevel) { const FReal indexFReal = inRelativePosition / boxWidthAtLeafLevel; - const long index = long(FMath::dfloor(indexFReal)); + const int index = int(FMath::dfloor(indexFReal)); if( index && FMath::LookEqual(inRelativePosition, boxWidthAtLeafLevel * FReal(index) ) ){ return index - 1; } @@ -66,7 +66,7 @@ private: FTreeCoordinate host; const FReal boxWidthAtLeafLevel = loader.getBoxWidth() / FReal(1 << (TreeHeight - 1) ); - for(long idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){ + for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){ loader.fillParticle(realParticlesIndexed[idxPart].particle); host.setX( getTreeCoordinate( realParticlesIndexed[idxPart].particle.getPosition().getX() - boxCorner.getX(), boxWidthAtLeafLevel )); host.setY( getTreeCoordinate( realParticlesIndexed[idxPart].particle.getPosition().getY() - boxCorner.getY(), boxWidthAtLeafLevel )); @@ -101,7 +101,7 @@ private: const FReal boxWidthAtLeafLevel = boxWidth / FReal(1 << (TreeHeight - 1) ); - for(long idxPart = 0 ; idxPart < size ; ++idxPart){ + for(int idxPart = 0 ; idxPart < size ; ++idxPart){ realParticlesIndexed[idxPart].particle = array[idxPart]; host.setX( getTreeCoordinate( realParticlesIndexed[idxPart].particle.getPosition().getX() - boxCorner.getX(), boxWidthAtLeafLevel )); host.setY( getTreeCoordinate( realParticlesIndexed[idxPart].particle.getPosition().getY() - boxCorner.getY(), boxWidthAtLeafLevel )); @@ -171,7 +171,7 @@ private: sendBuffer = new IndexedParticle[particlesToSend]; memcpy(sendBuffer, &workingArray[idxPart + 1], particlesToSend * sizeof(IndexedParticle)); - MPI_Isend( sendBuffer, particlesToSend * sizeof(IndexedParticle), MPI_BYTE, rank + 1, FMpi::TagSplittedLeaf, MPI_COMM_WORLD, &requestSendLeaf); + MPI_Isend( sendBuffer, particlesToSend * int(sizeof(IndexedParticle)), MPI_BYTE, rank + 1, FMpi::TagSplittedLeaf, MPI_COMM_WORLD, &requestSendLeaf); } else{ MPI_Isend( 0, 0, MPI_BYTE, rank + 1, FMpi::TagSplittedLeaf, MPI_COMM_WORLD, &requestSendLeaf); @@ -186,7 +186,7 @@ private: MPI_Get_count( &probStatus, MPI_BYTE, &sendByOther); if(sendByOther){ - sendByOther /= sizeof(IndexedParticle); + sendByOther /= int(sizeof(IndexedParticle)); const IndexedParticle* const reallocOutputArray = workingArray; const FSize reallocOutputSize = workingSize; @@ -196,7 +196,7 @@ private: FMemUtils::memcpy(&workingArray[sendByOther], reallocOutputArray, reallocOutputSize * sizeof(IndexedParticle)); delete[] reallocOutputArray; - MPI_Recv(workingArray, sizeof(IndexedParticle) * sendByOther, MPI_BYTE, rank - 1, FMpi::TagSplittedLeaf, MPI_COMM_WORLD, MPI_STATUS_IGNORE); + MPI_Recv(workingArray, int(sizeof(IndexedParticle)) * sendByOther, MPI_BYTE, rank - 1, FMpi::TagSplittedLeaf, MPI_COMM_WORLD, MPI_STATUS_IGNORE); } else{ MPI_Recv( 0, 0, MPI_BYTE, rank - 1, FMpi::TagSplittedLeaf, MPI_COMM_WORLD, MPI_STATUS_IGNORE); diff --git a/Src/Fmb/FFmbKernels.hpp b/Src/Fmb/FFmbKernels.hpp index 2d7e75504898e38bc2bfed5d14e518a56a56d979..caa6024f6293f631d97397429f91ac07014bbb08 100644 --- a/Src/Fmb/FFmbKernels.hpp +++ b/Src/Fmb/FFmbKernels.hpp @@ -156,7 +156,7 @@ protected: this->transitionM2M[idxLevel] = new FComplexe*[8]; this->transitionL2L[idxLevel] = new FComplexe*[8]; - for(long idxChild = 0; idxChild < 8; ++idxChild){ + for(int idxChild = 0; idxChild < 8; ++idxChild){ this->transitionM2M[idxLevel][idxChild] = new FComplexe[FMB_Info_exp_size]; this->transitionL2L[idxLevel][idxChild] = new FComplexe[FMB_Info_exp_size]; } @@ -167,13 +167,13 @@ protected: for(int idxLevel = 0; idxLevel < this->TreeHeight; ++idxLevel){ //this->transferM2L[idxLevel] = new FComplexe***[this->size1Dim]; - for(long idxD1 = 0 ; idxD1 < this->size1Dim; ++idxD1){ + for(int idxD1 = 0 ; idxD1 < this->size1Dim; ++idxD1){ //this->transferM2L[idxLevel][idxD1] = new FComplexe**[this->size1Dim]; - for(long idxD2 = 0; idxD2 < this->size1Dim; ++idxD2){ + for(int idxD2 = 0; idxD2 < this->size1Dim; ++idxD2){ //this->transferM2L[idxLevel][idxD1][idxD2] = new FComplexe*[this->size1Dim]; - for(long idxD3 = 0; idxD3 < this->size1Dim; ++idxD3){ + for(int idxD3 = 0; idxD3 < this->size1Dim; ++idxD3){ const int x = idxD1 - this->halphSize1Dim; const int y = idxD2 - this->halphSize1Dim; const int z = idxD3 - this->halphSize1Dim; @@ -195,8 +195,8 @@ protected: // transfer_M2L_free void transferDeallocate(){ // M2M L2L - /*for(long idxLevel = 0 ; idxLevel < this->TreeHeight ; ++idxLevel){ - for(long idxChild = 0; idxChild < 8; ++idxChild){ + /*for(int idxLevel = 0 ; idxLevel < this->TreeHeight ; ++idxLevel){ + for(int idxChild = 0; idxChild < 8; ++idxChild){ delete [] this->transitionM2M[idxLevel][idxChild]; delete [] this->transitionL2L[idxLevel][idxChild]; } @@ -207,9 +207,9 @@ protected: delete [] this->transitionL2L;*/ // M2L for(int idxLevel = 0 ; idxLevel < this->TreeHeight; ++idxLevel){ - for(long idxD1 = 0 ; idxD1 < this->size1Dim ; ++idxD1){ - for(long idxD2 = 0 ; idxD2 < this->size1Dim ; ++idxD2){ - for(long idxD3 = 0 ; idxD3 < this->size1Dim; ++idxD3){ + for(int idxD1 = 0 ; idxD1 < this->size1Dim ; ++idxD1){ + for(int idxD2 = 0 ; idxD2 < this->size1Dim ; ++idxD2){ + for(int idxD3 = 0 ; idxD3 < this->size1Dim; ++idxD3){ delete [] this->transferM2L[idxLevel][idxD1][idxD2][idxD3]; } //delete [] this->transferM2L[idxLevel][idxD1][idxD2]; @@ -585,9 +585,9 @@ protected: for( int idxd2 = 0; idxd2 < this->size1Dim ; ++idxd2 ){ for( int idxd3 = 0; idxd3 < this->size1Dim ; ++idxd3 ){ - const long x = idxd1 - this->halphSize1Dim; - const long y = idxd2 - this->halphSize1Dim; - const long z = idxd3 - this->halphSize1Dim; + const int x = idxd1 - this->halphSize1Dim; + const int y = idxd2 - this->halphSize1Dim; + const int z = idxd3 - this->halphSize1Dim; //printf("x=%ld \t y=%ld \t z=%ld\n",x,y,z); diff --git a/Src/Fmb/FFmbKernelsBlockBlas.hpp b/Src/Fmb/FFmbKernelsBlockBlas.hpp index baa3eb2ee9225655658d646ff4463cb6204ea3c6..f0e58c3cee3584838dcdbfa7e25819f7fc428c90 100644 --- a/Src/Fmb/FFmbKernelsBlockBlas.hpp +++ b/Src/Fmb/FFmbKernelsBlockBlas.hpp @@ -125,7 +125,7 @@ protected: static const int FF_MATRIX_ROW_DIM = FMB_Info_exp_size; static const int FF_MATRIX_COLUMN_DIM = FMB_Info_nexp_size; - static const int FF_MATRIX_SIZE = long(FF_MATRIX_ROW_DIM) * long(FF_MATRIX_COLUMN_DIM); + static const int FF_MATRIX_SIZE = int(FF_MATRIX_ROW_DIM) * int(FF_MATRIX_COLUMN_DIM); ////////////////////////////////////////////////////////////////// // Allocation @@ -227,7 +227,7 @@ protected: this->transitionM2M[idxLevel] = new FComplexe*[8]; this->transitionL2L[idxLevel] = new FComplexe*[8]; - for(long idxChild = 0; idxChild < 8; ++idxChild){ + for(int idxChild = 0; idxChild < 8; ++idxChild){ this->transitionM2M[idxLevel][idxChild] = new FComplexe[FMB_Info_exp_size]; this->transitionL2L[idxLevel][idxChild] = new FComplexe[FMB_Info_exp_size]; } @@ -238,13 +238,13 @@ protected: for(int idxLevel = 0; idxLevel < TreeHeight; ++idxLevel){ //this->transferM2L[idxLevel] = new FComplexe***[this->size1Dim]; - for(long idxD1 = 0 ; idxD1 < this->size1Dim; ++idxD1){ + for(int idxD1 = 0 ; idxD1 < this->size1Dim; ++idxD1){ //this->transferM2L[idxLevel][idxD1] = new FComplexe**[this->size1Dim]; - for(long idxD2 = 0; idxD2 < this->size1Dim; ++idxD2){ + for(int idxD2 = 0; idxD2 < this->size1Dim; ++idxD2){ //this->transferM2L[idxLevel][idxD1][idxD2] = new FComplexe*[this->size1Dim]; - for(long idxD3 = 0; idxD3 < this->size1Dim; ++idxD3){ + for(int idxD3 = 0; idxD3 < this->size1Dim; ++idxD3){ const int x = idxD1 - this->halphSize1Dim; const int y = idxD2 - this->halphSize1Dim; const int z = idxD3 - this->halphSize1Dim; @@ -280,8 +280,8 @@ protected: // transfer_M2L_free void transferDeallocate(){ // M2M L2L - /*for(long idxLevel = 0 ; idxLevel < TreeHeight ; ++idxLevel){ - for(long idxChild = 0; idxChild < 8; ++idxChild){ + /*for(int idxLevel = 0 ; idxLevel < TreeHeight ; ++idxLevel){ + for(int idxChild = 0; idxChild < 8; ++idxChild){ delete [] this->transitionM2M[idxLevel][idxChild]; delete [] this->transitionL2L[idxLevel][idxChild]; } @@ -292,9 +292,9 @@ protected: delete [] this->transitionL2L;*/ // M2L for(int idxLevel = 0 ; idxLevel < TreeHeight; ++idxLevel){ - for(long idxD1 = 0 ; idxD1 < this->size1Dim ; ++idxD1){ - for(long idxD2 = 0 ; idxD2 < this->size1Dim ; ++idxD2){ - for(long idxD3 = 0 ; idxD3 < this->size1Dim; ++idxD3){ + for(int idxD1 = 0 ; idxD1 < this->size1Dim ; ++idxD1){ + for(int idxD2 = 0 ; idxD2 < this->size1Dim ; ++idxD2){ + for(int idxD3 = 0 ; idxD3 < this->size1Dim; ++idxD3){ ff_block_matrix_Free(this->transferM2L[idxLevel][idxD1][idxD2][idxD3]); } //delete [] this->transferM2L[idxLevel][idxD1][idxD2]; diff --git a/Tests/testFmmAlgorithmProcPeriodic.cpp b/Tests/testFmmAlgorithmProcPeriodic.cpp index 18f072a8e153c502c5506be282a0cd974eea61ed..c98a747eeab1fed94f05e5c7405a78504aa070dc 100644 --- a/Tests/testFmmAlgorithmProcPeriodic.cpp +++ b/Tests/testFmmAlgorithmProcPeriodic.cpp @@ -70,11 +70,11 @@ int main(int argc, char ** argv){ const int NbLevels = FParameters::getValue(argc,argv,"-h", 7); const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3); - const long NbPartPerBoxesPerProc = FParameters::getValue(argc,argv,"-nb", 1); + const int NbPartPerBoxesPerProc = FParameters::getValue(argc,argv,"-nb", 1); FMpi app(argc, argv); - const long NbPartPerBoxes = NbPartPerBoxesPerProc * app.global().processCount(); + const int NbPartPerBoxes = NbPartPerBoxesPerProc * app.global().processCount(); FTic counter; @@ -95,9 +95,9 @@ int main(int argc, char ** argv){ std::cout << "\tHeight : " << NbLevels << " \t sub-height : " << SizeSubLevels << std::endl; counter.tic(); - long NbPart = 0; + int NbPart = 0; { - const long NbSmallBoxesPerSide = (1 << (NbLevels-1)); + const int NbSmallBoxesPerSide = (1 << (NbLevels-1)); const FReal SmallBoxWidth = BoxWidth / FReal(NbSmallBoxesPerSide); const FReal SmallBoxWidthDiv2 = SmallBoxWidth / 2; diff --git a/Tests/testOctree.cpp b/Tests/testOctree.cpp index 433d234c5ba7504cd4ed6be0d6c8bca41f5aafa0..10cebdc8964cd415ef3c65c8388f074c4b141e79 100644 --- a/Tests/testOctree.cpp +++ b/Tests/testOctree.cpp @@ -37,9 +37,9 @@ int main(int , char ** ){ const FReal FRandMax = FReal(RAND_MAX); FTic counter; - srand ( time(NULL) ); + srand( static_cast<unsigned int>(time(NULL)) ); - OctreeClass tree(10, 3,1.0,F3DPosition(0.5,0.5,0.5)); + OctreeClass tree(10, 3, 1.0, F3DPosition(0.5,0.5,0.5)); // ----------------------------------------------------- std::cout << "Creating and inserting " << NbPart << " particles ..." << std::endl; diff --git a/Tests/testOctreePrintMorton.cpp b/Tests/testOctreePrintMorton.cpp index 059daf9f7feb0b1c14ed3aff44d2ba01698d2e8c..e4b95ee6bc75c1979cb83dc418e2871866ce43a7 100644 --- a/Tests/testOctreePrintMorton.cpp +++ b/Tests/testOctreePrintMorton.cpp @@ -50,7 +50,7 @@ int main(int , char ** ){ int treeLevel = 10; F3DPosition centerOfBox(0.5,0.5,0.5); - double rootBoxWidth = 1; + FReal rootBoxWidth = 1; std::cout << "Welcome in the morton index test." << std::endl; @@ -124,11 +124,11 @@ int main(int , char ** ){ sscanf(buffer,"%d",&requiredlevel); } - double boxWidthAtThisLevel = rootBoxWidth; - for(int idx = 0 ; idx < requiredlevel ; ++idx) boxWidthAtThisLevel /= 2.0; + FReal boxWidthAtThisLevel = rootBoxWidth; + for(int idx = 0 ; idx < requiredlevel ; ++idx) boxWidthAtThisLevel /= FReal(2.0); std::cout << " At level "<< requiredlevel << " boxes width is " << boxWidthAtThisLevel << "\n"; - float x,y,z; + FReal x,y,z; do{ std::cout << " Tapes x y z = "; std::cin.getline( buffer , sizeof(buffer)); @@ -136,9 +136,9 @@ int main(int , char ** ){ FTreeCoordinate host; // position has to be relative to corner not center - host.setX( long(FMath::dfloor(( x - centerOfBox.getX() - rootBoxWidth/2) / boxWidthAtThisLevel ) )); - host.setY( long(FMath::dfloor(( y - centerOfBox.getY() - rootBoxWidth/2) / boxWidthAtThisLevel ) )); - host.setZ( long(FMath::dfloor(( z - centerOfBox.getZ() - rootBoxWidth/2) / boxWidthAtThisLevel ) )); + host.setX( int(FMath::dfloor(( x - centerOfBox.getX() - rootBoxWidth/2) / boxWidthAtThisLevel ) )); + host.setY( int(FMath::dfloor(( y - centerOfBox.getY() - rootBoxWidth/2) / boxWidthAtThisLevel ) )); + host.setZ( int(FMath::dfloor(( z - centerOfBox.getZ() - rootBoxWidth/2) / boxWidthAtThisLevel ) )); const MortonIndex index = host.getMortonIndex(requiredlevel); std::cout << " Morton Index is " << index << " \t " << std::hex << index << "h \t " << MortonToBinary(index,requiredlevel) << "d\n\n"; @@ -220,7 +220,7 @@ int main(int , char ** ){ sscanf(buffer,"%d",&treeLevel); } - float x,y,z; + FReal x,y,z; do{ std::cout << " Center of boxe Tapes x y z = "; std::cin.getline( buffer , sizeof(buffer)); @@ -230,7 +230,7 @@ int main(int , char ** ){ std::cout << " boxe width (default is = " << rootBoxWidth << ") : "; std::cin.getline( buffer , sizeof(buffer)); if( buffer[0] != '\0' ){ - sscanf(buffer,"%lf",&rootBoxWidth); + sscanf(buffer,"%e",&rootBoxWidth); } std::cout << "\n"; @@ -258,12 +258,12 @@ int main(int , char ** ){ std::cout << " This position is in the boxe x = "<< coord.getX() << " y = " << coord.getY() << " z = " << coord.getZ() << "\n"; - double boxWidthAtThisLevel = rootBoxWidth; - for(int idx = 0 ; idx < requiredlevel ; ++idx) boxWidthAtThisLevel /= 2.0; + FReal boxWidthAtThisLevel = rootBoxWidth; + for(int idx = 0 ; idx < requiredlevel ; ++idx) boxWidthAtThisLevel /= FReal(2.0); std::cout << " This center of this boxe is" - << " x = " << (coord.getX()*boxWidthAtThisLevel) + centerOfBox.getX() + boxWidthAtThisLevel/2 - rootBoxWidth/2 - << " y = " << (coord.getY()*boxWidthAtThisLevel) + centerOfBox.getX() + boxWidthAtThisLevel/2 - rootBoxWidth/2 - << " z = " << (coord.getZ()*boxWidthAtThisLevel) + centerOfBox.getX() + boxWidthAtThisLevel/2 - rootBoxWidth/2 << "\n\n"; + << " x = " << (FReal(coord.getX())*boxWidthAtThisLevel) + centerOfBox.getX() + boxWidthAtThisLevel/FReal(2.0) - rootBoxWidth/FReal(2.0) + << " y = " << (FReal(coord.getY())*boxWidthAtThisLevel) + centerOfBox.getX() + boxWidthAtThisLevel/FReal(2.0) - rootBoxWidth/FReal(2.0) + << " z = " << (FReal(coord.getZ())*boxWidthAtThisLevel) + centerOfBox.getX() + boxWidthAtThisLevel/FReal(2.0) - rootBoxWidth/FReal(2.0) << "\n\n"; } break; default: diff --git a/Tests/testOctreeRearrangeProc.cpp b/Tests/testOctreeRearrangeProc.cpp index d7325317703cad1aa755e621baac8c58d5940247..ac03be2c681a355eb8e5232aed40d89fe5e3b105 100644 --- a/Tests/testOctreeRearrangeProc.cpp +++ b/Tests/testOctreeRearrangeProc.cpp @@ -42,7 +42,7 @@ int main(int argc, char ** argv){ const int NbLevels = FParameters::getValue(argc,argv,"-h", 7); const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3); - const long NbPart = FParameters::getValue(argc,argv,"-nb", 20000); + const int NbPart = FParameters::getValue(argc,argv,"-nb", 20000); const FReal FRandMax = FReal(RAND_MAX); @@ -69,9 +69,9 @@ int main(int argc, char ** argv){ FTestParticle particles[NbPart]; for(int idxPart = 0 ; idxPart < NbPart ; ++idxPart){ particles[idxPart].setPosition( - (BoxWidth*FReal(rand())/FRandMax) + (BoxCenter-(BoxWidth/2)), - (BoxWidth*FReal(rand())/FRandMax) + (BoxCenter-(BoxWidth/2)), - (BoxWidth*FReal(rand())/FRandMax) + (BoxCenter-(BoxWidth/2))); + (BoxWidth*FReal(rand())/FRandMax) + (BoxCenter-(BoxWidth/FReal(2.0))), + (BoxWidth*FReal(rand())/FRandMax) + (BoxCenter-(BoxWidth/FReal(2.0))), + (BoxWidth*FReal(rand())/FRandMax) + (BoxCenter-(BoxWidth/FReal(2.0)))); } FMpiTreeBuilder<ParticleClass>::ArrayToTree(app.global(), particles, NbPart, F3DPosition(BoxCenter,BoxCenter,BoxCenter), BoxWidth, tree); diff --git a/Tests/testStatsTree.cpp b/Tests/testStatsTree.cpp index 617afbdf516343a43b7a9956f806001363c05570..002c0a49a0d819d0d3da389b0b4af249902e93fc 100644 --- a/Tests/testStatsTree.cpp +++ b/Tests/testStatsTree.cpp @@ -100,7 +100,7 @@ int main(int argc, char ** argv){ FReal averageParticles = 0; { - long nbLeafs = 0; + int nbLeafs = 0; typename OctreeClass::Iterator octreeIterator(&tree); octreeIterator.gotoBottomLeft(); do{ @@ -115,7 +115,7 @@ int main(int argc, char ** argv){ FReal varianceParticles = 0; { - long nbLeafs = 0; + int nbLeafs = 0; typename OctreeClass::Iterator octreeIterator(&tree); octreeIterator.gotoBottomLeft(); do{ @@ -132,17 +132,17 @@ int main(int argc, char ** argv){ FReal averageReduction = 0; typename OctreeClass::Iterator octreeIterator(&tree); octreeIterator.gotoBottomLeft(); - long previousCells = 0; + int previousCells = 0; do{ ++previousCells; } while(octreeIterator.moveRight()); - for(long idxLevel = NbLevels - 2 ; idxLevel > 1 ; --idxLevel){ + for(int idxLevel = NbLevels - 2 ; idxLevel > 1 ; --idxLevel){ octreeIterator.moveUp(); octreeIterator.gotoLeft(); - long nbCells = 0; + int nbCells = 0; do{ ++nbCells; } while(octreeIterator.moveRight()); @@ -154,7 +154,7 @@ int main(int argc, char ** argv){ { FReal averageNeighbors = 0; - long nbLeafs = 0; + int nbLeafs = 0; typename OctreeClass::Iterator octreeIterator(&tree); octreeIterator.gotoBottomLeft(); @@ -171,21 +171,21 @@ int main(int argc, char ** argv){ typename OctreeClass::Iterator octreeIterator(&tree); octreeIterator.gotoBottomLeft(); - long fullNbCells = 0; - long fullNbLeafs = 0; - long fullNbChild = 0; - long fullM2LCalculus = 0; + int fullNbCells = 0; + int fullNbLeafs = 0; + int fullNbChild = 0; + int fullM2LCalculus = 0; - long nbCellsAtLevel[NbLevels - 3]; - long nbChildAtLevel[NbLevels - 3]; - long M2LCalculusAtLevel[NbLevels - 3]; + int nbCellsAtLevel[NbLevels - 3]; + int nbChildAtLevel[NbLevels - 3]; + int M2LCalculusAtLevel[NbLevels - 3]; // Get data do{ ++fullNbLeafs; } while(octreeIterator.moveRight()); - for(long idxLevel = NbLevels - 1 ; idxLevel > 1 ; --idxLevel){ + for(int idxLevel = NbLevels - 1 ; idxLevel > 1 ; --idxLevel){ octreeIterator.moveUp(); octreeIterator.gotoLeft(); @@ -225,7 +225,7 @@ int main(int argc, char ** argv){ // compute by scoring level by level double averageChildByLevel = 0; double averageM2LByLevel = 0; - for(long idxLevel = NbLevels - 2 ; idxLevel > 1 ; --idxLevel){ + for(int idxLevel = NbLevels - 2 ; idxLevel > 1 ; --idxLevel){ const int idxArray = idxLevel - 2; averageChildByLevel += nbChildAtLevel[idxArray]/double(nbCellsAtLevel[idxArray]); averageM2LByLevel += M2LCalculusAtLevel[idxArray]/double(nbCellsAtLevel[idxArray]); @@ -238,7 +238,7 @@ int main(int argc, char ** argv){ // doing a variance for theses data double varianceChildByLevel = 0; double varianceM2LByLevel = 0; - for(long idxLevel = NbLevels - 2 ; idxLevel > 1 ; --idxLevel){ + for(int idxLevel = NbLevels - 2 ; idxLevel > 1 ; --idxLevel){ const int idxArray = idxLevel - 2; const double averageAtLevel = nbChildAtLevel[idxArray]/double(nbCellsAtLevel[idxArray]);