Commit cb41496e authored by Sebastian Eibl's avatar Sebastian Eibl Committed by Christoph Schwarzmeier
Browse files

enable clang-tidy 11

parent 388f3fa1
......@@ -11,6 +11,7 @@ bugprone-*,
misc-*,
-misc-misplaced-const,
-misc-no-recursion,
-misc-non-private-member-variables-in-classes,
modernize-*,
......@@ -43,17 +44,21 @@ readability-deleted-default,
readability-isolate-declaration,
readability-misleading-indentation,
readability-misplaced-array-index,
readability-non-const-parameter,
readability-redundant-access-specifiers,
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-boolean-expr,
readability-simplify-subscript-expr,
readability-static-accessed-through-instance,
readability-static-definition-in-anonymous-namespace,
readability-string-compare,
readability-uniqueptr-delete-release
readability-uniqueptr-delete-release,
readability-use-anyofallof
'
WarningsAsErrors: '*'
......
......@@ -1959,7 +1959,7 @@ doc:
###############################################################################
clang-tidy:
image: i10git.cs.fau.de:5005/walberla/buildenvs/clang:10.0
image: i10git.cs.fau.de:5005/walberla/buildenvs/clang:11.0
script:
- $CXX --version
- clang-tidy -version
......@@ -2481,4 +2481,4 @@ benchmark_ClangBuildAnalyzer:
- docker-benchmark
only:
variables:
- $ENABLE_NIGHTLY_BUILDS
\ No newline at end of file
- $ENABLE_NIGHTLY_BUILDS
......@@ -308,7 +308,7 @@ void createSetupBlockForest( blockforest::SetupBlockForest & sforest, const Conf
const memory_t memoryLimit = configBlock.getParameter< memory_t >( "memoryLimit", numeric_cast< memory_t >(256) );
sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), numberOfProcesses, bufferProcesses, memoryLimit, true,
(bufferProcesses != uint_t(0)) ? true : false );
bufferProcesses != uint_t(0) );
WALBERLA_LOG_INFO_ON_ROOT( "SetupBlockForest created successfully:\n" << sforest );
}
......
......@@ -265,9 +265,7 @@ private:
{
const auto d = block.getAABB().sqSignedDistance( forest.getDomain().center() );
const real_t r = setup_.radius_L + bufferDistance_;
if( d > (r * r) )
return true;
return false;
return d > (r * r);
}
return false;
......
......@@ -1318,9 +1318,9 @@ public:
"cD (real area) [5], cL (real area) [6], cD (discrete area) [7], cL (discrete area) [8], "
"pressure difference (in lattice units) [9], pressure difference (in Pa) [10], vortex velocity (in lattice units) [11], "
"Strouhal number (real D) [12], Strouhal number (discrete D) [13]" << std::endl;
if( setup_.evaluatePressure == false )
if( !setup_.evaluatePressure )
file << "# ATTENTION: pressure was not evaluated, pressure difference is set to zero!" << std::endl;
if( setup_.evaluateStrouhal == false )
if( !setup_.evaluateStrouhal )
file << "# ATTENTION: vortex velocities were not evaluated, Strouhal number is set to zero!" << std::endl;
file.close();
}
......
......@@ -265,10 +265,7 @@ bool selectDPMBodies(pe::BodyID bodyID)
{
pe::SphereID sphere = static_cast< pe::SphereID >(bodyID);
real_t radius = sphere->getRadius();
if (radius <= real_t(0.5))
return true;
else
return false;
return radius <= real_t(0.5);
}
bool selectMEMBodies(pe::BodyID bodyID) { return !selectDPMBodies(bodyID); }
......
......@@ -37,7 +37,7 @@ void SetupBlock::assembleNeighborhood() {
for( uint_t n = 0; n != 26; ++n )
for( uint_t i = 0; i != neighborhoodSection_[n].size(); ++i )
if( neighborhood.insert( neighborhoodSection_[n][i] ).second == true )
if( neighborhood.insert( neighborhoodSection_[n][i] ).second )
neighborhood_.push_back( neighborhoodSection_[n][i] );
}
......
......@@ -49,13 +49,10 @@ bool CellInterval::overlaps( const CellVector& cellVector ) const
if( empty() )
return false;
for( const Cell & cell : cellVector )
{
if( this->contains( cell ) )
return true;
}
return false;
return std::any_of(cellVector.begin(),
cellVector.end(),
[&](const Cell & cell)
{return contains( cell );});
}
......
......@@ -168,14 +168,7 @@ bool HCPIterator::operator==(const HCPIterator &rhs) const
{
if (ended_ || rhs.ended_)
{
if (ended_ == rhs.ended_)
{
return true;
}
else
{
return false;
}
return ended_ == rhs.ended_;
}
// WALBERLA_ASSERT_FLOAT_EQUAL(aabb_, rhs.aabb_, "Comparing iterators for different starting configurations!");
......
......@@ -115,14 +115,7 @@ bool SCIterator::operator==(const SCIterator &rhs) const
{
if (ended_ || rhs.ended_)
{
if (ended_ == rhs.ended_)
{
return true;
}
else
{
return false;
}
return ended_ == rhs.ended_;
}
// WALBERLA_ASSERT_FLOAT_EQUAL(aabb_, rhs.aabb_, "Comparing iterators for different starting configurations!");
......
......@@ -362,11 +362,7 @@ bool EPA::doEPA( Support &geom1,
penetrationDepth = -supp_dist + real_t(2.0) * margin;
retNormal = -ctr;
if(penetrationDepth < contactThreshold){
return true;
}else{
return false;
}
return penetrationDepth < contactThreshold;
} else {
//Reject sphere
removeSupportMargin(epaVolume, supportA, supportB);
......@@ -500,12 +496,7 @@ bool EPA::doEPA( Support &geom1,
std::cerr << "entryHeap[0]->getSqrDist()=" << entryHeap[0]->getSqrDist() << std::endl;*/
//std::cout << "EPA penetration depth: " << penetrationDepth << std::endl;
if(penetrationDepth < contactThreshold) {
return true;
}
//no intersection found!
return false;
return penetrationDepth < contactThreshold;
}
//*************************************************************************************************
......@@ -722,11 +713,7 @@ inline bool EPA::originInTetrahedron( const Vec3& p0, const Vec3& p1, const Vec3
return false;
}
Vec3 normal3T = (p0 -p3) % (p1-p3);
if( (normal3T*p3 > real_t(0.0)) == (normal3T*p2 > real_t(0.0)) ) {
return false;
}
return true;
return (normal3T*p3 > real_t(0.0)) != (normal3T*p2 > real_t(0.0));
}
//*************************************************************************************************
......
......@@ -127,11 +127,10 @@ bool BlockForestDomain::isContainedInProcessSubdomain(const uint_t rank, const V
bool BlockForestDomain::isContainedInLocalSubdomain(const Vec3& pt,
const real_t& radius) const
{
for (auto& aabb : localAABBs_)
{
if (isInsideAABB(pt, radius, aabb)) return true;
}
return false;
return std::any_of(localAABBs_.begin(),
localAABBs_.end(),
[&](auto& aabb)
{return isInsideAABB(pt, radius, aabb);});
}
bool BlockForestDomain::isContainedInProcessSubdomain(const Vec3& pt, const real_t& radius) const
......@@ -153,12 +152,11 @@ bool BlockForestDomain::isContainedInProcessSubdomain(const Vec3& pt, const real
}
//intersects one of the neighboring subdomains?
for (auto& subdomain : neighborSubdomains_)
{
if (sqDistancePointToAABB(pt, subdomain.aabb) < radius*radius) return false;
}
return true;
return std::none_of(neighborSubdomains_.begin(),
neighborSubdomains_.end(),
[&](const auto &subdomain) {
return sqDistancePointToAABB(pt, subdomain.aabb) < radius * radius;
});
}
int BlockForestDomain::findContainingProcessRank(const Vec3& pt) const
......
......@@ -297,16 +297,17 @@ bool ConvexPolyhedron::containsRelPointImpl( real_t px, real_t py, real_t pz ) c
if( px * px + py * py + pz * pz > boundingSphereRadius_ * boundingSphereRadius_ )
return false;
for(auto fh : mesh_.faces())
{
const TriangleMesh::Normal & n = mesh_.normal(fh); // Plane normal
const TriangleMesh::Point & pp = mesh_.point(mesh_.to_vertex_handle(mesh_.halfedge_handle(fh))); // Point on plane
if( n[0] * (px - pp[0]) + n[1] * (py - pp[1]) + n[2] * (pz - pp[2]) >= real_t(0) )
return false;
}
return true;
return std::none_of(mesh_.faces().begin(),
mesh_.faces().end(),
[&](auto fh)
{
//check if point is on positive side of the face
const TriangleMesh::Normal &n = mesh_.normal(fh); // Plane normal
const TriangleMesh::Point &pp = mesh_.point(
mesh_.to_vertex_handle(mesh_.halfedge_handle(fh))); // Point on plane
return (n[0] * (px - pp[0]) + n[1] * (py - pp[1]) + n[2] * (pz - pp[2]) >= real_t(0));
});
}
//*************************************************************************************************
......
......@@ -350,11 +350,7 @@ bool EPA::doEPA( GeomPrimitive &geom1, GeomPrimitive &geom2, const GJK& gjk, Vec
penetrationDepth = -supp_dist + real_t(2.0) * margin;
retNormal = -ctr;
if(penetrationDepth < contactThreshold){
return true;
}else{
return false;
}
return penetrationDepth < contactThreshold;
} else {
//Reject sphere
removeSupportMargin(epaVolume, supportA, supportB);
......@@ -488,12 +484,7 @@ bool EPA::doEPA( GeomPrimitive &geom1, GeomPrimitive &geom2, const GJK& gjk, Vec
std::cerr << "entryHeap[0]->getSqrDist()=" << entryHeap[0]->getSqrDist() << std::endl;*/
//std::cout << "EPA penetration depth: " << penetrationDepth << std::endl;
if(penetrationDepth < contactThreshold) {
return true;
}
//no intersection found!
return false;
return penetrationDepth < contactThreshold;
}
//*************************************************************************************************
......@@ -705,11 +696,7 @@ inline bool EPA::originInTetrahedron( const Vec3& p0, const Vec3& p1, const Vec3
return false;
}
Vec3 normal3T = (p0 -p3) % (p1-p3);
if( (normal3T*p3 > real_t(0.0)) == (normal3T*p2 > real_t(0.0)) ) {
return false;
}
return true;
return (normal3T*p3 > real_t(0.0)) != (normal3T*p2 > real_t(0.0));
}
//*************************************************************************************************
......
......@@ -31,7 +31,7 @@ namespace walberla {
namespace pe {
namespace raytracing {
void BodyIntersectionInfo_Comparator_MPI_OP( BodyIntersectionInfo *in, BodyIntersectionInfo *inout, int *len, MPI_Datatype *dptr) {
void BodyIntersectionInfo_Comparator_MPI_OP( BodyIntersectionInfo *in, BodyIntersectionInfo *inout, const int *len, MPI_Datatype *dptr) {
WALBERLA_UNUSED(dptr);
for (int i = 0; i < *len; ++i) {
if (in->bodySystemID != 0 && inout->bodySystemID != 0) {
......
......@@ -458,7 +458,7 @@ void VTKOutput::computeOutputPoints( std::vector<Vector3<real_t> > & points, std
outputPoint.assign( points.size(), true );
for( uint_t i = 0; i != points.size(); ++i )
{
bool included = ( aabbInclusionFilters_.empty() ) ? true : false;
bool included = aabbInclusionFilters_.empty();
for( auto aabb = aabbInclusionFilters_.begin(); aabb != aabbInclusionFilters_.end() && !included; ++aabb )
if( aabb->contains( points[ i ][ 0 ], points[ i ][ 1 ], points[ i ][ 2 ] ) ) included = true;
if( !included )
......@@ -665,7 +665,7 @@ void VTKOutput::computeOutputPolylines( std::vector< std::vector< Vector3< real_
auto outputPointIt = outputPolylinePointIt->begin();
for( auto pointIt = polylineIt->begin(); pointIt != polylineIt->end(); ++pointIt, ++outputPointIt )
{
bool included = ( aabbInclusionFilters_.empty() ) ? true : false;
bool included = aabbInclusionFilters_.empty();
for( auto aabb = aabbInclusionFilters_.begin(); aabb != aabbInclusionFilters_.end() && !included; ++aabb )
if( aabb->contains( ( *pointIt )[ 0 ], ( *pointIt )[ 1 ], ( *pointIt )[ 2 ] ) ) included = true;
if( !included )
......
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