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
41bcd12d
Commit
41bcd12d
authored
Mar 25, 2015
by
BRAMAS Berenger
Browse files
change ScalFMM to SCALFMM in the code and the cmake files
parent
3e570695
Changes
59
Expand all
Hide whitespace changes
Inline
Side-by-side
Addons/CKernelApi/CMakeLists.txt
View file @
41bcd12d
...
...
@@ -4,8 +4,8 @@ if(insource)
MESSAGE
(
FATAL_ERROR
"
${
PROJECT_NAME
}
requires an out of source build. Goto ./Build and tapes cmake ../"
)
endif
(
insource
)
project
(
A
ddons_ckernelapi_scalfmm
CXX C
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
S
ca
LFMM_CXX_FLAGS
}
"
)
project
(
A
DDONS_CKERNELAPI_SCALFMM
CXX C
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
S
CA
LFMM_CXX_FLAGS
}
"
)
# Active language
# -----------------------
...
...
@@ -14,7 +14,7 @@ MESSAGE(STATUS " CXX ${CMAKE_CXX_COMPILER_ID}" )
# if ask to build addon
if
(
S
cal
FMM_ADDON_CKERNELAPI
)
if
(
S
CAL
FMM_ADDON_CKERNELAPI
)
# first build lib scalfmmckernelapi
set
(
LIBRARY_OUTPUT_PATH ../lib/
${
CMAKE_BUILD_TYPE
}
)
...
...
@@ -58,7 +58,7 @@ if(ScalFMM_ADDON_CKERNELAPI)
foreach
(
fuse_key
${
FUSE_LIST
}
)
file
(
STRINGS
"
${
exec
}
"
lines_fuse REGEX
"@FUSE_
${
fuse_key
}
"
)
if
(
lines_fuse
)
if
(
NOT S
cal
FMM_USE_
${
fuse_key
}
)
if
(
NOT S
CAL
FMM_USE_
${
fuse_key
}
)
MESSAGE
(
STATUS
"This needs
${
fuse_key
}
=
${
exec
}
"
)
set
(
compile_exec
"FALSE"
)
endif
()
...
...
Addons/FmmApi/CMakeLists.txt
View file @
41bcd12d
...
...
@@ -60,7 +60,7 @@ if(SCALFMM_ADDON_FMMAPI)
foreach
(
fuse_key
${
FUSE_LIST
}
)
file
(
STRINGS
"
${
exec
}
"
lines_fuse REGEX
"@FUSE_
${
fuse_key
}
"
)
if
(
lines_fuse
)
if
(
NOT S
cal
FMM_USE_
${
fuse_key
}
)
if
(
NOT S
CAL
FMM_USE_
${
fuse_key
}
)
MESSAGE
(
STATUS
"This needs
${
fuse_key
}
=
${
exec
}
"
)
set
(
compile_exec
"FALSE"
)
endif
()
...
...
Addons/FmmApi/Src/ScalfmmApiCore.cpp
View file @
41bcd12d
...
...
@@ -24,7 +24,7 @@
#include "../../Src/Components/FBasicParticleContainer.hpp"
#ifdef S
cal
FMM_USE_MPI
#ifdef S
CAL
FMM_USE_MPI
#include "../../Src/Utils/FMpi.hpp"
#endif
...
...
@@ -268,7 +268,7 @@ struct ScalFmmCoreHandle {
int
treeHeight
;
// hombre de niveaux de l'arbre (int)
FReal
boxWidth
;
// taille de la boîte racine (FReal)
FReal
boxCenter
[
3
];
// position du centre de la boîte racine (FReal[3])
#ifdef S
cal
FMM_USE_MPI
#ifdef S
CAL
FMM_USE_MPI
MPI_Comm
mpiCom
;
// communicateur MPI (MPI_Comm)
#endif
int
nbThreads
;
// nombre de threads (int)
...
...
@@ -304,7 +304,7 @@ int FmmCore_isParameterUsed(void */*fmmCore*/, int *name, int *flag){
case
FMMCORE_ROOT_BOX_WIDTH
:
case
FMMCORE_ROOT_BOX_CENTER
:
case
FMMCORE_TREE_HEIGHT
:
#ifdef S
cal
FMM_USE_MPI
#ifdef S
CAL
FMM_USE_MPI
case
FMMCORE_MPI_COMMUNICATOR
:
#endif
case
FMMCORE_THREADS_NUMBER
:
...
...
@@ -343,7 +343,7 @@ int FmmCore_setParameter(void *fmmCore, int *name, void*value){
case
FMMCORE_ROOT_BOX_CENTER
:
memcpy
(
corehandle
->
config
.
boxCenter
,
value
,
sizeof
(
FReal
)
*
3
);
break
;
#ifdef S
cal
FMM_USE_MPI
#ifdef S
CAL
FMM_USE_MPI
case
FMMCORE_MPI_COMMUNICATOR
:
corehandle
->
config
.
mpiCom
=
*
(
MPI_Comm
*
)
value
;
break
;
...
...
@@ -388,7 +388,7 @@ int FmmCore_getParameter(void *fmmCore, int *name, void*value){
case
FMMCORE_ROOT_BOX_CENTER
:
memcpy
(
value
,
corehandle
->
config
.
boxCenter
,
sizeof
(
FReal
)
*
3
);
break
;
#ifdef S
cal
FMM_USE_MPI
#ifdef S
CAL
FMM_USE_MPI
case
FMMCORE_MPI_COMMUNICATOR
:
*
(
MPI_Comm
*
)
value
=
corehandle
->
config
.
mpiCom
;
break
;
...
...
CMakeLists.txt
View file @
41bcd12d
This diff is collapsed.
Click to expand it.
Doc/CMakeLists.txt
View file @
41bcd12d
# add a target to generate API documentation with Doxygen
OPTION
(
S
cal
FMM_BUILD_DOC
"Set to ON to build the Doxygen documentation "
OFF
)
IF
(
S
cal
FMM_BUILD_DOC
)
OPTION
(
S
CAL
FMM_BUILD_DOC
"Set to ON to build the Doxygen documentation "
OFF
)
IF
(
S
CAL
FMM_BUILD_DOC
)
find_package
(
Doxygen
)
if
(
DOXYGEN_FOUND
)
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/Doxyfile.in
${
CMAKE_CURRENT_BINARY_DIR
}
/Doxyfile @ONLY
)
...
...
@@ -10,11 +10,11 @@ IF(ScalFMM_BUILD_DOC)
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
COMMENT
"Generating API documentation with Doxygen"
VERBATIM
)
# INSTALL(FILES ${S
cal
FMM_BINARY_DIR}/Doc/scalfmm.tag
# INSTALL(FILES ${S
CAL
FMM_BINARY_DIR}/Doc/scalfmm.tag
# DESTINATION doc/
# )
# INSTALL(DIRECTORY ${S
cal
FMM_BINARY_DIR}/Doc/html
# INSTALL(DIRECTORY ${S
CAL
FMM_BINARY_DIR}/Doc/html
# DESTINATION doc/
# )
endif
(
DOXYGEN_FOUND
)
endif
(
S
cal
FMM_BUILD_DOC
)
endif
(
S
CAL
FMM_BUILD_DOC
)
Doc/Site_dox/FDownload.dox
View file @
41bcd12d
...
...
@@ -40,8 +40,8 @@
* </ul>
*
* an example : <br>
* <b> cmake -DS
cal
FMM_USE_BLAS=ON -DS
cal
FMM_USE_MKL_AS_BLAS=ON \ <br>
* -DS
cal
FMM_USE_SSE=OFF -DS
cal
FMM_USE_AVX=ON ../ </b>
* <b> cmake -DS
CAL
FMM_USE_BLAS=ON -DS
CAL
FMM_USE_MKL_AS_BLAS=ON \ <br>
* -DS
CAL
FMM_USE_SSE=OFF -DS
CAL
FMM_USE_AVX=ON ../ </b>
*
* \subsection conf Configuration of the build
*
...
...
@@ -49,33 +49,33 @@
*
* <ul>
* <li> CMAKE_INSTALL_PREFIX : to choose where to install ScalFmm </li>
* <li> S
cal
FMM_USE_MPI : to use and enable MPI. Warning, you need to use this parameter at the first cmake command you write. </li>
* <li> S
cal
FMM_ATTACHE_SOURCE : to build with -g </li>
* <li> SS
cal
FMM_BUILD_TESTS : to build the text and the examples </li>
* <li> S
cal
FMM_BUILD_UTESTS : to build the unit tests </li>
* <li> S
cal
FMM_USE_ADDONS : to activate add ons </li>
* <li> S
CAL
FMM_USE_MPI : to use and enable MPI. Warning, you need to use this parameter at the first cmake command you write. </li>
* <li> S
CAL
FMM_ATTACHE_SOURCE : to build with -g </li>
* <li> SS
CAL
FMM_BUILD_TESTS : to build the text and the examples </li>
* <li> S
CAL
FMM_BUILD_UTESTS : to build the unit tests </li>
* <li> S
CAL
FMM_USE_ADDONS : to activate add ons </li>
* <ul>
* <li> SCALFMM_ADDON_FMMAPI : to build Fmm Api </li>
* </ul>
* <li> S
cal
FMM_USE_DOUBLE_PRECISION : to build in double precision </li>
* <li> S
CAL
FMM_USE_DOUBLE_PRECISION : to build in double precision </li>
* <li> ScalFMMUSE_MEM_STATS : to use memory stats (which count any new/delete done during a simulation) </li>
* <li> S
cal
FMM_USE_BLAS : to enable BLAS (needed by Chebyshev interpolation kernel) </li>
* <li> S
CAL
FMM_USE_BLAS : to enable BLAS (needed by Chebyshev interpolation kernel) </li>
* <ul>
* <li> SCALFMM_USE_MKL_AS_BLAS : to use MKL as blas </li>
* </ul>
* <li> S
cal
FMM_USE_FFT : Use FFTW needed for uniform point for interpolation kernel</li>
* <li> S
CAL
FMM_USE_FFT : Use FFTW needed for uniform point for interpolation kernel</li>
* <ul>
* <li> ( S
cal
FMM_USE_MKL_AS_FFTW : to use MKL as FFTW </li>
* <li> ( S
CAL
FMM_USE_MKL_AS_FFTW : to use MKL as FFTW </li>
* </ul>
* <li> S
cal
FMM_USE_TRACE : to create trace </li>
* <li> S
CAL
FMM_USE_TRACE : to create trace </li>
* <ul>
* <li> S
cal
FMM_USE_ITAC : to use Intel ITAC tool as trace generator </li>
* <li> S
CAL
FMM_USE_ITAC : to use Intel ITAC tool as trace generator </li>
* </ul>
* <li> S
cal
FMM_USE_LOG to print output debug information
* <li> S
cal
FMM_USE_ASSERT enable safe tests during execution
* <li> S
cal
FMM_USE_MEM_STATS to profile memory
* <li> S
cal
FMM_USE_SSE compile with SEE support
* <li> S
cal
FMM_USE_AVX compile with AVX support
* <li> S
CAL
FMM_USE_LOG to print output debug information
* <li> S
CAL
FMM_USE_ASSERT enable safe tests during execution
* <li> S
CAL
FMM_USE_MEM_STATS to profile memory
* <li> S
CAL
FMM_USE_SSE compile with SEE support
* <li> S
CAL
FMM_USE_AVX compile with AVX support
* <li>
* </ul>
*
...
...
Examples/CMakeLists.txt
View file @
41bcd12d
...
...
@@ -4,7 +4,7 @@ if(insource)
MESSAGE
(
FATAL_ERROR
"
${
PROJECT_NAME
}
requires an out of source build. Goto scalfmm/Build and tapes cmake ../"
)
endif
(
insource
)
project
(
E
xamples_scalfmm
CXX
)
project
(
E
XAMPLES_SCALFMM
CXX
)
set
(
EXECUTABLE_OUTPUT_PATH
${
CMAKE_BUILD_TYPE
}
)
ADD_DEFINITIONS
(
${
ScaLFMM_CXX_FLAGS
}
)
# Find all code files
...
...
@@ -36,7 +36,7 @@ foreach(exec ${source_tests_files})
foreach
(
fuse_key
${
FUSE_LIST
}
)
file
(
STRINGS
"
${
exec
}
"
lines_fuse REGEX
"@FUSE_
${
fuse_key
}
"
)
if
(
lines_fuse
)
if
(
NOT S
cal
FMM_USE_
${
fuse_key
}
)
if
(
NOT S
CAL
FMM_USE_
${
fuse_key
}
)
MESSAGE
(
STATUS
"This needs
${
fuse_key
}
=
${
exec
}
"
)
set
(
compile_exec
"FALSE"
)
endif
()
...
...
Examples/ChebyshevInterpolationMPIFMM.cpp
View file @
41bcd12d
...
...
@@ -59,11 +59,11 @@
int
main
(
int
argc
,
char
*
argv
[])
{
FHelpDescribeAndExit
(
argc
,
argv
,
"Driver for Chebyshev Interpolation kernel using MPI (1/r kernel). "
"Usully run using : mpirun -np nb_proc_needed ./ChebyshevInterpolationAlgorithm [params]."
,
FParameterDefinitions
::
InputFile
,
FParameterDefinitions
::
OctreeHeight
,
FParameterDefinitions
::
OctreeSubHeight
,
FParameterDefinitions
::
InputFile
,
FParameterDefinitions
::
NbThreads
);
"Driver for Chebyshev Interpolation kernel using MPI (1/r kernel). "
"Usully run using : mpirun -np nb_proc_needed ./ChebyshevInterpolationAlgorithm [params]."
,
FParameterDefinitions
::
InputFile
,
FParameterDefinitions
::
OctreeHeight
,
FParameterDefinitions
::
OctreeSubHeight
,
FParameterDefinitions
::
InputFile
,
FParameterDefinitions
::
NbThreads
);
const
std
::
string
defaultFile
(
/*SCALFMMDataPath+*/
"../Data/test20k.fma"
);
const
std
::
string
filename
=
FParameters
::
getStr
(
argc
,
argv
,
FParameterDefinitions
::
InputFile
.
options
,
defaultFile
.
c_str
());
...
...
@@ -71,184 +71,181 @@ int main(int argc, char* argv[])
const
unsigned
int
SubTreeHeight
=
FParameters
::
getValue
(
argc
,
argv
,
FParameterDefinitions
::
OctreeSubHeight
.
options
,
2
);
const
unsigned
int
NbThreads
=
FParameters
::
getValue
(
argc
,
argv
,
FParameterDefinitions
::
NbThreads
.
options
,
1
);
#ifdef _OPENMP
omp_set_num_threads
(
NbThreads
);
std
::
cout
<<
"
\n
>> Using "
<<
omp_get_max_threads
()
<<
" threads.
\n
"
<<
std
::
endl
;
#else
std
::
cout
<<
"
\n
>> Sequential version.
\n
"
<<
std
::
endl
;
#endif
//
std
::
cout
<<
"Parameters "
<<
std
::
endl
<<
" Octree Depth "
<<
TreeHeight
<<
std
::
endl
<<
" SubOctree depth "
<<
SubTreeHeight
<<
std
::
endl
<<
" Input file name: "
<<
filename
<<
std
::
endl
<<
" Thread number: "
<<
NbThreads
<<
std
::
endl
<<
std
::
endl
;
//init values for MPI
FMpi
app
(
argc
,
argv
);
//
// init timer
FTic
time
;
omp_set_num_threads
(
NbThreads
);
std
::
cout
<<
"
\n
>> Using "
<<
omp_get_max_threads
()
<<
" threads.
\n
"
<<
std
::
endl
;
//
std
::
cout
<<
"Parameters "
<<
std
::
endl
<<
" Octree Depth "
<<
TreeHeight
<<
std
::
endl
<<
" SubOctree depth "
<<
SubTreeHeight
<<
std
::
endl
<<
" Input file name: "
<<
filename
<<
std
::
endl
<<
" Thread number: "
<<
NbThreads
<<
std
::
endl
<<
std
::
endl
;
//init values for MPI
FMpi
app
(
argc
,
argv
);
//
// init timer
FTic
time
;
typedef
double
FReal
;
FMpiFmaGenericLoader
<
FReal
>
loader
(
filename
,
app
.
global
());
if
(
!
loader
.
isOpen
())
throw
std
::
runtime_error
(
"Particle file couldn't be opened!"
)
;
////////////////////////////////////////////////////////////////////
if
(
!
loader
.
isOpen
())
throw
std
::
runtime_error
(
"Particle file couldn't be opened!"
)
;
////////////////////////////////////////////////////////////////////
// begin spherical kernel
// accuracy
const
unsigned
int
ORDER
=
7
;
// typedefs
// accuracy
const
unsigned
int
ORDER
=
7
;
// typedefs
typedef
FP2PParticleContainerIndexed
<
FReal
>
ContainerClass
;
typedef
FSimpleLeaf
<
FReal
,
ContainerClass
>
LeafClass
;
typedef
FChebCell
<
FReal
,
ORDER
>
CellClass
;
typedef
FOctree
<
FReal
,
CellClass
,
ContainerClass
,
LeafClass
>
OctreeClass
;
typedef
FInterpMatrixKernelR
<
FReal
>
MatrixKernelClass
;
const
MatrixKernelClass
MatrixKernel
;
const
MatrixKernelClass
MatrixKernel
;
typedef
FChebSymKernel
<
FReal
,
CellClass
,
ContainerClass
,
MatrixKernelClass
,
ORDER
>
KernelClass
;
//
typedef
FFmmAlgorithmThreadProc
<
OctreeClass
,
CellClass
,
ContainerClass
,
KernelClass
,
LeafClass
>
FmmClassProc
;
// init oct-tree
OctreeClass
tree
(
TreeHeight
,
SubTreeHeight
,
loader
.
getBoxWidth
(),
loader
.
getCenterOfBox
());
{
// -----------------------------------------------------
if
(
app
.
global
().
processId
()
==
0
){
std
::
cout
<<
"Creating & Inserting "
<<
loader
.
getNumberOfParticles
()
<<
" particles ..."
<<
std
::
endl
;
std
::
cout
<<
"
\t
Height : "
<<
TreeHeight
<<
"
\t
sub-height : "
<<
SubTreeHeight
<<
std
::
endl
;
}
time
.
tic
();
//
struct
TestParticle
{
FSize
index
;
FPoint
<
FReal
>
position
;
FReal
physicalValue
;
const
FPoint
<
FReal
>&
getPosition
(){
return
position
;
}
};
TestParticle
*
particles
=
new
TestParticle
[
loader
.
getMyNumberOfParticles
()];
memset
(
particles
,
0
,
(
unsigned
int
)
(
sizeof
(
TestParticle
)
*
loader
.
getMyNumberOfParticles
()));
//idx (in file) of the first part that will be used by this proc.
FSize
idxStart
=
loader
.
getStart
();
printf
(
"Proc %d idxStart %lld
\n
"
,
app
.
global
().
processId
(),
idxStart
);
for
(
FSize
idxPart
=
0
;
idxPart
<
loader
.
getMyNumberOfParticles
()
;
++
idxPart
){
//Storage of the index (in the original file) of each part.
particles
[
idxPart
].
index
=
idxPart
+
idxStart
;
// Read particles from file
loader
.
fillParticle
(
&
particles
[
idxPart
].
position
,
&
particles
[
idxPart
].
physicalValue
);
}
FVector
<
TestParticle
>
finalParticles
;
FLeafBalance
balancer
;
// FMpiTreeBuilder< FReal,TestParticle >::ArrayToTree(app.global(), particles, loader.getMyNumberOfParticles(),
// tree.getBoxCenter(),
// tree.getBoxWidth(),
// tree.getHeight(), &finalParticles,&balancer);
FMpiTreeBuilder
<
FReal
,
TestParticle
>::
DistributeArrayToContainer
(
app
.
global
(),
particles
,
loader
.
getMyNumberOfParticles
(),
tree
.
getBoxCenter
(),
tree
.
getBoxWidth
(),
tree
.
getHeight
(),
&
finalParticles
,
&
balancer
);
for
(
int
idx
=
0
;
idx
<
finalParticles
.
getSize
();
++
idx
){
tree
.
insert
(
finalParticles
[
idx
].
position
,
finalParticles
[
idx
].
index
,
finalParticles
[
idx
].
physicalValue
);
}
printf
(
"%d parts have been inserted in Tree
\n
"
,
finalParticles
.
getSize
());
delete
[]
particles
;
time
.
tac
();
double
timeUsed
=
time
.
elapsed
();
double
minTime
,
maxTime
;
std
::
cout
<<
"Done "
<<
"(@Reading and Inserting Particles = "
<<
time
.
elapsed
()
<<
"s)."
<<
std
::
endl
;
MPI_Reduce
(
&
timeUsed
,
&
minTime
,
1
,
MPI_DOUBLE
,
MPI_MIN
,
0
,
app
.
global
().
getComm
());
MPI_Reduce
(
&
timeUsed
,
&
maxTime
,
1
,
MPI_DOUBLE
,
MPI_MAX
,
0
,
app
.
global
().
getComm
());
if
(
app
.
global
().
processId
()
==
0
){
printf
(
"Reading and Inserting Particles Time used :
\t
MIN : %f
\t
MAX %f in s
\n
"
,
minTime
,
maxTime
);
}
}
// -----------------------------------------------------
{
// -----------------------------------------------------
std
::
cout
<<
"
\n
Chebyshev Interpolation FMM Proc (P="
<<
ORDER
<<
") ... "
<<
std
::
endl
;
time
.
tic
();
//
// Here we use a pointer due to the limited size of the stack
//
KernelClass
*
kernels
=
new
KernelClass
(
TreeHeight
,
loader
.
getBoxWidth
(),
loader
.
getCenterOfBox
(),
&
MatrixKernel
);
//
FmmClassProc
algorithm
(
app
.
global
(),
&
tree
,
kernels
);
//
algorithm
.
execute
();
// Here the call of the FMM algorithm
//
time
.
tac
();
double
timeUsed
=
time
.
elapsed
();
double
minTime
,
maxTime
;
std
::
cout
<<
"Done "
<<
"(@Algorithm = "
<<
time
.
elapsed
()
<<
" s)."
<<
std
::
endl
;
MPI_Reduce
(
&
timeUsed
,
&
minTime
,
1
,
MPI_DOUBLE
,
MPI_MIN
,
0
,
app
.
global
().
getComm
());
MPI_Reduce
(
&
timeUsed
,
&
maxTime
,
1
,
MPI_DOUBLE
,
MPI_MAX
,
0
,
app
.
global
().
getComm
());
if
(
app
.
global
().
processId
()
==
0
){
printf
(
"Time used :
\t
MIN : %f
\t
MAX %f
\n
"
,
minTime
,
maxTime
);
}
}
// -----------------------------------------------------
//
// Some output
//
//
{
// -----------------------------------------------------
long
int
N1
=
0
,
N2
=
loader
.
getNumberOfParticles
()
/
2
,
N3
=
(
loader
.
getNumberOfParticles
()
-
1
);
;
FReal
energy
=
0.0
;
//
// Loop over all leaves
//
std
::
cout
<<
std
::
endl
<<
" &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& "
<<
std
::
endl
;
std
::
cout
<<
std
::
scientific
;
std
::
cout
.
precision
(
10
)
;
tree
.
forEachLeaf
([
&
](
LeafClass
*
leaf
){
const
FReal
*
const
posX
=
leaf
->
getTargets
()
->
getPositions
()[
0
];
const
FReal
*
const
posY
=
leaf
->
getTargets
()
->
getPositions
()[
1
];
const
FReal
*
const
posZ
=
leaf
->
getTargets
()
->
getPositions
()[
2
];
const
FReal
*
const
potentials
=
leaf
->
getTargets
()
->
getPotentials
();
const
FReal
*
const
forcesX
=
leaf
->
getTargets
()
->
getForcesX
();
const
FReal
*
const
forcesY
=
leaf
->
getTargets
()
->
getForcesY
();
const
FReal
*
const
forcesZ
=
leaf
->
getTargets
()
->
getForcesZ
();
const
int
nbParticlesInLeaf
=
leaf
->
getTargets
()
->
getNbParticles
();
const
FReal
*
const
physicalValues
=
leaf
->
getTargets
()
->
getPhysicalValues
();
const
FVector
<
int
>&
indexes
=
leaf
->
getTargets
()
->
getIndexes
();
for
(
int
idxPart
=
0
;
idxPart
<
nbParticlesInLeaf
;
++
idxPart
){
const
int
indexPartOrig
=
indexes
[
idxPart
];
if
((
indexPartOrig
==
N1
)
||
(
indexPartOrig
==
N2
)
||
(
indexPartOrig
==
N3
)
)
{
std
::
cout
<<
"Proc "
<<
app
.
global
().
processId
()
<<
" Index "
<<
indexPartOrig
<<
" potential "
<<
potentials
[
idxPart
]
<<
" Pos "
<<
posX
[
idxPart
]
<<
" "
<<
posY
[
idxPart
]
<<
" "
<<
posZ
[
idxPart
]
<<
" Forces: "
<<
forcesX
[
idxPart
]
<<
" "
<<
forcesY
[
idxPart
]
<<
" "
<<
forcesZ
[
idxPart
]
<<
std
::
endl
;
}
energy
+=
potentials
[
idxPart
]
*
physicalValues
[
idxPart
]
;
}
});
FReal
gloEnergy
=
app
.
global
().
reduceSum
(
energy
);
if
(
0
==
app
.
global
().
processId
()){
std
::
cout
<<
std
::
endl
<<
"Proc "
<<
app
.
global
().
processId
()
<<
" Energy: "
<<
gloEnergy
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
<<
" &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& "
<<
std
::
endl
<<
std
::
endl
;
}
}
// -----------------------------------------------------
return
0
;
//
typedef
FFmmAlgorithmThreadProc
<
OctreeClass
,
CellClass
,
ContainerClass
,
KernelClass
,
LeafClass
>
FmmClassProc
;
// init oct-tree
OctreeClass
tree
(
TreeHeight
,
SubTreeHeight
,
loader
.
getBoxWidth
(),
loader
.
getCenterOfBox
());
{
// -----------------------------------------------------
if
(
app
.
global
().
processId
()
==
0
){
std
::
cout
<<
"Creating & Inserting "
<<
loader
.
getNumberOfParticles
()
<<
" particles ..."
<<
std
::
endl
;
std
::
cout
<<
"
\t
Height : "
<<
TreeHeight
<<
"
\t
sub-height : "
<<
SubTreeHeight
<<
std
::
endl
;
}
time
.
tic
();
//
struct
TestParticle
{
FSize
index
;
FPoint
<
FReal
>
position
;
FReal
physicalValue
;
const
FPoint
<
FReal
>&
getPosition
(){
return
position
;
}
};
TestParticle
*
particles
=
new
TestParticle
[
loader
.
getMyNumberOfParticles
()];
memset
(
particles
,
0
,
(
unsigned
int
)
(
sizeof
(
TestParticle
)
*
loader
.
getMyNumberOfParticles
()));
//idx (in file) of the first part that will be used by this proc.
FSize
idxStart
=
loader
.
getStart
();
printf
(
"Proc %d idxStart %lld
\n
"
,
app
.
global
().
processId
(),
idxStart
);
for
(
FSize
idxPart
=
0
;
idxPart
<
loader
.
getMyNumberOfParticles
()
;
++
idxPart
){
//Storage of the index (in the original file) of each part.
particles
[
idxPart
].
index
=
idxPart
+
idxStart
;
// Read particles from file
loader
.
fillParticle
(
&
particles
[
idxPart
].
position
,
&
particles
[
idxPart
].
physicalValue
);
}
FVector
<
TestParticle
>
finalParticles
;
FLeafBalance
balancer
;
// FMpiTreeBuilder< FReal,TestParticle >::ArrayToTree(app.global(), particles, loader.getMyNumberOfParticles(),
// tree.getBoxCenter(),
// tree.getBoxWidth(),
// tree.getHeight(), &finalParticles,&balancer);
FMpiTreeBuilder
<
FReal
,
TestParticle
>::
DistributeArrayToContainer
(
app
.
global
(),
particles
,
loader
.
getMyNumberOfParticles
(),
tree
.
getBoxCenter
(),
tree
.
getBoxWidth
(),
tree
.
getHeight
(),
&
finalParticles
,
&
balancer
);
for
(
int
idx
=
0
;
idx
<
finalParticles
.
getSize
();
++
idx
){
tree
.
insert
(
finalParticles
[
idx
].
position
,
finalParticles
[
idx
].
index
,
finalParticles
[
idx
].
physicalValue
);
}
printf
(
"%d parts have been inserted in Tree
\n
"
,
finalParticles
.
getSize
());
delete
[]
particles
;
time
.
tac
();
double
timeUsed
=
time
.
elapsed
();
double
minTime
,
maxTime
;
std
::
cout
<<
"Done "
<<
"(@Reading and Inserting Particles = "
<<
time
.
elapsed
()
<<
"s)."
<<
std
::
endl
;
MPI_Reduce
(
&
timeUsed
,
&
minTime
,
1
,
MPI_DOUBLE
,
MPI_MIN
,
0
,
app
.
global
().
getComm
());
MPI_Reduce
(
&
timeUsed
,
&
maxTime
,
1
,
MPI_DOUBLE
,
MPI_MAX
,
0
,
app
.
global
().
getComm
());
if
(
app
.
global
().
processId
()
==
0
){
printf
(
"Reading and Inserting Particles Time used :
\t
MIN : %f
\t
MAX %f in s
\n
"
,
minTime
,
maxTime
);
}
}
// -----------------------------------------------------
{
// -----------------------------------------------------
std
::
cout
<<
"
\n
Chebyshev Interpolation FMM Proc (P="
<<
ORDER
<<
") ... "
<<
std
::
endl
;
time
.
tic
();
//
// Here we use a pointer due to the limited size of the stack
//
KernelClass
*
kernels
=
new
KernelClass
(
TreeHeight
,
loader
.
getBoxWidth
(),
loader
.
getCenterOfBox
(),
&
MatrixKernel
);
//
FmmClassProc
algorithm
(
app
.
global
(),
&
tree
,
kernels
);
//
algorithm
.
execute
();
// Here the call of the FMM algorithm
//
time
.
tac
();
double
timeUsed
=
time
.
elapsed
();
double
minTime
,
maxTime
;
std
::
cout
<<
"Done "
<<
"(@Algorithm = "
<<
time
.
elapsed
()
<<
" s)."
<<
std
::
endl
;
MPI_Reduce
(
&
timeUsed
,
&
minTime
,
1
,
MPI_DOUBLE
,
MPI_MIN
,
0
,
app
.
global
().
getComm
());
MPI_Reduce
(
&
timeUsed
,
&
maxTime
,
1
,
MPI_DOUBLE
,
MPI_MAX
,
0
,
app
.
global
().
getComm
());
if
(
app
.
global
().
processId
()
==
0
){
printf
(
"Time used :
\t
MIN : %f
\t
MAX %f
\n
"
,
minTime
,
maxTime
);
}
delete
kernels
;
}
// -----------------------------------------------------
//
// Some output
//
//
{
// -----------------------------------------------------
long
int
N1
=
0
,
N2
=
loader
.
getNumberOfParticles
()
/
2
,
N3
=
(
loader
.
getNumberOfParticles
()
-
1
);
;
FReal
energy
=
0.0
;
//
// Loop over all leaves
//
std
::
cout
<<
std
::
endl
<<
" &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& "
<<
std
::
endl
;
std
::
cout
<<
std
::
scientific
;
std
::
cout
.
precision
(
10
)
;
tree
.
forEachLeaf
([
&
](
LeafClass
*
leaf
){
const
FReal
*
const
posX
=
leaf
->
getTargets
()
->
getPositions
()[
0
];
const
FReal
*
const
posY
=
leaf
->
getTargets
()
->
getPositions
()[
1
];
const
FReal
*
const
posZ
=
leaf
->
getTargets
()
->
getPositions
()[
2
];
const
FReal
*
const
potentials
=
leaf
->
getTargets
()
->
getPotentials
();
const
FReal
*
const
forcesX
=
leaf
->
getTargets
()
->
getForcesX
();
const
FReal
*
const
forcesY
=
leaf
->
getTargets
()
->
getForcesY
();
const
FReal
*
const
forcesZ
=
leaf
->
getTargets
()
->
getForcesZ
();
const
int
nbParticlesInLeaf
=
leaf
->
getTargets
()
->
getNbParticles
();
const
FReal
*
const
physicalValues
=
leaf
->
getTargets
()
->
getPhysicalValues
();
const
FVector
<
int
>&
indexes
=
leaf
->
getTargets
()
->
getIndexes
();
for
(
int
idxPart
=
0
;
idxPart
<
nbParticlesInLeaf
;
++
idxPart
){
const
int
indexPartOrig
=
indexes
[
idxPart
];
if
((
indexPartOrig
==
N1
)
||
(
indexPartOrig
==
N2
)
||
(
indexPartOrig
==
N3
)
)
{
std
::
cout
<<
"Proc "
<<
app
.
global
().
processId
()
<<
" Index "
<<
indexPartOrig
<<
" potential "
<<
potentials
[
idxPart
]
<<
" Pos "
<<
posX
[
idxPart
]
<<
" "
<<
posY
[
idxPart
]
<<
" "
<<
posZ
[
idxPart
]
<<
" Forces: "
<<
forcesX
[
idxPart
]
<<
" "
<<
forcesY
[
idxPart
]
<<
" "
<<
forcesZ
[
idxPart
]
<<
std
::
endl
;
}
energy
+=
potentials
[
idxPart
]
*
physicalValues
[
idxPart
]
;
}
});
FReal
gloEnergy
=
app
.
global
().
reduceSum
(
energy
);
if
(
0
==
app
.
global
().
processId
()){
std
::
cout
<<
std
::
endl
<<
"Proc "
<<
app
.
global
().
processId
()
<<
" Energy: "
<<
gloEnergy
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
<<
" &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& "
<<
std
::
endl
<<
std
::
endl
;
}
}
// -----------------------------------------------------
return
0
;
}
Examples/LagrangeInterpolationFMM.cpp
View file @
41bcd12d
This diff is collapsed.
Click to expand it.
Examples/changeFmaFormat.cpp
View file @
41bcd12d
...
...
@@ -92,6 +92,6 @@ int main(int argc, char ** argv){
driverExportData
(
outfilename
,
particles
,
NbPoints
,
loader
.
getNbRecordPerline
()
);
}
//
delete
particles
;
delete
[]
particles
;
return
0
;
}
Examples/compareAllPoissonKernels.cpp
View file @
41bcd12d
...
...
@@ -36,7 +36,7 @@
#include "Core/FFmmAlgorithmThread.hpp"
#ifdef S
cal
FMM_USE_BLAS
#ifdef S
CAL
FMM_USE_BLAS
// chebyshev kernel
#include "Kernels/Chebyshev/FChebCell.hpp"
...
...
@@ -47,7 +47,7 @@
//
// spherical kernel
#include "Kernels/Spherical/FSphericalCell.hpp"
#ifdef S
cal
FMM_USE_BLAS
#ifdef S
CAL
FMM_USE_BLAS
#include "Kernels/Spherical/FSphericalBlasKernel.hpp"
#include "Kernels/Spherical/FSphericalBlockBlasKernel.hpp"
#endif
...
...
@@ -67,7 +67,7 @@
#include "Kernels/Rotation/FRotationKernel.hpp"
#include "Kernels/Rotation/FRotationCell.hpp"
#ifdef S
cal
FMM_USE_FFT
#ifdef S
CAL
FMM_USE_FFT
// Uniform grid kernel
#include "Kernels/Uniform/FUnifCell.hpp"
#include "Kernels/Interpolation/FInterpMatrixKernel.hpp"
...
...
@@ -153,7 +153,7 @@ int main(int argc, char* argv[])
std
::
cout
<<
" Energy of the system: "
<<
energyD
<<
std
::
endl
;
////////////////////////////////////////////////////////////////////