Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
solverstack
ScalFMM
Commits
0b18cdb9
Commit
0b18cdb9
authored
Nov 15, 2013
by
BRAMAS Berenger
Browse files
move to clean assertion
parent
48c4e4da
Changes
28
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
0b18cdb9
...
...
@@ -49,6 +49,7 @@ OPTION( ScalFMM_USE_DOUBLE_PRECISION "Set to ON to compile in double precision"
OPTION
(
ScalFMM_ATTACHE_SOURCE
"Set to ON to compile with -g"
OFF
)
OPTION
(
ScalFMM_USE_ADDONS
"Set to ON to compile add ons"
OFF
)
OPTION
(
ScalFMM_USE_SSE
"Set to ON to compile with sse support"
ON
)
OPTION
(
ScalFMM_USE_ASSERT
"Set to ON to enable safe tests during execution"
ON
)
# Set scalfmm to default libraries
SET
(
SCALFMM_LIBRARIES
""
)
...
...
@@ -160,6 +161,12 @@ endif()
# Use Mem stats
MESSAGE
(
STATUS
"ScalFMM_USE_MEM_STATS =
${
ScalFMM_USE_MEM_STATS
}
"
)
# Use Log
MESSAGE
(
STATUS
"ScalFMM_USE_LOG =
${
ScalFMM_USE_LOG
}
"
)
# Use Assert
MESSAGE
(
STATUS
"ScalFMM_USE_ASSERT =
${
ScalFMM_USE_ASSERT
}
"
)
# Add CBLAS
set
(
CMAKE_EXE_LINKER_FLAGS
"
${
CMAKE_EXE_LINKER_FLAGS
}
${
CBLAS_LIBRARIES
}
"
)
...
...
Src/Arranger/FOctreeArranger.hpp
View file @
0b18cdb9
...
...
@@ -19,7 +19,7 @@
#include
"../Utils/FGlobal.hpp"
#include
"../Utils/FPoint.hpp"
#include
"../Containers/FVector.hpp"
#include
"../Utils/FAssert
able
.hpp"
#include
"../Utils/FAssert.hpp"
#include
"../Utils/FGlobalPeriodic.hpp"
...
...
@@ -37,13 +37,13 @@
* tree.
*/
template
<
class
OctreeClass
,
class
ContainerClass
,
class
ParticleClass
,
class
ConverterClass
>
class
FOctreeArranger
:
FAssertable
{
class
FOctreeArranger
{
OctreeClass
*
const
tree
;
//< The tree to work on
public:
/** Basic constructor */
FOctreeArranger
(
OctreeClass
*
const
inTree
)
:
tree
(
inTree
)
{
fa
ssert
(
tree
,
"Tree cannot be null"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
tree
,
"Tree cannot be null"
);
}
/** Arrange */
...
...
Src/Arranger/FOctreeArrangerProc.hpp
View file @
0b18cdb9
...
...
@@ -18,7 +18,7 @@
#include
"../Utils/FGlobal.hpp"
#include
"../Containers/FVector.hpp"
#include
"../Utils/FAssert
able
.hpp"
#include
"../Utils/FAssert.hpp"
#include
"../Utils/FMpi.hpp"
#include
"../Utils/FGlobalPeriodic.hpp"
...
...
@@ -36,7 +36,7 @@
* tree.
*/
template
<
class
OctreeClass
,
class
ContainerClass
,
class
ParticleClass
,
class
ConverterClass
>
class
FOctreeArrangerProc
:
FAssertable
{
class
FOctreeArrangerProc
{
/** Interval is the min/max morton index
* for a proc
*/
...
...
@@ -64,7 +64,7 @@ class FOctreeArrangerProc : FAssertable {
public:
/** Basic constructor */
FOctreeArrangerProc
(
OctreeClass
*
const
inTree
)
:
tree
(
inTree
)
{
fa
ssert
(
tree
,
"Tree cannot be null"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
tree
,
"Tree cannot be null"
);
}
/** return false if the tree is empty after processing */
...
...
Src/Components/FTypedLeaf.hpp
View file @
0b18cdb9
...
...
@@ -17,7 +17,7 @@
#define FTYPEDLEAF_HPP
#include
"../Utils/FAssert
able
.hpp"
#include
"../Utils/FAssert.hpp"
#include
"FAbstractLeaf.hpp"
#include
"FParticleType.hpp"
...
...
@@ -33,7 +33,7 @@
* Particles should be typed to enable targets/sources difference.
*/
template
<
class
ContainerClass
>
class
FTypedLeaf
:
public
FAbstractLeaf
<
ContainerClass
>
,
public
FAssertable
{
class
FTypedLeaf
:
public
FAbstractLeaf
<
ContainerClass
>
{
ContainerClass
sources
;
//< The sources containers
ContainerClass
targets
;
//< The targets containers
...
...
Src/Containers/FOctree.hpp
View file @
0b18cdb9
...
...
@@ -28,7 +28,7 @@
#include
"../Utils/FPoint.hpp"
#include
"../Utils/FMath.hpp"
#include
"../Utils/FNoCopyable.hpp"
#include
"../Utils/FAssert
able
.hpp"
#include
"../Utils/FAssert.hpp"
/**
...
...
@@ -53,7 +53,7 @@
* CellAllocator can be FListBlockAllocator<CellClass, 10> or FBasicBlockAllocator<CellClass>
*/
template
<
class
CellClass
,
class
ContainerClass
,
class
LeafClass
,
class
CellAllocatorClass
=
FListBlockAllocator
<
CellClass
,
15
>
>
class
FOctree
:
protected
FAssertable
,
public
FNoCopyable
{
class
FOctree
:
public
FNoCopyable
{
typedef
FSubOctreeWithLeafs
<
CellClass
,
ContainerClass
,
LeafClass
,
CellAllocatorClass
>
SubOctreeWithLeaves
;
typedef
FSubOctree
<
CellClass
,
ContainerClass
,
LeafClass
,
CellAllocatorClass
>
SubOctree
;
...
...
@@ -93,15 +93,9 @@ class FOctree : protected FAssertable, public FNoCopyable {
* @return the box num at the leaf level that contains inRelativePosition
*/
int
getTreeCoordinate
(
const
FReal
inRelativePosition
)
const
{
if
(
!
(
inRelativePosition
>=
0
&&
inRelativePosition
<
this
->
boxWidth
))
printf
(
"inRelativePosition : %f
\n
"
,
inRelativePosition
);
FLOG
(
fassert
(
inRelativePosition
>=
0
&&
inRelativePosition
<
this
->
boxWidth
,
"Particle out of box"
,
__LINE__
,
__FILE__
)
);
FAssertLF
(
(
inRelativePosition
>=
0
&&
inRelativePosition
<
this
->
boxWidth
),
"inRelativePosition : "
,
inRelativePosition
);
FAssertLF
(
inRelativePosition
>=
0
&&
inRelativePosition
<
this
->
boxWidth
,
"Particle out of box"
);
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) ) ){
return index - 1;
}
return index;*/
return
static_cast
<
int
>
(
indexFReal
);
}
...
...
@@ -119,7 +113,7 @@ public:
height
(
inHeight
)
,
subHeight
(
inSubHeight
),
leafIndex
(
this
->
height
-
1
),
boxCenter
(
inBoxCenter
),
boxCorner
(
inBoxCenter
,
-
(
inBoxWidth
/
2
)),
boxWidth
(
inBoxWidth
)
{
fa
ssert
(
subHeight
<=
height
-
1
,
"Subheight cannot be greater than height"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
subHeight
<=
height
-
1
,
"Subheight cannot be greater than height"
,
__LINE__
,
__FILE__
);
// Does we only need one suboctree?
if
(
subHeight
==
height
-
1
){
root
=
new
FSubOctreeWithLeafs
<
CellClass
,
ContainerClass
,
LeafClass
,
CellAllocatorClass
>
(
0
,
0
,
this
->
subHeight
,
1
);
...
...
@@ -273,7 +267,7 @@ public:
* It uses the left right limit on each suboctree and their morton index.
* Please have a look to the move functions to understand how the system is working.
*/
class
Iterator
:
protected
FAssertable
{
class
Iterator
{
SubOctreeTypes
current
;
//< Current suboctree
int
currentLocalIndex
;
//< Current index (array position) in the current_suboctree.cells[ currentLocalLevel ]
...
...
@@ -297,8 +291,8 @@ public:
*/
explicit
Iterator
(
FOctree
*
const
inTarget
)
:
currentLocalIndex
(
0
)
,
currentLocalLevel
(
0
)
{
fa
ssert
(
inTarget
,
"Target for Octree::Iterator cannot be null"
,
__LINE__
,
__FILE__
);
fa
ssert
(
inTarget
->
root
->
getRightLeafIndex
()
>=
0
,
"Octree seems to be empty, getRightLeafIndex == 0"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
inTarget
,
"Target for Octree::Iterator cannot be null"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
inTarget
->
root
->
getRightLeafIndex
()
>=
0
,
"Octree seems to be empty, getRightLeafIndex == 0"
,
__LINE__
,
__FILE__
);
// Start by the root
this
->
current
.
tree
=
inTarget
->
root
;
...
...
Src/Containers/FSubOctree.hpp
View file @
0b18cdb9
...
...
@@ -19,7 +19,7 @@
#include
"../Utils/FGlobal.hpp"
#include
"../Utils/FPoint.hpp"
#include
"../Utils/FAssert
able
.hpp"
#include
"../Utils/FAssert.hpp"
#include
"../Utils/FMath.hpp"
#include
"FTreeCoordinate.hpp"
...
...
@@ -48,7 +48,7 @@
* @warning Give the particleClass & cellClass
*/
template
<
class
CellClass
,
class
ContainerClass
,
class
LeafClass
,
class
CellAllocatorClass
>
class
FAbstractSubOctree
:
protected
FAssertable
{
class
FAbstractSubOctree
{
protected:
CellClass
***
cells
;
//< Potential cells, cells are allocated only if needed
...
...
@@ -187,7 +187,7 @@ public:
subOctreeHeight
(
inSubOctreeHeight
),
subOctreePosition
(
inSubOctreePosition
),
isLeafSubtree
(
inIsLeafSubtree
)
{
this
->
cells
=
new
CellClass
**
[
this
->
subOctreeHeight
];
fa
ssert
(
this
->
cells
,
"Allocation failled"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
this
->
cells
,
"Allocation failled"
);
memset
(
this
->
cells
,
0
,
sizeof
(
CellClass
**
)
*
subOctreeHeight
);
...
...
@@ -195,7 +195,7 @@ public:
int
cellsAtlevel
=
8
;
for
(
int
indexLevel
=
0
;
indexLevel
<
this
->
subOctreeHeight
;
++
indexLevel
){
this
->
cells
[
indexLevel
]
=
new
CellClass
*
[
cellsAtlevel
];
fa
ssert
(
this
->
cells
[
indexLevel
],
"Allocation failled"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
this
->
cells
[
indexLevel
],
"Allocation failled"
);
memset
(
this
->
cells
[
indexLevel
],
0
,
sizeof
(
CellClass
*
)
*
cellsAtlevel
);
...
...
@@ -278,7 +278,7 @@ public:
* @param level the level to access cells array (must be < subOctreeHeight)
* @return cells[level] */
CellClass
**
cellsAt
(
const
int
level
)
const
{
fa
ssert
(
level
<
subOctreeHeight
,
"Level out of memory"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
level
<
subOctreeHeight
,
"Level out of memory"
);
return
cells
[
level
];
}
...
...
@@ -360,7 +360,7 @@ public:
const
int
cellsAtLeafLevel
=
1
<<
(
3
*
inSubOctreeHeight
);
this
->
leafs
=
new
LeafClass
*
[
cellsAtLeafLevel
];
Parent
::
fa
ssert
(
this
->
leafs
,
"Allocation failled"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
this
->
leafs
,
"Allocation failled"
);
memset
(
leafs
,
0
,
sizeof
(
LeafClass
*
)
*
cellsAtLeafLevel
);
}
...
...
@@ -507,7 +507,7 @@ public:
const
int
cellsAtLeafLevel
=
1
<<
(
3
*
inSubOctreeHeight
);
this
->
subleafs
=
new
Parent
*
[
cellsAtLeafLevel
];
Parent
::
fa
ssert
(
this
->
subleafs
,
"Allocation failled"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
this
->
subleafs
,
"Allocation failled"
);
memset
(
subleafs
,
0
,
sizeof
(
Parent
**
)
*
cellsAtLeafLevel
);
}
...
...
Src/Core/FFmmAlgorithm.hpp
View file @
0b18cdb9
...
...
@@ -18,7 +18,7 @@
#include
"../Utils/FGlobal.hpp"
#include
"../Utils/FAssert
able
.hpp"
#include
"../Utils/FAssert.hpp"
#include
"../Utils/FLog.hpp"
#include
"../Utils/FTrace.hpp"
#include
"../Utils/FTic.hpp"
...
...
@@ -40,7 +40,7 @@
* Of course this class does not deallocate pointer given in arguements.
*/
template
<
class
OctreeClass
,
class
CellClass
,
class
ContainerClass
,
class
KernelClass
,
class
LeafClass
>
class
FFmmAlgorithm
:
protected
FAssertable
,
public
FAbstractAlgorithm
{
class
FFmmAlgorithm
:
public
FAbstractAlgorithm
{
OctreeClass
*
const
tree
;
//< The octree to work on
KernelClass
*
const
kernels
;
//< The kernels
...
...
@@ -56,8 +56,8 @@ public:
FFmmAlgorithm
(
OctreeClass
*
const
inTree
,
KernelClass
*
const
inKernels
)
:
tree
(
inTree
)
,
kernels
(
inKernels
),
OctreeHeight
(
tree
->
getHeight
())
{
fa
ssert
(
tree
,
"tree cannot be null"
,
__LINE__
,
__FILE__
);
fa
ssert
(
kernels
,
"kernels cannot be null"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
tree
,
"tree cannot be null"
);
FA
ssert
LF
(
kernels
,
"kernels cannot be null"
);
FLOG
(
FLog
::
Controller
<<
"FFmmAlgorithm
\n
"
);
}
...
...
Src/Core/FFmmAlgorithmPeriodic.hpp
View file @
0b18cdb9
...
...
@@ -19,7 +19,7 @@
#include
"../Utils/FGlobal.hpp"
#include
"../Utils/FGlobalPeriodic.hpp"
#include
"../Utils/FAssert
able
.hpp"
#include
"../Utils/FAssert.hpp"
#include
"../Utils/FLog.hpp"
#include
"../Utils/FTrace.hpp"
#include
"../Utils/FTic.hpp"
...
...
@@ -42,7 +42,7 @@
* Of course this class does not deallocate pointer given in arguments.
*/
template
<
class
OctreeClass
,
class
CellClass
,
class
ContainerClass
,
class
KernelClass
,
class
LeafClass
>
class
FFmmAlgorithmPeriodic
:
protected
FAssertable
,
public
FAbstractAlgorithm
{
class
FFmmAlgorithmPeriodic
:
public
FAbstractAlgorithm
{
OctreeClass
*
const
tree
;
//< The octree to work on
KernelClass
*
kernels
;
//< The kernels
...
...
@@ -66,8 +66,8 @@ public:
nbLevelsAboveRoot
(
inUpperLevel
),
offsetRealTree
(
inUpperLevel
+
3
),
periodicDirections
(
inPeriodicDirections
)
{
fa
ssert
(
tree
,
"tree cannot be null"
,
__LINE__
,
__FILE__
);
fa
ssert
(
-
1
<=
inUpperLevel
,
"inUpperLevel cannot be < -1"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
tree
,
"tree cannot be null"
);
FA
ssert
LF
(
-
1
<=
inUpperLevel
,
"inUpperLevel cannot be < -1"
);
FLOG
(
FLog
::
Controller
<<
"FFmmAlgorithmPeriodic
\n
"
);
}
...
...
@@ -85,7 +85,7 @@ public:
* Call this function to run the complete algorithm
*/
void
execute
(
const
unsigned
operationsToProceed
=
FFmmNearAndFarFields
){
fa
ssert
(
kernels
,
"kernels cannot be null"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
kernels
,
"kernels cannot be null"
);
FTRACE
(
FTrace
::
FFunction
functionTrace
(
__FUNCTION__
,
"Fmm"
,
__FILE__
,
__LINE__
)
);
if
(
operationsToProceed
&
FFmmP2M
)
bottomPass
();
...
...
Src/Core/FFmmAlgorithmSectionTask.hpp
View file @
0b18cdb9
...
...
@@ -18,7 +18,7 @@
#include
"../Utils/FGlobal.hpp"
#include
"../Utils/FAssert
able
.hpp"
#include
"../Utils/FAssert.hpp"
#include
"../Utils/FLog.hpp"
#include
"../Utils/FTrace.hpp"
#include
"../Utils/FTic.hpp"
...
...
@@ -40,7 +40,7 @@
* Of course this class does not deallocate pointer given in arguements.
*/
template
<
class
OctreeClass
,
class
CellClass
,
class
ContainerClass
,
class
KernelClass
,
class
LeafClass
>
class
FFmmAlgorithmSectionTask
:
protected
FAssertable
,
public
FAbstractAlgorithm
{
class
FFmmAlgorithmSectionTask
:
public
FAbstractAlgorithm
{
OctreeClass
*
const
tree
;
//< The octree to work on
KernelClass
**
kernels
;
//< The kernels
...
...
@@ -60,8 +60,8 @@ public:
MaxThreads
(
omp_get_max_threads
()),
OctreeHeight
(
tree
->
getHeight
())
{
fa
ssert
(
tree
,
"tree cannot be null"
,
__LINE__
,
__FILE__
);
fa
ssert
(
inKernels
,
"kernels cannot be null"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
tree
,
"tree cannot be null"
);
FA
ssert
LF
(
inKernels
,
"kernels cannot be null"
);
this
->
kernels
=
new
KernelClass
*
[
MaxThreads
];
for
(
int
idxThread
=
0
;
idxThread
<
MaxThreads
;
++
idxThread
){
...
...
Src/Core/FFmmAlgorithmTask.hpp
View file @
0b18cdb9
...
...
@@ -18,7 +18,7 @@
#include
"../Utils/FGlobal.hpp"
#include
"../Utils/FAssert
able
.hpp"
#include
"../Utils/FAssert.hpp"
#include
"../Utils/FLog.hpp"
#include
"../Utils/FTrace.hpp"
#include
"../Utils/FTic.hpp"
...
...
@@ -40,7 +40,7 @@
* Of course this class does not deallocate pointer given in arguements.
*/
template
<
class
OctreeClass
,
class
CellClass
,
class
ContainerClass
,
class
KernelClass
,
class
LeafClass
>
class
FFmmAlgorithmTask
:
protected
FAssertable
,
public
FAbstractAlgorithm
{
class
FFmmAlgorithmTask
:
public
FAbstractAlgorithm
{
OctreeClass
*
const
tree
;
//< The octree to work on
KernelClass
**
kernels
;
//< The kernels
...
...
@@ -60,8 +60,8 @@ public:
MaxThreads
(
omp_get_max_threads
()),
OctreeHeight
(
tree
->
getHeight
())
{
fa
ssert
(
tree
,
"tree cannot be null"
,
__LINE__
,
__FILE__
);
fa
ssert
(
inKernels
,
"kernels cannot be null"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
tree
,
"tree cannot be null"
);
FA
ssert
LF
(
inKernels
,
"kernels cannot be null"
);
this
->
kernels
=
new
KernelClass
*
[
MaxThreads
];
for
(
int
idxThread
=
0
;
idxThread
<
MaxThreads
;
++
idxThread
){
...
...
Src/Core/FFmmAlgorithmThread.hpp
View file @
0b18cdb9
...
...
@@ -17,7 +17,7 @@
#define FFMMALGORITHMTHREAD_HPP
#include
"../Utils/FAssert
able
.hpp"
#include
"../Utils/FAssert.hpp"
#include
"../Utils/FLog.hpp"
#include
"../Utils/FTrace.hpp"
#include
"../Utils/FTic.hpp"
...
...
@@ -45,7 +45,7 @@
* When using this algorithm the P2P is thread safe.
*/
template
<
class
OctreeClass
,
class
CellClass
,
class
ContainerClass
,
class
KernelClass
,
class
LeafClass
>
class
FFmmAlgorithmThread
:
protected
FAssertable
,
public
FAbstractAlgorithm
{
class
FFmmAlgorithmThread
:
public
FAbstractAlgorithm
{
OctreeClass
*
const
tree
;
//< The octree to work on
KernelClass
**
kernels
;
//< The kernels
...
...
@@ -69,7 +69,7 @@ public:
:
tree
(
inTree
)
,
kernels
(
0
),
iterArray
(
0
),
leafsNumber
(
0
),
MaxThreads
(
omp_get_max_threads
()),
OctreeHeight
(
tree
->
getHeight
())
{
fa
ssert
(
tree
,
"tree cannot be null"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
tree
,
"tree cannot be null"
);
this
->
kernels
=
new
KernelClass
*
[
MaxThreads
];
for
(
int
idxThread
=
0
;
idxThread
<
MaxThreads
;
++
idxThread
){
...
...
@@ -109,7 +109,7 @@ public:
}
while
(
octreeIterator
.
moveRight
());
iterArray
=
new
typename
OctreeClass
::
Iterator
[
leafsNumber
];
fa
ssert
(
iterArray
,
"iterArray bad alloc"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
iterArray
,
"iterArray bad alloc"
);
if
(
operationsToProceed
&
FFmmP2M
)
bottomPass
();
...
...
Src/Core/FFmmAlgorithmThreadProc.hpp
View file @
0b18cdb9
...
...
@@ -19,7 +19,7 @@
#include
<omp.h>
//
#include
"../Utils/FAssert
able
.hpp"
#include
"../Utils/FAssert.hpp"
#include
"../Utils/FLog.hpp"
#include
"../Utils/FTrace.hpp"
#include
"../Utils/FTic.hpp"
...
...
@@ -60,7 +60,7 @@
* ./Tests/testFmmAlgorithmProc ../Data/testLoaderSmall.fma.tmp
*/
template
<
class
OctreeClass
,
class
CellClass
,
class
ContainerClass
,
class
KernelClass
,
class
LeafClass
>
class
FFmmAlgorithmThreadProc
:
protected
FAssertable
,
public
FAbstractAlgorithm
{
class
FFmmAlgorithmThreadProc
:
public
FAbstractAlgorithm
{
static
const
int
MaxSizePerCell
=
1024
;
...
...
@@ -119,7 +119,7 @@ public:
OctreeHeight
(
tree
->
getHeight
()),
intervals
(
new
Interval
[
inComm
.
processCount
()]),
workingIntervalsPerLevel
(
new
Interval
[
inComm
.
processCount
()
*
tree
->
getHeight
()]){
fa
ssert
(
tree
,
"tree cannot be null"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
tree
,
"tree cannot be null"
);
this
->
kernels
=
new
KernelClass
*
[
MaxThreads
];
for
(
int
idxThread
=
0
;
idxThread
<
MaxThreads
;
++
idxThread
){
...
...
@@ -163,7 +163,7 @@ public:
myLastInterval
.
max
=
octreeIterator
.
getCurrentGlobalIndex
();
}
iterArray
=
new
typename
OctreeClass
::
Iterator
[
numberOfLeafs
];
fa
ssert
(
iterArray
,
"iterArray bad alloc"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
iterArray
,
"iterArray bad alloc"
);
// We get the min/max indexes from each procs
FMpi
::
MpiAssert
(
MPI_Allgather
(
&
myLastInterval
,
sizeof
(
Interval
),
MPI_BYTE
,
intervals
,
sizeof
(
Interval
),
MPI_BYTE
,
comm
.
getComm
()),
__LINE__
);
...
...
@@ -414,7 +414,7 @@ private:
++
position
;
}
fa
ssert
(
!
currentChild
[
position
],
"Already has a cell here"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
!
currentChild
[
position
],
"Already has a cell here"
);
recvBufferCells
[
position
].
deserializeUp
(
recvBuffer
);
currentChild
[
position
]
=
(
CellClass
*
)
&
recvBufferCells
[
position
];
...
...
Src/Core/FFmmAlgorithmThreadProcPeriodic.hpp
View file @
0b18cdb9
...
...
@@ -17,7 +17,7 @@
#define FFMMALGORITHMTHREADPROCPPERIODIC_HPP
#include
"../Utils/FAssert
able
.hpp"
#include
"../Utils/FAssert.hpp"
#include
"../Utils/FLog.hpp"
#include
"../Utils/FTrace.hpp"
#include
"../Utils/FTic.hpp"
...
...
@@ -58,7 +58,7 @@
* ./Tests/testFmmAlgorithmProc ../Data/testLoaderSmall.fma.tmp
*/
template
<
class
OctreeClass
,
class
CellClass
,
class
ContainerClass
,
class
KernelClass
,
class
LeafClass
>
class
FFmmAlgorithmThreadProcPeriodic
:
protected
FAssertable
,
public
FAbstractAlgorithm
{
class
FFmmAlgorithmThreadProcPeriodic
:
public
FAbstractAlgorithm
{
static
const
int
MaxSizePerCell
=
2048
;
...
...
@@ -132,8 +132,8 @@ public:
OctreeHeight
(
tree
->
getHeight
()),
intervals
(
new
Interval
[
inComm
.
processCount
()]),
workingIntervalsPerLevel
(
new
Interval
[
inComm
.
processCount
()
*
tree
->
getHeight
()])
{
fa
ssert
(
tree
,
"tree cannot be null"
,
__LINE__
,
__FILE__
);
fa
ssert
(
-
1
<=
inUpperLevel
,
"inUpperLevel cannot be < -1"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
tree
,
"tree cannot be null"
);
FA
ssert
LF
(
-
1
<=
inUpperLevel
,
"inUpperLevel cannot be < -1"
);
FLOG
(
FLog
::
Controller
<<
"FFmmAlgorithmThreadProcPeriodic
\n
"
);
FLOG
(
FLog
::
Controller
<<
"Max threads = "
<<
MaxThreads
<<
", Procs = "
<<
nbProcess
<<
", I am "
<<
idProcess
<<
".
\n
"
);
...
...
@@ -173,7 +173,7 @@ public:
myLastInterval
.
max
=
octreeIterator
.
getCurrentGlobalIndex
();
}
iterArray
=
new
typename
OctreeClass
::
Iterator
[
numberOfLeafs
];
fa
ssert
(
iterArray
,
"iterArray bad alloc"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
iterArray
,
"iterArray bad alloc"
);
// We get the min/max indexes from each procs
FMpi
::
MpiAssert
(
MPI_Allgather
(
&
myLastInterval
,
sizeof
(
Interval
),
MPI_BYTE
,
intervals
,
sizeof
(
Interval
),
MPI_BYTE
,
comm
.
getComm
()),
__LINE__
);
...
...
@@ -418,7 +418,7 @@ private:
++
position
;
}
fa
ssert
(
!
currentChild
[
position
],
"Already has a cell here"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
!
currentChild
[
position
],
"Already has a cell here"
);
recvBufferCells
[
position
].
deserializeUp
(
recvBuffer
);
currentChild
[
position
]
=
(
CellClass
*
)
&
recvBufferCells
[
position
];
...
...
@@ -481,7 +481,7 @@ private:
state
>>=
1
;
++
position
;
}
fa
ssert
(
!
currentChild
[
position
],
"Already has a cell here"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
!
currentChild
[
position
],
"Already has a cell here"
);
recvBufferCells
[
position
].
deserializeUp
(
recvBuffer
);
...
...
Src/Core/FFmmAlgorithmThreadTsm.hpp
View file @
0b18cdb9
...
...
@@ -17,7 +17,7 @@
#define FFMMALGORITHMTHREADTSM_HPP
#include
"../Utils/FAssert
able
.hpp"
#include
"../Utils/FAssert.hpp"
#include
"../Utils/FLog.hpp"
#include
"../Utils/FTrace.hpp"
#include
"../Utils/FTic.hpp"
...
...
@@ -45,7 +45,7 @@
* You should not write on sources in the P2P method!
*/
template
<
class
OctreeClass
,
class
CellClass
,
class
ContainerClass
,
class
KernelClass
,
class
LeafClass
>
class
FFmmAlgorithmThreadTsm
:
protected
FAssertable
,
public
FAbstractAlgorithm
{
class
FFmmAlgorithmThreadTsm
:
public
FAbstractAlgorithm
{
OctreeClass
*
const
tree
;
//< The octree to work on
KernelClass
**
kernels
;
//< The kernels
...
...
@@ -65,7 +65,7 @@ public:
:
tree
(
inTree
)
,
kernels
(
0
),
iterArray
(
0
),
MaxThreads
(
omp_get_max_threads
())
,
OctreeHeight
(
tree
->
getHeight
())
{
fa
ssert
(
tree
,
"tree cannot be null"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
tree
,
"tree cannot be null"
);
this
->
kernels
=
new
KernelClass
*
[
MaxThreads
];
for
(
int
idxThread
=
0
;
idxThread
<
MaxThreads
;
++
idxThread
){
...
...
@@ -98,7 +98,7 @@ public:
++
numberOfLeafs
;
}
while
(
octreeIterator
.
moveRight
());
iterArray
=
new
typename
OctreeClass
::
Iterator
[
numberOfLeafs
];
fa
ssert
(
iterArray
,
"iterArray bad alloc"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
iterArray
,
"iterArray bad alloc"
);
if
(
operationsToProceed
&
FFmmP2M
)
bottomPass
();
...
...
Src/Core/FFmmAlgorithmTsm.hpp
View file @
0b18cdb9
...
...
@@ -17,7 +17,7 @@
#define FFMMALGORITHMTSM_HPP
#include
"../Utils/FAssert
able
.hpp"
#include
"../Utils/FAssert.hpp"
#include
"../Utils/FLog.hpp"
#include
"../Utils/FTrace.hpp"
#include
"../Utils/FTic.hpp"
...
...
@@ -39,7 +39,7 @@
* The differences with FmmAlgorithm is that it used target source model.
*/
template
<
class
OctreeClass
,
class
CellClass
,
class
ContainerClass
,
class
KernelClass
,
class
LeafClass
>
class
FFmmAlgorithmTsm
:
protected
FAssertable
,
public
FAbstractAlgorithm
{
class
FFmmAlgorithmTsm
:
public
FAbstractAlgorithm
{
OctreeClass
*
const
tree
;
//< The octree to work on
KernelClass
*
const
kernels
;
//< The kernels
...
...
@@ -58,8 +58,8 @@ public:
FFmmAlgorithmTsm
(
OctreeClass
*
const
inTree
,
KernelClass
*
const
inKernels
)
:
tree
(
inTree
)
,
kernels
(
inKernels
)
,
OctreeHeight
(
tree
->
getHeight
()){
fa
ssert
(
tree
,
"tree cannot be null"
,
__LINE__
,
__FILE__
);
fa
ssert
(
kernels
,
"kernels cannot be null"
,
__LINE__
,
__FILE__
);
FA
ssert
LF
(
tree
,
"tree cannot be null"
);
FA
ssert
LF
(
kernels
,
"kernels cannot be null"
);
FLOG
(
FLog
::
Controller
<<
"FFmmAlgorithmTsm
\n
"
);
}
...
...
Src/ScalFmmConfig.h.cmake
View file @
0b18cdb9
...
...
@@ -68,4 +68,10 @@
#cmakedefine ScalFMM_USE_SSE
///////////////////////////////////////////////////////
// Assert tests
///////////////////////////////////////////////////////
#cmakedefine ScalFMM_USE_ASSERT
#endif // CONFIG_H
Src/Utils/FAssert
able
.hpp
→
Src/Utils/FAssert.hpp
View file @
0b18cdb9
...
...
@@ -13,57 +13,92 @@
// "http://www.cecill.info".
// "http://www.gnu.org/licenses".
// ===================================================================================
#ifndef FASSERT
ABLE
_HPP
#define FASSERT
ABLE
_HPP
#ifndef FASSERT_HPP
#define FASSERT_HPP
#include
<cstdlib>
#include
<sstream>
#include
<iostream>
#include
<cassert>
#include
"FGlobal.hpp"
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FAssertable
* Please read the license
*
* This class is an interface for managing error.
*
* Please refere to testAssert.cpp to see an example
* <code>
* </code>
*/
class
FAssertable
{
* @brief The SpError class
* It is recommendede to use the macro:
* FAssertLF( aTest , "some data ", "to ", plot);
*/
class
SpError
{
protected:
/** Empty Destructor */
virtual
~
FAssertable
(){}
/**
* to write debug data with line & file
* @param inTest if false, application will stop
* @param inMessage a message - from any type - to print
* @param inLinePosition line number
* @param inFilePosition file name
* @param inExitCode an exit code
*
* @code
* fassert(toto == titi, "problem : toto is not equal titi!", __LINE__, __FILE__);
* @endcode
* To prevent use from multiple thread we use a ostringstream before printing
*/
template
<
class
Tmess
,
class
Tline
,
class
Tfile
>
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
"
;
oss
<<
inMessage
<<
"
\n
"
;
std
::
cerr
<<
oss
.
str
();