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
b2be4187
Commit
b2be4187
authored
Nov 13, 2015
by
PIACIBELLO Cyrille
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API's working again, and reset_cell mechanism is split into apply_on_cell and apply_on_leaf.
parent
74f47c5a
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
30 deletions
+27
-30
Addons/CKernelApi/Src/CScalfmmApi.h
Addons/CKernelApi/Src/CScalfmmApi.h
+5
-6
Addons/CKernelApi/Src/FInterEngine.hpp
Addons/CKernelApi/Src/FInterEngine.hpp
+3
-2
Addons/CKernelApi/Src/FScalFMMEngine.hpp
Addons/CKernelApi/Src/FScalFMMEngine.hpp
+6
-6
Addons/CKernelApi/Src/FScalfmmApiInit.cpp
Addons/CKernelApi/Src/FScalfmmApiInit.cpp
+1
-1
Addons/CKernelApi/Src/FUserKernelDistrEngine.hpp
Addons/CKernelApi/Src/FUserKernelDistrEngine.hpp
+1
-1
Addons/CKernelApi/Src/FUserKernelEngine.hpp
Addons/CKernelApi/Src/FUserKernelEngine.hpp
+4
-4
Addons/CKernelApi/Tests/testChebInterface.c
Addons/CKernelApi/Tests/testChebInterface.c
+7
-10
No files found.
Addons/CKernelApi/Src/CScalfmmApi.h
View file @
b2be4187
...
...
@@ -170,7 +170,7 @@ typedef void (*Callback_copy_cell)(void * userDatas, FSize size, void * memoryAl
* @param userData cell user data
* @param userData Kernel user data
*/
typedef
void
(
*
Callback_
finalize
_leaf
)(
int
level
,
FSize
nbParts
,
const
FSize
*
idxParts
,
long
long
morton_index
,
double
center
[
3
],
typedef
void
(
*
Callback_
apply_on
_leaf
)(
int
level
,
FSize
nbParts
,
const
FSize
*
idxParts
,
long
long
morton_index
,
double
center
[
3
],
void
*
cellDatas
,
void
*
leafDatas
,
void
*
userDatas
);
/**
...
...
@@ -608,7 +608,7 @@ typedef void (*Callback_P2PSym)(void * targetLeaf, FSize nbParticles, const FSiz
* @param spatial_position double[3] center of the cell
* @param usercell ptr to user's cell
*/
typedef
void
(
*
Callback_
reset
_cell
)(
int
level
,
long
long
morton_index
,
int
*
tree_position
,
double
*
spatial_position
,
void
*
userCell
,
void
*
userData
);
typedef
void
(
*
Callback_
apply_on
_cell
)(
int
level
,
long
long
morton_index
,
int
*
tree_position
,
double
*
spatial_position
,
void
*
userCell
,
void
*
userData
);
/**
* @brief Structure containing callbacks to fill in order to define
...
...
@@ -667,7 +667,7 @@ void scalfmm_execute_fmm(scalfmm_handle Handle);
* called after insert_parts.
* @param
*/
void
scalfmm_apply_on_leaf
(
scalfmm_handle
Handle
,
Callback_
finalize
_leaf
function
);
void
scalfmm_apply_on_leaf
(
scalfmm_handle
Handle
,
Callback_
apply_on
_leaf
function
);
/////////////////////////////////////////////////////////////////////
...
...
@@ -689,11 +689,10 @@ void scalfmm_apply_on_leaf(scalfmm_handle Handle, Callback_finalize_leaf functio
void
scalfmm_dealloc_handle
(
scalfmm_handle
handle
,
Callback_free_cell
cellDestroyer
);
/**
* @brief this function reset all the data of the tree. (i e multipole
* and local development, forces and potentials)
* @brief This function apply the function param on each cell of the octree
* @param Handle scalfmm_handle provided by scalfmm_init.
*/
void
scalfmm_
reset_tree
(
scalfmm_handle
handle
,
Callback_reset_cell
cellReseter
);
void
scalfmm_
apply_on_cell
(
scalfmm_handle
handle
,
Callback_apply_on_cell
function
);
/////////////////////////////////////////////////////////////////////
/////////////// Monitoring functions /////////////////
...
...
Addons/CKernelApi/Src/FInterEngine.hpp
View file @
b2be4187
...
...
@@ -716,8 +716,9 @@ public:
}
//Simple call to FScalFMMEngine method with good template
void
reset_tree
(
Callback_reset_cell
/*not used*/
){
FScalFMMEngine
<
FReal
>::
template
generic_reset_tree
<
ContainerClass
,
InterCell
,
LeafClass
>(
octree
);
void
apply_on_cell
(
Callback_apply_on_cell
/*not used*/
){
//We used this one to clean the Cehb cell in the user defined cheb kernel situation.
FScalFMMEngine
<
FReal
>::
template
generic_apply_on_cell
<
ContainerClass
,
InterCell
,
LeafClass
>(
octree
);
}
...
...
Addons/CKernelApi/Src/FScalFMMEngine.hpp
View file @
b2be4187
...
...
@@ -173,7 +173,7 @@ public:
virtual
void
set_potentials_npart
(
int
nbParts
,
int
*
idxOfParticles
,
FReal
*
potentialsToRead
,
PartType
type
){
FAssertLF
(
0
,
"No tree instancied, exiting ...
\n
"
);
}
virtual
void
apply_on_each_leaf
(
Callback_
finalize
_leaf
function
){
virtual
void
apply_on_each_leaf
(
Callback_
apply_on
_leaf
function
){
FAssertLF
(
0
,
"No tree instancied, exiting ...
\n
"
);
}
...
...
@@ -771,11 +771,11 @@ public:
}
}
virtual
void
reset_tree
(
Callback_reset_cell
cellReset
){
virtual
void
apply_on_cell
(
Callback_apply_on_cell
function
){
}
template
<
class
ContainerClass
,
class
CellClass
,
class
LeafClass
>
void
generic_
reset_tree
(
FOctree
<
FReal
,
CellClass
,
ContainerClass
,
LeafClass
>
*
tree
){
void
generic_
apply_on_cell
(
FOctree
<
FReal
,
CellClass
,
ContainerClass
,
LeafClass
>
*
tree
){
//Reset forces and potentials
tree
->
forEachLeaf
([
&
](
LeafClass
*
leaf
){
ContainerClass
*
targets
=
leaf
->
getTargets
();
...
...
@@ -1057,8 +1057,8 @@ extern "C" void scalfmm_utils_interactionPosition(int interactionPosition, int*
}
extern
"C"
void
scalfmm_
reset_tree
(
scalfmm_handle
Handle
,
Callback_reset_cell
cellReseter
){
((
ScalFmmCoreHandle
<
double
>
*
)
Handle
)
->
engine
->
reset_tree
(
cellReseter
);
extern
"C"
void
scalfmm_
apply_on_cell
(
scalfmm_handle
Handle
,
Callback_apply_on_cell
function
){
((
ScalFmmCoreHandle
<
double
>
*
)
Handle
)
->
engine
->
apply_on_cell
(
function
);
}
extern
"C"
void
scalfmm_print_everything
(
scalfmm_handle
Handle
){
...
...
@@ -1069,7 +1069,7 @@ extern "C" void scalfmm_set_upper_limit(scalfmm_handle Handle, int upperLimit){
((
ScalFmmCoreHandle
<
double
>
*
)
Handle
)
->
engine
->
set_upper_limit
(
upperLimit
);
}
extern
"C"
void
scalfmm_apply_on_leaf
(
scalfmm_handle
Handle
,
Callback_
finalize
_leaf
function
){
extern
"C"
void
scalfmm_apply_on_leaf
(
scalfmm_handle
Handle
,
Callback_
apply_on
_leaf
function
){
((
ScalFmmCoreHandle
<
double
>
*
)
Handle
)
->
engine
->
apply_on_each_leaf
(
function
);
}
...
...
Addons/CKernelApi/Src/FScalfmmApiInit.cpp
View file @
b2be4187
...
...
@@ -386,7 +386,7 @@ void ChebKernel_P2P(FSize nbParticles, const FSize* particleIndexes, const FSize
//Empty tree coordinate
int
coord
[
3
]
=
{
0
,
0
,
0
};
inKernelStruct
->
kernel
[
id_thread
]
->
P2P
(
FTreeCoordinate
(
coord
),
tempContTarget
,
nullptr
,
tempContSources
,
sourcePosition
,
size
);
inKernelStruct
->
kernel
[
id_thread
]
->
P2P
(
FTreeCoordinate
(
coord
),
tempContTarget
,
tempContTarget
,
tempContSources
,
sourcePosition
,
size
);
//get back forces & potentials
double
*
forcesToFill
=
reinterpret_cast
<
UserData
*>
(
inKernel
)
->
forcesComputed
[
id_thread
];
...
...
Addons/CKernelApi/Src/FUserKernelDistrEngine.hpp
View file @
b2be4187
...
...
@@ -637,7 +637,7 @@ public:
});
}
void
apply_on_each_leaf
(
Callback_
finalize
_leaf
function
){
void
apply_on_each_leaf
(
Callback_
apply_on
_leaf
function
){
if
(
octreeDist
){
FUserKernelEngine
<
FReal
,
LeafClass
>::
template
generic_apply_on_each_leaf
<
ContainerClass
,
CoreCellDist
>(
octreeDist
,
kernel
->
getUserKernelDatas
(),
function
);
}
else
{
...
...
Addons/CKernelApi/Src/FUserKernelEngine.hpp
View file @
b2be4187
...
...
@@ -335,7 +335,7 @@ public:
this
->
octree
=
new
OctreeClass
(
TreeHeight
,
FMath
::
Min
(
3
,
TreeHeight
-
1
),
BoxWidth
,
FPoint
<
FReal
>
(
BoxCenter
));
}
void
reset_tree
(
Callback_reset_cell
cellReset
){
void
apply_on_cell
(
Callback_apply_on_cell
function
){
double
boxwidth
=
octree
->
getBoxWidth
();
//apply user function reset on each user's cell
octree
->
forEachCellWithLevel
([
&
](
CoreCell
*
currCell
,
const
int
currLevel
){
...
...
@@ -347,7 +347,7 @@ public:
position
[
0
]
=
boxCorner
.
getX
()
+
currCoord
.
getX
()
*
boxwidth
/
double
(
1
<<
currLevel
);
position
[
1
]
=
boxCorner
.
getY
()
+
currCoord
.
getY
()
*
boxwidth
/
double
(
1
<<
currLevel
);
position
[
2
]
=
boxCorner
.
getZ
()
+
currCoord
.
getZ
()
*
boxwidth
/
double
(
1
<<
currLevel
);
cellReset
(
currLevel
,
currMorton
,
arrayCoord
,
position
,
currCell
->
getContainer
(),
kernel
->
getUserKernelDatas
());
function
(
currLevel
,
currMorton
,
arrayCoord
,
position
,
currCell
->
getContainer
(),
kernel
->
getUserKernelDatas
());
}
});
}
...
...
@@ -444,14 +444,14 @@ public:
FScalFMMEngine
<
FReal
>::
template
generic_set_positions_npart
<
ContainerClass
,
LeafClass
,
CoreCell
>(
octree
,
NbPositions
,
idxOfParticles
,
X
,
Y
,
Z
,
type
);
}
virtual
void
apply_on_each_leaf
(
Callback_
finalize
_leaf
function
){
virtual
void
apply_on_each_leaf
(
Callback_
apply_on
_leaf
function
){
generic_apply_on_each_leaf
<
ContainerClass
,
CoreCell
>
(
octree
,
kernel
->
getUserKernelDatas
(),
function
);
}
template
<
class
ContainerClass
,
class
CellClass
>
void
generic_apply_on_each_leaf
(
FOctree
<
FReal
,
CellClass
,
ContainerClass
,
LeafClass
>*
octreeIn
,
void
*
kernelUserData
,
Callback_
finalize
_leaf
function
){
Callback_
apply_on
_leaf
function
){
if
(
octreeIn
){
octreeIn
->
forEachCellLeaf
([
&
](
CoreCell
*
currCell
,
LeafClass
*
leaf
){
int
lvl
=
octreeIn
->
getHeight
();
...
...
Addons/CKernelApi/Tests/testChebInterface.c
View file @
b2be4187
...
...
@@ -99,13 +99,13 @@ void on_leaf(int level, FSize nbParts, const FSize * idxParts, long long morton_
* @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
]);
exit
(
0
);
}
int
nbPart
=
atoi
(
av
[
1
]);
int
nbPart
=
atoi
(
av
[
1
]);
;
int
treeHeight
=
5
;
if
(
argc
>
2
){
int
treeHeight
=
atoi
(
av
[
2
]);
...
...
@@ -125,12 +125,9 @@ int main(int argc, char ** av){
printf
(
"Creating Particles:
\n
"
);
FSize
idxPart
;
for
(
idxPart
=
0
;
idxPart
<
nbPart
;
++
idxPart
){
particleXYZ
[
idxPart
*
3
]
=
(
random
()
/
(
double
)(
RAND_MAX
))
*
boxWidth
-
boxWidth
/
2
+
boxCenter
[
0
];
particleXYZ
[
idxPart
*
3
+
1
]
=
(
random
()
/
(
double
)(
RAND_MAX
))
*
boxWidth
-
boxWidth
/
2
+
boxCenter
[
1
];
particleXYZ
[
idxPart
*
3
+
2
]
=
(
random
()
/
(
double
)(
RAND_MAX
))
*
boxWidth
-
boxWidth
/
2
+
boxCenter
[
2
];
particleXYZ
[
idxPart
*
3
]
=
(
random
()
/
(
double
)(
RAND_MAX
))
*
boxWidth
-
boxWidth
/
2
+
boxCenter
[
0
];
particleXYZ
[
idxPart
*
3
+
1
]
=
(
random
()
/
(
double
)(
RAND_MAX
))
*
boxWidth
-
boxWidth
/
2
+
boxCenter
[
1
];
particleXYZ
[
idxPart
*
3
+
2
]
=
(
random
()
/
(
double
)(
RAND_MAX
))
*
boxWidth
-
boxWidth
/
2
+
boxCenter
[
2
];
physicalValues
[
idxPart
]
=
1
.
0
;
}
}
...
...
@@ -360,8 +357,8 @@ int main(int argc, char ** av){
free
(
potentialsRef
);
//Reset
scalfmm_
reset_tree
(
handle
,
cheb_resetCell
);
scalfmm_
reset_tree
(
handle_ref
,
NULL
);
scalfmm_
apply_on_cell
(
handle
,
cheb_resetCell
);
scalfmm_
apply_on_cell
(
handle_ref
,
NULL
);
printf
(
"Internal resets done
\n
"
);
...
...
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