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
26a0f75b
Commit
26a0f75b
authored
Apr 24, 2015
by
BRAMAS Berenger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update dyn block tree
parent
282ef597
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
21 deletions
+66
-21
Src/GroupTree/Core/FGroupOfCellsDyn.hpp
Src/GroupTree/Core/FGroupOfCellsDyn.hpp
+14
-8
Src/GroupTree/Core/FGroupTreeDyn.hpp
Src/GroupTree/Core/FGroupTreeDyn.hpp
+23
-8
Tests/noDist/testBlockedAlgorithmDyn.cpp
Tests/noDist/testBlockedAlgorithmDyn.cpp
+29
-5
No files found.
Src/GroupTree/Core/FGroupOfCellsDyn.hpp
View file @
26a0f75b
...
...
@@ -177,8 +177,8 @@ public:
cellMultipoles
=
(
unsigned
char
*
)
FAlignedMemory
::
AllocateBytes
<
32
>
(
inNumberOfCells
*
cellSizes
->
poleCellClassSize
);
memset
(
cellMultipoles
,
0
,
inNumberOfCells
*
cellSizes
->
poleCellClassSize
);
cellLocals
=
(
unsigned
char
*
)
FAlignedMemory
::
AllocateBytes
<
32
>
(
inNumberOfCells
*
cellSizes
->
pole
CellClassSize
);
memset
(
cellLocals
,
0
,
inNumberOfCells
*
cellSizes
->
pole
CellClassSize
);
cellLocals
=
(
unsigned
char
*
)
FAlignedMemory
::
AllocateBytes
<
32
>
(
inNumberOfCells
*
cellSizes
->
local
CellClassSize
);
memset
(
cellLocals
,
0
,
inNumberOfCells
*
cellSizes
->
local
CellClassSize
);
// Set all index to not used
for
(
int
idxCellPtr
=
0
;
idxCellPtr
<
blockIndexesTableSize
;
++
idxCellPtr
){
...
...
@@ -314,15 +314,21 @@ public:
}
/** Allocate a new cell by calling its constructor */
template
<
typename
...
CellConstructorParams
>
void
newCell
(
const
MortonIndex
inIndex
,
const
int
id
,
CellConstructorParams
...
args
){
void
newCell
(
const
MortonIndex
inIndex
,
const
int
id
,
std
::
function
<
void
(
const
MortonIndex
mindex
,
unsigned
char
*
symbBuff
,
const
size_t
symbSize
,
unsigned
char
*
upBuff
,
const
size_t
upSize
,
unsigned
char
*
downBuff
,
const
size_t
downSize
,
const
int
level
)
>
BuildCellFunc
,
const
int
inLevel
){
FAssertLF
(
isInside
(
inIndex
));
FAssertLF
(
!
exists
(
inIndex
));
FAssertLF
(
id
<
blockHeader
->
blockIndexesTableSize
);
CompositeCellClass
cell
(
&
blockCells
[
id
*
cellSizes
->
symbCellClassSize
],
&
cellMultipoles
[
id
*
cellSizes
->
poleCellClassSize
],
&
cellLocals
[
id
*
cellSizes
->
localCellClassSize
]);
cell
.
init
(
args
...);
BuildCellFunc
(
inIndex
,
&
blockCells
[
id
*
cellSizes
->
symbCellClassSize
],
cellSizes
->
symbCellClassSize
,
&
cellMultipoles
[
id
*
cellSizes
->
poleCellClassSize
],
cellSizes
->
poleCellClassSize
,
&
cellLocals
[
id
*
cellSizes
->
localCellClassSize
],
cellSizes
->
localCellClassSize
,
inLevel
);
blockIndexesTable
[
inIndex
-
blockHeader
->
startingIndex
]
=
id
;
}
...
...
Src/GroupTree/Core/FGroupTreeDyn.hpp
View file @
26a0f75b
...
...
@@ -62,7 +62,12 @@ public:
template
<
class
OctreeClass
>
FGroupTreeDyn
(
const
int
inTreeHeight
,
const
int
inNbElementsPerBlock
,
OctreeClass
*
const
inOctreeSrc
,
const
size_t
inSymbSizePerLevel
[],
const
size_t
inPoleSizePerLevel
[],
const
size_t
inLocalSizePerLevel
[],
std
::
function
<
void
(
const
MortonIndex
,
const
void
*
,
size_t
*
,
size_t
*
)
>
GetSizeFunc
)
std
::
function
<
void
(
const
MortonIndex
,
const
void
*
,
size_t
*
,
size_t
*
)
>
GetSizeFunc
,
std
::
function
<
void
(
const
MortonIndex
mindex
,
unsigned
char
*
symbBuff
,
const
size_t
symbSize
,
unsigned
char
*
upBuff
,
const
size_t
upSize
,
unsigned
char
*
downBuff
,
const
size_t
downSize
,
const
int
level
)
>
BuildCellFunc
)
:
treeHeight
(
inTreeHeight
),
nbElementsPerBlock
(
inNbElementsPerBlock
),
cellBlocksPerLevel
(
nullptr
),
boxCenter
(
inOctreeSrc
->
getBoxCenter
()),
boxCorner
(
inOctreeSrc
->
getBoxCenter
(),
-
(
inOctreeSrc
->
getBoxWidth
()
/
2
)),
boxWidth
(
inOctreeSrc
->
getBoxWidth
()),
boxWidthAtLeafLevel
(
inOctreeSrc
->
getBoxWidth
()
/
FReal
(
1
<<
(
inTreeHeight
-
1
))){
...
...
@@ -102,7 +107,7 @@ public:
const
MortonIndex
newNodeIndex
=
blockIteratorCellInOctree
.
getCurrentCell
()
->
getMortonIndex
();
const
FTreeCoordinate
newNodeCoordinate
=
blockIteratorCellInOctree
.
getCurrentCell
()
->
getCoordinate
();
// Add cell
newBlock
->
newCell
(
newNodeIndex
,
cellIdInBlock
);
newBlock
->
newCell
(
newNodeIndex
,
cellIdInBlock
,
BuildCellFunc
,
idxLevel
);
CompositeCellClass
newNode
=
newBlock
->
getCompleteCell
(
newNodeIndex
);
newNode
.
setMortonIndex
(
newNodeIndex
);
...
...
@@ -182,7 +187,7 @@ public:
while
(
cellIdInBlock
!=
sizeOfBlock
){
const
MortonIndex
newNodeIndex
=
blockIteratorInOctree
.
getCurrentCell
()
->
getMortonIndex
();
const
FTreeCoordinate
newNodeCoordinate
=
blockIteratorInOctree
.
getCurrentCell
()
->
getCoordinate
();
newBlock
->
newCell
(
newNodeIndex
,
cellIdInBlock
);
newBlock
->
newCell
(
newNodeIndex
,
cellIdInBlock
,
BuildCellFunc
,
idxLevel
);
CompositeCellClass
newNode
=
newBlock
->
getCompleteCell
(
newNodeIndex
);
newNode
.
setMortonIndex
(
newNodeIndex
);
...
...
@@ -221,6 +226,11 @@ public:
const
FSize
,
unsigned
char
*
,
const
size_t
,
unsigned
char
*
,
const
size_t
)
>
InitLeafFunc
,
std
::
function
<
void
(
const
MortonIndex
mindex
,
unsigned
char
*
symbBuff
,
const
size_t
symbSize
,
unsigned
char
*
upBuff
,
const
size_t
upSize
,
unsigned
char
*
downBuff
,
const
size_t
downSize
,
const
int
level
)
>
BuildCellFunc
,
const
bool
particlesAreSorted
=
false
,
MortonIndex
inLeftLimite
=
-
1
)
:
treeHeight
(
inTreeHeight
),
nbElementsPerBlock
(
inNbElementsPerBlock
),
cellBlocksPerLevel
(
nullptr
),
boxCenter
(
inBoxCenter
),
boxCorner
(
inBoxCenter
,
-
(
inBoxWidth
/
2
)),
boxWidth
(
inBoxWidth
),
...
...
@@ -285,7 +295,7 @@ public:
inPoleSizePerLevel
[
idxLevel
],
inLocalSizePerLevel
[
idxLevel
]);
{
for
(
int
cellIdInBlock
=
0
;
cellIdInBlock
!=
sizeOfBlock
;
++
cellIdInBlock
){
newBlock
->
newCell
(
currentBlockIndexes
[
cellIdInBlock
],
cellIdInBlock
);
newBlock
->
newCell
(
currentBlockIndexes
[
cellIdInBlock
],
cellIdInBlock
,
BuildCellFunc
,
idxLevel
);
CompositeCellClass
newNode
=
newBlock
->
getCompleteCell
(
currentBlockIndexes
[
cellIdInBlock
]);
newNode
.
setMortonIndex
(
currentBlockIndexes
[
cellIdInBlock
]);
...
...
@@ -386,7 +396,7 @@ public:
inPoleSizePerLevel
[
idxLevel
],
inLocalSizePerLevel
[
idxLevel
]);
// Init cells
for
(
int
cellIdInBlock
=
0
;
cellIdInBlock
!=
sizeOfBlock
;
++
cellIdInBlock
){
newBlock
->
newCell
(
currentBlockIndexes
[
cellIdInBlock
],
cellIdInBlock
);
newBlock
->
newCell
(
currentBlockIndexes
[
cellIdInBlock
],
cellIdInBlock
,
BuildCellFunc
,
idxLevel
);
CompositeCellClass
newNode
=
newBlock
->
getCompleteCell
(
currentBlockIndexes
[
cellIdInBlock
]);
newNode
.
setMortonIndex
(
currentBlockIndexes
[
cellIdInBlock
]);
...
...
@@ -427,6 +437,11 @@ public:
const
FSize
,
unsigned
char
*
,
const
size_t
,
unsigned
char
*
,
const
size_t
)
>
InitLeafFunc
,
std
::
function
<
void
(
const
MortonIndex
mindex
,
unsigned
char
*
symbBuff
,
const
size_t
symbSize
,
unsigned
char
*
upBuff
,
const
size_t
upSize
,
unsigned
char
*
downBuff
,
const
size_t
downSize
,
const
int
level
)
>
BuildCellFunc
,
const
bool
particlesAreSorted
,
const
bool
oneParent
,
const
FReal
inCoverRatio
=
0.0
,
MortonIndex
inLeftLimite
=
-
1
)
:
treeHeight
(
inTreeHeight
),
nbElementsPerBlock
(
inNbElementsPerBlock
),
cellBlocksPerLevel
(
nullptr
),
...
...
@@ -497,7 +512,7 @@ public:
inPoleSizePerLevel
[
idxLevel
],
inLocalSizePerLevel
[
idxLevel
]);
{
for
(
int
cellIdInBlock
=
0
;
cellIdInBlock
!=
sizeOfBlock
;
++
cellIdInBlock
){
newBlock
->
newCell
(
currentBlockIndexes
[
cellIdInBlock
],
cellIdInBlock
);
newBlock
->
newCell
(
currentBlockIndexes
[
cellIdInBlock
],
cellIdInBlock
,
BuildCellFunc
,
idxLevel
);
CompositeCellClass
newNode
=
newBlock
->
getCompleteCell
(
currentBlockIndexes
[
cellIdInBlock
]);
newNode
.
setMortonIndex
(
currentBlockIndexes
[
cellIdInBlock
]);
...
...
@@ -599,7 +614,7 @@ public:
inPoleSizePerLevel
[
idxLevel
],
inLocalSizePerLevel
[
idxLevel
]);
// Init cells
for
(
int
cellIdInBlock
=
0
;
cellIdInBlock
!=
sizeOfBlock
;
++
cellIdInBlock
){
newBlock
->
newCell
(
currentBlockIndexes
[
cellIdInBlock
],
cellIdInBlock
);
newBlock
->
newCell
(
currentBlockIndexes
[
cellIdInBlock
],
cellIdInBlock
,
BuildCellFunc
,
idxLevel
);
CompositeCellClass
newNode
=
newBlock
->
getCompleteCell
(
currentBlockIndexes
[
cellIdInBlock
]);
newNode
.
setMortonIndex
(
currentBlockIndexes
[
cellIdInBlock
]);
...
...
@@ -655,7 +670,7 @@ public:
inPoleSizePerLevel
[
idxLevel
],
inLocalSizePerLevel
[
idxLevel
]);
// Init cells
for
(
int
cellIdInBlock
=
0
;
cellIdInBlock
!=
sizeOfBlock
;
++
cellIdInBlock
){
newBlock
->
newCell
(
currentBlockIndexes
[
cellIdInBlock
],
cellIdInBlock
);
newBlock
->
newCell
(
currentBlockIndexes
[
cellIdInBlock
],
cellIdInBlock
,
BuildCellFunc
,
idxLevel
);
CompositeCellClass
newNode
=
newBlock
->
getCompleteCell
(
currentBlockIndexes
[
cellIdInBlock
]);
newNode
.
setMortonIndex
(
currentBlockIndexes
[
cellIdInBlock
]);
...
...
Tests/noDist/testBlockedAlgorithmDyn.cpp
View file @
26a0f75b
...
...
@@ -110,10 +110,6 @@ public:
:
symb
(
nullptr
),
up
(
nullptr
),
down
(
nullptr
){
}
void
init
(){
resetToInitialState
();
}
void
release
(){
// nothing
}
...
...
@@ -265,7 +261,14 @@ int main(int argc, char* argv[]){
// size_t* inSymbSize, size_t* inDownSize) {
// GroupContainerClass::GetSizeContainerFunc<ContainerClass>(
// inIndex, inParticles, inSymbSize, inDownSize);
// });
// },
// [](const MortonIndex /*mindex*/,
// unsigned char* symbBuff, const size_t /*symbSize*/,
// unsigned char* upBuff, const size_t /*upSize*/,
// unsigned char* downBuff, const size_t /*downSize*/,
// const int /*inLevel*/){
// GroupCellClass cell(symbBuff, upBuff, downBuff);
// });
GroupOctreeClass
groupedTree
(
NbLevels
,
loader
.
getBoxWidth
(),
loader
.
getCenterOfBox
(),
groupSize
,
cellSymbSizePerLevel
.
get
(),
cellUpSizePerLevel
.
get
(),
cellDownSizePerLevel
.
get
(),
allParticles
.
get
(),
loader
.
getNumberOfParticles
(),
...
...
@@ -278,6 +281,13 @@ int main(int argc, char* argv[]){
unsigned
char
*
downBuffer
,
const
size_t
inDownSize
){
GroupContainerClass
leaf
(
symbBuffer
,
downBuffer
);
leaf
.
init
(
inIndex
,
inParticles
,
inNbParticles
,
inSymbSize
,
inDownSize
);
},
[](
const
MortonIndex
/*mindex*/
,
unsigned
char
*
symbBuff
,
const
size_t
/*symbSize*/
,
unsigned
char
*
upBuff
,
const
size_t
/*upSize*/
,
unsigned
char
*
downBuff
,
const
size_t
/*downSize*/
,
const
int
/*inLevel*/
){
GroupCellClass
cell
(
symbBuff
,
upBuff
,
downBuff
);
});
// GroupOctreeClass groupedTree(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), groupSize,
// cellSymbSizePerLevel.get(), cellUpSizePerLevel.get(), cellDownSizePerLevel.get(),
...
...
@@ -291,6 +301,13 @@ int main(int argc, char* argv[]){
// unsigned char* downBuffer, const size_t inDownSize){
// GroupContainerClass leaf(symbBuffer, downBuffer);
// leaf.init(inIndex, inParticles, inNbParticles, inSymbSize, inDownSize);
// },
// [](const MortonIndex /*mindex*/,
// unsigned char* symbBuff, const size_t /*symbSize*/,
// unsigned char* upBuff, const size_t /*upSize*/,
// unsigned char* downBuff, const size_t /*downSize*/,
// const int /*inLevel*/){
// GroupCellClass cell(symbBuff, upBuff, downBuff);
// }
// false, true);
// GroupOctreeClass groupedTree(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), groupSize,
...
...
@@ -305,6 +322,13 @@ int main(int argc, char* argv[]){
// unsigned char* downBuffer, const size_t inDownSize){
// GroupContainerClass leaf(symbBuffer, downBuffer);
// leaf.init(inIndex, inParticles, inNbParticles, inSymbSize, inDownSize);
// },
// [](const MortonIndex /*mindex*/,
// unsigned char* symbBuff, const size_t /*symbSize*/,
// unsigned char* upBuff, const size_t /*upSize*/,
// unsigned char* downBuff, const size_t /*downSize*/,
// const int /*inLevel*/){
// GroupCellClass cell(symbBuff, upBuff, downBuff);
// }
// false, true, 0.2);
groupedTree
.
printInfoBlocks
();
...
...
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