Commit 8c0a300e authored by Martin Bauer's avatar Martin Bauer
Browse files

Merge branch 'AdditionalClangTidyChecks' into 'master'

additional clang tidy checks

See merge request walberla/walberla!226
parents 3ad8986f c5643df6
---
Checks: '-*,bugprone-*,-bugprone-exception-escape,misc-*,-misc-misplaced-const,modernize-*,-modernize-use-auto,-modernize-loop-convert,-modernize-pass-by-value,-modernize-raw-string-literal,-modernize-use-using,-modernize-avoid-bind,-modernize-return-braced-init-list,-modernize-use-transparent-functors,-modernize-redundant-void-arg,-modernize-avoid-c-arrays,-misc-non-private-member-variables-in-classes,performance-*,readability-container-size-empty,readability-misleading-indentation,readability-misplaced-array-index'
Checks: '
-*,
boost-*,
bugprone-*,
-bugprone-exception-escape,
misc-*,
-misc-misplaced-const,
-misc-non-private-member-variables-in-classes,
modernize-*,
-modernize-use-auto,
-modernize-loop-convert,
-modernize-pass-by-value,
-modernize-raw-string-literal,
-modernize-use-using,
-modernize-avoid-bind,
-modernize-return-braced-init-list,
-modernize-use-transparent-functors,
-modernize-redundant-void-arg,
-modernize-avoid-c-arrays,
mpi-*,
openmp-*,
performance-*,
portability-*,
readability-const-return-type,
readability-container-size-empty,
readability-delete-null-pointer,
readability-deleted-default,
readability-misleading-indentation,
readability-misplaced-array-index,
readability-redundant-control-flow,
readability-redundant-function-ptr-dereference,
readability-redundant-smartptr-get,
readability-redundant-string-cstr,
readability-static-accessed-through-instance,
readability-string-compare,
readability-uniqueptr-delete-release
'
WarningsAsErrors: '*'
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: none
User: si11fita
CheckOptions:
- key: modernize-loop-convert.MaxCopySize
value: '16'
- key: modernize-loop-convert.MinConfidence
value: reasonable
- key: modernize-loop-convert.NamingStyle
value: CamelCase
- key: modernize-make-shared.IgnoreMacros
value: '1'
- key: modernize-make-shared.IncludeStyle
value: '0'
- key: modernize-make-shared.MakeSmartPtrFunction
value: 'std::make_shared'
- key: modernize-make-shared.MakeSmartPtrFunctionHeader
value: memory
- key: modernize-make-unique.IgnoreMacros
value: '1'
- key: modernize-make-unique.IncludeStyle
value: '0'
- key: modernize-make-unique.MakeSmartPtrFunction
value: 'std::make_unique'
- key: modernize-make-unique.MakeSmartPtrFunctionHeader
value: memory
- key: modernize-pass-by-value.IncludeStyle
value: llvm
- key: modernize-pass-by-value.ValuesOnly
value: '0'
- key: modernize-raw-string-literal.ReplaceShorterLiterals
value: '0'
- key: modernize-replace-auto-ptr.IncludeStyle
value: llvm
- key: modernize-replace-random-shuffle.IncludeStyle
value: llvm
- key: modernize-use-auto.RemoveStars
value: '0'
- key: modernize-use-default-member-init.IgnoreMacros
value: '1'
- key: modernize-use-default-member-init.UseAssignment
value: '0'
- key: modernize-use-emplace.ContainersWithPushBack
value: '::std::vector;::std::list;::std::deque'
- key: modernize-use-emplace.SmartPointers
value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr'
- key: modernize-use-emplace.TupleMakeFunctions
value: '::std::make_pair;::std::make_tuple'
- key: modernize-use-emplace.TupleTypes
value: '::std::pair;::std::tuple'
- key: modernize-use-equals-default.IgnoreMacros
value: '1'
- key: modernize-use-noexcept.ReplacementString
value: ''
- key: modernize-use-noexcept.UseNoexceptFalse
value: '1'
- key: modernize-use-nullptr.NullMacros
value: 'NULL'
- key: modernize-use-transparent-functors.SafeMode
value: '0'
- key: modernize-use-using.IgnoreMacros
value: '1'
...
......@@ -553,12 +553,12 @@ void setFlags( shared_ptr< StructuredBlockForest > & blocks, const BlockDataID &
{
CurvedDeltaValueCalculation< LatticeModel_T > deltaCalculation( blocks, *block, channel );
lbm::refinement::consistentlyForceBoundary< BoundaryHandling_T >( *blocks, dynamic_cast< blockforest::Block & >(*block.get()),
lbm::refinement::consistentlyForceBoundary< BoundaryHandling_T >( *blocks, dynamic_cast< blockforest::Block & >(*block),
boundaryHandlingId, Curved_Flag, channel, deltaCalculation );
}
else // staircase (1st order bounce back no-slip boundary condition)
{
lbm::refinement::consistentlyForceBoundary< BoundaryHandling_T >( *blocks, dynamic_cast< blockforest::Block & >(*block.get()),
lbm::refinement::consistentlyForceBoundary< BoundaryHandling_T >( *blocks, dynamic_cast< blockforest::Block & >(*block),
boundaryHandlingId, NoSlip_Flag, channel );
}
......
......@@ -961,12 +961,12 @@ void BoundarySetter< LatticeModel_T >::operator()()
{
CurvedDeltaValueCalculation< LatticeModel_T > deltaCalculation( blocks, *block, cylinder );
lbm::refinement::consistentlyForceBoundary< BoundaryHandling_T >( *blocks, dynamic_cast< blockforest::Block & >(*block.get()),
lbm::refinement::consistentlyForceBoundary< BoundaryHandling_T >( *blocks, dynamic_cast< blockforest::Block & >(*block),
boundaryHandlingId_, Curved_Flag, cylinder, deltaCalculation );
}
else // staircase
{
lbm::refinement::consistentlyForceBoundary< BoundaryHandling_T >( *blocks, dynamic_cast< blockforest::Block & >(*block.get()),
lbm::refinement::consistentlyForceBoundary< BoundaryHandling_T >( *blocks, dynamic_cast< blockforest::Block & >(*block),
boundaryHandlingId_, Obstacle_Flag, cylinder );
}
......
......@@ -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 );
......
......@@ -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 );
}
}
}
......
......@@ -271,16 +271,16 @@ void Config::parseFromFile( const char* filename, Block& block, unsigned int lev
else if( std::getline( input, value, ';' ) && !input.eof() )
{
input.ignore( 1 );
while( (value.find("$(") != value.npos) && (value.find(')') != value.npos) ) {
while( (value.find("$(") != std::string::npos) && (value.find(')') != std::string::npos) ) {
size_t s = value.find("$("); size_t e = value.find(')');
ValueReplacementMap::iterator mkey = valueReplacements_.find( value.substr( s+2, e-s+1-3 ) );
if(mkey != valueReplacements_.end()) {
value.replace( s,e-s+1, mkey->second );
}
else {
if(e!=value.npos)
if(e!=std::string::npos)
value.erase(e,1);
if(s!=value.npos)
if(s!=std::string::npos)
value.erase(s,2);
}
}
......@@ -404,16 +404,16 @@ void Config::extractBlock( const char* filename, std::stringstream& input, Block
else if( std::getline( input, value, ';' ) && !input.eof() )
{
input.ignore( 1 );
while( (value.find("$(") != value.npos) && (value.find(')') != value.npos) ) {
while( (value.find("$(") != std::string::npos) && (value.find(')') != std::string::npos) ) {
size_t s = value.find("$("); size_t e = value.find(')');
ValueReplacementMap::iterator mkey = valueReplacements_.find( value.substr( s+2, e-s+1-3 ) );
if(mkey != valueReplacements_.end()) {
value.replace( s,e-s+1, mkey->second );
}
else {
if(e!=value.npos)
if(e!=std::string::npos)
value.erase(e,1);
if(s!=value.npos)
if(s!=std::string::npos)
value.erase(s,2);
}
}
......@@ -428,7 +428,6 @@ void Config::extractBlock( const char* filename, std::stringstream& input, Block
error_ << " Missing '}' for " << block.getKey()
<< " block starting in line " << lineNumber << "\n";
stateFlag_ = false;
return;
}
//**********************************************************************************************************************
......
......@@ -171,7 +171,7 @@ size_t EquationSystem::getNumberOfEquations() const
return eqMap_.size();
}
const std::string EquationSystem::writeEquations() const
std::string EquationSystem::writeEquations() const
{
std::stringstream ss;
ss << "Equations to solve:" << std::endl;
......@@ -182,7 +182,7 @@ const std::string EquationSystem::writeEquations() const
return ss.str();
}
const std::string EquationSystem::writeVariables() const
std::string EquationSystem::writeVariables() const
{
std::stringstream ss;
ss << "Solution for each variable:" << std::endl;
......
......@@ -100,8 +100,8 @@ namespace math {
//**Output functions*************************************************************************
/*! \name Output functions */
//@{
const std::string writeEquations() const;
const std::string writeVariables() const;
std::string writeEquations() const;
std::string writeVariables() const;
friend std::ostream& operator<<( std::ostream& os, EquationSystem& es );
//@}
//****************************************************************************************************************
......
......@@ -125,7 +125,7 @@ void EveryNth::operator()()
++calls_;
}
const std::string EveryNth::getName() const
std::string EveryNth::getName() const
{
std::stringstream ss;
ss << "every " << interval_ << "th step:";
......@@ -208,7 +208,7 @@ void Loop::synchronizedStop( bool stopVar )
mpi::allReduceInplace( stop_, mpi::LOGICAL_OR );
}
const std::string Loop::getName() const
std::string Loop::getName() const
{
std::stringstream ss;
ss << "Loop [" << iterations_ << "]";
......
......@@ -109,8 +109,8 @@ class IFunctionNode
public:
virtual ~IFunctionNode() {}
virtual void operator()() = 0;
virtual const std::string getName() const = 0;
virtual const std::deque< shared_ptr< IFunctionNode > > getChildren() const { return {}; }
virtual std::string getName() const = 0;
virtual std::deque< shared_ptr< IFunctionNode > > getChildren() const { return {}; }
};
......@@ -122,7 +122,7 @@ public:
const std::string &name,
const TimingTreePtr & timingTree );
const std::string getName() const override { return name_ != "" ? name_ : "Functor"; };
std::string getName() const override { return name_ != "" ? name_ : "Functor"; };
void operator() () override;
private:
......@@ -138,8 +138,8 @@ public:
EveryNth( const IFunctionNodePtr &node, uint_t interval, bool onFirst = false, uint_t startValue = 0 );
void operator()() override;
const std::string getName() const override;
const std::deque< shared_ptr< IFunctionNode > > getChildren() const override { return { wrapped_ }; }
std::string getName() const override;
std::deque< shared_ptr< IFunctionNode > > getChildren() const override { return { wrapped_ }; }
private:
IFunctionNodePtr wrapped_;
......@@ -158,8 +158,8 @@ public:
void push_back( const IFunctionNodePtr &fct ) { children_.push_back( fct ); }
void push_front( const IFunctionNodePtr &fct ) { children_.push_front( fct ); }
const std::string getName() const override { return name_ != "" ? name_ : "Sequence"; };
const std::deque< IFunctionNodePtr > getChildren() const override { return children_; };
std::string getName() const override { return name_ != "" ? name_ : "Sequence"; };
std::deque< IFunctionNodePtr > getChildren() const override { return children_; };
private:
std::string name_;
......@@ -185,8 +185,8 @@ public:
uint_t getCurrentTimeStep() const override { return currentIteration_; }
uint_t getNrOfTimeSteps() const override { return iterations_; }
const std::deque< shared_ptr< IFunctionNode > > getChildren() const override { return { body_ }; }
const std::string getName() const override;
std::deque< shared_ptr< IFunctionNode > > getChildren() const override { return { body_ }; }
std::string getName() const override;
private:
IFunctionNodePtr body_;
......@@ -203,4 +203,4 @@ private:
} // namespace walberla
#include "ExecutionTree.impl.h"
\ No newline at end of file
#include "ExecutionTree.impl.h"
......@@ -47,7 +47,7 @@ GJK::GJK()
* \param dir The support point direction.
* \param threshold Extension of the particle.
*/
const Vec3 GJK::putSupport(const Support &geom1,
Vec3 GJK::putSupport(const Support &geom1,
const Support &geom2,
const Vec3& dir,
const real_t margin,
......
......@@ -81,7 +81,7 @@ private:
inline bool zeroLengthVector( const Vec3& vec ) const { return vec.sqrLength() < math::Limits<real_t>::fpuAccuracy(); }
real_t calcDistance ( Vec3& normal, Vec3& contactPoint );
inline const Vec3 putSupport(const Support &geom1,
inline Vec3 putSupport(const Support &geom1,
const Support &geom2,
const Vec3& dir,
const real_t margin,
......
......@@ -196,7 +196,7 @@ bool RigidBody::checkInvariants()
*
* The function calculates the global velocity of a point relative to the body's center of mass.
*/
const Vec3 RigidBody::velFromBF( real_t px, real_t py, real_t pz ) const
Vec3 RigidBody::velFromBF( real_t px, real_t py, real_t pz ) const
{
return velFromBF( Vec3( px, py, pz ) );
}
......@@ -211,7 +211,7 @@ const Vec3 RigidBody::velFromBF( real_t px, real_t py, real_t pz ) const
*
* The function calculates the global velocity of a point relative to the body's center of mass.
*/
const Vec3 RigidBody::velFromBF( const Vec3& rpos ) const
Vec3 RigidBody::velFromBF( const Vec3& rpos ) const
{
if( !hasSuperBody() )
return v_ + w_ % ( R_ * rpos );
......@@ -230,7 +230,7 @@ const Vec3 RigidBody::velFromBF( const Vec3& rpos ) const
*
* The function calculates the global velocity of a point in global coordinates.
*/
const Vec3 RigidBody::velFromWF( real_t px, real_t py, real_t pz ) const
Vec3 RigidBody::velFromWF( real_t px, real_t py, real_t pz ) const
{
return velFromWF( Vec3( px, py, pz ) );
}
......@@ -245,7 +245,7 @@ const Vec3 RigidBody::velFromWF( real_t px, real_t py, real_t pz ) const
*
* The function calculates the global velocity of a point in global coordinates.
*/
const Vec3 RigidBody::velFromWF( const Vec3& gpos ) const
Vec3 RigidBody::velFromWF( const Vec3& gpos ) const
{
if( !hasSuperBody() )
return v_ + w_ % ( gpos - gpos_ );
......
......@@ -125,14 +125,14 @@ public:
inline const Vec3 vectorFromBFtoWF( const Vec3& v ) const;
inline const Vec3 pointFromBFtoWF ( real_t px, real_t py, real_t pz ) const;
inline const Vec3 pointFromBFtoWF ( const Vec3& rpos ) const;
virtual const Vec3 velFromBF ( real_t px, real_t py, real_t pz ) const;
virtual const Vec3 velFromBF ( const Vec3& rpos ) const;
virtual Vec3 velFromBF ( real_t px, real_t py, real_t pz ) const;
virtual Vec3 velFromBF ( const Vec3& rpos ) const;
inline const Vec3 vectorFromWFtoBF( real_t vx, real_t vy, real_t vz ) const;
inline const Vec3 vectorFromWFtoBF( const Vec3& v ) const;
inline const Vec3 pointFromWFtoBF ( real_t px, real_t py, real_t pz ) const;
inline const Vec3 pointFromWFtoBF ( const Vec3& gpos ) const;
virtual const Vec3 velFromWF ( real_t px, real_t py, real_t pz ) const;
virtual const Vec3 velFromWF ( const Vec3& gpos ) const;
virtual Vec3 velFromWF ( real_t px, real_t py, real_t pz ) const;
virtual Vec3 velFromWF ( const Vec3& gpos ) const;
inline const Vec3 accFromWF ( real_t px, real_t py, real_t pz ) const;
const Vec3 accFromWF ( const Vec3& gpos ) const;
......
......@@ -89,7 +89,7 @@ Squirmer::~Squirmer()
*
* The function calculates the global velocity of a point relative to the body's center of mass.
*/
const Vec3 Squirmer::velFromBF( real_t px, real_t py, real_t pz ) const
Vec3 Squirmer::velFromBF( real_t px, real_t py, real_t pz ) const
{
return velFromBF( Vec3( px, py, pz ) );
}
......@@ -104,7 +104,7 @@ const Vec3 Squirmer::velFromBF( real_t px, real_t py, real_t pz ) const
*
* The function calculates the global velocity of a point relative to the body's center of mass.
*/
const Vec3 Squirmer::velFromBF( const Vec3& rpos ) const
Vec3 Squirmer::velFromBF( const Vec3& rpos ) const
{
return Sphere::velFromBF( rpos ) + getSquirmerVelocity( getRotation() * rpos );
}
......@@ -120,7 +120,7 @@ const Vec3 Squirmer::velFromBF( const Vec3& rpos ) const
*
* The function calculates the global velocity of a point in global coordinates.
*/
const Vec3 Squirmer::velFromWF( real_t px, real_t py, real_t pz ) const
Vec3 Squirmer::velFromWF( real_t px, real_t py, real_t pz ) const
{
return velFromWF( Vec3( px, py, pz ) );
}
......@@ -133,7 +133,7 @@ const Vec3 Squirmer::velFromWF( real_t px, real_t py, real_t pz ) const
* \param rpos The relative global coordinate.
* \return The local surface velocity of the squirmer.
*/
const Vec3 Squirmer::getSquirmerVelocity( const Vec3& rpos ) const
Vec3 Squirmer::getSquirmerVelocity( const Vec3& rpos ) const
{
const auto rs = rpos.getNormalized();
const auto e = getQuaternion().rotate(Vec3(0.0,0.0,1.0)).getNormalized();
......@@ -152,7 +152,7 @@ const Vec3 Squirmer::getSquirmerVelocity( const Vec3& rpos ) const
*
* The function calculates the global velocity of a point in global coordinates.
*/
const Vec3 Squirmer::velFromWF( const Vec3& gpos ) const
Vec3 Squirmer::velFromWF( const Vec3& gpos ) const
{
return Sphere::velFromWF( gpos ) + getSquirmerVelocity( gpos - getPosition() );
}
......
......@@ -53,10 +53,10 @@ public:
inline real_t getSquirmerVelocity() const;
inline real_t getSquirmerBeta() const;
inline const Vec3 velFromBF ( real_t px, real_t py, real_t pz ) const WALBERLA_OVERRIDE;
inline const Vec3 velFromBF ( const Vec3& rpos ) const WALBERLA_OVERRIDE;
inline const Vec3 velFromWF ( real_t px, real_t py, real_t pz ) const WALBERLA_OVERRIDE;
inline const Vec3 velFromWF ( const Vec3& gpos ) const WALBERLA_OVERRIDE;
inline Vec3 velFromBF ( real_t px, real_t py, real_t pz ) const WALBERLA_OVERRIDE;
inline Vec3 velFromBF ( const Vec3& rpos ) const WALBERLA_OVERRIDE;
inline Vec3 velFromWF ( real_t px, real_t py, real_t pz ) const WALBERLA_OVERRIDE;
inline Vec3 velFromWF ( const Vec3& gpos ) const WALBERLA_OVERRIDE;
static inline id_t getStaticTypeID() WALBERLA_OVERRIDE;
//@}
......@@ -67,7 +67,7 @@ protected:
//**Get functions*******************************************************************************
/*!\name Get functions */
//@{
const Vec3 getSquirmerVelocity( const Vec3& rpos ) const;
Vec3 getSquirmerVelocity( const Vec3& rpos ) const;
//@}
//**Member variables****************************************************************************
......
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