Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
solverstack
ScalFMM
Commits
ea5984ac
Commit
ea5984ac
authored
May 15, 2014
by
PIACIBELLO Cyrille
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Chebyshev Proc and not Proc updated
parent
0131962d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
12 deletions
+34
-12
Examples/ChebyshevInterpolationAlgorithm.cpp
Examples/ChebyshevInterpolationAlgorithm.cpp
+6
-1
Examples/ChebyshevInterpolationAlgorithmProc.cpp
Examples/ChebyshevInterpolationAlgorithmProc.cpp
+28
-11
No files found.
Examples/ChebyshevInterpolationAlgorithm.cpp
View file @
ea5984ac
...
...
@@ -182,6 +182,10 @@ int main(int argc, char* argv[])
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
();
...
...
@@ -195,7 +199,8 @@ int main(int argc, char* argv[])
const
int
indexPartOrig
=
indexes
[
idxPart
];
if
((
indexPartOrig
==
N1
)
||
(
indexPartOrig
==
N2
)
||
(
indexPartOrig
==
N3
)
)
{
std
::
cout
<<
"Index "
<<
indexPartOrig
<<
" potential "
<<
potentials
[
idxPart
]
<<
" Forces: "
<<
forcesX
[
idxPart
]
<<
" "
<<
forcesY
[
idxPart
]
<<
" "
<<
forcesZ
[
idxPart
]
<<
std
::
endl
;
<<
" Pos "
<<
posX
[
idxPart
]
<<
" "
<<
posY
[
idxPart
]
<<
" "
<<
posZ
[
idxPart
]
<<
" Forces: "
<<
forcesX
[
idxPart
]
<<
" "
<<
forcesY
[
idxPart
]
<<
" "
<<
forcesZ
[
idxPart
]
<<
std
::
endl
;
}
energy
+=
potentials
[
idxPart
]
*
physicalValues
[
idxPart
]
;
}
...
...
Examples/ChebyshevInterpolationAlgorithmProc.cpp
View file @
ea5984ac
...
...
@@ -45,12 +45,12 @@
#include "../../Src/Utils/FParameters.hpp"
/// \file
RotationFMMProc.cpp
/// \file
ChebyshevInterpolationAlgorithmProc
//!
//! \brief This program runs the FMM Algorithm Proc (i.e. using MPI) with
harmonic spherical approxim
ation of 1/r kernel
//! \brief This program runs the FMM Algorithm Proc (i.e. using MPI) with
Chebyshev interpol
ation of 1/r kernel
//! \authors B. Bramas, O. Coulaud
//!
//! This code is a short example to use the
rotation harmonic spherical approxim
ation for the 1/r kernel
//! This code is a short example to use the
FMM Algorithm Proc with Chebyshev Interpol
ation for the 1/r kernel
//!
//!
//! <b> General arguments:</b>
...
...
@@ -130,7 +130,8 @@ int main(int argc, char* argv[])
// init oct-tree
OctreeClass
tree
(
TreeHeight
,
SubTreeHeight
,
loader
.
getBoxWidth
(),
loader
.
getCenterOfBox
());
printf
(
"There
\n
"
);
{
// -----------------------------------------------------
std
::
cout
<<
"Creating & Inserting "
<<
loader
.
getNumberOfParticles
()
...
...
@@ -138,8 +139,9 @@ int main(int argc, char* argv[])
std
::
cout
<<
"
\t
Height : "
<<
TreeHeight
<<
"
\t
sub-height : "
<<
SubTreeHeight
<<
std
::
endl
;
time
.
tic
();
//
struct
TestParticle
{
int
index
;
FPoint
position
;
FReal
physicalValue
;
const
FPoint
&
getPosition
(){
...
...
@@ -148,11 +150,18 @@ int main(int argc, char* argv[])
};
TestParticle
*
particles
=
new
TestParticle
[
loader
.
getNumberOfParticles
()];
memset
(
particles
,
0
,
(
unsigned
int
)
(
sizeof
(
TestParticle
)
*
loader
.
getNumberOfParticles
()));
//idx (in file) of the first part that will be used by this proc.
int
idxStart
=
loader
.
getStart
();
printf
(
"Proc %d idxStart %d
\n
"
,
app
.
global
().
processId
(),
idxStart
);
for
(
int
idxPart
=
0
;
idxPart
<
loader
.
getNumberOfParticles
()
;
++
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
<
TestParticle
>::
ArrayToTree
(
app
.
global
(),
particles
,
loader
.
getNumberOfParticles
(),
...
...
@@ -161,8 +170,9 @@ int main(int argc, char* argv[])
tree
.
getHeight
(),
&
finalParticles
,
&
balancer
);
for
(
int
idx
=
0
;
idx
<
finalParticles
.
getSize
();
++
idx
){
tree
.
insert
(
finalParticles
[
idx
].
position
,
id
x
,
finalParticles
[
idx
].
physicalValue
);
tree
.
insert
(
finalParticles
[
idx
].
position
,
finalParticles
[
idx
].
inde
x
,
finalParticles
[
idx
].
physicalValue
);
}
printf
(
"%d parts have been inserted in Tree
\n
"
,
finalParticles
.
getSize
());
delete
[]
particles
;
time
.
tac
();
...
...
@@ -192,7 +202,7 @@ int main(int argc, char* argv[])
//
//
{
// -----------------------------------------------------
long
int
N1
=
0
,
N2
=
loader
.
getNumberOfParticles
()
/
4
,
N3
=
(
loader
.
getNumberOfParticles
()
-
1
)
/
2
;
;
long
int
N1
=
0
,
N2
=
loader
.
get
Total
NumberOfParticles
()
/
2
,
N3
=
(
loader
.
get
Total
NumberOfParticles
()
-
1
);
;
FReal
energy
=
0.0
;
//
// Loop over all leaves
...
...
@@ -202,6 +212,10 @@ int main(int argc, char* argv[])
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
();
...
...
@@ -215,14 +229,17 @@ int main(int argc, char* argv[])
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
]
;
}
});
std
::
cout
<<
std
::
endl
<<
"Energy: "
<<
energy
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
<<
" &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& "
<<
std
::
endl
<<
std
::
endl
;
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
;
}
}
// -----------------------------------------------------
...
...
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