Commit 824f70fd authored by berenger-bramas's avatar berenger-bramas
Browse files

Comment modified to describe with more details

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@8 2616d619-271b-44dc-8df4-d4a8f33a7222
parent b1f3037c
......@@ -425,7 +425,7 @@ public:
* @return true if we can move down
*/
bool canProgressToDown() const {
return !isAtLeafLevel();
return !this->isAtLeafLevel();
}
/**
......@@ -433,7 +433,7 @@ public:
* @return true if we are at the bottom of the tree
*/
bool isAtLeafLevel() const {
return level() + 1 == OctreeHeight;
return this->level() + 1 == OctreeHeight;
}
/**
......@@ -491,15 +491,17 @@ public:
// To be able to access octree root
friend class Iterator;
///////////////////////////////////////////////////////////////////////////
// This part is related to the FMM algorithm (needed by M2M,M2L,etc.)
///////////////////////////////////////////////////////////////////////////
/** This function return a cell (if it exists) from a morton index and a level
* @param inIndex the index of the desired cell
* @param inLevel the level of the desired cell (cannot be infered from the index)
* @return the cell if it exist or null (0)
* This function starts from the root until it find a missing cell or the right cell
* This function starts from the root until it finds a missing cell or the right cell
*/
CellClass* getCell(const MortonIndex inIndex, const int inLevel){
SubOctreeTypes workingTree;
......@@ -568,7 +570,8 @@ public:
}
/** This function return an adresse of cell array from a morton index and a level
*
* So after calling this function you can test 8 cells (for each case if not null
* there is a cell allocated)
* @param inIndex the index of the desired cell array has to contains
* @param inLevel the level of the desired cell (cannot be infered from the index)
* @return the cell if it exist or null (0)
......@@ -600,7 +603,19 @@ public:
return &workingTree.tree->cellsAt(levelInTree)[treeLeafMask & inIndex];
}
/** This function fill a array with the distant neighbors of a cell
* Distant neighbors are child of the father neighbor (if not a direct
* neighbors)
* There is a maximum of 8 * 26 (3*3*3-1) distant neighbors
* @param inNeighbors the array to store the elements
* @param inIndex the index of the element we want the neighbors
* @param inLevel the level of the element
* @return the number of neighbors
*
* First find the direct neighbors of the cell (without brother)
* Second then for each neighbors of the parent of the cell
* Add child of this neighbors if they are not in the direct neighbors
*/
int getDistantNeighbors(CellClass* inNeighbors[208], const MortonIndex inIndex, const int inLevel){
// Take the neighbors != brothers
CellClass* directNeighbors[26];
......@@ -660,10 +675,10 @@ public:
}
/** This function return a cell (if it exists) from a morton index and a level
/** This function return the particules list (leaf) from a morton index
* @param inIndex the index of the desired cell
* @param inLevel the level of the desired cell (cannot be infered from the index)
* @return the cell if it exist or null (0)
* @return the list if it exists or null (0)
*
*/
FList<ParticuleClass*>* getLeaf(const MortonIndex inIndex){
......@@ -685,17 +700,16 @@ public:
return workingTree.leafTree->getLeaf(treeLeafMask & inIndex);
}
/** This function fill an array with the neighbors of a cell
/** This function fill an array with the neighbors of a leaf
* @param inNeighbors the array to store the elements
* @param inIndex the index of the element we want the neighbors
* @param inLevel the level of the element
* @return the number of neighbors
*/
int getLeafsNeighbors(FList<ParticuleClass*>* inNeighbors[26], const MortonIndex inIndex, const int inLevel){
int getLeafsNeighbors(FList<ParticuleClass*>* inNeighbors[26], const MortonIndex inIndex){
FTreeCoordinate center;
center.setPositionFromMorton(inIndex, inLevel);
center.setPositionFromMorton(inIndex, leafIndex);
const long limite = FMath::pow(2,inLevel);
const long limite = FMath::pow(2,leafIndex);
int idxNeighbors = 0;
......@@ -712,7 +726,7 @@ public:
// if we are not on the current cell
if( !(!idxX && !idxY && !idxZ) ){
const FTreeCoordinate other(center.getX() + idxX,center.getY() + idxY,center.getZ() + idxZ);
const MortonIndex mortonOther = other.getMortonIndex(inLevel);
const MortonIndex mortonOther = other.getMortonIndex(leafIndex);
// get cell
FList<ParticuleClass*>* const leaf = getLeaf(mortonOther);
// add to list if not null
......
......@@ -160,27 +160,27 @@ public:
/** Suboctree height accessor (leaf level + 1)
* @return subOctreeHeight */
int getSubOctreeHeight() const{
return subOctreeHeight;
return this->subOctreeHeight;
}
/** Suboctree position in the real tree
* @return subOctreePosition */
int getSubOctreePosition() const {
return subOctreePosition;
return this->subOctreePosition;
}
/** Return the more left leaf index
* the smallest index on the leafs array
* @return leftLeafIndex */
long getLeftLeafIndex() const {
return leftLeafIndex;
return this->leftLeafIndex;
}
/** Return the more right leaf index
* the biggest index on the leafs array
* @return rightLeafIndex */
long getRightLeafIndex() const {
return rightLeafIndex;
return this->rightLeafIndex;
}
/** Return the array of cells at a specious index
......@@ -188,19 +188,19 @@ public:
* @return cells[level] */
CellClass** cellsAt(const int level){
assert(level < subOctreeHeight, "Level out of memory", __LINE__, __FILE__);
return cells[level];
return this->cells[level];
}
/** To know if it is the root suboctree
* @return true if has parent otherwise return false */
bool hasParent() const {
return parent;
return this->parent;
}
/** To get access to the parent suboctree
* @return parent */
FAbstractSubOctree* getParent(){
return parent;
return this->parent;
}
/** To get the index of the current suboctree in the parent leafs array
......@@ -208,7 +208,7 @@ public:
* in this suboctree
* @return indexInParent */
long getIndexInParent() const{
return indexInParent;
return this->indexInParent;
}
};
......
......@@ -38,7 +38,7 @@ public:
* @return the position of the current cell
*/
MortonIndex getMortonIndex() const {
return index;
return this->index;
}
/**
......@@ -46,7 +46,7 @@ public:
* @param inPos the position given by the basic loader
*/
void setMortonIndex(const MortonIndex inIndex) {
index = inIndex;
this->index = inIndex;
}
};
......
......@@ -46,7 +46,7 @@ public:
* @return the position of the current cell
*/
F3DPosition getPosition() const {
return pos;
return this->pos;
}
/**
......@@ -54,7 +54,7 @@ public:
* @param inPos the position given by the basic loader
*/
void setPosition(const F3DPosition& inPos) {
pos = inPos;
this->pos = inPos;
}
};
......
......@@ -84,7 +84,7 @@ public:
// We need the current cell and the child
// child is an array (of 8 child) that may be null
kernels->M2M( octreeIterator.getCurrentCell() , octreeIterator.getCurrentChild());
} while(octreeIterator.moveRight());
} while( octreeIterator.moveRight() );
octreeIterator.moveUp();
octreeIterator.gotoLeft();
}
......@@ -103,10 +103,10 @@ public:
// for each levels
for(int idxLevel = 2 ; idxLevel < OctreeHeight ; ++idxLevel ){
// for each cells
do{
const int counter = tree->getDistantNeighbors(neighbors, octreeIterator.getCurrentGlobalIndex(),idxLevel);
kernels->M2L( octreeIterator.getCurrentCell() , neighbors, counter);
} while(octreeIterator.moveRight());
do {
const int numberOfNeighbors = tree->getDistantNeighbors(neighbors, octreeIterator.getCurrentGlobalIndex(),idxLevel);
kernels->M2L( octreeIterator.getCurrentCell() , neighbors, numberOfNeighbors);
} while( octreeIterator.moveRight() );
octreeIterator.gotoLeft();
octreeIterator.moveDown();
}
......@@ -141,8 +141,8 @@ public:
do{
kernels->L2P(octreeIterator.getCurrentCell(), octreeIterator.getCurrentList());
// need the current particules and neighbors particules
const int counter = tree->getLeafsNeighbors(neighbors, octreeIterator.getCurrentGlobalIndex(),OctreeHeight-1);
kernels->P2P( octreeIterator.getCurrentList() , neighbors, counter);
const int numberOfNeighbors = tree->getLeafsNeighbors(neighbors, octreeIterator.getCurrentGlobalIndex());
kernels->P2P( octreeIterator.getCurrentList() , neighbors, numberOfNeighbors);
} while(octreeIterator.moveRight());
FDEBUG( FDebug::Controller.write("Finished\n"); )
......
......@@ -64,7 +64,7 @@ public:
* Default destructor, simply close the file
*/
virtual ~FBasicLoader(){
file.close();
this->file.close();
}
/**
......
......@@ -26,8 +26,8 @@ private:
* Called by Fapplication instance to set the current app
* @param inCurrentApp current app
*/
static void SetCurrentApp(FAbstractApplication* const inCurrentApp){
CurrentApp = inCurrentApp;
static void SetCurrentApp(FAbstractApplication* const inCurrentApp){
CurrentApp = inCurrentApp;
}
/** To set CurrentApp */
......
......@@ -32,8 +32,7 @@ private:
std::ostream* stream; //< Standart c++ ostream
/** Default constructor forbiden */
FDebug(){
stream = &std::cout;
FDebug() : stream(&std::cout) {
}
/** Default destructor forbiden */
......@@ -47,8 +46,8 @@ private:
* after this call stream is useless
*/
void close(){
stream->flush();
if(stream != &std::cout) delete(stream);
this->stream->flush();
if(this->stream != &std::cout) delete(this->stream);
}
/**
......@@ -78,7 +77,7 @@ public:
std::ofstream* const file = new std::ofstream();
file->open(filename);
stream = file;
this->stream = file;
}
/**
......@@ -86,7 +85,7 @@ public:
*/
void writeToCout(){
close();
stream = &std::cout;
this->stream = &std::cout;
}
/**
......@@ -96,7 +95,7 @@ public:
*/
template <class T>
FDebug& operator<<(const T& inMessage){
(*stream) << inMessage;
(*this->stream) << inMessage;
return *this;
}
......@@ -107,7 +106,7 @@ public:
*/
template <class T>
FDebug& write(const T& inMessage){
(*stream) << inMessage;
(*this->stream) << inMessage;
return *this;
}
......@@ -128,7 +127,7 @@ public:
oss << "Message from " << inFilePosition << " (at line " << inLinePosition <<")\n";
oss << ">> " << inMessage << "\n";
(*stream) << oss.str();
(*this->stream) << oss.str();
return *this;
}
......@@ -149,7 +148,7 @@ public:
std::ostringstream oss;
oss << "[Value] " << inVariable << " = " << inValue << " at line " << inLinePosition <<" (file " << inFilePosition << ")\n";
(*stream) << oss.str();
(*this->stream) << oss.str();
return *this;
}
......
......@@ -20,7 +20,7 @@
#include "../Sources/Core/FSimpleKernels.hpp"
// We use openmp to count time (portable and easy to manage)
// Compile by : g++ testFMMAlgorithm.cpp ../Sources/Utils/FAssertable.cpp -lgomp -fopenmp -O2 -o testFMMAlgorithm.exe
// Compile by : g++ testFMMAlgorithm.cpp ../Sources/Utils/FDebug.cpp ../Sources/Utils/FAssertable.cpp -lgomp -fopenmp -O2 -o testFMMAlgorithm.exe
/** This program show an example of use of
* the fmm basic algo
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment