Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ScalFMM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
solverstack
ScalFMM
Commits
5108b944
Commit
5108b944
authored
Jul 21, 2015
by
PIACIBELLO Cyrille
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Free memory and testChebInterface debug.
parent
5f89650d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
18 deletions
+55
-18
Addons/CKernelApi/Src/CScalfmmApi.h
Addons/CKernelApi/Src/CScalfmmApi.h
+18
-0
Addons/CKernelApi/Src/FInterEngine.hpp
Addons/CKernelApi/Src/FInterEngine.hpp
+3
-0
Addons/CKernelApi/Src/FScalFMMEngine.hpp
Addons/CKernelApi/Src/FScalFMMEngine.hpp
+8
-5
Addons/CKernelApi/Src/FScalfmmApiInit.cpp
Addons/CKernelApi/Src/FScalfmmApiInit.cpp
+1
-1
Addons/CKernelApi/Src/FUserKernelEngine.hpp
Addons/CKernelApi/Src/FUserKernelEngine.hpp
+23
-11
Addons/CKernelApi/Tests/testChebInterface.c
Addons/CKernelApi/Tests/testChebInterface.c
+2
-1
No files found.
Addons/CKernelApi/Src/CScalfmmApi.h
View file @
5108b944
...
...
@@ -481,6 +481,9 @@ typedef void (*Callback_P2P)(FSize nbParticles, const FSize* particleIndexes, FS
/**
* @brief Function to be filled by user's P2P
* @attention This function is symmetrc, thus when a call is done
* between target and cell[27], the user needs to apply the target
* field onto the 27 cells too.
* @param nbParticles number of particle in current leaf
* @param particleIndexes indexes of particles currently computed
* @param sourceCell array of the neighbors source cells
...
...
@@ -500,6 +503,20 @@ typedef void (*Callback_P2PFull)(FSize nbParticles, const FSize* particleIndexes
*/
typedef
void
(
*
Callback_P2PInner
)(
FSize
nbParticles
,
const
FSize
*
particleIndexes
,
void
*
userData
);
/**
* @brief Function to be filled by user's P2P
* @param nbParticles number of particle in current leaf
* @param particleIndexes indexes of particles currently computed
* @param nbSourceParticles number of particles in source leaf
* @param sourceParticleIndexes indexes of cource particles currently computed
* @param userData datas specific to the user's kernel
* @attention The fact that this callback is defined (and thus
* different from NULL or nullptr) means that it will be used, and
* thus if a call is done with cell1 as source and cell2 as target, no
* call will be done with cell2 as source and cell1 as target.
*/
typedef
void
(
*
Callback_P2PSym
)(
FSize
nbParticles
,
const
FSize
*
particleIndexes
,
FSize
nbSourceParticles
,
const
FSize
*
sourceParticleIndexes
,
void
*
userData
);
/**
* @brief Function to be filled by user's method to reset a user's cell
* @param level level of the cell.
...
...
@@ -527,6 +544,7 @@ typedef struct User_Scalfmm_Kernel_Descriptor {
Callback_P2P
p2p
;
Callback_P2PFull
p2p_full
;
Callback_P2PInner
p2pinner
;
Callback_P2PSym
p2p_sym
;
}
Scalfmm_Kernel_Descriptor
;
...
...
Addons/CKernelApi/Src/FInterEngine.hpp
View file @
5108b944
...
...
@@ -746,6 +746,7 @@ public:
AlgoClassSeq
*
algoSeq
=
new
AlgoClassSeq
(
octree
,
kernel
);
algoSeq
->
execute
();
FScalFMMEngine
<
FReal
>::
algoTimer
=
algoSeq
;
FScalFMMEngine
<
FReal
>::
abstrct
=
algoSeq
;
break
;
}
case
1
:
...
...
@@ -754,6 +755,7 @@ public:
AlgoClassThread
*
algoThread
=
new
AlgoClassThread
(
octree
,
kernel
);
algoThread
->
execute
();
FScalFMMEngine
<
FReal
>::
algoTimer
=
algoThread
;
FScalFMMEngine
<
FReal
>::
abstrct
=
algoThread
;
break
;
}
case
2
:
...
...
@@ -770,6 +772,7 @@ public:
AlgoClassTargetSource
*
algoTS
=
new
AlgoClassTargetSource
(
octree
,
kernel
);
algoTS
->
execute
();
FScalFMMEngine
<
FReal
>::
algoTimer
=
algoTS
;
FScalFMMEngine
<
FReal
>::
abstrct
=
algoTS
;
break
;
}
default
:
...
...
Addons/CKernelApi/Src/FScalFMMEngine.hpp
View file @
5108b944
...
...
@@ -47,7 +47,7 @@
#include "Components/FTypedLeaf.hpp"
#include "Containers/FOctree.hpp"
#include "Utils/FTemplate.hpp"
#include "Core/FCoreCommon.hpp"
/**
* @class FScalFMMEngine
...
...
@@ -62,16 +62,19 @@ protected:
FVector
<
bool
>*
progress
;
int
nbPart
;
FAlgorithmTimers
*
algoTimer
;
FAbstractAlgorithm
*
abstrct
;
public:
FScalFMMEngine
()
:
Algorithm
(
multi_thread
),
progress
(
nullptr
),
nbPart
(
0
),
algoTimer
(
nullptr
){
FScalFMMEngine
()
:
Algorithm
(
multi_thread
),
progress
(
nullptr
),
nbPart
(
0
),
algoTimer
(
nullptr
)
,
abstrct
(
nullptr
)
{
progress
=
new
FVector
<
bool
>
();
}
virtual
~
FScalFMMEngine
()
{
if
(
algoTimer
){
delete
algoTimer
;
//Do not delete algoTimer because abstract and algoTimer are two pointers on the same thing
if
(
abstrct
){
delete
abstrct
;
abstrct
=
nullptr
;
algoTimer
=
nullptr
;
}
delete
progress
;
}
...
...
Addons/CKernelApi/Src/FScalfmmApiInit.cpp
View file @
5108b944
...
...
@@ -5,7 +5,7 @@ extern "C" {
#include "FInterEngine.hpp"
#include "FUserKernelEngine.hpp"
//#include "FAdaptEngine.hpp"
extern
"C"
scalfmm_handle
scalfmm_init
(
/*int TreeHeight,double BoxWidth,double* BoxCenter, */
scalfmm_kernel_type
KernelType
,
scalfmm_algorithm
algo
){
...
...
Addons/CKernelApi/Src/FUserKernelEngine.hpp
View file @
5108b944
...
...
@@ -164,6 +164,8 @@ public:
ContainerClass
*
const
neighbors
[
27
],
const
int
){
if
(
kernel
.
p2pinner
)
kernel
.
p2pinner
(
targets
->
getNbParticles
(),
targets
->
getIndexes
().
data
(),
userData
);
if
(
kernel
.
p2p_full
){
//Create the arrays of size and indexes
FSize
nbPartPerNeighbors
[
27
];
...
...
@@ -180,11 +182,21 @@ public:
}
kernel
.
p2p_full
(
targets
->
getNbParticles
(),
targets
->
getIndexes
().
data
(),
indicesPerNeighbors
,
nbPartPerNeighbors
,
userData
);
}
if
(
kernel
.
p2p
){
for
(
int
idx
=
0
;
idx
<
27
;
++
idx
){
if
(
kernel
.
p2p
_sym
){
for
(
int
idx
=
0
;
idx
<
14
;
++
idx
){
if
(
neighbors
[
idx
]
){
kernel
.
p2p
(
targets
->
getNbParticles
(),
targets
->
getIndexes
().
data
(),
neighbors
[
idx
]
->
getNbParticles
(),
neighbors
[
idx
]
->
getIndexes
().
data
(),
userData
);
kernel
.
p2p_sym
(
targets
->
getNbParticles
(),
targets
->
getIndexes
().
data
(),
neighbors
[
idx
]
->
getNbParticles
(),
neighbors
[
idx
]
->
getIndexes
().
data
(),
userData
);
}
}
}
else
{
if
(
kernel
.
p2p
){
for
(
int
idx
=
0
;
idx
<
27
;
++
idx
){
if
(
neighbors
[
idx
]
){
kernel
.
p2p
(
targets
->
getNbParticles
(),
targets
->
getIndexes
().
data
(),
neighbors
[
idx
]
->
getNbParticles
(),
neighbors
[
idx
]
->
getIndexes
().
data
(),
userData
);
}
}
}
}
...
...
@@ -535,14 +547,13 @@ public:
void
execute_fmm
(){
FAssertLF
(
kernel
,
"No kernel set, please use scalfmm_user_kernel_config before calling the execute routine ... Exiting
\n
"
);
FAbstractAlgorithm
*
abstrct
=
nullptr
;
switch
(
FScalFMMEngine
<
FReal
>::
Algorithm
){
case
0
:
{
typedef
FFmmAlgorithm
<
OctreeClass
,
CoreCell
,
ContainerClass
,
CoreKernelClass
,
LeafClass
>
AlgoClassSeq
;
AlgoClassSeq
*
algoSeq
=
new
AlgoClassSeq
(
octree
,
kernel
);
FScalFMMEngine
<
FReal
>::
algoTimer
=
algoSeq
;
abstrct
=
algoSeq
;
FScalFMMEngine
<
FReal
>::
abstrct
=
algoSeq
;
//algoSeq->execute(); will be done later
break
;
}
...
...
@@ -551,7 +562,7 @@ public:
typedef
FFmmAlgorithmThread
<
OctreeClass
,
CoreCell
,
ContainerClass
,
CoreKernelClass
,
LeafClass
>
AlgoClassThread
;
AlgoClassThread
*
algoThread
=
new
AlgoClassThread
(
octree
,
kernel
);
FScalFMMEngine
<
FReal
>::
algoTimer
=
algoThread
;
abstrct
=
algoThread
;
FScalFMMEngine
<
FReal
>::
abstrct
=
algoThread
;
//algoThread->execute(); will be done later
break
;
}
...
...
@@ -568,24 +579,25 @@ public:
typedef
FFmmAlgorithmThreadTsm
<
OctreeClass
,
CoreCell
,
ContainerClass
,
CoreKernelClass
,
LeafClass
>
AlgoClassTargetSource
;
AlgoClassTargetSource
*
algoTS
=
new
AlgoClassTargetSource
(
octree
,
kernel
);
FScalFMMEngine
<
FReal
>::
algoTimer
=
algoTS
;
abstrct
=
algoTS
;
FScalFMMEngine
<
FReal
>::
abstrct
=
algoTS
;
//algoTS->execute(); will be done later
break
;
}
default
:
std
::
cout
<<
"No algorithm found (probably for strange reasons) : "
<<
FScalFMMEngine
<
FReal
>::
Algorithm
<<
" exiting"
<<
std
::
endl
;
}
if
(
FScalFMMEngine
<
FReal
>::
Algorithm
!=
2
){
if
(
upperLimit
!=
2
){
abstrct
->
execute
(
FFmmP2M
|
FFmmM2M
|
FFmmM2L
,
upperLimit
,
treeHeight
);
(
FScalFMMEngine
<
FReal
>::
abstrct
)
->
execute
(
FFmmP2M
|
FFmmM2M
|
FFmmM2L
,
upperLimit
,
treeHeight
);
printf
(
"
\t
UpPass finished
\n
"
);
internal_M2L
();
printf
(
"
\t
Strange M2L finished
\n
"
);
abstrct
->
execute
(
FFmmL2L
|
FFmmL2P
|
FFmmP2P
,
upperLimit
,
treeHeight
);
(
FScalFMMEngine
<
FReal
>::
abstrct
)
->
execute
(
FFmmL2L
|
FFmmL2P
|
FFmmP2P
,
upperLimit
,
treeHeight
);
printf
(
"
\t
DownPass finished
\n
"
);
}
else
{
abstrct
->
execute
();
(
FScalFMMEngine
<
FReal
>::
abstrct
)
->
execute
();
}
}
}
...
...
Addons/CKernelApi/Tests/testChebInterface.c
View file @
5108b944
...
...
@@ -65,7 +65,7 @@ void cheb_resetCell(int level, long long morton_index, int* tree_position, doubl
* @param number of particle (no default value)
*/
int
main
(
int
argc
,
char
**
av
){
//
omp_set_num_threads(1);
omp_set_num_threads
(
1
);
printf
(
"Start
\n
"
);
if
(
argc
<
2
){
printf
(
"Use : %s nb_part (optionnal : TreeHeight)
\n
exiting
\n
"
,
av
[
0
]);
...
...
@@ -149,6 +149,7 @@ int main(int argc, char ** av){
kernel
.
m2l_full
=
cheb_m2l_full
;
kernel
.
l2l
=
cheb_l2l
;
kernel
.
l2p
=
cheb_l2p
;
kernel
.
p2p_sym
=
NULL
;
kernel
.
p2p_full
=
cheb_p2pFull
;
kernel
.
p2pinner
=
NULL
;
kernel
.
p2p
=
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment