Commit 95aaeddd authored by berenger-bramas's avatar berenger-bramas
Browse files

Change assert into fassert because some macro do some troubles.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@152 2616d619-271b-44dc-8df4-d4a8f33a7222
parent c4b52c53
......@@ -30,7 +30,7 @@ public:
void push(const ParticleClass& particle){
if(particle.isTarget()) this->targets.push(particle);
else if(particle.isSource()) this->sources.push(particle);
else FAssertable::assert(false, "Error particle has undefined type.", __LINE__, __FILE__);
else fassert(false, "Error particle has undefined type.", __LINE__, __FILE__);
}
/**
......
......@@ -39,7 +39,7 @@ template <int Capacity>
public:
// Constructor, set buffer to null
FBufferVector() : buffer(0), occuped(0) {
FAssertable::assert(Capacity > 0, "Capacity has to be positive", __LINE__, __FILE__);
fassert(Capacity > 0, "Capacity has to be positive", __LINE__, __FILE__);
}
// Dealloc buffer if needed
......
......@@ -191,8 +191,8 @@ public:
*/
Iterator(FOctree* const inTarget)
: currentLocalIndex(0) , currentLocalLevel(0) {
FAssertable::assert(inTarget, "Target for Octree::Iterator cannot be null", __LINE__, __FILE__);
FAssertable::assert(inTarget->root.getRightLeafIndex() >= 0, "Octree seems to be empty, getRightLeafIndex == 0", __LINE__, __FILE__);
fassert(inTarget, "Target for Octree::Iterator cannot be null", __LINE__, __FILE__);
fassert(inTarget->root.getRightLeafIndex() >= 0, "Octree seems to be empty, getRightLeafIndex == 0", __LINE__, __FILE__);
// Start by the root
this->current.tree = &inTarget->root;
......
......@@ -133,13 +133,13 @@ public:
subOctreeHeight( inSubOctreeHeight ), subOctreePosition( inSubOctreePosition ), isLeafSubtree(inIsLeafSubtree) {
this->cells = new CellClass**[this->subOctreeHeight];
FAssertable::assert(this->cells, "Allocation failled", __LINE__, __FILE__);
fassert(this->cells, "Allocation failled", __LINE__, __FILE__);
// We start at a sub-level - 8^1
long cellsAtlevel = 8;
for( int indexLevel = 0 ; indexLevel < this->subOctreeHeight ; ++indexLevel ){
this->cells[indexLevel] = new CellClass*[cellsAtlevel];
FAssertable::assert(this->cells[indexLevel], "Allocation failled", __LINE__, __FILE__);
fassert(this->cells[indexLevel], "Allocation failled", __LINE__, __FILE__);
for( int indexCells = 0 ; indexCells < cellsAtlevel ; ++indexCells ){
this->cells[indexLevel][indexCells] = 0;
......@@ -212,7 +212,7 @@ public:
* @param level the level to access cells array (must be < subOctreeHeight)
* @return cells[level] */
CellClass** cellsAt(const int level) const{
FAssertable::assert(level < subOctreeHeight, "Level out of memory", __LINE__, __FILE__);
fassert(level < subOctreeHeight, "Level out of memory", __LINE__, __FILE__);
return cells[level];
}
......@@ -294,7 +294,7 @@ public:
const long cellsAtLeafLevel = 1 << (3 * inSubOctreeHeight);
this->leafs = new LeafClass*[cellsAtLeafLevel];
FAssertable::assert(this->leafs, "Allocation failled", __LINE__, __FILE__);
fassert(this->leafs, "Allocation failled", __LINE__, __FILE__);
for( long indexLeaf = 0 ; indexLeaf < cellsAtLeafLevel ; ++indexLeaf ){
this->leafs[indexLeaf] = 0;
......@@ -406,7 +406,7 @@ public:
const long cellsAtLeafLevel = 1 << (3 * inSubOctreeHeight);
this->subleafs = new FAbstractSubOctree<ParticleClass,CellClass,ContainerClass,LeafClass>*[cellsAtLeafLevel];
FAssertable::assert(this->subleafs, "Allocation failled", __LINE__, __FILE__);
fassert(this->subleafs, "Allocation failled", __LINE__, __FILE__);
for( int indexLeaf = 0 ; indexLeaf < cellsAtLeafLevel ; ++indexLeaf ){
this->subleafs[indexLeaf] = 0;
......
......@@ -39,8 +39,8 @@ public:
FFmmAlgorithm(OctreeClass* const inTree, KernelClass* const inKernels)
: tree(inTree) , kernels(inKernels), OctreeHeight(tree->getHeight()) {
FAssertable::assert(tree, "tree cannot be null", __LINE__, __FILE__);
FAssertable::assert(kernels, "kernels cannot be null", __LINE__, __FILE__);
fassert(tree, "tree cannot be null", __LINE__, __FILE__);
fassert(kernels, "kernels cannot be null", __LINE__, __FILE__);
FDEBUG(FDebug::Controller << "FFmmAlgorithm\n");
}
......
......@@ -53,7 +53,7 @@ public:
: tree(inTree) , kernels(0), iterArray(0), leafsNumber(0),
MaxThreads(omp_get_max_threads()), OctreeHeight(tree->getHeight()) {
FAssertable::assert(tree, "tree cannot be null", __LINE__, __FILE__);
fassert(tree, "tree cannot be null", __LINE__, __FILE__);
this->kernels = new KernelClass*[MaxThreads];
for(int idxThread = 0 ; idxThread < MaxThreads ; ++idxThread){
......@@ -96,7 +96,7 @@ public:
} while(octreeIterator.moveRight());
iterArray = new typename OctreeClass::Iterator[leafsNumber];
FAssertable::assert(iterArray, "iterArray bad alloc", __LINE__, __FILE__);
fassert(iterArray, "iterArray bad alloc", __LINE__, __FILE__);
bottomPass();
upwardPass();
......
......@@ -86,7 +86,7 @@ public:
MaxThreads(omp_get_max_threads()), nbProcess(inApp.processCount()), idPorcess(inApp.processId()),
sendBuffer(0), OctreeHeight(tree->getHeight()) {
FAssertable::assert(tree, "tree cannot be null", __LINE__, __FILE__);
fassert(tree, "tree cannot be null", __LINE__, __FILE__);
this->kernels = new KernelClass*[MaxThreads];
for(int idxThread = 0 ; idxThread < MaxThreads ; ++idxThread){
......@@ -128,10 +128,10 @@ public:
} while(octreeIterator.moveRight());
iterArray = new typename OctreeClass::Iterator[leafs];
FAssertable::assert(iterArray, "iterArray bad alloc", __LINE__, __FILE__);
fassert(iterArray, "iterArray bad alloc", __LINE__, __FILE__);
previousIterArray = new typename OctreeClass::Iterator[leafs];
FAssertable::assert(previousIterArray, "previousIterArray bad alloc", __LINE__, __FILE__);
fassert(previousIterArray, "previousIterArray bad alloc", __LINE__, __FILE__);
// init offsets
for(int idxOff = 0 ; idxOff < OctreeHeight ; ++idxOff){
......
......@@ -50,7 +50,7 @@ public:
: tree(inTree) , kernels(0), iterArray(0),
MaxThreads(omp_get_max_threads()) , OctreeHeight(tree->getHeight()) {
FAssertable::assert(tree, "tree cannot be null", __LINE__, __FILE__);
fassert(tree, "tree cannot be null", __LINE__, __FILE__);
this->kernels = new KernelClass*[MaxThreads];
for(int idxThread = 0 ; idxThread < MaxThreads ; ++idxThread){
......@@ -83,7 +83,7 @@ public:
++numberOfLeafs;
} while(octreeIterator.moveRight());
iterArray = new typename OctreeClass::Iterator[numberOfLeafs];
FAssertable::assert(iterArray, "iterArray bad alloc", __LINE__, __FILE__);
fassert(iterArray, "iterArray bad alloc", __LINE__, __FILE__);
bottomPass();
upwardPass();
......
......@@ -51,7 +51,7 @@ public:
: tree(inTree), kernels(0), iterArray(0),
MaxThreads(omp_get_max_threads()), OctreeHeight(tree->getHeight()) {
FAssertable::assert(tree, "tree cannot be null", __LINE__, __FILE__);
fassert(tree, "tree cannot be null", __LINE__, __FILE__);
this->kernels = new KernelClass*[MaxThreads];
for(int idxThread = 0 ; idxThread < MaxThreads ; ++idxThread){
......@@ -84,7 +84,7 @@ public:
++numberOfLeafs;
} while(octreeIterator.moveRight());
iterArray = new typename OctreeClass::Iterator[numberOfLeafs];
FAssertable::assert(iterArray, "iterArray bad alloc", __LINE__, __FILE__);
fassert(iterArray, "iterArray bad alloc", __LINE__, __FILE__);
for(int idxThread = 0 ; idxThread < MaxThreads ; ++idxThread){
this->kernels[idxThread]->init();
......
......@@ -43,8 +43,8 @@ public:
FFmmAlgorithmTsm(OctreeClass* const inTree, KernelClass* const inKernels)
: tree(inTree) , kernels(inKernels) , OctreeHeight(tree->getHeight()){
FAssertable::assert(tree, "tree cannot be null", __LINE__, __FILE__);
FAssertable::assert(kernels, "kernels cannot be null", __LINE__, __FILE__);
fassert(tree, "tree cannot be null", __LINE__, __FILE__);
fassert(kernels, "kernels cannot be null", __LINE__, __FILE__);
FDEBUG(FDebug::Controller << "FFmmAlgorithmTsm\n");
}
......
......@@ -29,12 +29,12 @@ protected:
* @param inLinePosition line number
* @param inFilePosition file name
*
* <code> FAssertable::assert(toto == titi, "problem : toto is not equal titi!", __LINE__, __FILE__); </code>
* <code> fassert(toto == titi, "problem : toto is not equal titi!", __LINE__, __FILE__); </code>
*
* To prevent use from multiple thread we use a ostringstream before printing
*/
template <class Tmess, class Tline, class Tfile>
void assert(const bool inTest, const Tmess& inMessage, const Tline& inLinePosition, const Tfile& inFilePosition, const int inExitCode = 1) const {
void fassert(const bool inTest, const Tmess& inMessage, const Tline& inLinePosition, const Tfile& inFilePosition, const int inExitCode = 1) const {
if(!inTest){
std::ostringstream oss;
oss << "Error in " << inFilePosition << " at line " << inLinePosition <<" :\n";
......
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