Commit 9b55df2d authored by COULAUD Olivier's avatar COULAUD Olivier
parents 73c3bd64 6a76f66e
......@@ -38,10 +38,10 @@ MESSAGE(STATUS " CXX ${CMAKE_CXX_COMPILER_ID}" )
#
# Options
OPTION( ScalFMM_USE_BLAS "Set to ON to build ScaFMM with BLAS" OFF )
OPTION( ScalFMM_USE_TRACE "Set to ON to print trace or use itac trace" OFF )
OPTION( ScalFMM_BUILD_TESTS "Set to ON to build fonctionnalities Tests" OFF )
OPTION( ScalFMM_BUILD_UTESTS "Set to ON to build UTests" OFF )
OPTION( ScalFMM_USE_BLAS "Set to ON to build ScaFMM with BLAS" OFF )
OPTION( ScalFMM_USE_TRACE "Set to ON to print trace or use itac trace" OFF )
OPTION( ScalFMM_BUILD_TESTS "Set to ON to build fonctionnalities Tests" OFF )
OPTION( ScalFMM_BUILD_UTESTS "Set to ON to build UTests" OFF )
OPTION( ScalFMM_BUILD_DEBUG "Set to ON to build in Debug" OFF )
OPTION( ScalFMM_USE_LOG "Set to ON to print output debug information" OFF )
OPTION( ScalFMM_USE_MEM_STATS "Set to ON to profile memory" OFF )
......@@ -90,13 +90,13 @@ else()
# Compile optimization
IF( APPLE )
SET(SCALFMM_FLAGS_OPTI_RELEASE "-m64 -Ofast -funroll-loops" CACHE STRING "Set your optimization flags for release mode.")
SET(SCALFMM_FLAGS_OPTI_RELEASE "-m64 -ffast-math -funroll-loops" CACHE STRING "Set your optimization flags for release mode.")
ELSE()
# Test if not apple and 64bits
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(SCALFMM_FLAGS_OPTI_RELEASE "-m64 -Ofast -flto -march=native -funroll-loops" CACHE STRING "Set your optimization flags for release mode.")
SET(SCALFMM_FLAGS_OPTI_RELEASE "-m64 -ffast-math -flto -march=native -funroll-loops" CACHE STRING "Set your optimization flags for release mode.")
else()
SET(SCALFMM_FLAGS_OPTI_RELEASE "-Ofast -flto -march=native -funroll-loops" CACHE STRING "Set your optimization flags for release mode.")
SET(SCALFMM_FLAGS_OPTI_RELEASE "-ffast-math -flto -march=native -funroll-loops" CACHE STRING "Set your optimization flags for release mode.")
endif()
ENDIF()
ADD_DEFINITIONS(${SCALFMM_FLAGS_OPTI_RELEASE})
......
......@@ -18,7 +18,7 @@
#include "../Utils/FGlobal.hpp"
#include "../Utils/FDebug.hpp"
#include "../Utils/FLog.hpp"
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
......@@ -126,7 +126,7 @@ public:
virtual void P2PRemote(const FTreeCoordinate& /*inLeafPosition*/,
ContainerClass* const FRestrict /*targets*/, const ContainerClass* const FRestrict /*sources*/,
ContainerClass* const /*directNeighborsParticles*/[27], const int /*size*/) {
FDEBUG( FDebug::Controller.write("Warning, P2P remote is used but not implemented!").write(FDebug::Flush) );
FLOG( FLog::Controller.write("Warning, P2P remote is used but not implemented!").write(FLog::Flush) );
}
};
......
......@@ -17,7 +17,7 @@
#define FABSTRACTLEAF_HPP
#include "../Utils/FPoint.hpp"
#include "../Utils/FDebug.hpp"
#include "../Utils/FLog.hpp"
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
......@@ -42,7 +42,7 @@ public:
*/
template<typename... Args>
void push(const FPoint& /*inParticlePosition*/, Args ... /*args*/){
FDEBUG( FDebug::Controller.write("Warning, push is not implemented!").write(FDebug::Flush) );
FLOG( FLog::Controller.write("Warning, push is not implemented!").write(FLog::Flush) );
}
/**
......
......@@ -17,7 +17,7 @@
#define FABSTRACTPARTICLECONTAINER_HPP
#include "../Utils/FGlobal.hpp"
#include "../Utils/FDebug.hpp"
#include "../Utils/FLog.hpp"
/* forward declaration to avoid include */
class FPoint;
......@@ -45,7 +45,7 @@ public:
*/
template<typename... Args>
void push(const FPoint& /*inParticlePosition*/, Args ... /*args*/){
FDEBUG( FDebug::Controller.write("Warning, push is not implemented!").write(FDebug::Flush) );
FLOG( FLog::Controller.write("Warning, push is not implemented!").write(FLog::Flush) );
}
};
......
......@@ -17,6 +17,8 @@
#define FBASICPARTICLECONTAINER_HPP
#include "FAbstractParticleContainer.hpp"
#include "../Utils/FAlignedMemory.hpp"
#include "../Utils/FMath.hpp"
#include "../Utils/FPoint.hpp"
......@@ -89,7 +91,7 @@ public:
/** Simply dalloc the memory using first pointer
*/
~FBasicParticleContainer(){
delete[] reinterpret_cast<char*>(positions[0]);
FAlignedMemory::Dealloc16BAligned(positions[0]);
}
/**
......@@ -164,10 +166,12 @@ public:
// enought space?
if( nbParticles == allocatedParticles ){
// allocate memory
allocatedParticles = FMath::Max(10,int(FReal(nbParticles+1)*1.5));
const int moduloParticlesNumber = (16/sizeof(FReal)); // We want to be rounded to 16B
allocatedParticles = (FMath::Max(10,int(FReal(nbParticles+1)*1.5)) + moduloParticlesNumber - 1) & ~(moduloParticlesNumber-1);
// init with 0
FReal* newData = reinterpret_cast<FReal*>(new char[(sizeof(FReal)*3 + sizeof(AttributeClass)*NbAttributesPerParticle)*allocatedParticles]);
memset( newData, 0, (sizeof(FReal)*3 + sizeof(AttributeClass)*NbAttributesPerParticle)*allocatedParticles);
const size_t allocatedBytes = (sizeof(FReal)*3 + sizeof(AttributeClass)*NbAttributesPerParticle)*allocatedParticles;
FReal* newData = reinterpret_cast<FReal*>(FAlignedMemory::Allocate16BAligned(allocatedBytes));
memset( newData, 0, allocatedBytes);
// copy memory
const char*const toDelete = reinterpret_cast<const char*>(positions[0]);
for(int idx = 0 ; idx < 3 ; ++idx){
......@@ -181,7 +185,7 @@ public:
attributes[idx] = startAddress + (idx * allocatedParticles);
}
// delete old
delete[] toDelete;
FAlignedMemory::Dealloc16BAligned(toDelete);
}
// insert particle data
positions[0][nbParticles] = inParticlePosition.getX();
......@@ -260,11 +264,15 @@ public:
void restore(FBufferReader& buffer){
buffer >> nbParticles;
if( nbParticles >= allocatedParticles ){
allocatedParticles = FMath::Max(10,int(FReal(nbParticles+1)*1.5));
FReal* newData = reinterpret_cast<FReal*>(new char[(sizeof(FReal)*3 + sizeof(AttributeClass)*NbAttributesPerParticle)*allocatedParticles]);
memset( newData, 0, (sizeof(FReal)*3 + sizeof(AttributeClass)*NbAttributesPerParticle)*allocatedParticles);
// allocate memory
const int moduloParticlesNumber = (16/sizeof(FReal)); // We want to be rounded to 16B
allocatedParticles = (FMath::Max(10,int(FReal(nbParticles+1)*1.5)) + moduloParticlesNumber - 1) & ~(moduloParticlesNumber-1);
// init with 0
const size_t allocatedBytes = (sizeof(FReal)*3 + sizeof(AttributeClass)*NbAttributesPerParticle)*allocatedParticles;
FReal* newData = reinterpret_cast<FReal*>(FAlignedMemory::Allocate16BAligned(allocatedBytes));
memset( newData, 0, allocatedBytes);
delete[] reinterpret_cast<char*>(positions[0]);
FAlignedMemory::Dealloc16BAligned(positions[0]);
for(int idx = 0 ; idx < 3 ; ++idx){
positions[idx] = newData + (allocatedParticles * idx);
}
......
......@@ -2,6 +2,7 @@
#define FBLOCKALLOCATOR_HPP
#include <list>
#include <cstring>
/**
* What a cell allocator should implement
......@@ -17,8 +18,8 @@ public:
FAbstractBlockAllocator(const FAbstractBlockAllocator&) = delete;
FAbstractBlockAllocator& operator=(const FAbstractBlockAllocator&) = delete;
virtual ObjectClass* newCell() = 0;
virtual void deleteCell(const ObjectClass*) = 0;
virtual ObjectClass* newObject() = 0;
virtual void deleteObject(const ObjectClass*) = 0;
};
/**
......@@ -27,12 +28,12 @@ public:
template <class ObjectClass>
class FBasicBlockAllocator : public FAbstractBlockAllocator<ObjectClass> {
public:
ObjectClass* newCell(){
ObjectClass* newObject(){
return new ObjectClass;
}
void deleteCell(const ObjectClass* inCell){
delete inCell;
void deleteObject(const ObjectClass* inObject){
delete inObject;
}
};
......@@ -43,38 +44,38 @@ public:
template <class ObjectClass, int SizeOfBlock >
class FListBlockAllocator : public FAbstractBlockAllocator<ObjectClass>{
class CellsBlock {
int nbCellsInBlock;
int nbObjectInBlock;
unsigned char usedBlocks[SizeOfBlock];
unsigned char cellsMemory[SizeOfBlock * sizeof(ObjectClass)];
unsigned char objectMemory[SizeOfBlock * sizeof(ObjectClass)];
public:
CellsBlock() : nbCellsInBlock(0){
CellsBlock() : nbObjectInBlock(0){
memset(usedBlocks, 0, sizeof(unsigned char) * SizeOfBlock);
}
bool isInsideBlock(const ObjectClass*const cellPtr) const{
const unsigned char*const inPtr = reinterpret_cast<const unsigned char*>( cellPtr );
return cellsMemory <= inPtr && inPtr < (cellsMemory+ SizeOfBlock * sizeof(ObjectClass));
return objectMemory <= inPtr && inPtr < (objectMemory+ SizeOfBlock * sizeof(ObjectClass));
}
int getPositionInBlock(const ObjectClass*const cellPtr) const{
const unsigned char*const inPtr = reinterpret_cast<const unsigned char*>( cellPtr );
return int((inPtr - cellsMemory) / sizeof(ObjectClass));
return int((inPtr - objectMemory) / sizeof(ObjectClass));
}
void deleteCell(const int position){
((ObjectClass*)&cellsMemory)[position].~ObjectClass();
nbCellsInBlock -= 1;
void deleteObject(const int position){
reinterpret_cast<ObjectClass*>(objectMemory)[position].~ObjectClass();
nbObjectInBlock -= 1;
usedBlocks[position] = 0x0;
}
ObjectClass* getNewCell(){
ObjectClass* getNewObject(){
for(int idx = 0 ; idx < SizeOfBlock ; ++idx){
if(usedBlocks[idx] == 0){
nbCellsInBlock += 1;
nbObjectInBlock += 1;
usedBlocks[idx] = 0x1;
new (&((ObjectClass*)&cellsMemory)[idx]) ObjectClass;
return &((ObjectClass*)&cellsMemory)[idx];
new (&reinterpret_cast<ObjectClass*>(objectMemory)[idx]) ObjectClass;
return &reinterpret_cast<ObjectClass*>(objectMemory)[idx];
}
}
......@@ -82,39 +83,39 @@ class FListBlockAllocator : public FAbstractBlockAllocator<ObjectClass>{
}
int isEmpty() const{
return nbCellsInBlock == 0;
return nbObjectInBlock == 0;
}
int isFull() const{
return nbCellsInBlock == SizeOfBlock;
return nbObjectInBlock == SizeOfBlock;
}
};
std::list<CellsBlock> blocks;
public:
ObjectClass* newCell(){
ObjectClass* newObject(){
typename std::list<CellsBlock>::iterator iterator(blocks.begin());
const typename std::list<CellsBlock>::iterator end(blocks.end());
while( iterator != end){
if( !(*iterator).isFull() ){
return (*iterator).getNewCell();
return (*iterator).getNewObject();
}
++iterator;
}
blocks.emplace_back();
return blocks.back().getNewCell();
return blocks.back().getNewObject();
}
void deleteCell(const ObjectClass* inCell){
void deleteObject(const ObjectClass* inObject){
typename std::list<CellsBlock>::iterator iterator(blocks.begin());
const typename std::list<CellsBlock>::iterator end(blocks.end());
while( iterator != end ){
if( (*iterator).isInsideBlock(inCell) ){
(*iterator).deleteCell((*iterator).getPositionInBlock(inCell));
if( (*iterator).isInsideBlock(inObject) ){
(*iterator).deleteObject((*iterator).getPositionInBlock(inObject));
if( (*iterator).isEmpty() ){
blocks.erase(iterator);
}
......
......@@ -20,8 +20,9 @@
#include "FSubOctree.hpp"
#include "FTreeCoordinate.hpp"
#include "FBlockAllocator.hpp"
#include "../Utils/FDebug.hpp"
#include "../Utils/FLog.hpp"
#include "../Utils/FGlobal.hpp"
#include "../Utils/FGlobalPeriodic.hpp"
#include "../Utils/FPoint.hpp"
......@@ -49,13 +50,14 @@
*
* If the octree as an height H, then it goes from 0 to H-1
* at level 0 the space is not split
* CellAllocator can be FListBlockAllocator<CellClass, 10> or FBasicBlockAllocator<CellClass>
*/
template< class CellClass, class ContainerClass, class LeafClass>
template< class CellClass, class ContainerClass, class LeafClass, class CellAllocatorClass = FListBlockAllocator<CellClass, 15> >
class FOctree : protected FAssertable, public FNoCopyable {
typedef FSubOctreeWithLeafs< CellClass , ContainerClass, LeafClass> SubOctreeWithLeaves;
typedef FSubOctree< CellClass , ContainerClass, LeafClass> SubOctree;
typedef FSubOctreeWithLeafs< CellClass , ContainerClass, LeafClass, CellAllocatorClass> SubOctreeWithLeaves;
typedef FSubOctree< CellClass , ContainerClass, LeafClass, CellAllocatorClass> SubOctree;
FAbstractSubOctree< CellClass , ContainerClass, LeafClass>* root; //< root suboctree
FAbstractSubOctree< CellClass , ContainerClass, LeafClass, CellAllocatorClass>* root; //< root suboctree
FReal*const boxWidthAtLevel; //< to store the width of each boxs at all levels
......@@ -91,7 +93,7 @@ class FOctree : protected FAssertable, public FNoCopyable {
* @return the box num at the leaf level that contains inRelativePosition
*/
int getTreeCoordinate(const FReal inRelativePosition) const {
FDEBUG( fassert(inRelativePosition >= 0 && inRelativePosition < this->boxWidth, "Particle out of box", __LINE__, __FILE__) );
FLOG( fassert(inRelativePosition >= 0 && inRelativePosition < this->boxWidth, "Particle out of box", __LINE__, __FILE__) );
const FReal indexFReal = inRelativePosition / this->boxWidthAtLevel[this->leafIndex];
/*const int index = int(FMath::dfloor(indexFReal));
if( index && FMath::LookEqual(inRelativePosition, this->boxWidthAtLevel[this->leafIndex] * FReal(index) ) ){
......@@ -118,10 +120,10 @@ public:
fassert(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>(0, 0, this->subHeight, 1);
root = new FSubOctreeWithLeafs< CellClass , ContainerClass, LeafClass,CellAllocatorClass>(0, 0, this->subHeight, 1);
}
else {// if(subHeight < height - 1)
root = new FSubOctree< CellClass , ContainerClass, LeafClass>(0, 0, this->subHeight, 1);
root = new FSubOctree< CellClass , ContainerClass, LeafClass,CellAllocatorClass>(0, 0, this->subHeight, 1);
}
FReal tempWidth = this->boxWidth;
......@@ -235,18 +237,18 @@ public:
* depending if we are working on the bottom of the tree.
*/
union SubOctreeTypes {
FAbstractSubOctree<CellClass,ContainerClass,LeafClass>* tree; //< Usual pointer to work
FSubOctree<CellClass,ContainerClass,LeafClass>* middleTree; //< To access to sub-octree under
FSubOctreeWithLeafs<CellClass,ContainerClass,LeafClass>* leafTree;//< To access to particles lists
FAbstractSubOctree<CellClass,ContainerClass,LeafClass,CellAllocatorClass>* tree; //< Usual pointer to work
FSubOctree<CellClass,ContainerClass,LeafClass,CellAllocatorClass>* middleTree; //< To access to sub-octree under
FSubOctreeWithLeafs<CellClass,ContainerClass,LeafClass,CellAllocatorClass>* leafTree;//< To access to particles lists
};
/**
* This class is a const SubOctreeTypes
*/
union SubOctreeTypesConst {
const FAbstractSubOctree<CellClass,ContainerClass,LeafClass>* tree; //< Usual pointer to work
const FSubOctree<CellClass,ContainerClass,LeafClass>* middleTree; //< To access to sub-octree under
const FSubOctreeWithLeafs<CellClass,ContainerClass,LeafClass>* leafTree;//< To access to particles lists
const FAbstractSubOctree<CellClass,ContainerClass,LeafClass,CellAllocatorClass>* tree; //< Usual pointer to work
const FSubOctree<CellClass,ContainerClass,LeafClass,CellAllocatorClass>* middleTree; //< To access to sub-octree under
const FSubOctreeWithLeafs<CellClass,ContainerClass,LeafClass,CellAllocatorClass>* leafTree;//< To access to particles lists
};
/**
......
......@@ -47,7 +47,7 @@
* Please refere to testOctree.cpp to see an example
* @warning Give the particleClass & cellClass
*/
template< class CellClass , class ContainerClass, class LeafClass>
template< class CellClass , class ContainerClass, class LeafClass, class CellAllocatorClass>
class FAbstractSubOctree : protected FAssertable{
protected:
......@@ -64,6 +64,7 @@ protected:
const bool isLeafSubtree; //< To know if a subtree is leaf or not (we prefere that to a virtual method)
CellAllocatorClass cellAllocator;
/**
* This function compute the morton index for the last level of this suboctree.
......@@ -93,7 +94,7 @@ protected:
int indexLevel = this->subOctreeHeight - 1;
int bottomToTop = 0;
while(indexLevel >= 0 && !this->cells[indexLevel][arrayIndex]){
CellClass* const newNode = new CellClass();
CellClass* const newNode = cellAllocator.newObject();//new CellClass();
newNode->setMortonIndex(inLeafCellIndex);
newNode->setCoordinate(treePosition.getX() >> bottomToTop,
......@@ -145,7 +146,7 @@ protected:
}
// remove the last cells
delete this->cells[indexLevel][arrayIndex];
cellAllocator.deleteObject(this->cells[indexLevel][arrayIndex]);
this->cells[indexLevel][arrayIndex] = 0;
// progress upper
--indexLevel;
......@@ -157,7 +158,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 ){
delete this->cells[indexLevel][arrayIndex];
cellAllocator.deleteObject( this->cells[indexLevel][arrayIndex] );
this->cells[indexLevel][arrayIndex] = 0;
--indexLevel;
......@@ -213,7 +214,7 @@ public:
for( int indexLevel = this->subOctreeHeight - 1 ; indexLevel >= 0 ; --indexLevel ){
for( int indexCells = mostLeft ; indexCells <= mostRight ; ++indexCells ){
if(this->cells[indexLevel][indexCells]){
delete this->cells[indexLevel][indexCells];
cellAllocator.deleteObject( this->cells[indexLevel][indexCells] );
}
}
......@@ -334,10 +335,10 @@ public:
* Please refere to testOctree.cpp to see an example.
* @warning Give the particleClass & cellClass
*/
template< class CellClass , class ContainerClass, class LeafClass>
class FSubOctreeWithLeafs : public FAbstractSubOctree<CellClass,ContainerClass,LeafClass> {
template< class CellClass , class ContainerClass, class LeafClass, class CellAllocatorClass>
class FSubOctreeWithLeafs : public FAbstractSubOctree<CellClass,ContainerClass,LeafClass, CellAllocatorClass> {
private:
typedef FAbstractSubOctree<CellClass,ContainerClass,LeafClass> Parent;
typedef FAbstractSubOctree<CellClass,ContainerClass,LeafClass, CellAllocatorClass> Parent;
LeafClass** leafs; //< Leafs array
......@@ -352,9 +353,9 @@ public:
* @param inSubOctreeHeight Height of this suboctree
* @param inSubOctreePosition Level of the current suboctree in the global tree (1 if upper tree)
*/
FSubOctreeWithLeafs(FAbstractSubOctree<CellClass,ContainerClass,LeafClass>* const inParent, const int inIndexInParent,
FSubOctreeWithLeafs(FAbstractSubOctree<CellClass,ContainerClass,LeafClass,CellAllocatorClass>* const inParent, const int inIndexInParent,
const int inSubOctreeHeight, const int inSubOctreePosition) :
FAbstractSubOctree<CellClass,ContainerClass,LeafClass>(inParent, inIndexInParent, inSubOctreeHeight, inSubOctreePosition, true) {
FAbstractSubOctree<CellClass,ContainerClass,LeafClass,CellAllocatorClass>(inParent, inIndexInParent, inSubOctreeHeight, inSubOctreePosition, true) {
const int cellsAtLeafLevel = 1 << (3 * inSubOctreeHeight);
......@@ -479,11 +480,11 @@ public:
*
* @warning Give the particleClass & cellClass
*/
template< class CellClass , class ContainerClass, class LeafClass>
class FSubOctree : public FAbstractSubOctree<CellClass,ContainerClass,LeafClass> {
template< class CellClass , class ContainerClass, class LeafClass, class CellAllocatorClass>
class FSubOctree : public FAbstractSubOctree<CellClass,ContainerClass,LeafClass, CellAllocatorClass> {
private:
typedef FAbstractSubOctree<CellClass,ContainerClass,LeafClass> Parent;
typedef FSubOctreeWithLeafs<CellClass,ContainerClass,LeafClass> SubOctreeWithLeaf;
typedef FAbstractSubOctree<CellClass,ContainerClass,LeafClass,CellAllocatorClass> Parent;
typedef FSubOctreeWithLeafs<CellClass,ContainerClass,LeafClass,CellAllocatorClass> SubOctreeWithLeaf;
Parent** subleafs; //< Last levels is composed of suboctree
......@@ -499,9 +500,9 @@ public:
* @param inSubOctreeHeight Height of this suboctree
* @param inSubOctreePosition Level of the current suboctree in the global tree (0 if upper tree)
*/
FSubOctree(FAbstractSubOctree<CellClass,ContainerClass,LeafClass>* const inParent, const int inIndexInParent,
FSubOctree(FAbstractSubOctree<CellClass,ContainerClass,LeafClass,CellAllocatorClass>* const inParent, const int inIndexInParent,
const int inSubOctreeHeight, const int inSubOctreePosition) :
FAbstractSubOctree<CellClass,ContainerClass,LeafClass>(inParent, inIndexInParent, inSubOctreeHeight, inSubOctreePosition, false) {
FAbstractSubOctree<CellClass,ContainerClass,LeafClass,CellAllocatorClass>(inParent, inIndexInParent, inSubOctreeHeight, inSubOctreePosition, false) {
const int cellsAtLeafLevel = 1 << (3 * inSubOctreeHeight);
......@@ -615,14 +616,14 @@ public:
/** To get access to leafs elements (child suboctree)
* @param index the position of the leaf/child suboctree
* @return child at this index */
FAbstractSubOctree<CellClass,ContainerClass,LeafClass>* leafs(const int index) {
FAbstractSubOctree<CellClass,ContainerClass,LeafClass,CellAllocatorClass>* leafs(const int index) {
return this->subleafs[index];
}
/** To get access to leafs elements (child suboctree)
* @param index the position of the leaf/child suboctree
* @return child at this index */
const FAbstractSubOctree<CellClass,ContainerClass,LeafClass>* leafs(const int index) const {
const FAbstractSubOctree<CellClass,ContainerClass,LeafClass,CellAllocatorClass>* leafs(const int index) const {
return this->subleafs[index];
}
};
......
......@@ -19,7 +19,7 @@
#include "../Utils/FGlobal.hpp"
#include "../Utils/FAssertable.hpp"
#include "../Utils/FDebug.hpp"
#include "../Utils/FLog.hpp"
#include "../Utils/FTrace.hpp"
#include "../Utils/FTic.hpp"
......@@ -59,7 +59,7 @@ public:
fassert(tree, "tree cannot be null", __LINE__, __FILE__);
fassert(kernels, "kernels cannot be null", __LINE__, __FILE__);
FDEBUG(FDebug::Controller << "FFmmAlgorithm\n");
FLOG(FLog::Controller << "FFmmAlgorithm\n");
}
/** Default destructor */
......@@ -92,9 +92,9 @@ private:
/** P2M */
void bottomPass(){
FTRACE( FTrace::FFunction functionTrace(__FUNCTION__, "Fmm" , __FILE__ , __LINE__) );
FDEBUG( FDebug::Controller.write("\tStart Bottom Pass\n").write(FDebug::Flush) );
FDEBUG(FTic counterTime);
FDEBUG(FTic computationCounter);
FLOG( FLog::Controller.write("\tStart Bottom Pass\n").write(FLog::Flush) );
FLOG(FTic counterTime);
FLOG(FTic computationCounter);
typename OctreeClass::Iterator octreeIterator(tree);
......@@ -103,13 +103,13 @@ private:
do{
// We need the current cell that represent the leaf
// and the list of particles
FDEBUG(computationCounter.tic());
FLOG(computationCounter.tic());
kernels->P2M( octreeIterator.getCurrentCell() , octreeIterator.getCurrentListSrc());
FDEBUG(computationCounter.tac());
FLOG(computationCounter.tac());
} while(octreeIterator.moveRight());
FDEBUG( FDebug::Controller << "\tFinished (@Bottom Pass (P2M) = " << counterTime.tacAndElapsed() << "s)\n" );
FDEBUG( FDebug::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" );
FLOG( FLog::Controller << "\tFinished (@Bottom Pass (P2M) = " << counterTime.tacAndElapsed() << "s)\n" );
FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" );
}
/////////////////////////////////////////////////////////////////////////////
......@@ -119,9 +119,9 @@ private:
/** M2M */
void upwardPass(){
FTRACE( FTrace::FFunction functionTrace(__FUNCTION__, "Fmm" , __FILE__ , __LINE__) );
FDEBUG( FDebug::Controller.write("\tStart Upward Pass\n").write(FDebug::Flush); );
FDEBUG(FTic counterTime);
FDEBUG(FTic computationCounter);
FLOG( FLog::Controller.write("\tStart Upward Pass\n").write(FLog::Flush); );
FLOG(FTic counterTime);
FLOG(FTic computationCounter);
// Start from leal level - 1
typename OctreeClass::Iterator octreeIterator(tree);
......@@ -132,26 +132,26 @@ private:
// for each levels
for(int idxLevel = OctreeHeight - 2 ; idxLevel > 1 ; --idxLevel ){
FDEBUG(FTic counterTimeLevel);
FLOG(FTic counterTimeLevel);
// for each cells
do{
// We need the current cell and the child
// child is an array (of 8 child) that may be null
FDEBUG(computationCounter.tic());
FLOG(computationCounter.tic());
kernels->M2M( octreeIterator.getCurrentCell() , octreeIterator.getCurrentChild(), idxLevel);
FDEBUG(computationCounter.tac());
FLOG(computationCounter.tac());
} while(octreeIterator.moveRight());
avoidGotoLeftIterator.moveUp();
octreeIterator = avoidGotoLeftIterator;
FDEBUG( FDebug::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" );
FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" );
}
FDEBUG( FDebug::Controller << "\tFinished (@Upward Pass (M2M) = " << counterTime.tacAndElapsed() << "s)\n" );
FDEBUG( FDebug::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" );
FLOG( FLog::Controller << "\tFinished (@Upward Pass (M2M) = " << counterTime.tacAndElapsed() << "s)\n" );
FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" );
}
/////////////////////////////////////////////////////////////////////////////
......@@ -162,9 +162,9 @@ private:
void transferPass(){
FTRACE( FTrace::FFunction functionTrace(__FUNCTION__, "Fmm" , __FILE__ , __LINE__) );
FDEBUG( FDebug::Controller.write("\tStart Downward Pass (M2L)\n").write(FDebug::Flush); );
FDEBUG(FTic counterTime);
FDEBUG(FTic computationCounter);
FLOG( FLog::Controller.write("\tStart Downward Pass (M2L)\n").write(FLog::Flush); );
FLOG(FTic counterTime);
FLOG(FTic computationCounter);
typename OctreeClass::Iterator octreeIterator(tree);
octreeIterator.moveDown();
......@@ -175,27 +175,27 @@ private:
// for each levels
for(int idxLevel = 2 ; idxLevel < OctreeHeight ; ++idxLevel ){