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
75044b07
Commit
75044b07
authored
Mar 11, 2014
by
BRAMAS Berenger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some comments
parent
7c386566
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
32 deletions
+42
-32
Src/GroupTree/FGroupTree.hpp
Src/GroupTree/FGroupTree.hpp
+39
-29
Tests/Kernels/testBlockedTree.cpp
Tests/Kernels/testBlockedTree.cpp
+3
-3
No files found.
Src/GroupTree/FGroupTree.hpp
View file @
75044b07
...
...
@@ -25,35 +25,6 @@ protected:
//< all the blocks of leaves
std
::
list
<
FGroupOfParticles
<
NbAttributesPerParticle
,
AttributeClass
>*>
particleBlocks
;
/** @brief This private method take an array of Morton index to
* create the block and the cells, using the constructor of
* FGroupOfCells !!
*/
FGroupOfCells
<
CellClass
>
*
createBlockFromArray
(
MortonIndex
head
[]){
//Store the start and end
MortonIndex
start
=
head
[
0
];
MortonIndex
end
=
start
;
int
count
=
0
;
// Find the number of cell to allocate in the blocks
for
(
int
idxHead
=
0
;
idxHead
<
nbElementsPerBlock
;
idxHead
++
){
if
(
head
[
idxHead
]
!=
CellIsEmptyFlag
){
count
++
;
end
=
head
[
idxHead
];
}
// else{
// break;
// }
}
//allocation of memory
FGroupOfCells
<
CellClass
>
*
newBlock
=
new
FGroupOfCells
<
CellClass
>
(
start
,
end
+
1
,
count
);
//allocation of cells
for
(
int
idx
=
0
;
idx
<
count
;
idx
++
){
newBlock
->
newCell
(
head
[
idx
],
idx
);
(
newBlock
->
getCell
(
head
[
idx
]))
->
setMortonIndex
(
head
[
idx
]);
//(this->getCell(head[idx]))->setCoordinate();
}
return
newBlock
;
}
public:
/** This constructor create a blocked octree from a usual octree
...
...
@@ -166,6 +137,41 @@ public:
}
}
////////////////////////////////////////////////////////////////////
// Work in progress part, build the tree from an array of particles
////////////////////////////////////////////////////////////////////
/** @brief This private method take an array of Morton index to
* create the block and the cells, using the constructor of
* FGroupOfCells !!
*/
FGroupOfCells
<
CellClass
>
*
createBlockFromArray
(
MortonIndex
head
[]){
//Store the start and end
MortonIndex
start
=
head
[
0
];
MortonIndex
end
=
start
;
int
count
=
0
;
// Find the number of cell to allocate in the blocks
for
(
int
idxHead
=
0
;
idxHead
<
nbElementsPerBlock
;
idxHead
++
){
if
(
head
[
idxHead
]
!=
CellIsEmptyFlag
){
count
++
;
end
=
head
[
idxHead
];
}
// else{
// break;
// }
}
//allocation of memory
FGroupOfCells
<
CellClass
>
*
newBlock
=
new
FGroupOfCells
<
CellClass
>
(
start
,
end
+
1
,
count
);
//allocation of cells
for
(
int
idx
=
0
;
idx
<
count
;
idx
++
){
newBlock
->
newCell
(
head
[
idx
],
idx
);
(
newBlock
->
getCell
(
head
[
idx
]))
->
setMortonIndex
(
head
[
idx
]);
//(this->getCell(head[idx]))->setCoordinate();
}
return
newBlock
;
}
/** This constructor build the BlockOctree from an Octree, but only
* the cells at leaf level are read. The cells ares constructed with
* several walk through the leafs.
...
...
@@ -267,6 +273,10 @@ public:
delete
[]
head
;
}
////////////////////////////////////////////////////////////////////
// End work in progress part, build the tree from an array of particles
////////////////////////////////////////////////////////////////////
/** This function dealloc the tree by deleting each block */
~
FGroupTree
(){
...
...
Tests/Kernels/testBlockedTree.cpp
View file @
75044b07
...
...
@@ -57,16 +57,16 @@ int main(int argc, char* argv[]){
const
int
groupSize
=
FParameters
::
getValue
(
argc
,
argv
,
"-bs"
,
250
);
counter
.
tic
();
GroupOctreeClass
groupedTree
(
NbLevels
,
groupSize
,
&
tree
);
GroupOctreeClass
groupedTree
(
NbLevels
,
groupSize
,
&
tree
,
0
);
std
::
cout
<<
"Done "
<<
"(@Converting the tree with leafs only = "
<<
counter
.
tacAndElapsed
()
<<
"s). Group size is "
<<
groupSize
<<
"."
<<
std
::
endl
;
counter
.
tic
();
//
GroupOctreeClass groupedTree2(NbLevels, groupSize, &tree);
GroupOctreeClass
groupedTree2
(
NbLevels
,
groupSize
,
&
tree
);
std
::
cout
<<
"Done "
<<
"(@Converting the tree with all Octree = "
<<
counter
.
tacAndElapsed
()
<<
"s). Group size is "
<<
groupSize
<<
"."
<<
std
::
endl
;
groupedTree
.
printInfoBlocks
();
//
groupedTree2.printInfoBlocks();
groupedTree2
.
printInfoBlocks
();
return
0
;
...
...
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