diff --git a/.clang-tidy b/.clang-tidy index 2c1bdff4123ca8349e16fedbd87d80064e1dfcd2..eaebf0f56e0ea5955f3d2f7651c88c3e8e143f03 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -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 diff --git a/apps/benchmarks/AdaptiveMeshRefinementFluidParticleCoupling/AMRSedimentSettling.cpp b/apps/benchmarks/AdaptiveMeshRefinementFluidParticleCoupling/AMRSedimentSettling.cpp index 935d226ebca87cf1e064e203c12a7456366f7db6..bdfc7cd490ec94f10cf429a31af43816a6be42ab 100644 --- a/apps/benchmarks/AdaptiveMeshRefinementFluidParticleCoupling/AMRSedimentSettling.cpp +++ b/apps/benchmarks/AdaptiveMeshRefinementFluidParticleCoupling/AMRSedimentSettling.cpp @@ -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); diff --git a/apps/benchmarks/AdaptiveMeshRefinementFluidParticleCoupling/WorkloadEvaluation.cpp b/apps/benchmarks/AdaptiveMeshRefinementFluidParticleCoupling/WorkloadEvaluation.cpp index 9e03ef1a9089495c0287af8343df40f9ee9bb5c2..18d93204ff732f767ff0655935355b2a3f2992c8 100644 --- a/apps/benchmarks/AdaptiveMeshRefinementFluidParticleCoupling/WorkloadEvaluation.cpp +++ b/apps/benchmarks/AdaptiveMeshRefinementFluidParticleCoupling/WorkloadEvaluation.cpp @@ -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); diff --git a/apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp b/apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp index ddd54546f7bc8451b3353c2e1a7cf76b40961142..bdc421e6d4d856e0e7544599104d6982d9545d9c 100644 --- a/apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp +++ b/apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp @@ -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); diff --git a/apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp b/apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp index 618f29af9f70ce8e81ea1223734622116a6449d4..c5f1df93e544ed8a16f5ae802caa21268fc438a7 100644 --- a/apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp +++ b/apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp @@ -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" ) ) diff --git a/apps/benchmarks/UniformGrid/UniformGrid.cpp b/apps/benchmarks/UniformGrid/UniformGrid.cpp index bd9efc7d40ead02f4e7e041e7f774cbfff4fdfa2..a55ca158317e82e716b19773224c1d8673656d17 100644 --- a/apps/benchmarks/UniformGrid/UniformGrid.cpp +++ b/apps/benchmarks/UniformGrid/UniformGrid.cpp @@ -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 ) ); diff --git a/src/blockforest/PhantomBlockForest.cpp b/src/blockforest/PhantomBlockForest.cpp index accf55746fc00d807621103f3d244fb63a9c33e3..d6867a9dd64d4fca4370531be65b5402b18f6084 100644 --- a/src/blockforest/PhantomBlockForest.cpp +++ b/src/blockforest/PhantomBlockForest.cpp @@ -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 ); diff --git a/src/blockforest/SetupBlockForest.cpp b/src/blockforest/SetupBlockForest.cpp index 93281d111ead0972ff25c497e750a2f48d5f8a93..b57abcccfa8834fa033f593491c69c3a73aaec8f 100644 --- a/src/blockforest/SetupBlockForest.cpp +++ b/src/blockforest/SetupBlockForest.cpp @@ -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 ); diff --git a/src/blockforest/StructuredBlockForest.cpp b/src/blockforest/StructuredBlockForest.cpp index 034feb8277a32c4554c94bac90ae6a29b383c41a..ef2d66a02d1d62b96b87ec6a62283eeb8e3b100b 100644 --- a/src/blockforest/StructuredBlockForest.cpp +++ b/src/blockforest/StructuredBlockForest.cpp @@ -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() ) { diff --git a/src/blockforest/loadbalancing/DynamicParMetis.cpp b/src/blockforest/loadbalancing/DynamicParMetis.cpp index 94142b23766556f90fa5545b9414c9410ec52cc1..062ce75851ef4d9f7eb36cae9a23e0383b2ebf3e 100644 --- a/src/blockforest/loadbalancing/DynamicParMetis.cpp +++ b/src/blockforest/loadbalancing/DynamicParMetis.cpp @@ -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; diff --git a/src/blockforest/loadbalancing/StaticParMetis.cpp b/src/blockforest/loadbalancing/StaticParMetis.cpp index c94d81b8720eb3a3a9763f70bbdcfe8f5e86145e..c712bab5971dcda1afb3588afb7cea487c3107ca 100644 --- a/src/blockforest/loadbalancing/StaticParMetis.cpp +++ b/src/blockforest/loadbalancing/StaticParMetis.cpp @@ -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; diff --git a/src/core/config/Config.cpp b/src/core/config/Config.cpp index dfd7a683484a605ce9c9b6e66b9752ff2c86d01f..6b5899e9b414d0aa1885c5ffacb2c54e74d32af9 100644 --- a/src/core/config/Config.cpp +++ b/src/core/config/Config.cpp @@ -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 ) { diff --git a/src/core/load_balancing/MetisWrapper.cpp b/src/core/load_balancing/MetisWrapper.cpp index a3d89aaec14ed6259e8c754aecc18386ab3ea766..6ea1bded21e7691456976c0c9b341dacfef82f7e 100644 --- a/src/core/load_balancing/MetisWrapper.cpp +++ b/src/core/load_balancing/MetisWrapper.cpp @@ -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 diff --git a/src/core/logging/Initialization.cpp b/src/core/logging/Initialization.cpp index f38e07c379589041d1df8f8cf18e56fad69ec60a..3ea701abd57207f409927b1e85b19e355f47e7ab 100644 --- a/src/core/logging/Initialization.cpp +++ b/src/core/logging/Initialization.cpp @@ -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; diff --git a/src/core/math/PhysicalCheck.cpp b/src/core/math/PhysicalCheck.cpp index e6a3c26e8cf8c75b2d182a1323cb6b9640d40bb6..7288961752c9ab84be7521e994200bfa7349f63a 100644 --- a/src/core/math/PhysicalCheck.cpp +++ b/src/core/math/PhysicalCheck.cpp @@ -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 ) diff --git a/src/core/math/Uint.cpp b/src/core/math/Uint.cpp index 3f09efbdf22fd389ec33d851fb572a712427c936..ee16588d1976d9884bd99e3f07abaf4b128ba28c 100644 --- a/src/core/math/Uint.cpp +++ b/src/core/math/Uint.cpp @@ -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 ) { diff --git a/src/core/math/equation_system/EquationSystem.cpp b/src/core/math/equation_system/EquationSystem.cpp index 30a9394cfe22e7e7b4f117525ee47b3e00e1519a..ef68ac88aff3e89d6af02890fdfb31c2ab405162 100644 --- a/src/core/math/equation_system/EquationSystem.cpp +++ b/src/core/math/equation_system/EquationSystem.cpp @@ -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; diff --git a/src/core/mpi/MPIHelper.cpp b/src/core/mpi/MPIHelper.cpp index 94f239a90e20e36fe35d7193976206b0e1add64e..ba444e3c51e3fc67701db3afb7cb9e0f41bc9c1e 100644 --- a/src/core/mpi/MPIHelper.cpp +++ b/src/core/mpi/MPIHelper.cpp @@ -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]); diff --git a/src/core/mpi/MPITextFile.cpp b/src/core/mpi/MPITextFile.cpp index 34fe2eb39e173d0268b803bbbc2729fcfcd3a5d2..ac9a40cea0bba20bc75c6a55d3abbe7e4c8df7f9 100644 --- a/src/core/mpi/MPITextFile.cpp +++ b/src/core/mpi/MPITextFile.cpp @@ -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 ); diff --git a/src/fft/Fft.cpp b/src/fft/Fft.cpp index 37517dc45f9620b0be8014ea83343851d526be4e..65db93e517bc42eb45b56e02207c5c0c15555951 100644 --- a/src/fft/Fft.cpp +++ b/src/fft/Fft.cpp @@ -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, diff --git a/src/geometry/GeometricalFunctions.cpp b/src/geometry/GeometricalFunctions.cpp index 6726e44c1784274619a78698876c9c940c7ef95b..e904312d97b483058ee6f8551142898b2c6ae3aa 100644 --- a/src/geometry/GeometricalFunctions.cpp +++ b/src/geometry/GeometricalFunctions.cpp @@ -297,7 +297,8 @@ void getClosestLineSegmentPoints( const Vector3<real_t>& a1, const Vector3<real_ // If one or both of the line segments have zero length, we will never get here. Therefore // we don't have to worry about possible divisions by zero in the following calculations. - Vector3<real_t> n, k; + Vector3<real_t> n; + Vector3<real_t> k; const real_t la( a1a2 * a1a2 ); if( da1 >= -Limits<real_t>::fpuAccuracy() && da3 <= +Limits<real_t>::fpuAccuracy() ) { diff --git a/src/geometry/mesh/TriangleMesh.cpp b/src/geometry/mesh/TriangleMesh.cpp index de03f58963bbe5162b314574db98d59ad616f17e..c3596c6c814026232e30888a13628bb4c2abcfdf 100644 --- a/src/geometry/mesh/TriangleMesh.cpp +++ b/src/geometry/mesh/TriangleMesh.cpp @@ -457,7 +457,9 @@ void TriangleMesh::exchangeAxes( uint_t xAxisId, uint_t yAxisId, uint_t zAxisId real_t TriangleMesh::volume() const { - vertex_t v0, v1, v2; + vertex_t v0; + vertex_t v1; + vertex_t v2; real_t result(0); for(size_t i = 0; i < getNumTriangles(); ++i) @@ -471,7 +473,9 @@ real_t TriangleMesh::volume() const real_t TriangleMesh::surfaceArea() const { - vertex_t v0, v1, v2; + vertex_t v0; + vertex_t v1; + vertex_t v2; real_t result(0); for(size_t i = 0; i < getNumTriangles(); ++i) diff --git a/src/geometry/mesh/TriangleMeshIO.cpp b/src/geometry/mesh/TriangleMeshIO.cpp index 1161e086540dc8a195f03354f61ac2c22041cd65..653166a44f54b796f1ddd3e3ffb9c01289ffdc64 100644 --- a/src/geometry/mesh/TriangleMeshIO.cpp +++ b/src/geometry/mesh/TriangleMeshIO.cpp @@ -182,14 +182,20 @@ namespace geometry { if( in.peek() == 'n' ) { in.ignore(); - real_t nx, ny, nz; + real_t nx; + real_t ny; + real_t nz; in >> nx >> ny >> nz; mesh.addVertexNormal( TriangleMesh::normal_t(nx,ny,nz) ); continue; } - real_t x,y,z; + real_t x; + real_t y; + real_t z; in >> x >> y >> z; - float r, g, b; + float r; + float g; + float b; in >> r >> g >> b; if( in ) mesh.addVertex( TriangleMesh::vertex_t(x,y,z), TriangleMesh::color_t(r,g,b) ); @@ -380,10 +386,16 @@ namespace geometry { std::stringstream vin(stateMap[VERTEX]); std::stringstream nin(stateMap[NORMAL]); - size_t vcount, ncount; + size_t vcount; + size_t ncount; vin >> vcount; nin >> ncount; - real_t x,y,z,nx,ny,nz; + real_t x; + real_t y; + real_t z; + real_t nx; + real_t ny; + real_t nz; for( size_t j=0; j<vcount; ++j ) { vin >> x >> y >> z; @@ -395,7 +407,9 @@ namespace geometry { std::stringstream fin(stateMap[FACE]); size_t fcount; fin >> fcount; - TriangleMesh::index_t ix, iy, iz; + TriangleMesh::index_t ix; + TriangleMesh::index_t iy; + TriangleMesh::index_t iz; for( size_t j=0; j<fcount; ++j ) { fin >> ix >> iy >> iz; @@ -573,7 +587,9 @@ namespace geometry { skipComments( is ); - uint_t vertexCount, faceCount, edgeCount; + uint_t vertexCount; + uint_t faceCount; + uint_t edgeCount; is >> vertexCount >> faceCount >> edgeCount; skipComments( is ); @@ -589,7 +605,9 @@ namespace geometry { for( uint_t i = 0; i < faceCount; ++i ) { uint_t numVertices; - TriangleMesh::index_t i0, i1, i2; + TriangleMesh::index_t i0; + TriangleMesh::index_t i1; + TriangleMesh::index_t i2; is >> numVertices >> i0 >> i1 >> i2; if( numVertices != 3 ) WALBERLA_ABORT( "Face with more or less than 3 vertices given while trying to read a mesh in Geomview Object File Format!" ); diff --git a/src/geometry/structured/GrayScaleImage.cpp b/src/geometry/structured/GrayScaleImage.cpp index 63084a54c11243d4cdeac47dbf609f84525a4ced..a4eafb54e32493c680f8f4d72ab299737b54b399 100644 --- a/src/geometry/structured/GrayScaleImage.cpp +++ b/src/geometry/structured/GrayScaleImage.cpp @@ -37,7 +37,8 @@ namespace geometry { GrayScaleImage::GrayScaleImage( const std::string & pngFilename ) { - unsigned int tmpWidth, tmpHeight; + unsigned int tmpWidth; + unsigned int tmpHeight; unsigned int error = lodepng::decode( image_, tmpWidth, tmpHeight, pngFilename, LCT_GREY, 8 ); size_[0] = tmpWidth; size_[1] = tmpHeight; diff --git a/src/geometry/structured/RGBAImage.cpp b/src/geometry/structured/RGBAImage.cpp index e2566f3cb7ebf2716852f1c02079ad2676ceacd1..4d0402a737c3172d65d9459444653866d0971e47 100644 --- a/src/geometry/structured/RGBAImage.cpp +++ b/src/geometry/structured/RGBAImage.cpp @@ -50,7 +50,8 @@ namespace geometry { RGBAImage::RGBAImage( const std::string & pngFilename ) { - unsigned int tmpWidth, tmpHeight; + unsigned int tmpWidth; + unsigned int tmpHeight; unsigned int error = lodepng::decode( image_, tmpWidth, tmpHeight, pngFilename, LCT_RGBA, 8 ); size_[0] = tmpWidth; size_[1] = tmpHeight; diff --git a/src/mesh/pe/communication/ConvexPolyhedron.cpp b/src/mesh/pe/communication/ConvexPolyhedron.cpp index 47fb940c7e99f3199a97752d858d08c0f9892583..1709c495f2bdfbb228b2a16f0eaa735344377d54 100644 --- a/src/mesh/pe/communication/ConvexPolyhedron.cpp +++ b/src/mesh/pe/communication/ConvexPolyhedron.cpp @@ -111,7 +111,9 @@ void unmarshal( mpi::RecvBuffer& buffer, ConvexPolyhedronParameters& objparam ) buffer >> numFaces; for(size_t i = 0; i < numFaces; ++i) { - int v0, v1, v2; + int v0; + int v1; + int v2; buffer >> v0 >> v1 >> v2; WALBERLA_ASSERT_GREATER_EQUAL( v0, 0 ); WALBERLA_ASSERT_GREATER_EQUAL( v1, 0 ); diff --git a/src/pe/raytracing/Color.cpp b/src/pe/raytracing/Color.cpp index 4e9deab3f029827d88226d6ab353d144e33bc165..ffc557d557d9a259138b9faedd8cf52e7d21ab07 100644 --- a/src/pe/raytracing/Color.cpp +++ b/src/pe/raytracing/Color.cpp @@ -31,7 +31,9 @@ namespace raytracing { */ Color Color::colorFromHSV(real_t hue, real_t saturation, real_t value) { // based on Max K. Agoston: Computer Graphics and Geometric Modeling - Implementation and Algorithms - real_t r, g, b; + real_t r; + real_t g; + real_t b; if (realIsEqual(hue, real_t(360))) { hue = real_t(0); diff --git a/src/pe/raytracing/Raytracer.cpp b/src/pe/raytracing/Raytracer.cpp index 833089fcd874c135859b2f30119b03c7960d166d..631a5dfd3384bba103c8b5cd2381acad40d0cd5d 100644 --- a/src/pe/raytracing/Raytracer.cpp +++ b/src/pe/raytracing/Raytracer.cpp @@ -241,7 +241,8 @@ void Raytracer::setupMPI_() { MPI_Datatype tmp_type; MPI_Type_create_struct(nblocks, blocklengths, displacements, types, &tmp_type); - MPI_Aint lb, extent; + MPI_Aint lb; + MPI_Aint extent; MPI_Type_get_extent( tmp_type, &lb, &extent ); MPI_Type_create_resized( tmp_type, lb, extent, &bodyIntersectionInfo_mpi_type ); @@ -299,7 +300,9 @@ void Raytracer::writeImageToFile(const std::vector<BodyIntersectionInfo>& inters real_t patchSize = real_c(antiAliasFactor_*antiAliasFactor_); for (int y = pixelsVertical_-1; y >= 0; y--) { for (uint32_t x = 0; x < pixelsHorizontal_; x++) { - real_t r_sum = 0, g_sum = 0, b_sum = 0; + real_t r_sum = 0; + real_t g_sum = 0; + real_t b_sum = 0; for (uint32_t ay = uint32_c(y)*antiAliasFactor_; ay < (uint32_c(y+1))*antiAliasFactor_; ay++) { for (uint32_t ax = x*antiAliasFactor_; ax < (x+1)*antiAliasFactor_; ax++) { size_t i = coordinateToArrayIndex(ax, ay); diff --git a/src/pe_coupling/amr/InfoCollection.cpp b/src/pe_coupling/amr/InfoCollection.cpp index 19238621785912cc6ee8bcfdaf3466c93a5b058b..7cec1736b21aba011fb3c720c5782a86b477cb2b 100644 --- a/src/pe_coupling/amr/InfoCollection.cpp +++ b/src/pe_coupling/amr/InfoCollection.cpp @@ -69,7 +69,8 @@ void getBlockInfoFromInfoCollection( const PhantomBlock * block, const shared_pt auto childForInitIt = ic->find( childIdForInit ); WALBERLA_CHECK_UNEQUAL( childForInitIt, ic->end(), "Child block with ID " << childIdForInit << " not found in info collection!" ); BlockInfo combinedInfo = childForInitIt->second; - uint_t numFluidCells(0), numNearBoundaryCells(0); + uint_t numFluidCells(0); + uint_t numNearBoundaryCells(0); for (uint_t child = 0; child < 8; ++child) { blockforest::BlockID childId(block->getId(), child); diff --git a/src/pe_coupling/momentum_exchange_method/restoration/ExtrapolationDirectionFinder.cpp b/src/pe_coupling/momentum_exchange_method/restoration/ExtrapolationDirectionFinder.cpp index 9821dbb80e8e9565c889ee61be52b83a1a733e14..67dfbbc413fdf17ce8a93a8f17709b0c9718b0a8 100644 --- a/src/pe_coupling/momentum_exchange_method/restoration/ExtrapolationDirectionFinder.cpp +++ b/src/pe_coupling/momentum_exchange_method/restoration/ExtrapolationDirectionFinder.cpp @@ -34,7 +34,9 @@ void SphereNormalExtrapolationDirectionFinder WALBERLA_ASSERT_NOT_NULLPTR( bodyField ); WALBERLA_ASSERT_NOT_NULLPTR( (*bodyField)(x,y,z) ); - real_t cx, cy, cz; + real_t cx; + real_t cy; + real_t cz; blockStorage_->getBlockLocalCellCenter( *block, Cell(x,y,z), cx, cy, cz ); Vector3<real_t> bodyCenterPosition = (*bodyField)(x,y,z)->getPosition(); diff --git a/src/vtk/Initialization.cpp b/src/vtk/Initialization.cpp index d25529731cfb30547aec0854e56529f7b2dfe45e..c69f039f2869d74368481bb492045daa38f7b7fb 100644 --- a/src/vtk/Initialization.cpp +++ b/src/vtk/Initialization.cpp @@ -247,10 +247,14 @@ void initializeVTKOutput( std::map< std::string, SelectableOutputFunction > & ou if( !aabb->isDefined("min") || !aabb->isDefined("max") ) WALBERLA_ABORT( "You must specify a \"min\" and a \"max\" coordinate for AABB cell filter \"" << aabb->getKey() << "\"." ); - real_t xmin, ymin, zmin; + real_t xmin; + real_t ymin; + real_t zmin; splitVector< real_t >( xmin, ymin, zmin, *aabb, "min", std::string( "The \"min\" coordinate of AABB cell filter \"" ) + aabb->getKey() + std::string( "\" must be a three-dimensional vector." ) ); - real_t xmax, ymax, zmax; + real_t xmax; + real_t ymax; + real_t zmax; splitVector< real_t >( xmax, ymax, zmax, *aabb, "max", std::string( "The \"max\" coordinate of AABB cell filter \"" ) + aabb->getKey() + std::string( "\" must be a three-dimensional vector." ) ); @@ -270,10 +274,14 @@ void initializeVTKOutput( std::map< std::string, SelectableOutputFunction > & ou if( bb->isDefined( "level" ) ) level = bb->getParameter< uint_t >( "level" ); - cell_idx_t xmin, ymin, zmin; + cell_idx_t xmin; + cell_idx_t ymin; + cell_idx_t zmin; splitVector< cell_idx_t >( xmin, ymin, zmin, *bb, "min", std::string( "The \"min\" coordinate of CellBB cell filter \"" ) + bb->getKey() + std::string( "\" must be a three-dimensional vector." ) ); - cell_idx_t xmax, ymax, zmax; + cell_idx_t xmax; + cell_idx_t ymax; + cell_idx_t zmax; splitVector< cell_idx_t >( xmax, ymax, zmax, *bb, "max", std::string( "The \"max\" coordinate of CellBB cell filter \"" ) + bb->getKey() + std::string( "\" must be a three-dimensional vector." ) );