Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
solverstack
ScalFMM
Commits
d41d80b1
Commit
d41d80b1
authored
Nov 12, 2012
by
BRAMAS Berenger
Browse files
update fmm api
parent
a2c96d8b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Addons/FmmApi/Src/ScalfmmApiCore.cpp
View file @
d41d80b1
...
...
@@ -8,14 +8,12 @@
// Owners: INRIA.
// Copyright © 2011-2012, spread under the terms and conditions of a proprietary license.
// ===================================================================================
#include "../../Src/Utils/FParameters.hpp"
#include "../../Src/Utils/FTic.hpp"
#include "../../Src/Containers/FOctree.hpp"
#include "../../Src/Containers/FVector.hpp"
#include "../../Src/Components/FSimpleLeaf.hpp"
#include "../../Src/Components/FBasicParticle.hpp"
#include "../../Src/Components/FBasicCell.hpp"
#include "../../Src/Utils/FPoint.hpp"
...
...
@@ -308,19 +306,6 @@ int FmmCore_init(void **fmmCore) {
return
FMMAPI_NO_ERROR
;
}
/*alloue et initialise le FmmCore*/
// !!! Added !!!
int
FmmCore_finishInit
(
void
*
fmmCore
)
{
ScalFmmCoreHandle
*
corehandle
=
(
ScalFmmCoreHandle
*
)
fmmCore
;
corehandle
->
octree
=
new
OctreeClass
(
corehandle
->
config
.
treeHeight
,
FMath
::
Min
(
3
,
corehandle
->
config
.
treeHeight
-
1
),
corehandle
->
config
.
boxWidth
,
FPoint
(
corehandle
->
config
.
boxCenter
));
if
(
corehandle
->
config
.
nbThreads
!=
0
){
omp_set_num_threads
(
corehandle
->
config
.
nbThreads
);
}
return
FMMAPI_NO_ERROR
;
}
/*alloue et initialise le FmmCore*/
int
FmmCore_free
(
void
*
fmmCore
)
{
ScalFmmCoreHandle
*
corehandle
=
(
ScalFmmCoreHandle
*
)
fmmCore
;
...
...
@@ -561,14 +546,20 @@ int FmmCore_getKernelData(void*fmmCore, void **fmmKernel) {
int
FmmCore_setPositions
(
void
*
fmmCore
,
int
*
nb
,
FReal
*
position
)
{
ScalFmmCoreHandle
*
corehandle
=
(
ScalFmmCoreHandle
*
)
fmmCore
;
OctreeClass
*
octree
=
corehandle
->
octree
;
corehandle
->
octree
=
new
OctreeClass
(
corehandle
->
config
.
treeHeight
,
FMath
::
Min
(
3
,
corehandle
->
config
.
treeHeight
-
1
),
corehandle
->
config
.
boxWidth
,
FPoint
(
corehandle
->
config
.
boxCenter
));
if
(
corehandle
->
config
.
nbThreads
!=
0
){
omp_set_num_threads
(
corehandle
->
config
.
nbThreads
);
}
CoreParticleClass
part
;
for
(
int
idxPart
=
0
;
idxPart
<
(
*
nb
)
;
++
idxPart
){
FReal
*
pos
=
&
position
[
idxPart
*
3
];
part
.
setPosition
(
pos
[
0
],
pos
[
1
],
pos
[
2
]);
part
.
setIndex
(
idxPart
);
octree
->
insert
(
part
);
corehandle
->
octree
->
insert
(
part
);
}
return
FMMAPI_NO_ERROR
;
...
...
Addons/FmmApi/Src/ScalfmmApiRotation.cpp
View file @
d41d80b1
...
...
@@ -193,9 +193,8 @@ int FmmKernel_getLocalArraySize(void */*fmmCore*/, int *size){
/******* Opérateurs FMM : **/
int
FmmKernel_P2M
(
void
*
fmmCore
,
void
*
boxId
){
ScalFmmCoreHandle
*
corehandle
=
(
ScalFmmCoreHandle
*
)
fmmCore
;
ScalFmmKernelHandle
*
kernelhandle
;
FmmCore_getKernelData
(
corehandl
e
,
(
void
**
)
&
kernelhandle
);
FmmCore_getKernelData
(
fmmCor
e
,
(
void
**
)
&
kernelhandle
);
int
threadId
;
FmmCore_getParameter
(
fmmCore
,
FMMCORE_THREAD_ID
,
&
threadId
);
...
...
@@ -229,9 +228,8 @@ int FmmKernel_P2M(void *fmmCore, void* boxId){
}
int
FmmKernel_L2P
(
void
*
fmmCore
,
void
*
boxId
){
ScalFmmCoreHandle
*
corehandle
=
(
ScalFmmCoreHandle
*
)
fmmCore
;
ScalFmmKernelHandle
*
kernelhandle
;
FmmCore_getKernelData
(
corehandl
e
,
(
void
**
)
&
kernelhandle
);
FmmCore_getKernelData
(
fmmCor
e
,
(
void
**
)
&
kernelhandle
);
int
threadId
;
FmmCore_getParameter
(
fmmCore
,
FMMCORE_THREAD_ID
,
&
threadId
);
...
...
@@ -281,9 +279,8 @@ int FmmKernel_L2P(void *fmmCore, void* boxId){
}
int
FmmKernel_M2M
(
void
*
fmmCore
,
void
*
boxIdFather
,
void
*
boxIdSon
){
ScalFmmCoreHandle
*
corehandle
=
(
ScalFmmCoreHandle
*
)
fmmCore
;
ScalFmmKernelHandle
*
kernelhandle
;
FmmCore_getKernelData
(
corehandl
e
,
(
void
**
)
&
kernelhandle
);
FmmCore_getKernelData
(
fmmCor
e
,
(
void
**
)
&
kernelhandle
);
int
threadId
;
FmmCore_getParameter
(
fmmCore
,
FMMCORE_THREAD_ID
,
&
threadId
);
...
...
@@ -318,9 +315,8 @@ int FmmKernel_M2M(void *fmmCore, void *boxIdFather, void *boxIdSon){
}
int
FmmKernel_L2L
(
void
*
fmmCore
,
void
*
boxIdFather
,
void
*
boxIdSon
){
ScalFmmCoreHandle
*
corehandle
=
(
ScalFmmCoreHandle
*
)
fmmCore
;
ScalFmmKernelHandle
*
kernelhandle
;
FmmCore_getKernelData
(
corehandl
e
,
(
void
**
)
&
kernelhandle
);
FmmCore_getKernelData
(
fmmCor
e
,
(
void
**
)
&
kernelhandle
);
int
threadId
;
FmmCore_getParameter
(
fmmCore
,
FMMCORE_THREAD_ID
,
&
threadId
);
...
...
@@ -355,9 +351,8 @@ int FmmKernel_L2L(void *fmmCore, void *boxIdFather, void *boxIdSon){
}
int
FmmKernel_M2L
(
void
*
fmmCore
,
void
*
boxIdSrc
,
void
*
boxIdDest
){
ScalFmmCoreHandle
*
corehandle
=
(
ScalFmmCoreHandle
*
)
fmmCore
;
ScalFmmKernelHandle
*
kernelhandle
;
FmmCore_getKernelData
(
corehandl
e
,
(
void
**
)
&
kernelhandle
);
FmmCore_getKernelData
(
fmmCor
e
,
(
void
**
)
&
kernelhandle
);
int
threadId
;
FmmCore_getParameter
(
fmmCore
,
FMMCORE_THREAD_ID
,
&
threadId
);
...
...
@@ -394,9 +389,8 @@ int FmmKernel_M2L(void *fmmCore, void *boxIdSrc, void *boxIdDest){
}
int
FmmKernel_P2P
(
void
*
fmmCore
,
void
*
boxIdSrc
,
void
*
boxIdDest
){
ScalFmmCoreHandle
*
corehandle
=
(
ScalFmmCoreHandle
*
)
fmmCore
;
ScalFmmKernelHandle
*
kernelhandle
;
FmmCore_getKernelData
(
corehandl
e
,
(
void
**
)
&
kernelhandle
);
FmmCore_getKernelData
(
fmmCor
e
,
(
void
**
)
&
kernelhandle
);
int
threadId
;
FmmCore_getParameter
(
fmmCore
,
FMMCORE_THREAD_ID
,
&
threadId
);
...
...
Addons/FmmApi/Tests/testFmmApi.cpp
View file @
d41d80b1
...
...
@@ -14,9 +14,13 @@
#include "../../Src/Utils/FParameters.hpp"
#include "../../Src/Utils/FTic.hpp"
#include "../../Src/Utils/FMemUtils.hpp"
#include "../../Src/Files/FRandomLoader.hpp"
#include "../../Src/Components/FBasicParticle.hpp"
#include "../Src/FmmApi.h"
/** This program show an example of use of the fmm api
*/
...
...
@@ -35,7 +39,7 @@ int main(int argc, char ** argv){
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
FRandomLoader
<
Kernel
Particle
Class
>
loader
(
NbPart
,
1
,
FPoint
(
0.5
,
0.5
,
0.5
),
1
);
FRandomLoader
<
FBasic
Particle
>
loader
(
NbPart
,
1
,
FPoint
(
0.5
,
0.5
,
0.5
),
1
);
void
*
FmmCoreHandle
;
FmmCore_init
(
&
FmmCoreHandle
);
...
...
@@ -45,8 +49,6 @@ int main(int argc, char ** argv){
FmmCore_setParameter
(
FmmCoreHandle
,
FMMCORE_ROOT_BOX_WIDTH
,
&
boxWidth
);
FmmCore_setParameter
(
FmmCoreHandle
,
FMMCORE_ROOT_BOX_CENTER
,
loader
.
getCenterOfBox
().
getDataValue
());
FmmCore_finishInit
(
FmmCoreHandle
);
void
*
FmmKernelHandle
;
FmmKernel_init
(
FmmCoreHandle
,
&
FmmKernelHandle
);
...
...
@@ -64,13 +66,13 @@ int main(int argc, char ** argv){
FReal
*
positions
=
new
FReal
[
nbPart
*
3
];
{
Kernel
Particle
Class
part
;
part
.
setP
hysicalValue
(
0.1
)
;
FBasic
Particle
part
;
const
FReal
p
hysicalValue
=
0.1
;
for
(
int
idx
=
0
;
idx
<
nbPart
;
++
idx
){
loader
.
fillParticle
(
part
);
potentials
[
idx
]
=
p
art
.
getP
hysicalValue
()
;
potentials
[
idx
]
=
physicalValue
;
positions
[
3
*
idx
]
=
part
.
getPosition
().
getX
();
positions
[
3
*
idx
+
1
]
=
part
.
getPosition
().
getY
();
positions
[
3
*
idx
+
2
]
=
part
.
getPosition
().
getZ
();
...
...
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