Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
waLBerla
waLBerla
Commits
85be0096
Commit
85be0096
authored
Feb 09, 2021
by
Sebastian Eibl
Committed by
Christoph Schwarzmeier
Feb 09, 2021
Browse files
extend clang-tidy coverage
parent
504f3528
Changes
229
Hide whitespace changes
Inline
Side-by-side
.clang-tidy
View file @
85be0096
...
...
@@ -65,7 +65,6 @@ readability-use-anyofallof
'
WarningsAsErrors: '*'
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
HeaderFilterRegex: '.*'
...
src/blockforest/AABBRefinementSelection.h
View file @
85be0096
...
...
@@ -40,7 +40,7 @@ class AABBRefinementSelection
{
public:
AABBRefinementSelection
()
{}
AABBRefinementSelection
()
=
default
;
AABBRefinementSelection
(
const
Config
::
BlockHandle
&
configBlock
)
{
...
...
@@ -74,12 +74,12 @@ public:
void
addAABB
(
const
math
::
AABB
&
aabb
,
const
uint_t
level
)
{
aabbs_
.
push_back
(
std
::
make_pair
(
aabb
,
level
)
);
aabbs_
.
emplace_back
(
aabb
,
level
);
}
void
addRegion
(
const
math
::
AABB
&
region
,
const
uint_t
level
)
{
regions_
.
push_back
(
std
::
make_pair
(
region
,
level
)
);
regions_
.
emplace_back
(
region
,
level
);
}
// for static refinement
...
...
@@ -144,12 +144,12 @@ private:
std
::
vector
<
std
::
pair
<
math
::
AABB
,
uint_t
>
>
aabbs
;
for
(
auto
region
=
regions_
.
begin
();
region
!=
regions_
.
end
();
++
region
)
{
aabbs
.
push_back
(
std
::
make_pair
(
math
::
AABB
(
simulationDomain
.
xMin
()
+
region
->
first
.
xMin
()
*
simulationDomain
.
xSize
(),
simulationDomain
.
yMin
()
+
region
->
first
.
yMin
()
*
simulationDomain
.
ySize
(),
simulationDomain
.
zMin
()
+
region
->
first
.
zMin
()
*
simulationDomain
.
zSize
(),
simulationDomain
.
xMin
()
+
region
->
first
.
xMax
()
*
simulationDomain
.
xSize
(),
simulationDomain
.
yMin
()
+
region
->
first
.
yMax
()
*
simulationDomain
.
ySize
(),
simulationDomain
.
zMin
()
+
region
->
first
.
zMax
()
*
simulationDomain
.
zSize
()
),
region
->
second
)
);
aabbs
.
emplace_back
(
math
::
AABB
(
simulationDomain
.
xMin
()
+
region
->
first
.
xMin
()
*
simulationDomain
.
xSize
(),
simulationDomain
.
yMin
()
+
region
->
first
.
yMin
()
*
simulationDomain
.
ySize
(),
simulationDomain
.
zMin
()
+
region
->
first
.
zMin
()
*
simulationDomain
.
zSize
(),
simulationDomain
.
xMin
()
+
region
->
first
.
xMax
()
*
simulationDomain
.
xSize
(),
simulationDomain
.
yMin
()
+
region
->
first
.
yMax
()
*
simulationDomain
.
ySize
(),
simulationDomain
.
zMin
()
+
region
->
first
.
zMax
()
*
simulationDomain
.
zSize
()
),
region
->
second
);
}
return
aabbs
;
}
...
...
src/blockforest/Block.h
View file @
85be0096
...
...
@@ -79,14 +79,14 @@ public:
Block
(
BlockForest
&
forest
,
const
BlockID
&
id
,
const
AABB
&
aabb
,
const
uint_t
level
,
mpi
::
RecvBuffer
&
buffer
,
const
std
::
function
<
uint_t
(
const
uint_t
)
>
&
processMapping
=
std
::
function
<
uint_t
(
const
uint_t
)
>
()
);
virtual
~
Block
()
{}
~
Block
()
override
=
default
;
void
toBuffer
(
mpi
::
SendBuffer
&
buffer
)
const
;
const
BlockForest
&
getForest
()
const
{
return
forest_
;
}
BlockForest
&
getForest
()
{
return
forest_
;
}
const
BlockID
&
getId
()
const
{
return
id_
;
}
const
BlockID
&
getId
()
const
override
{
return
id_
;
}
uint_t
getProcess
()
const
;
uint_t
getLevel
()
const
{
return
level_
;
}
...
...
@@ -135,7 +135,7 @@ public:
protected:
bool
equal
(
const
IBlock
*
rhs
)
const
;
bool
equal
(
const
IBlock
*
rhs
)
const
override
;
private:
...
...
@@ -296,7 +296,7 @@ inline void Block::addNeighbor( const BlockID & id, const uint_t process, const
WALBERLA_ASSERT
(
neighborhood_
[
i
].
getId
()
<
id
||
id
<
neighborhood_
[
i
].
getId
()
);
#endif
neighborhood_
.
push_back
(
NeighborBlo
ck
(
forest_
,
id
,
process
,
state
)
);
neighborhood_
.
emplace_ba
ck
(
forest_
,
id
,
process
,
state
);
}
...
...
src/blockforest/BlockDataHandling.h
View file @
85be0096
...
...
@@ -36,7 +36,7 @@ template< typename T >
class
BlockDataHandling
:
public
domain_decomposition
::
BlockDataHandling
<
T
>
{
public:
virtual
~
BlockDataHandling
()
{}
~
BlockDataHandling
()
override
=
default
;
/// must be thread-safe !
virtual
void
serializeCoarseToFine
(
Block
*
const
block
,
const
BlockDataID
&
id
,
mpi
::
SendBuffer
&
buffer
,
const
uint_t
child
)
=
0
;
...
...
@@ -60,19 +60,19 @@ template< typename T >
class
AlwaysInitializeBlockDataHandling
:
public
BlockDataHandling
<
T
>
{
public:
~
AlwaysInitializeBlockDataHandling
()
{}
~
AlwaysInitializeBlockDataHandling
()
override
=
default
;
void
serialize
(
IBlock
*
const
,
const
BlockDataID
&
,
mpi
::
SendBuffer
&
)
{}
void
serializeCoarseToFine
(
Block
*
const
,
const
BlockDataID
&
,
mpi
::
SendBuffer
&
,
const
uint_t
)
{}
void
serializeFineToCoarse
(
Block
*
const
,
const
BlockDataID
&
,
mpi
::
SendBuffer
&
)
{}
void
serialize
(
IBlock
*
const
,
const
BlockDataID
&
,
mpi
::
SendBuffer
&
)
override
{}
void
serializeCoarseToFine
(
Block
*
const
,
const
BlockDataID
&
,
mpi
::
SendBuffer
&
,
const
uint_t
)
override
{}
void
serializeFineToCoarse
(
Block
*
const
,
const
BlockDataID
&
,
mpi
::
SendBuffer
&
)
override
{}
T
*
deserialize
(
IBlock
*
const
block
)
{
return
this
->
initialize
(
block
);
}
T
*
deserializeCoarseToFine
(
Block
*
const
block
)
{
return
this
->
initialize
(
block
);
}
T
*
deserializeFineToCoarse
(
Block
*
const
block
)
{
return
this
->
initialize
(
block
);
}
T
*
deserialize
(
IBlock
*
const
block
)
override
{
return
this
->
initialize
(
block
);
}
T
*
deserializeCoarseToFine
(
Block
*
const
block
)
override
{
return
this
->
initialize
(
block
);
}
T
*
deserializeFineToCoarse
(
Block
*
const
block
)
override
{
return
this
->
initialize
(
block
);
}
void
deserialize
(
IBlock
*
const
,
const
BlockDataID
&
,
mpi
::
RecvBuffer
&
)
{}
void
deserializeCoarseToFine
(
Block
*
const
,
const
BlockDataID
&
,
mpi
::
RecvBuffer
&
)
{}
void
deserializeFineToCoarse
(
Block
*
const
,
const
BlockDataID
&
,
mpi
::
RecvBuffer
&
,
const
uint_t
)
{}
void
deserialize
(
IBlock
*
const
,
const
BlockDataID
&
,
mpi
::
RecvBuffer
&
)
override
{}
void
deserializeCoarseToFine
(
Block
*
const
,
const
BlockDataID
&
,
mpi
::
RecvBuffer
&
)
override
{}
void
deserializeFineToCoarse
(
Block
*
const
,
const
BlockDataID
&
,
mpi
::
RecvBuffer
&
,
const
uint_t
)
override
{}
};
...
...
@@ -81,9 +81,9 @@ template< typename T >
class
AlwaysCreateBlockDataHandling
:
public
AlwaysInitializeBlockDataHandling
<
T
>
{
public:
~
AlwaysCreateBlockDataHandling
()
{}
~
AlwaysCreateBlockDataHandling
()
override
=
default
;
T
*
initialize
(
IBlock
*
const
/*block*/
)
{
return
new
T
();}
T
*
initialize
(
IBlock
*
const
/*block*/
)
override
{
return
new
T
();}
};
...
...
@@ -97,7 +97,7 @@ class BlockDataHandlingWrapper : public domain_decomposition::internal::BlockDat
public:
typedef
domain_decomposition
::
internal
::
BlockData
BlockData
;
virtual
~
BlockDataHandlingWrapper
()
{}
~
BlockDataHandlingWrapper
()
override
=
default
;
virtual
void
serializeCoarseToFine
(
Block
*
const
block
,
const
BlockDataID
&
id
,
mpi
::
SendBuffer
&
buffer
,
const
uint_t
child
)
=
0
;
virtual
void
serializeFineToCoarse
(
Block
*
const
block
,
const
BlockDataID
&
id
,
mpi
::
SendBuffer
&
buffer
)
=
0
;
...
...
@@ -118,67 +118,67 @@ public:
typedef
domain_decomposition
::
internal
::
BlockData
BlockData
;
BlockDataHandlingHelper
(
const
shared_ptr
<
BlockDataHandling
<
T
>
>
&
dataHandling
)
:
dataHandling_
(
dataHandling
)
{}
~
BlockDataHandlingHelper
()
{}
~
BlockDataHandlingHelper
()
override
=
default
;
BlockData
*
initialize
(
IBlock
*
const
block
)
BlockData
*
initialize
(
IBlock
*
const
block
)
override
{
WALBERLA_ASSERT_NOT_NULLPTR
(
block
);
T
*
ptr
=
dataHandling_
->
initialize
(
block
);
return
ptr
?
new
BlockData
(
ptr
)
:
NULL
;
return
ptr
?
new
BlockData
(
ptr
)
:
nullptr
;
}
void
serialize
(
IBlock
*
const
block
,
const
BlockDataID
&
id
,
mpi
::
SendBuffer
&
buffer
)
void
serialize
(
IBlock
*
const
block
,
const
BlockDataID
&
id
,
mpi
::
SendBuffer
&
buffer
)
override
{
WALBERLA_ASSERT_NOT_NULLPTR
(
block
);
dataHandling_
->
serialize
(
block
,
id
,
buffer
);
}
void
serializeCoarseToFine
(
Block
*
const
block
,
const
BlockDataID
&
id
,
mpi
::
SendBuffer
&
buffer
,
const
uint_t
child
)
void
serializeCoarseToFine
(
Block
*
const
block
,
const
BlockDataID
&
id
,
mpi
::
SendBuffer
&
buffer
,
const
uint_t
child
)
override
{
WALBERLA_ASSERT_NOT_NULLPTR
(
block
);
dataHandling_
->
serializeCoarseToFine
(
block
,
id
,
buffer
,
child
);
}
void
serializeFineToCoarse
(
Block
*
const
block
,
const
BlockDataID
&
id
,
mpi
::
SendBuffer
&
buffer
)
void
serializeFineToCoarse
(
Block
*
const
block
,
const
BlockDataID
&
id
,
mpi
::
SendBuffer
&
buffer
)
override
{
WALBERLA_ASSERT_NOT_NULLPTR
(
block
);
dataHandling_
->
serializeFineToCoarse
(
block
,
id
,
buffer
);
}
BlockData
*
deserialize
(
IBlock
*
const
block
)
BlockData
*
deserialize
(
IBlock
*
const
block
)
override
{
WALBERLA_ASSERT_NOT_NULLPTR
(
block
);
T
*
ptr
=
dataHandling_
->
deserialize
(
block
);
return
ptr
?
new
BlockData
(
ptr
)
:
NULL
;
return
ptr
?
new
BlockData
(
ptr
)
:
nullptr
;
}
BlockData
*
deserializeCoarseToFine
(
Block
*
const
block
)
BlockData
*
deserializeCoarseToFine
(
Block
*
const
block
)
override
{
WALBERLA_ASSERT_NOT_NULLPTR
(
block
);
T
*
ptr
=
dataHandling_
->
deserializeCoarseToFine
(
block
);
return
ptr
?
new
BlockData
(
ptr
)
:
NULL
;
return
ptr
?
new
BlockData
(
ptr
)
:
nullptr
;
}
BlockData
*
deserializeFineToCoarse
(
Block
*
const
block
)
BlockData
*
deserializeFineToCoarse
(
Block
*
const
block
)
override
{
WALBERLA_ASSERT_NOT_NULLPTR
(
block
);
T
*
ptr
=
dataHandling_
->
deserializeFineToCoarse
(
block
);
return
ptr
?
new
BlockData
(
ptr
)
:
NULL
;
return
ptr
?
new
BlockData
(
ptr
)
:
nullptr
;
}
void
deserialize
(
IBlock
*
const
block
,
const
BlockDataID
&
id
,
mpi
::
RecvBuffer
&
buffer
)
void
deserialize
(
IBlock
*
const
block
,
const
BlockDataID
&
id
,
mpi
::
RecvBuffer
&
buffer
)
override
{
WALBERLA_ASSERT_NOT_NULLPTR
(
block
);
dataHandling_
->
deserialize
(
block
,
id
,
buffer
);
}
void
deserializeCoarseToFine
(
Block
*
const
block
,
const
BlockDataID
&
id
,
mpi
::
RecvBuffer
&
buffer
)
void
deserializeCoarseToFine
(
Block
*
const
block
,
const
BlockDataID
&
id
,
mpi
::
RecvBuffer
&
buffer
)
override
{
WALBERLA_ASSERT_NOT_NULLPTR
(
block
);
dataHandling_
->
deserializeCoarseToFine
(
block
,
id
,
buffer
);
}
void
deserializeFineToCoarse
(
Block
*
const
block
,
const
BlockDataID
&
id
,
mpi
::
RecvBuffer
&
buffer
,
const
uint_t
child
)
void
deserializeFineToCoarse
(
Block
*
const
block
,
const
BlockDataID
&
id
,
mpi
::
RecvBuffer
&
buffer
,
const
uint_t
child
)
override
{
WALBERLA_ASSERT_NOT_NULLPTR
(
block
);
dataHandling_
->
deserializeFineToCoarse
(
block
,
id
,
buffer
,
child
);
...
...
src/blockforest/BlockForest.h
View file @
85be0096
...
...
@@ -179,13 +179,13 @@ public:
bool
getState
(
Set
<
SUID
>&
state
,
const
BlockID
&
id
)
const
{
const
Node
*
node
=
getNode
(
id
);
if
(
node
)
{
state
=
node
->
state_
;
return
true
;
}
return
false
;
}
bool
exists
(
const
real_t
x
,
const
real_t
y
,
const
real_t
z
)
const
{
return
getNode
(
x
,
y
,
z
)
!=
NULL
;
}
bool
exists
(
const
BlockID
&
id
)
const
{
return
getNode
(
id
)
!=
NULL
;
}
bool
exists
(
const
real_t
x
,
const
real_t
y
,
const
real_t
z
)
const
{
return
getNode
(
x
,
y
,
z
)
!=
nullptr
;
}
bool
exists
(
const
BlockID
&
id
)
const
{
return
getNode
(
id
)
!=
nullptr
;
}
bool
existsRemotely
(
const
real_t
x
,
const
real_t
y
,
const
real_t
z
)
const
{
const
Node
*
node
=
getNode
(
x
,
y
,
z
);
return
(
node
!=
NULL
&&
node
->
process_
!=
forest_
.
getProcess
()
);
}
{
const
Node
*
node
=
getNode
(
x
,
y
,
z
);
return
(
node
!=
nullptr
&&
node
->
process_
!=
forest_
.
getProcess
()
);
}
bool
existsRemotely
(
const
BlockID
&
id
)
const
{
const
Node
*
node
=
getNode
(
id
);
return
(
node
!=
NULL
&&
node
->
process_
!=
forest_
.
getProcess
()
);
}
{
const
Node
*
node
=
getNode
(
id
);
return
(
node
!=
nullptr
&&
node
->
process_
!=
forest_
.
getProcess
()
);
}
bool
getId
(
BlockID
&
id
,
const
real_t
x
,
const
real_t
y
,
const
real_t
z
)
const
;
...
...
@@ -197,10 +197,10 @@ public:
bool
getRootBlockState
(
Set
<
SUID
>&
state
,
const
uint_t
x
,
const
uint_t
y
,
const
uint_t
z
)
const
{
const
Node
*
node
=
getRootNode
(
x
,
y
,
z
);
if
(
node
)
{
state
=
node
->
state_
;
return
true
;
}
return
false
;
}
bool
rootBlockExists
(
const
uint_t
x
,
const
uint_t
y
,
const
uint_t
z
)
const
{
return
getRootNode
(
x
,
y
,
z
)
!=
NULL
;
}
bool
rootBlockExists
(
const
uint_t
x
,
const
uint_t
y
,
const
uint_t
z
)
const
{
return
getRootNode
(
x
,
y
,
z
)
!=
nullptr
;
}
bool
rootBlockExistsRemotely
(
const
uint_t
x
,
const
uint_t
y
,
const
uint_t
z
)
const
{
const
Node
*
node
=
getRootNode
(
x
,
y
,
z
);
return
(
node
!=
NULL
&&
node
->
process_
!=
forest_
.
getProcess
()
);
}
{
const
Node
*
node
=
getRootNode
(
x
,
y
,
z
);
return
(
node
!=
nullptr
&&
node
->
process_
!=
forest_
.
getProcess
()
);
}
private:
...
...
@@ -210,7 +210,7 @@ public:
const
Node
*
getRootNode
(
const
uint_t
x
,
const
uint_t
y
,
const
uint_t
z
)
const
{
const
uint_t
index
=
z
*
forest_
.
getYSize
()
*
forest_
.
getXSize
()
+
y
*
forest_
.
getXSize
()
+
x
;
if
(
index
>=
nodes_
.
size
()
)
return
NULL
;
return
nullptr
;
return
nodes_
[
index
].
get
();
}
...
...
@@ -223,7 +223,7 @@ public:
BlockForest
(
const
uint_t
process
,
const
SetupBlockForest
&
forest
,
const
bool
keepGlobalBlockInformation
=
false
);
BlockForest
(
const
uint_t
process
,
const
char
*
const
filename
,
const
bool
broadcastFile
=
true
,
const
bool
keepGlobalBlockInformation
=
false
);
~
BlockForest
()
{}
~
BlockForest
()
override
=
default
;
uint_t
getProcess
()
const
{
return
process_
;
}
uint_t
getProcessIdBytes
()
const
{
return
processIdBytes_
;
}
...
...
@@ -277,45 +277,45 @@ public:
inline
void
getBlocks
(
std
::
vector
<
const
Block
*
>&
blocks
,
const
uint_t
level
)
const
;
inline
void
getBlocks
(
std
::
vector
<
Block
*
>&
blocks
,
const
uint_t
level
);
inline
void
getBlocksContainedWithinAABB
(
std
::
vector
<
const
IBlock
*
>&
blocks
,
const
AABB
&
aabb
)
const
;
inline
void
getBlocksContainedWithinAABB
(
std
::
vector
<
IBlock
*
>&
blocks
,
const
AABB
&
aabb
);
inline
void
getBlocksContainedWithinAABB
(
std
::
vector
<
const
IBlock
*
>&
blocks
,
const
AABB
&
aabb
)
const
override
;
inline
void
getBlocksContainedWithinAABB
(
std
::
vector
<
IBlock
*
>&
blocks
,
const
AABB
&
aabb
)
override
;
inline
void
getBlocksOverlappedByAABB
(
std
::
vector
<
const
IBlock
*
>&
blocks
,
const
AABB
&
aabb
)
const
;
inline
void
getBlocksOverlappedByAABB
(
std
::
vector
<
IBlock
*
>&
blocks
,
const
AABB
&
aabb
);
inline
void
getBlocksOverlappedByAABB
(
std
::
vector
<
const
IBlock
*
>&
blocks
,
const
AABB
&
aabb
)
const
override
;
inline
void
getBlocksOverlappedByAABB
(
std
::
vector
<
IBlock
*
>&
blocks
,
const
AABB
&
aabb
)
override
;
using
BlockStorage
::
getBlock
;
inline
const
Block
*
getBlock
(
const
IBlockID
&
id
)
const
;
inline
Block
*
getBlock
(
const
IBlockID
&
id
);
inline
const
Block
*
getBlock
(
const
IBlockID
&
id
)
const
override
;
inline
Block
*
getBlock
(
const
IBlockID
&
id
)
override
;
inline
const
Block
*
getBlock
(
const
real_t
x
,
const
real_t
y
,
const
real_t
z
)
const
;
inline
Block
*
getBlock
(
const
real_t
x
,
const
real_t
y
,
const
real_t
z
);
inline
const
Block
*
getBlock
(
const
real_t
x
,
const
real_t
y
,
const
real_t
z
)
const
override
;
inline
Block
*
getBlock
(
const
real_t
x
,
const
real_t
y
,
const
real_t
z
)
override
;
inline
const
Block
*
getRootBlock
(
const
uint_t
x
,
const
uint_t
y
,
const
uint_t
z
)
const
;
inline
Block
*
getRootBlock
(
const
uint_t
x
,
const
uint_t
y
,
const
uint_t
z
);
bool
containsGlobalBlockInformation
()
const
{
return
blockInformation_
->
active
();
}
bool
containsGlobalBlockInformation
()
const
override
{
return
blockInformation_
->
active
();
}
inline
void
getAllBlocks
(
std
::
vector
<
shared_ptr
<
IBlockID
>
>&
blocks
)
const
;
inline
void
getAllBlocks
(
std
::
vector
<
shared_ptr
<
IBlockID
>
>&
blocks
)
const
override
;
inline
bool
blockExists
(
const
real_t
x
,
const
real_t
y
,
const
real_t
z
)
const
;
inline
bool
blockExistsLocally
(
const
real_t
x
,
const
real_t
y
,
const
real_t
z
)
const
;
inline
bool
blockExistsRemotely
(
const
real_t
x
,
const
real_t
y
,
const
real_t
z
)
const
;
inline
bool
blockExists
(
const
real_t
x
,
const
real_t
y
,
const
real_t
z
)
const
override
;
inline
bool
blockExistsLocally
(
const
real_t
x
,
const
real_t
y
,
const
real_t
z
)
const
override
;
inline
bool
blockExistsRemotely
(
const
real_t
x
,
const
real_t
y
,
const
real_t
z
)
const
override
;
inline
bool
blockExists
(
const
IBlockID
&
id
)
const
;
inline
bool
blockExistsLocally
(
const
IBlockID
&
id
)
const
;
inline
bool
blockExistsRemotely
(
const
IBlockID
&
id
)
const
;
inline
bool
blockExists
(
const
IBlockID
&
id
)
const
override
;
inline
bool
blockExistsLocally
(
const
IBlockID
&
id
)
const
override
;
inline
bool
blockExistsRemotely
(
const
IBlockID
&
id
)
const
override
;
inline
bool
rootBlockExists
(
const
uint_t
x
,
const
uint_t
y
,
const
uint_t
z
)
const
;
inline
bool
rootBlockExistsLocally
(
const
uint_t
x
,
const
uint_t
y
,
const
uint_t
z
)
const
;
inline
bool
rootBlockExistsRemotely
(
const
uint_t
x
,
const
uint_t
y
,
const
uint_t
z
)
const
;
void
getBlockID
(
IBlockID
&
id
,
const
real_t
x
,
const
real_t
y
,
const
real_t
z
)
const
;
void
getAABB
(
AABB
&
aabb
,
const
IBlockID
&
id
)
const
;
void
getState
(
Set
<
SUID
>&
state
,
const
IBlockID
&
id
)
const
;
void
getProcessRank
(
uint_t
&
rank
,
const
IBlockID
&
id
)
const
;
void
getBlockID
(
IBlockID
&
id
,
const
real_t
x
,
const
real_t
y
,
const
real_t
z
)
const
override
;
void
getAABB
(
AABB
&
aabb
,
const
IBlockID
&
id
)
const
override
;
void
getState
(
Set
<
SUID
>&
state
,
const
IBlockID
&
id
)
const
override
;
void
getProcessRank
(
uint_t
&
rank
,
const
IBlockID
&
id
)
const
override
;
void
getRootBlockAABB
(
AABB
&
aabb
,
const
uint_t
x
,
const
uint_t
y
,
const
uint_t
z
)
const
;
void
getRootBlockState
(
Set
<
SUID
>&
state
,
const
uint_t
x
,
const
uint_t
y
,
const
uint_t
z
)
const
;
...
...
@@ -324,7 +324,7 @@ public:
const
BlockInformation
&
getBlockInformation
()
const
{
return
*
blockInformation_
;
}
inline
uint_t
getLevel
(
const
IBlock
&
block
)
const
;
inline
uint_t
getLevel
(
const
IBlock
&
block
)
const
override
;
inline
uint_t
getLevelFromBlockId
(
const
BlockID
&
id
)
const
;
inline
uint_t
getAABBFromBlockId
(
AABB
&
aabb
,
const
BlockID
&
id
)
const
;
inline
AABB
getAABBFromBlockId
(
const
BlockID
&
id
)
const
;
...
...
@@ -338,9 +338,9 @@ public:
bool
insertBuffersIntoProcessNetwork
()
const
{
return
insertBuffersIntoProcessNetwork_
;
}
const
std
::
vector
<
uint_t
>
&
getNeighborhood
()
const
{
return
neighborhood_
;
}
const
std
::
vector
<
uint_t
>
&
getNeighboringProcesses
()
const
{
return
getNeighborhood
();
}
const
std
::
vector
<
uint_t
>
&
getNeighboringProcesses
()
const
override
{
return
getNeighborhood
();
}
std
::
map
<
uint_t
,
std
::
vector
<
Vector3
<
real_t
>
>
>
getNeighboringProcessOffsets
()
const
;
std
::
map
<
uint_t
,
std
::
vector
<
Vector3
<
real_t
>
>
>
getNeighboringProcessOffsets
()
const
override
;
...
...
@@ -484,7 +484,7 @@ public:
protected:
bool
equal
(
const
BlockStorage
*
rhs
)
const
;
bool
equal
(
const
BlockStorage
*
rhs
)
const
override
;
void
addBlockData
(
IBlock
*
const
block
,
const
BlockDataID
&
index
,
domain_decomposition
::
internal
::
BlockData
*
const
data
)
{
BlockStorage
::
addBlockData
(
block
,
index
,
data
);
}
...
...
@@ -643,7 +643,7 @@ inline const Block* BlockForest::getBlock( const IBlockID& id ) const {
if
(
it
!=
blocks_
.
end
()
)
return
it
->
second
.
get
();
return
NULL
;
return
nullptr
;
}
...
...
@@ -657,7 +657,7 @@ inline Block* BlockForest::getBlock( const IBlockID& id ) {
if
(
it
!=
blocks_
.
end
()
)
return
it
->
second
.
get
();
return
NULL
;
return
nullptr
;
}
...
...
@@ -667,7 +667,7 @@ inline const Block* BlockForest::getBlock( const real_t x, const real_t y, const
for
(
auto
it
=
blocks_
.
begin
();
it
!=
blocks_
.
end
();
++
it
)
if
(
it
->
second
->
getAABB
().
contains
(
x
,
y
,
z
)
)
return
it
->
second
.
get
();
return
NULL
;
return
nullptr
;
}
...
...
@@ -677,7 +677,7 @@ inline Block* BlockForest::getBlock( const real_t x, const real_t y, const real_
for
(
auto
it
=
blocks_
.
begin
();
it
!=
blocks_
.
end
();
++
it
)
if
(
it
->
second
->
getAABB
().
contains
(
x
,
y
,
z
)
)
return
it
->
second
.
get
();
return
NULL
;
return
nullptr
;
}
...
...
@@ -721,14 +721,14 @@ inline bool BlockForest::blockExists( const real_t x, const real_t y, const real
if
(
blockInformation_
->
active
()
)
return
blockInformation_
->
exists
(
x
,
y
,
z
);
return
getBlock
(
x
,
y
,
z
)
!=
NULL
;
return
getBlock
(
x
,
y
,
z
)
!=
nullptr
;
}
inline
bool
BlockForest
::
blockExistsLocally
(
const
real_t
x
,
const
real_t
y
,
const
real_t
z
)
const
{
return
getBlock
(
x
,
y
,
z
)
!=
NULL
;
return
getBlock
(
x
,
y
,
z
)
!=
nullptr
;
}
...
...
@@ -738,7 +738,7 @@ inline bool BlockForest::blockExistsRemotely( const real_t x, const real_t y, co
if
(
blockInformation_
->
active
()
)
return
blockInformation_
->
existsRemotely
(
x
,
y
,
z
);
return
getBlock
(
x
,
y
,
z
)
==
NULL
;
return
getBlock
(
x
,
y
,
z
)
==
nullptr
;
}
...
...
@@ -750,14 +750,14 @@ inline bool BlockForest::blockExists( const IBlockID& id ) const {
if
(
blockInformation_
->
active
()
)
return
blockInformation_
->
exists
(
*
static_cast
<
const
BlockID
*
>
(
&
id
)
);
return
getBlock
(
id
)
!=
NULL
;
return
getBlock
(
id
)
!=
nullptr
;
}
inline
bool
BlockForest
::
blockExistsLocally
(
const
IBlockID
&
id
)
const
{
return
getBlock
(
id
)
!=
NULL
;
return
getBlock
(
id
)
!=
nullptr
;
}
...
...
@@ -769,7 +769,7 @@ inline bool BlockForest::blockExistsRemotely( const IBlockID& id ) const {
if
(
blockInformation_
->
active
()
)
return
blockInformation_
->
existsRemotely
(
*
static_cast
<
const
BlockID
*
>
(
&
id
)
);
return
getBlock
(
id
)
==
NULL
;
return
getBlock
(
id
)
==
nullptr
;
}
...
...
@@ -779,14 +779,14 @@ inline bool BlockForest::rootBlockExists( const uint_t x, const uint_t y, const
if
(
blockInformation_
->
active
()
)
return
blockInformation_
->
rootBlockExists
(
x
,
y
,
z
);
return
getRootBlock
(
x
,
y
,
z
)
!=
NULL
;
return
getRootBlock
(
x
,
y
,
z
)
!=
nullptr
;
}
inline
bool
BlockForest
::
rootBlockExistsLocally
(
const
uint_t
x
,
const
uint_t
y
,
const
uint_t
z
)
const
{
return
getRootBlock
(
x
,
y
,
z
)
!=
NULL
;
return
getRootBlock
(
x
,
y
,
z
)
!=
nullptr
;
}
...
...
@@ -796,7 +796,7 @@ inline bool BlockForest::rootBlockExistsRemotely( const uint_t x, const uint_t y
if
(
blockInformation_
->
active
()
)
return
blockInformation_
->
rootBlockExistsRemotely
(
x
,
y
,
z
);
return
getRootBlock
(
x
,
y
,
z
)
==
NULL
;
return
getRootBlock
(
x
,
y
,
z
)
==
nullptr
;
}
...
...
src/blockforest/BlockID.h
View file @
85be0096
...
...
@@ -283,18 +283,18 @@ public:
void
removeBranchId
()
{
WALBERLA_ASSERT_GREATER_EQUAL
(
getUsedBits
(),
uint_c
(
4
)
);
id_
>>=
3
;
}
uint_t
getBranchId
()
const
{
WALBERLA_ASSERT_GREATER_EQUAL
(
getUsedBits
(),
uint_c
(
4
)
);
return
id_
&
uint_c
(
7
);
}
bool
operator
<
(
const
IBlockID
&
rhs
)
const
bool
operator
<
(
const
IBlockID
&
rhs
)
const
override
{
WALBERLA_ASSERT_EQUAL
(
dynamic_cast
<
const
BlockID
*
>
(
&
rhs
),
&
rhs
);
return
id_
<
static_cast
<
const
BlockID
*
>
(
&
rhs
)
->
id_
;
}
bool
operator
>
(
const
IBlockID
&
rhs
)
const
{
WALBERLA_ASSERT_EQUAL
(
dynamic_cast
<
const
BlockID
*
>
(
&
rhs
),
&
rhs
);
return
id_
>
static_cast
<
const
BlockID
*
>
(
&
rhs
)
->
id_
;
}
bool
operator
==
(
const
IBlockID
&
rhs
)
const
bool
operator
==
(
const
IBlockID
&
rhs
)
const
override
{
WALBERLA_ASSERT_EQUAL
(
dynamic_cast
<
const
BlockID
*
>
(
&
rhs
),
&
rhs
);
return
id_
==
static_cast
<
const
BlockID
*
>
(
&
rhs
)
->
id_
;
}
bool
operator
!=
(
const
IBlockID
&
rhs
)
const
bool
operator
!=
(
const
IBlockID
&
rhs
)
const
override
{
WALBERLA_ASSERT_EQUAL
(
dynamic_cast
<
const
BlockID
*
>
(
&
rhs
),
&
rhs
);
return
id_
!=
static_cast
<
const
BlockID
*
>
(
&
rhs
)
->
id_
;
}
inline
IDType
getID
()
const
;
inline
IDType
getID
()
const
override
;
inline
std
::
ostream
&
toStream
(
std
::
ostream
&
os
)
const
;
inline
std
::
ostream
&
toStream
(
std
::
ostream
&
os
)
const
override
;
void
toByteArray
(
std
::
vector
<
uint8_t
>&
array
,
const
uint_t
offset
,
const
uint_t
bytes
)
const
{
uintToByteArray
(
id_
,
array
,
offset
,
bytes
);
}
...
...
src/blockforest/BlockReconstruction.h
View file @
85be0096
...
...
@@ -164,7 +164,7 @@ void BlockReconstruction::reconstructNeighborhood( BLOCK* block, const std::vect
const
NeighborhoodReconstructionBlock
*
neighbor
=
&
(
neighbors
[
i
]);
uint_t
index
=
0
;
if
(
neighborhood
.
insert
(
neighbor
).
second
==
true
)
{
if
(
neighborhood
.
insert
(
neighbor
).
second
)
{
index
=
block
->
getNeighborhoodSize
();
neighborhoodIndex
[
neighbor
]
=
index
;
...
...
src/blockforest/GlobalLoadBalancing.h
View file @
85be0096
...
...
@@ -57,7 +57,7 @@ public:
public:
typedef
std
::
function
<
memory_t
(
const
BLOCK
*
const
,
const
BLOCK
*
const
)
>
CommunicationFunction
;
MetisConfiguration
(
const
bool
_includeMetis
=
false
,
const
bool
_forceMetis
=
false
,
CommunicationFunction
_communicationFunction
=
0
,
MetisConfiguration
(
const
bool
_includeMetis
=
false
,
const
bool
_forceMetis
=
false
,
CommunicationFunction
_communicationFunction
=
nullptr
,
const
real_t
_maxUbvec
=
real_c
(
1.5
),
const
uint_t
_iterations
=
uint_c
(
10
)
)
:
includeMetis_
(
_includeMetis
),
forceMetis_
(
_forceMetis
),
communicationFunction_
(
_communicationFunction
),
maxUbvec_
(
_maxUbvec
),
iterations_
(
_iterations
)
{}
...
...
@@ -103,13 +103,13 @@ public:
template
<
typename
BLOCK
>
static
inline
uint_t
minimizeProcesses
(
const
std
::
vector
<
BLOCK
*
>&
blocks
,
const
memory_t
memoryLimit
,
const
MetisConfiguration
<
BLOCK
>&
metisConfig
,
const
std
::
vector
<
workload_t
>*
processesWork
=
NULL
,
const
std
::
vector
<
memory_t
>*
processesMemory
=
NULL
);
const
std
::
vector
<
workload_t
>*
processesWork
=
nullptr
,
const
std
::
vector
<
memory_t
>*
processesMemory
=
nullptr
);
template
<
typename
BLOCK
>
static
inline
uint_t
maximizeMemoryUtilization
(
const
std
::
vector
<
BLOCK
*
>&
blocks
,
const
memory_t
memoryLimit
,
const
MetisConfiguration
<
BLOCK
>&
metisConfig
,
const
std
::
vector
<
workload_t
>*
processesWork
=
NULL
,
const
std
::
vector
<
memory_t
>*
processesMemory
=
NULL
);
const
std
::
vector
<
workload_t
>*
processesWork
=
nullptr
,
const
std
::
vector
<
memory_t
>*
processesMemory
=
nullptr
);
// optimize workload
template
<
typename
BLOCK
>
...
...
@@ -130,7 +130,7 @@ private:
template
<
typename
BLOCK
>
static
uint_t
fixedWork
(
const
std
::
vector
<
BLOCK
*
>&
blocks
,
const
workload_t
workloadLimit
,
const
memory_t
memoryLimit
,
const
std
::
vector
<
workload_t
>*
processesWork
=
NULL
,
const
std
::
vector
<
memory_t
>*
processesMemory
=
NULL
);
const
std
::
vector
<
workload_t
>*
processesWork
=
nullptr
,
const
std
::
vector
<
memory_t
>*
processesMemory
=
nullptr
);
#ifdef WALBERLA_BUILD_WITH_METIS
...
...
@@ -490,7 +490,7 @@ inline uint_t GlobalLoadBalancing::minimizeProcesses( const std::vector< BLOCK*
// minimize number of processes == do not care about the amount of workload that is assigned to a process,
// just put as many blocks as possible on any process
workload_t
workloadLimit
=
workloadSum
(
blocks
)
+
(
(
processesWork
==
NULL
)
?
static_cast
<
workload_t
>
(
0
)
:
workload_t
workloadLimit
=
workloadSum
(
blocks
)
+
(
(
processesWork
==
nullptr
)
?
static_cast
<
workload_t
>
(
0
)
:
math
::
kahanSummation
(
processesWork
->
begin
(),
processesWork
->
end
()
)
);
uint_t
numberOfProcesses
=
fixedWork
(
blocks
,
workloadLimit
,
memoryLimit
,
processesWork
,
processesMemory
);
...
...
@@ -642,7 +642,7 @@ void GlobalLoadBalancing::prepareProcessReordering( const std::vector< BLOCK* >
const
BLOCK
*
const
block
=
(
*
it
).
second
;
for
(
uint_t
i
=
0
;
i
!=
block
->
getNeighborhoodSize
();
++
i
)
if
(
neighbors
.
insert
(
block
->
getNeighborTargetProcess
(
i
)
).
second
==
true
)
if
(
neighbors
.
insert
(
block
->
getNeighborTargetProcess
(
i
)
).
second
)
processNeighbors
[
uint_c
(
p
)
].
push_back
(
block
->
getNeighborTargetProcess
(
i
)
);
// for( uint_t n = 0; n != 26; ++n )
...
...
@@ -673,7 +673,7 @@ void GlobalLoadBalancing::reorderProcessesByBFS( std::vector< BLOCK* > & blocks,
uint_t
startIndex
=
numberOfProcesses
;
for
(
uint_t
i
=
previousStartIndex
;
i
<
numberOfProcesses
;
++
i
)
{