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
33db3f4c
Commit
33db3f4c
authored
Sep 22, 2014
by
BRAMAS Berenger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put reset into adaptative, improve output and add kernel print
parent
12e72c0f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
189 additions
and
17 deletions
+189
-17
Src/Adaptive/FAdaptiveCell.hpp
Src/Adaptive/FAdaptiveCell.hpp
+4
-0
Src/Adaptive/FAdaptiveKernelWrapper.hpp
Src/Adaptive/FAdaptiveKernelWrapper.hpp
+20
-10
Src/Adaptive/FAdaptivePrintKernel.hpp
Src/Adaptive/FAdaptivePrintKernel.hpp
+130
-0
Tests/Utils/testFmmAdaptiveAlgorithmAdvanced.cpp
Tests/Utils/testFmmAdaptiveAlgorithmAdvanced.cpp
+10
-6
Tests/noDist/testAdaptiveChebSymFMM.cpp
Tests/noDist/testAdaptiveChebSymFMM.cpp
+25
-1
No files found.
Src/Adaptive/FAdaptiveCell.hpp
View file @
33db3f4c
...
...
@@ -71,6 +71,10 @@ public:
}
}
void
resetSubLeaves
()
{
subLeaves
.
clear
();
}
bool
hasDevelopment
()
const
{
return
realCell
!=
nullptr
;
}
...
...
Src/Adaptive/FAdaptiveKernelWrapper.hpp
View file @
33db3f4c
...
...
@@ -40,15 +40,16 @@ public:
void
P2M
(
FAdaptiveCell
<
CellClass
,
ContainerClass
>*
const
pole
,
const
ContainerClass
*
const
particles
)
override
{
// Leaf is always Adaptive
pole
->
setAdaptive
(
true
);
std
::
cout
<<
"P2M ("
<<
pole
->
getGlobalId
()
<<
") part ("
<<
particles
->
getNbParticles
()
<<
") "
<<
particles
;
pole
->
resetSubLeaves
();
if
(
kernel
.
preferP2M
(
particles
)
){
// If it is better to compute the P2M at this level
pole
->
setHaveDevelopment
(
true
);
kernel
.
P2M
(
pole
->
getRealCell
(),
particles
);
std
::
cout
<<
" true "
<<
std
::
endl
;
std
::
cout
<<
"P2M ("
<<
pole
->
getGlobalId
()
<<
") part ("
<<
particles
->
getNbParticles
()
<<
") "
<<
particles
<<
" morton "
<<
pole
->
getMortonIndex
()
<<
"
\n
"
;
}
else
{
std
::
cout
<<
" false "
<<
std
::
endl
;
std
::
cout
<<
"No P2M ("
<<
pole
->
getGlobalId
()
<<
") part ("
<<
particles
->
getNbParticles
()
<<
") "
<<
particles
<<
" morton "
<<
pole
->
getMortonIndex
()
<<
"
\n
"
;
// Else simply keep the current leaf
pole
->
setHaveDevelopment
(
false
);
...
...
@@ -70,8 +71,8 @@ public:
int
lastChild
=
0
;
bool
onlyParticlesCells
=
true
;
FVector
<
const
ContainerClass
*>
subLeaves
;
std
::
cout
<<
" M2M ( "
<<
pole
->
getGlobalId
(
)
<<
"): "
;
std
::
cout
<<
"M2M ("
<<
pole
->
getGlobalId
(
)
<<
") morton "
<<
pole
->
getMortonIndex
()
<<
" inLevel "
<<
inLevel
<<
" "
;
pole
->
resetSubLeaves
();
// Test all the children
for
(
int
idxChild
=
0
;
idxChild
<
8
;
++
idxChild
){
if
(
child
[
idxChild
]){
...
...
@@ -92,13 +93,14 @@ public:
}
}
// We need to aggregate if there are only particles and if the kernel says so
std
::
cout
<<
"
only Part ("
<<
std
::
boolalpha
<<
onlyParticlesCells
<<
" ) "
;
std
::
cout
<<
"
only Part ("
<<
std
::
boolalpha
<<
onlyParticlesCells
<<
" ) "
;
const
bool
continueToAgregate
=
(
onlyParticlesCells
&&
(
kernel
.
preferP2M
(
inLevel
,
subLeaves
.
data
(),
subLeaves
.
getSize
())
==
false
));
if
(
nbChild
==
1
){
// One child means that the cell is not Adaptive
pole
->
setAdaptive
(
false
);
pole
->
setHaveDevelopment
(
false
);
std
::
cout
<<
" not adaptive "
;
std
::
cout
<<
" child "
<<
child
[
lastChild
]
->
getMortonIndex
()
<<
" "
;
if
(
child
[
lastChild
]
->
isAdaptive
()){
pole
->
setSubAdaptiveCell
(
child
[
lastChild
],
inLevel
+
1
);
...
...
@@ -115,6 +117,7 @@ public:
pole
->
setHaveDevelopment
(
false
);
for
(
int
idxChild
=
0
;
idxChild
<
8
;
++
idxChild
){
if
(
child
[
idxChild
]){
std
::
cout
<<
" child "
<<
child
[
idxChild
]
->
getMortonIndex
()
<<
" "
;
if
(
child
[
idxChild
]
->
isAdaptive
()){
pole
->
addSubLeaves
(
child
[
idxChild
]
->
getSubLeaves
(),
child
[
idxChild
]
->
getNbSubLeaves
());
}
...
...
@@ -135,6 +138,7 @@ public:
// Test each child
for
(
int
idxChild
=
0
;
idxChild
<
8
;
++
idxChild
){
if
(
child
[
idxChild
]){
std
::
cout
<<
" child "
<<
child
[
idxChild
]
->
getMortonIndex
()
<<
" "
;
if
(
child
[
idxChild
]
->
isAdaptive
()){
if
(
child
[
idxChild
]
->
hasDevelopment
()){
// If it is Adaptive and has development than we compute is using usual M2M
...
...
@@ -196,7 +200,7 @@ public:
FAdaptiveCell
<
CellClass
,
ContainerClass
>*
currentAdaptiveCell
=
nullptr
;
int
currentAdaptiveLevel
=
-
1
;
// If the current Adaptive cell is the current cell
std
::
cout
<<
" M2L cell ("
<<
local
->
getGlobalId
(
)
<<
"):
"
;
std
::
cout
<<
" M2L cell ("
<<
local
->
getGlobalId
(
)
<<
"): morton "
<<
local
->
getMortonIndex
()
<<
" inLevel "
<<
inLevel
<<
"
"
;
if
(
local
->
isAdaptive
()){
currentAdaptiveCell
=
local
;
currentAdaptiveLevel
=
inLevel
;
...
...
@@ -211,6 +215,7 @@ public:
for
(
int
idxNeigh
=
0
;
idxNeigh
<
343
;
++
idxNeigh
){
if
(
distantNeighbors
[
idxNeigh
]){
std
::
cout
<<
" neigh "
<<
distantNeighbors
[
idxNeigh
]
->
getMortonIndex
()
<<
" "
;
// If the current cell is Adaptive and the neighbor too
if
(
distantNeighbors
[
idxNeigh
]
->
isAdaptive
()
&&
local
->
isAdaptive
()){
if
(
distantNeighbors
[
idxNeigh
]
->
hasDevelopment
()
&&
currentAdaptiveCell
->
hasDevelopment
()){
...
...
@@ -236,11 +241,12 @@ public:
}
else
{
// If both have particles
std
::
cout
<<
"
P2P: "
;
std
::
cout
<<
"B]
P2P: "
;
for
(
int
idxLeafTgt
=
0
;
idxLeafTgt
<
currentAdaptiveCell
->
getNbSubLeaves
()
;
++
idxLeafTgt
){
std
::
cout
<<
"Target "
<<
currentAdaptiveCell
->
getSubLeaf
(
idxLeafTgt
)
<<
" >> "
;
for
(
int
idxLeafSrc
=
0
;
idxLeafSrc
<
distantNeighbors
[
idxNeigh
]
->
getNbSubLeaves
()
;
++
idxLeafSrc
){
std
::
cout
<<
"
( "
<<
distantNeighbors
[
idxNeigh
]
->
getSubLeaf
(
idxLeafSrc
)
<<
" ) "
;
std
::
cout
<<
" Srouce
( "
<<
distantNeighbors
[
idxNeigh
]
->
getSubLeaf
(
idxLeafSrc
)
<<
" ) "
;
kernel
.
P2P
(
currentAdaptiveCell
->
getSubLeaf
(
idxLeafTgt
),
distantNeighbors
[
idxNeigh
]
->
getSubLeaf
(
idxLeafSrc
));
}
...
...
@@ -279,10 +285,14 @@ public:
}
}
else
{
std
::
cout
<<
" P2P: "
;
std
::
cout
<<
"A] P2P: "
;
std
::
cout
<<
" currentAdaptiveCell->getNbSubLeaves() "
<<
currentAdaptiveCell
->
getNbSubLeaves
()
;
// If both have particles
for
(
int
idxLeafTgt
=
0
;
idxLeafTgt
<
currentAdaptiveCell
->
getNbSubLeaves
()
;
++
idxLeafTgt
){
std
::
cout
<<
" ( currentAdaptiveCell "
<<
currentAdaptiveCell
->
getSubLeaf
(
idxLeafTgt
)
<<
" ) "
;
std
::
cout
<<
" ( lowerAdaptiveCell->getNbSubLeaves() "
<<
lowerAdaptiveCell
->
getNbSubLeaves
()
<<
" ) "
;
for
(
int
idxLeafSrc
=
0
;
idxLeafSrc
<
lowerAdaptiveCell
->
getNbSubLeaves
()
;
++
idxLeafSrc
){
std
::
cout
<<
" ( lowerAdaptiveCell "
<<
lowerAdaptiveCell
->
getSubLeaf
(
idxLeafSrc
)
<<
" ) "
;
kernel
.
P2P
(
currentAdaptiveCell
->
getSubLeaf
(
idxLeafTgt
),
lowerAdaptiveCell
->
getSubLeaf
(
idxLeafSrc
));
}
}
...
...
Src/Adaptive/FAdaptivePrintKernel.hpp
0 → 100644
View file @
33db3f4c
#ifndef FADAPTIVEPRINTKERNEL_HPP
#define FADAPTIVEPRINTKERNEL_HPP
#include <iostream>
#include "FAbstractAdaptiveKernel.hpp"
#include "../Components/FAbstractKernels.hpp"
/**
* This class simply print the interactions
*/
template
<
class
CellClass
,
class
ContainerClass
>
class
FAdaptivePrintKernel
:
public
FAbstractKernels
<
CellClass
,
ContainerClass
>
,
public
FAbstractAdaptiveKernel
<
CellClass
,
ContainerClass
>
{
const
int
p2mTresh
;
public:
FAdaptivePrintKernel
(
const
int
inP2mTresh
=
10
)
:
p2mTresh
(
inP2mTresh
)
{
}
virtual
~
FAdaptivePrintKernel
(){
}
void
P2M
(
CellClass
*
const
pole
,
const
ContainerClass
*
const
particles
)
override
{
std
::
cout
<<
"Usual] P2M Idx = "
<<
pole
->
getMortonIndex
()
<<
" and @"
<<
particles
<<
" with "
<<
particles
->
getNbParticles
()
<<
"
\n
"
;
}
void
M2M
(
CellClass
*
const
FRestrict
pole
,
const
CellClass
*
const
FRestrict
*
const
FRestrict
child
,
const
int
level
)
override
{
std
::
cout
<<
"Usual] M2M Idx = "
<<
pole
->
getMortonIndex
()
<<
" at level "
<<
level
<<
" with
\n
"
;
for
(
int
idxChild
=
0
;
idxChild
<
8
;
++
idxChild
){
if
(
child
[
idxChild
]){
std
::
cout
<<
"
\t
Idx "
<<
child
[
idxChild
]
->
getMortonIndex
()
<<
"
\n
"
;
}
}
}
void
M2L
(
CellClass
*
const
FRestrict
local
,
const
CellClass
*
interactions
[],
const
int
counter
,
const
int
level
)
override
{
std
::
cout
<<
"Usual] M2L Idx = "
<<
local
->
getMortonIndex
()
<<
" at level "
<<
level
<<
" with
\n
"
;
for
(
int
idxInter
=
0
;
idxInter
<
8
;
++
idxInter
){
if
(
interactions
[
idxInter
]){
std
::
cout
<<
"
\t
Idx "
<<
interactions
[
idxInter
]
->
getMortonIndex
()
<<
"
\n
"
;
}
}
}
void
L2L
(
const
CellClass
*
const
FRestrict
local
,
CellClass
*
FRestrict
*
const
FRestrict
child
,
const
int
level
)
override
{
std
::
cout
<<
"Usual] L2L Idx = "
<<
local
->
getMortonIndex
()
<<
" at level "
<<
level
<<
" with
\n
"
;
for
(
int
idxChild
=
0
;
idxChild
<
8
;
++
idxChild
){
if
(
child
[
idxChild
]){
std
::
cout
<<
"
\t
Idx "
<<
child
[
idxChild
]
->
getMortonIndex
()
<<
"
\n
"
;
}
}
}
void
L2P
(
const
CellClass
*
const
local
,
ContainerClass
*
const
particles
)
override
{
std
::
cout
<<
"Usual] L2P Idx = "
<<
local
->
getMortonIndex
()
<<
" and @"
<<
particles
<<
" with "
<<
particles
->
getNbParticles
()
<<
"
\n
"
;
}
void
P2P
(
const
FTreeCoordinate
&
,
ContainerClass
*
const
FRestrict
targets
,
const
ContainerClass
*
const
FRestrict
,
ContainerClass
*
const
neighs
[
27
],
const
int
)
override
{
std
::
cout
<<
"Usual] P2P @"
<<
targets
<<
" has "
<<
targets
->
getNbParticles
()
<<
" with
\n
"
;
for
(
int
idxNeigh
=
0
;
idxNeigh
<
27
;
++
idxNeigh
){
if
(
neighs
[
idxNeigh
]){
std
::
cout
<<
"
\t
@"
<<
neighs
[
idxNeigh
]
<<
" has "
<<
neighs
[
idxNeigh
]
->
getNbParticles
()
<<
"
\n
"
;
}
}
}
void
P2PRemote
(
const
FTreeCoordinate
&
,
ContainerClass
*
const
FRestrict
targets
,
const
ContainerClass
*
const
FRestrict
,
ContainerClass
*
const
neighs
[
27
],
const
int
)
override
{
std
::
cout
<<
"Usual] P2P remote @"
<<
targets
<<
" has "
<<
targets
->
getNbParticles
()
<<
" with
\n
"
;
for
(
int
idxNeigh
=
0
;
idxNeigh
<
27
;
++
idxNeigh
){
if
(
neighs
[
idxNeigh
]){
std
::
cout
<<
"
\t
@"
<<
neighs
[
idxNeigh
]
<<
" has "
<<
neighs
[
idxNeigh
]
->
getNbParticles
()
<<
"
\n
"
;
}
}
}
void
P2M
(
CellClass
*
const
pole
,
const
int
cellLevel
,
const
ContainerClass
*
const
particles
)
override
{
std
::
cout
<<
"Adaptive] P2M Idx = "
<<
pole
->
getMortonIndex
()
<<
" and @"
<<
particles
<<
" with "
<<
particles
->
getNbParticles
()
<<
", cell at level "
<<
cellLevel
<<
"
\n
"
;
}
void
M2M
(
CellClass
*
const
pole
,
const
int
poleLevel
,
const
CellClass
*
const
subCell
,
const
int
subCellLevel
)
override
{
std
::
cout
<<
"Adaptive] M2M Idx = "
<<
pole
->
getMortonIndex
()
<<
" at level "
<<
poleLevel
<<
" with "
<<
subCell
->
getMortonIndex
()
<<
" from level "
<<
subCellLevel
<<
"
\n
"
;
}
void
P2L
(
CellClass
*
const
local
,
const
int
localLevel
,
const
ContainerClass
*
const
particles
)
override
{
std
::
cout
<<
"Adaptive] P2L Local Idx = "
<<
local
->
getMortonIndex
()
<<
" with "
<<
particles
->
getNbParticles
()
<<
", cell at level "
<<
localLevel
<<
"
\n
"
;
}
void
M2L
(
CellClass
*
const
local
,
const
int
localLevel
,
const
CellClass
*
const
aNeighbor
,
const
int
neighborLevel
)
override
{
std
::
cout
<<
"Adaptive] L2L Idx = "
<<
local
->
getMortonIndex
()
<<
" at level "
<<
localLevel
<<
" with "
<<
aNeighbor
->
getMortonIndex
()
<<
" from level "
<<
neighborLevel
<<
"
\n
"
;
}
void
M2P
(
const
CellClass
*
const
pole
,
const
int
poleLevel
,
ContainerClass
*
const
particles
)
override
{
std
::
cout
<<
"Adaptive] M2P Idx = "
<<
pole
->
getMortonIndex
()
<<
" with "
<<
particles
->
getNbParticles
()
<<
", cell at level "
<<
poleLevel
<<
"
\n
"
;
}
void
L2L
(
const
CellClass
*
const
local
,
const
int
localLevel
,
CellClass
*
const
subCell
,
const
int
subCellLevel
)
override
{
std
::
cout
<<
"Adaptive] L2L Idx = "
<<
local
->
getMortonIndex
()
<<
" at level "
<<
localLevel
<<
" with "
<<
subCell
->
getMortonIndex
()
<<
" from level "
<<
subCellLevel
<<
"
\n
"
;
}
void
L2P
(
const
CellClass
*
const
local
,
const
int
cellLevel
,
ContainerClass
*
const
particles
)
override
{
std
::
cout
<<
"Adaptive] L2P Idx = "
<<
local
->
getMortonIndex
()
<<
" with "
<<
particles
->
getNbParticles
()
<<
", cell at level "
<<
cellLevel
<<
"
\n
"
;
}
void
P2P
(
ContainerClass
*
targets
,
const
ContainerClass
*
sources
)
override
{
std
::
cout
<<
"Adaptive] P2P between @"
<<
targets
<<
" with "
<<
targets
->
getNbParticles
()
<<
" and @"
<<
sources
<<
" with "
<<
sources
->
getNbParticles
()
<<
"
\n
"
;
}
bool
preferP2M
(
const
ContainerClass
*
const
particles
)
override
{
return
particles
->
getNbParticles
()
>
p2mTresh
;
}
bool
preferP2M
(
const
int
atLevel
,
const
ContainerClass
*
const
particles
[],
const
int
nbContainers
)
override
{
int
count
=
0
;
for
(
int
idx
=
0
;
idx
<
nbContainers
;
++
idx
){
count
+=
particles
[
idx
]
->
getNbParticles
();
}
return
count
>
p2mTresh
;
}
};
#endif // FADAPTIVEPRINTKERNEL_HPP
Tests/Utils/testFmmAdaptiveAlgorithmAdvanced.cpp
View file @
33db3f4c
...
...
@@ -89,8 +89,8 @@ int main(int argc, char ** argv){
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
FRandomLoader
loader
(
FParameters
::
getValue
(
argc
,
argv
,
FParameterDefinitions
::
NbParticles
.
options
,
2000000
),
1
,
FPoint
(
0.5
,
0.5
,
0.5
),
1
);
//FFmaGenericLoader loader("../Data/noDist/prolate100-ref.fma"
);
//
FRandomLoader loader(FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 2000000), 1, FPoint(0.5,0.5,0.5), 1);
FFmaGenericLoader
loader
(
FParameters
::
getStr
(
argc
,
argv
,
FParameterDefinitions
::
InputFile
.
options
,
"../Data/noDist/prolate50-ref.fma"
)
);
OctreeClass
tree
(
NbLevels
,
SizeSubLevels
,
loader
.
getBoxWidth
(),
loader
.
getCenterOfBox
());
OctreeClassTest
treeTest
(
NbLevels
,
SizeSubLevels
,
loader
.
getBoxWidth
(),
loader
.
getCenterOfBox
());
...
...
@@ -104,9 +104,9 @@ int main(int argc, char ** argv){
{
FPoint
particlePosition
;
for
(
int
idxPart
=
0
;
idxPart
<
loader
.
getNumberOfParticles
()
;
++
idxPart
){
//
FReal pv;
//
loader.fillParticle(&particlePosition, &pv);
loader
.
fillParticle
(
&
particlePosition
);
FReal
pv
;
loader
.
fillParticle
(
&
particlePosition
,
&
pv
);
//
loader.fillParticle(&particlePosition);
tree
.
insert
(
particlePosition
);
treeTest
.
insert
(
particlePosition
);
}
...
...
@@ -121,7 +121,7 @@ int main(int argc, char ** argv){
std
::
cout
<<
"Working on particles ..."
<<
std
::
endl
;
counter
.
tic
();
KernelWrapperClass
kernels
;
// FTestKernels FBasicKernels
KernelWrapperClass
kernels
(
4
)
;
// FTestKernels FBasicKernels
FmmClass
algo
(
&
tree
,
&
kernels
);
//FFmmAlgorithm FFmmAlgorithmThread
algo
.
execute
();
...
...
@@ -159,6 +159,10 @@ int main(int argc, char ** argv){
std
::
cout
<<
"Error at index "
<<
testcell
->
getMortonIndex
()
<<
" level "
<<
level
<<
" up is "
<<
testcell
->
getDataUp
()
<<
" should be "
<<
testcelltest
->
getDataUp
()
<<
"
\n
"
;
}
if
(
testcell
->
getDataDown
()
!=
testcelltest
->
getDataDown
()){
std
::
cout
<<
"Error at index "
<<
testcell
->
getMortonIndex
()
<<
" level "
<<
level
<<
" up is "
<<
testcell
->
getDataDown
()
<<
" should be "
<<
testcelltest
->
getDataDown
()
<<
"
\n
"
;
}
}
});
...
...
Tests/noDist/testAdaptiveChebSymFMM.cpp
View file @
33db3f4c
...
...
@@ -52,6 +52,8 @@
#include "Adaptive/FAdaptTools.hpp"
//#include "AdaptiveTree/FAdaptChebSymKernel.hpp"
#include "Adaptive/FAdaptivePrintKernel.hpp"
//
//
#include "Core/FFmmAlgorithm.hpp"
...
...
@@ -120,6 +122,11 @@ int main(int argc, char ** argv){
typedef
FFmmAlgorithm
<
OctreeClass
,
CellWrapperClass
,
ContainerClass
,
KernelWrapperClass
,
LeafClass
>
FmmClass
;
typedef
FAdaptivePrintKernel
<
CellClass
,
ContainerClass
>
KernelClassPrint
;
typedef
FAdaptiveKernelWrapper
<
KernelClassPrint
,
CellClass
,
ContainerClass
>
KernelWrapperClassPrint
;
typedef
FFmmAlgorithm
<
OctreeClass
,
CellWrapperClass
,
ContainerClass
,
KernelWrapperClassPrint
,
LeafClass
>
FmmClassPrint
;
typedef
FP2PParticleContainerIndexed
<>
ContainerClassDebug
;
typedef
FSimpleLeaf
<
ContainerClass
>
LeafClassDebug
;
typedef
FChebCell
<
P
>
CellClassDebug
;
...
...
@@ -208,6 +215,10 @@ int main(int argc, char ** argv){
FmmClassDebug
algodebug
(
&
treedebug
,
&
kernelsdebug
);
//FFmmAlgorithm FFmmAlgorithmThread
algodebug
.
execute
();
KernelWrapperClassPrint
kernelsprint
(
sminM
);
// FTestKernels FBasicKernels
FmmClassPrint
algoprint
(
&
tree
,
&
kernelsprint
);
//FFmmAlgorithm FFmmAlgorithmThread
algoprint
.
execute
();
counter
.
tac
();
std
::
cout
<<
"Done "
<<
"(@Algorithm = "
<<
counter
.
elapsed
()
<<
" s)."
<<
std
::
endl
;
//
...
...
@@ -230,7 +241,10 @@ int main(int argc, char ** argv){
// std::cout << "indexPartOrig || DIRECT V fx || FMM V fx" << std::endl;
tree
.
forEachLeaf
([
&
](
LeafClass
*
leaf
){
tree
.
forEachCellLeaf
([
&
](
CellWrapperClass
*
cell
,
LeafClass
*
leaf
){
FMath
::
FAccurater
potentialDiffLeaf
;
FMath
::
FAccurater
fxLeaf
,
fyLeaf
,
fzLeaf
;
const
FReal
*
const
potentials
=
leaf
->
getTargets
()
->
getPotentials
();
const
FReal
*
const
physicalValues
=
leaf
->
getTargets
()
->
getPhysicalValues
();
const
FReal
*
const
forcesX
=
leaf
->
getTargets
()
->
getForcesX
();
...
...
@@ -252,7 +266,17 @@ int main(int argc, char ** argv){
// << " " << potentials[idxPart] << " " << forcesX[idxPart]
// << std::endl;
potentialDiffLeaf
.
add
(
particles
[
indexPartOrig
].
getPotential
(),
potentials
[
idxPart
]);
fxLeaf
.
add
(
particles
[
indexPartOrig
].
getForces
()[
0
],
forcesX
[
idxPart
]);
fyLeaf
.
add
(
particles
[
indexPartOrig
].
getForces
()[
1
],
forcesY
[
idxPart
]);
fzLeaf
.
add
(
particles
[
indexPartOrig
].
getForces
()[
2
],
forcesZ
[
idxPart
]);
}
std
::
cout
<<
"Cell id "
<<
cell
->
getGlobalId
(
)
<<
" morton "
<<
cell
->
getMortonIndex
()
<<
"
\n
"
;
std
::
cout
<<
"
\t
Potential "
<<
potentialDiffLeaf
<<
std
::
endl
;
std
::
cout
<<
"
\t
Fx "
<<
fxLeaf
<<
std
::
endl
;
std
::
cout
<<
"
\t
Fy "
<<
fyLeaf
<<
std
::
endl
;
std
::
cout
<<
"
\t
Fz "
<<
fzLeaf
<<
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