Commit afe97cab authored by Sebastian Eibl's avatar Sebastian Eibl
Browse files

Merge branch 'ClangTidy' into 'master'

additional clang tidy checks

See merge request walberla/walberla!231
parents 92e70084 5ac617d8
......@@ -6,6 +6,7 @@ Checks: '
boost-*,
bugprone-*,
-bugprone-branch-clone,
-bugprone-exception-escape,
misc-*,
......@@ -22,6 +23,7 @@ modernize-*,
-modernize-return-braced-init-list,
-modernize-use-transparent-functors,
-modernize-redundant-void-arg,
-modernize-use-trailing-return-type,
-modernize-avoid-c-arrays,
mpi-*,
......@@ -36,13 +38,18 @@ readability-const-return-type,
readability-container-size-empty,
readability-delete-null-pointer,
readability-deleted-default,
readability-isolate-declaration,
readability-misleading-indentation,
readability-misplaced-array-index,
readability-redundant-control-flow,
readability-redundant-declaration,
readability-redundant-function-ptr-dereference,
readability-redundant-preprocessor,
readability-redundant-smartptr-get,
readability-redundant-string-cstr,
readability-simplify-subscript-expr,
readability-static-accessed-through-instance,
readability-static-definition-in-anonymous-namespace,
readability-string-compare,
readability-uniqueptr-delete-release
......
......@@ -2020,7 +2020,8 @@ int main( int argc, char **argv )
// evaluate general simulation infos (on root)
{
real_t totalTimeToCurrentTimestep, totalLBTimeToCurrentTimestep;
real_t totalTimeToCurrentTimestep;
real_t totalLBTimeToCurrentTimestep;
evaluateTotalSimulationTimePassed(timeloopTiming, totalTimeToCurrentTimestep, totalLBTimeToCurrentTimestep);
std::vector<math::DistributedSample> numberOfBlocksPerLevel(numberOfLevels);
......
......@@ -867,7 +867,12 @@ int main( int argc, char **argv )
peTimer.emplace_back("Simulation Step.Collision Response Resolution.Collision Response Solving");
timerKeys.push_back(peTimer);
uint_t numCells, numFluidCells, numNBCells, numLocalParticles, numShadowParticles, numContacts;
uint_t numCells;
uint_t numFluidCells;
uint_t numNBCells;
uint_t numLocalParticles;
uint_t numShadowParticles;
uint_t numContacts;
numCells = uint_t(0);
numFluidCells = uint_t(0);
numNBCells = uint_t(0);
......
......@@ -788,7 +788,9 @@ int main( int argc, char **argv )
WALBERLA_CHECK(numProcs % 16 != 0, "An integer multiple of 16 MPI ranks has to be used due to horizontal periodicity and domain decomposition requirements!");
uint_t XBlocks, YBlocks, ZBlocks;
uint_t XBlocks;
uint_t YBlocks;
uint_t ZBlocks;
if( numProcs >= 192 )
{
XBlocks = uint_t(6);
......
......@@ -265,8 +265,12 @@ static void workloadAndMemoryAssignment( SetupBlockForest & forest, const memory
void createSetupBlockForest( blockforest::SetupBlockForest & sforest, const Config::BlockHandle & configBlock, const uint_t numberOfProcesses )
{
uint_t numberOfXCellsPerBlock, numberOfYCellsPerBlock, numberOfZCellsPerBlock;
uint_t numberOfXBlocks, numberOfYBlocks, numberOfZBlocks;
uint_t numberOfXCellsPerBlock;
uint_t numberOfYCellsPerBlock;
uint_t numberOfZCellsPerBlock;
uint_t numberOfXBlocks;
uint_t numberOfYBlocks;
uint_t numberOfZBlocks;
const uint_t bufferProcesses = configBlock.getParameter< uint_t >( "bufferProcesses", 0 );
const uint_t fineBlocksPerProcess = configBlock.getParameter< uint_t >( "fineBlocksPerProcess", 4 );
......@@ -313,7 +317,9 @@ void createSetupBlockForest( blockforest::SetupBlockForest & sforest, const Conf
shared_ptr< blockforest::StructuredBlockForest > createStructuredBlockForest( const Config::BlockHandle & configBlock )
{
uint_t numberOfXCellsPerBlock, numberOfYCellsPerBlock, numberOfZCellsPerBlock;
uint_t numberOfXCellsPerBlock;
uint_t numberOfYCellsPerBlock;
uint_t numberOfZCellsPerBlock;
getCells( configBlock, numberOfXCellsPerBlock, numberOfYCellsPerBlock, numberOfZCellsPerBlock );
if( configBlock.isDefined( "sbffile" ) )
......
......@@ -241,9 +241,15 @@ static inline void getCellsAndProcesses( const Config::BlockHandle & configBlock
void createSetupBlockForest( blockforest::SetupBlockForest & sforest, const Config::BlockHandle & configBlock, const uint_t numberOfProcesses, const uint_t blocksPerProcess )
{
uint_t numberOfXCellsPerBlock, numberOfYCellsPerBlock, numberOfZCellsPerBlock;
uint_t numberOfXProcesses, numberOfYProcesses, numberOfZProcesses;
uint_t numberOfXBlocks, numberOfYBlocks, numberOfZBlocks;
uint_t numberOfXCellsPerBlock;
uint_t numberOfYCellsPerBlock;
uint_t numberOfZCellsPerBlock;
uint_t numberOfXProcesses;
uint_t numberOfYProcesses;
uint_t numberOfZProcesses;
uint_t numberOfXBlocks;
uint_t numberOfYBlocks;
uint_t numberOfZBlocks;
getCellsAndProcesses( configBlock, numberOfProcesses, blocksPerProcess,
numberOfXCellsPerBlock, numberOfYCellsPerBlock, numberOfZCellsPerBlock,
......@@ -307,7 +313,9 @@ void createSetupBlockForest( blockforest::SetupBlockForest & sforest, const Conf
shared_ptr< blockforest::StructuredBlockForest > createStructuredBlockForest( const Config::BlockHandle & configBlock )
{
uint_t numberOfXCellsPerBlock, numberOfYCellsPerBlock, numberOfZCellsPerBlock;
uint_t numberOfXCellsPerBlock;
uint_t numberOfYCellsPerBlock;
uint_t numberOfZCellsPerBlock;
getCells( configBlock, numberOfXCellsPerBlock, numberOfYCellsPerBlock, numberOfZCellsPerBlock );
const uint_t blocksPerProcess = configBlock.getParameter< uint_t >( "blocksPerProcess", uint_t( 1 ) );
......
......@@ -458,8 +458,14 @@ void PhantomBlockForest::migrate( const PhantomBlockDataPackFunction & packBlock
{
WALBERLA_ASSERT_EQUAL( offset, int8_t(1) );
uint32_t s0( uint32_t(0) ), s1( uint32_t(0) ), s2( uint32_t(0) ), s3( uint32_t(0) ),
s4( uint32_t(0) ), s5( uint32_t(0) ), s6( uint32_t(0) ), s7( uint32_t(0) );
uint32_t s0( uint32_t(0) );
uint32_t s1( uint32_t(0) );
uint32_t s2( uint32_t(0) );
uint32_t s3( uint32_t(0) );
uint32_t s4( uint32_t(0) );
uint32_t s5( uint32_t(0) );
uint32_t s6( uint32_t(0) );
uint32_t s7( uint32_t(0) );
buffer >> s0 >> s1 >> s2 >> s3 >> s4 >> s5 >> s6 >> s7;
sp.push_back( s0 ); sp.push_back( s1 ); sp.push_back( s2 ); sp.push_back( s3 );
sp.push_back( s4 ); sp.push_back( s5 ); sp.push_back( s6 ); sp.push_back( s7 );
......
......@@ -53,7 +53,9 @@ AABB SetupBlockForest::RootBlockAABB::operator()( const uint_t index ) const //
{
AABB aabb;
uint_t x,y,z;
uint_t x;
uint_t y;
uint_t z;
SetupBlockForest::mapTreeIndexToForestCoordinates( index, xSize_, ySize_, x, y, z );
SetupBlockForest::getRootBlockAABB( aabb, domain_, rootBlockXSize_, rootBlockYSize_, rootBlockZSize_, xSize_, ySize_, zSize_, x, y, z );
......@@ -474,7 +476,8 @@ void SetupBlockForest::getBlocksOverlappedByAABB( std::vector< SetupBlock* >& bl
aabb.zMin() >= domain_.zMax() || aabb.zMax() <= domain_.zMin() )
return;
uint_t min[3], max[3];
uint_t min[3];
uint_t max[3];
mapAABBToBoundingForestCoordinates( aabb, min, max );
......
......@@ -30,7 +30,9 @@ namespace blockforest {
bool StructuredBlockForest::blockExists( const Cell& cell, const uint_t level ) const {
real_t x, y, z;
real_t x;
real_t y;
real_t z;
getCellCenter( x, y, z, cell, level );
if( getBlockInformation().active() ) {
......@@ -57,7 +59,9 @@ void StructuredBlockForest::getBlockID( IBlockID& id, const Cell& cell, const ui
WALBERLA_ASSERT_EQUAL( dynamic_cast< BlockID* >( &id ), &id );
real_t x, y, z;
real_t x;
real_t y;
real_t z;
getCellCenter( x, y, z, cell, level );
if( getBlockInformation().active() ) {
......
......@@ -110,7 +110,8 @@ bool DynamicParMetis::operator()( std::vector< std::pair< const PhantomBlock *,
//create new communicator which excludes processes which do not have blocks
MPI_Comm subComm = MPI_COMM_NULL;
MPI_Group allGroup, subGroup;
MPI_Group allGroup;
MPI_Group subGroup;
MPI_Comm_group( MPIManager::instance()->comm(), &allGroup );
std::vector<int> ranks;
if (!targetProcess.empty())
......@@ -144,7 +145,11 @@ bool DynamicParMetis::operator()( std::vector< std::pair< const PhantomBlock *,
WALBERLA_ASSERT_LESS( vtxdist[i-1], vtxdist[i] );
}
std::vector<int64_t> adjncy, xadj, vsize, vwgt, adjwgt;
std::vector<int64_t> adjncy;
std::vector<int64_t> xadj;
std::vector<int64_t> vsize;
std::vector<int64_t> vwgt;
std::vector<int64_t> adjwgt;
std::vector<double> xyz;
uint_t blockIndex = 0;
......
......@@ -52,7 +52,8 @@ using idx_t = uint_t;
uint_t StaticLevelwiseParMetis::operator()( SetupBlockForest & forest, const uint_t numberOfProcesses, const memory_t /*perProcessMemoryLimit*/ ) const
{
WcTimer globalTimer, parmetisTimer;
WcTimer globalTimer;
WcTimer parmetisTimer;
int numRunnerProcesses = MPIManager::instance()->numProcesses(); // Number of processes running ParMetis (!= number of processes the partition is computed for)
int rank = MPIManager::instance()->rank();
......@@ -93,7 +94,10 @@ uint_t StaticLevelwiseParMetis::operator()( SetupBlockForest & forest, const uin
vtxdist.push_back( int64_c( std::min( i * chunkSize, numBlocks ) ) );
vtxdist.push_back( int64_t( forest.getNumberOfBlocks( level ) ) );
std::vector<int64_t> adjncy, xadj, vwgt, adjwgt;
std::vector<int64_t> adjncy;
std::vector<int64_t> xadj;
std::vector<int64_t> vwgt;
std::vector<int64_t> adjwgt;
std::vector<double> xyz;
std::vector< BlockPair > blockPairs;
......
......@@ -153,8 +153,11 @@ void Config::parseFromFile( const char* filename, Block& block, unsigned int lev
{
std::stringstream input;
LineVector lineNumbers;
std::string line, key, value;
std::string::size_type pos1, pos2;
std::string line;
std::string key;
std::string value;
std::string::size_type pos1;
std::string::size_type pos2;
unsigned int lineCounter(0);
bool comment(false);
......@@ -357,7 +360,8 @@ void Config::extractBlock( const char* filename, std::stringstream& input, Block
const LineVector& lineNumbers, unsigned int lineNumber,
unsigned int level )
{
std::string key, value;
std::string key;
std::string value;
while( input >> key )
{
......
......@@ -54,9 +54,7 @@
# endif
#endif
#ifdef WALBERLA_BUILD_WITH_METIS
# include "metis.h"
#endif
#include "metis.h"
#ifdef _MSC_VER
# pragma pop_macro( "INT64_MAX" )
......@@ -185,4 +183,4 @@ const int METIS_OPTION_UBVEC = 0;
} // namespace core
} // namespace walberla
\ No newline at end of file
} // namespace walberla
......@@ -209,7 +209,8 @@ void configureLogging( const Config::BlockHandle & loggingBlock )
logging::Logging::instance()->showTimeStamp( loggingBlock.getParameter< bool >( "time", true ) );
logging::Logging::instance()->logCallerPath( loggingBlock.getParameter< bool >( "logCallerPath", false ) );
Config::Blocks ignoreBlocks, ignoreWarningBlocks;
Config::Blocks ignoreBlocks;
Config::Blocks ignoreWarningBlocks;
loggingBlock.getBlocks( "ignore", ignoreBlocks );
std::vector< walberla::regex > regexes;
......
......@@ -186,7 +186,8 @@ namespace math {
parametrizationTerm["dt"] = - unitParameterRelations_[varName]["s"] + 3*unitParameterRelations_[varName]["A"];
parametrizationTerm["rho"] = - unitParameterRelations_[varName]["kg"] - unitParameterRelations_[varName]["A"];
std::stringstream num, denom;
std::stringstream num;
std::stringstream denom;
for( auto i=parametrizationTerm.begin(); i!=parametrizationTerm.end(); ++i )
{
if( i->second == 0 )
......@@ -324,7 +325,8 @@ namespace math {
return std::string();
}
std::stringstream num, denom;
std::stringstream num;
std::stringstream denom;
for( auto i=unitParameterRelations_[varName].begin(); i!=unitParameterRelations_[varName].end(); ++i )
{
if( i->second == 0 )
......
......@@ -29,7 +29,8 @@ namespace math {
template<> uint_t uintMSBPosition< uint64_t >( uint64_t value ) { // for the documentation see the header file
uint64_t i, j;
uint64_t i;
uint64_t j;
i = value >> 32;
if( i != 0 ) {
......
......@@ -97,7 +97,8 @@ void EquationSystem::match()
WALBERLA_ASSERT( boost::checked_edmonds_maximum_cardinality_matching(eqGraph_, &mate[0]) );
WALBERLA_LOG_RESULT( "Maximum matching:" );
EqGraph::vertex_iterator vi, vi_end;
EqGraph::vertex_iterator vi;
EqGraph::vertex_iterator vi_end;
for(boost::tie(vi,vi_end) = vertices(eqGraph_); vi != vi_end; ++vi)
if (mate[*vi] != boost::graph_traits<EqGraph>::null_vertex() && *vi < mate[*vi])
//std::cout << "{" << *vi << ", " << mate[*vi] << "}" << std::endl;
......
......@@ -40,7 +40,8 @@ int translateRank(const MPI_Comm srcComm, const MPI_Comm destComm, const int src
}
int destRank = -1;
MPI_Group srcGroup, destGroup;
MPI_Group srcGroup;
MPI_Group destGroup;
MPI_Comm_group(srcComm, &srcGroup);
MPI_Comm_group(destComm, &destGroup);
MPI_Group_translate_ranks(srcGroup, 1, const_cast<int*>(&srcRank), destGroup, &destRank);
......@@ -69,7 +70,8 @@ std::vector<int> translateRank(const MPI_Comm srcComm, const MPI_Comm destComm,
}
std::vector<int> destRank(srcRank.size(), -1);
MPI_Group srcGroup, destGroup;
MPI_Group srcGroup;
MPI_Group destGroup;
MPI_Comm_group(srcComm, &srcGroup);
MPI_Comm_group(destComm, &destGroup);
MPI_Group_translate_ranks(srcGroup, int_c(srcRank.size()), const_cast<int*>(&srcRank[0]), destGroup, &destRank[0]);
......
......@@ -52,7 +52,8 @@ void writeMPITextFile( const std::string & filename, const std::string & process
WALBERLA_MPI_SECTION()
{
int rank, numProcesses;
int rank;
int numProcesses;
MPI_Comm_rank( comm, &rank );
MPI_Comm_size( comm, &numProcesses );
......
......@@ -35,7 +35,8 @@ FourierTransform<Field_T>::FourierTransform( shared_ptr< StructuredBlockForest >
#endif
#ifdef WALBERLA_USE_PFFT
ptrdiff_t local_ni[3], local_i_start[3];
ptrdiff_t local_ni[3];
ptrdiff_t local_i_start[3];
ptrdiff_t local_o_start[3];
MPI_Comm comm = MPIManager::instance()->comm();
ptrdiff_t alloc_local = pfft_local_size_dft_r2c_3d(n, comm, PFFT_TRANSPOSED_NONE,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment