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
Dominik Mehlich
waLBerla
Commits
39a70296
Commit
39a70296
authored
Aug 28, 2019
by
Sebastian Eibl
Browse files
[CLANG-TIDY] readability-delete-null-pointer
parent
f6eb600f
Changes
3
Hide whitespace changes
Inline
Side-by-side
.clang-tidy
View file @
39a70296
...
...
@@ -34,6 +34,7 @@ portability-*,
readability-const-return-type,
readability-container-size-empty,
readability-delete-null-pointer,
readability-misleading-indentation,
readability-misplaced-array-index
...
...
src/blockforest/Initialization.cpp
View file @
39a70296
...
...
@@ -222,7 +222,7 @@ createBlockForest( const AABB& domainAABB,
// if possible, create Cartesian MPI communicator
std
::
vector
<
uint_t
>
*
processIdMap
=
nullptr
;
std
::
vector
<
uint_t
>
processIdMap
(
0
)
;
WALBERLA_MPI_SECTION
()
{
...
...
@@ -233,13 +233,13 @@ createBlockForest( const AABB& domainAABB,
if
(
mpiManager
->
isCartesianCommValid
()
)
{
mpiManager
->
createCartesianComm
(
numberOfXProcesses
,
numberOfYProcesses
,
numberOfZProcesses
,
xPeriodic
,
yPeriodic
,
zPeriodic
);
processIdMap
=
new
std
::
vector
<
uint_t
>
(
numberOfProcesses
);
processIdMap
.
resize
(
numberOfProcesses
);
for
(
uint_t
z
=
0
;
z
!=
numberOfZProcesses
;
++
z
)
{
for
(
uint_t
y
=
0
;
y
!=
numberOfYProcesses
;
++
y
)
{
for
(
uint_t
x
=
0
;
x
!=
numberOfXProcesses
;
++
x
)
{
(
*
processIdMap
)
[
z
*
numberOfXProcesses
*
numberOfYProcesses
+
y
*
numberOfXProcesses
+
x
]
=
processIdMap
[
z
*
numberOfXProcesses
*
numberOfYProcesses
+
y
*
numberOfXProcesses
+
x
]
=
uint_c
(
MPIManager
::
instance
()
->
cartesianRank
(
x
,
y
,
z
)
);
}
}
...
...
@@ -256,11 +256,9 @@ createBlockForest( const AABB& domainAABB,
// calculate process distribution
sforest
.
balanceLoad
(
blockforest
::
CartesianDistribution
(
numberOfXProcesses
,
numberOfYProcesses
,
numberOfZProcesses
,
processIdMap
),
sforest
.
balanceLoad
(
blockforest
::
CartesianDistribution
(
numberOfXProcesses
,
numberOfYProcesses
,
numberOfZProcesses
,
&
processIdMap
),
numberOfXProcesses
*
numberOfYProcesses
*
numberOfZProcesses
);
if
(
processIdMap
!=
nullptr
)
delete
processIdMap
;
// create StructuredBlockForest (encapsulates a newly created BlockForest)
return
std
::
make_shared
<
BlockForest
>
(
uint_c
(
MPIManager
::
instance
()
->
rank
()
),
sforest
,
keepGlobalBlockInformation
);
...
...
src/blockforest/loadbalancing/Cartesian.cpp
View file @
39a70296
...
...
@@ -48,7 +48,7 @@ uint_t CartesianDistribution::operator()( SetupBlockForest & forest, const uint_
WALBERLA_ABORT
(
"Load balancing failed:
\'
Number of processes in z-direction
\'
must be in (0,"
<<
forest
.
getZSize
()
<<
"]. "
"You specified
\'
"
<<
numberOfZProcesses_
<<
"
\'
."
);
if
(
processIdMap_
!=
nullptr
)
if
(
!
processIdMap_
->
empty
()
)
WALBERLA_CHECK_EQUAL
(
processIdMap_
->
size
(),
numberOfProcesses
);
uint_t
partitions
[
3
];
...
...
@@ -84,7 +84,7 @@ uint_t CartesianDistribution::operator()( SetupBlockForest & forest, const uint_
{
const
uint_t
index
=
z
*
partitions
[
0
]
*
partitions
[
1
]
+
y
*
partitions
[
0
]
+
x
;
(
*
block
)
->
assignTargetProcess
(
(
processIdMap_
!=
nullptr
)
?
(
*
processIdMap_
)[
index
]
:
index
);
(
*
block
)
->
assignTargetProcess
(
(
!
processIdMap_
->
empty
()
)
?
(
*
processIdMap_
)[
index
]
:
index
);
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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