diff --git a/.clang-tidy b/.clang-tidy index cc4914591cf6fa9cc38beb930cffe2ccb25a18ae..2747454ca09d19d0af59207f587a0b3afe36b033 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -48,7 +48,8 @@ cppcoreguidelines-special-member-functions, -cppcoreguidelines-init-variables, -cppcoreguidelines-pro-type-member-init, -cppcoreguidelines-owning-memory, --cppcoreguidelines-special-member-functions +-cppcoreguidelines-special-member-functions, +-cppcoreguidelines-interfaces-global-init ' HeaderFilterRegex: '\.h$' diff --git a/src/basics/basics/container/CbArray2D.h b/src/basics/basics/container/CbArray2D.h index 4667a3dc28033d647aac2579a7dabbb7e7851c8e..a5e06f0aabce58842b23477a6ceaa64a48ba4ce2 100644 --- a/src/basics/basics/container/CbArray2D.h +++ b/src/basics/basics/container/CbArray2D.h @@ -163,10 +163,7 @@ public: this->data[i] = src.data[i]; } /*=======================================================================*/ - virtual ~CbArray2D() - { - //vector wird automatisch zerstoert - } + virtual ~CbArray2D() = default; /*=======================================================================*/ CbArray2D& operator= (const CbArray2D& rhs) { diff --git a/src/basics/basics/container/CbVector.h b/src/basics/basics/container/CbVector.h index 76df61df21bcfb0cc2cea68cb15314a0b4427ca4..300b0212b4203bbd82a8505a7570bb519d8dfeed 100644 --- a/src/basics/basics/container/CbVector.h +++ b/src/basics/basics/container/CbVector.h @@ -63,12 +63,13 @@ template< typename T > class CbVector { public: - typedef T value_type; + using value_type = T; using pointer = value_type *; using size_type = std::size_t; friend class CbVectorAllocator<value_type>; //um auf ptrData und dataSize zugreifen zu koennen! + CbVector<value_type>(const CbVector<value_type>& src) = delete; public: /*==========================================================*/ CbVector( CbVectorAllocator<value_type>* const& allocator = new CbVectorAllocatorStd<value_type> ) @@ -99,7 +100,8 @@ public: /*=======================================================================*/ CbVector& operator= (const CbVector& src) { - if(this == &src) return *this; + if(this == &src) + return *this; //gespeicherte Datenelemente loeschen //Laenge anpassen @@ -207,7 +209,6 @@ private: value_type* ptrData; size_type dataSize{0}; CbVectorAllocator<value_type>* allocator; - CbVector<value_type>(const CbVector<value_type>& src); //CbVector<value_type>& operator=(const CbVector<value_type>& src); }; diff --git a/src/basics/basics/writer/WbWriter.h b/src/basics/basics/writer/WbWriter.h index e0eb56ce509f7e97457f926fe1a5b4afde37dd73..8e5524416350c4704fc8a27882e6c9c61dc51c9f 100644 --- a/src/basics/basics/writer/WbWriter.h +++ b/src/basics/basics/writer/WbWriter.h @@ -49,8 +49,7 @@ class WbWriter { public: ////////////////////////////////////////////////////////////////////////// - virtual ~WbWriter() - = default; + virtual ~WbWriter() = default; ////////////////////////////////////////////////////////////////////////// //rein virtuelle Methoden diff --git a/src/basics/basics/writer/WbWriterVtkXmlBinary.cpp b/src/basics/basics/writer/WbWriterVtkXmlBinary.cpp index 448aeb91f0c67aa0352f01e5df01c2469666d22c..d88459eb5ed8c0ec90348618a4834def954f965e 100644 --- a/src/basics/basics/writer/WbWriterVtkXmlBinary.cpp +++ b/src/basics/basics/writer/WbWriterVtkXmlBinary.cpp @@ -38,7 +38,7 @@ using namespace std; /*===============================================================================*/ -string WbWriterVtkXmlBinary::pvdEndTag =" </Collection>\n</VTKFile>"; +const std::string WbWriterVtkXmlBinary::pvdEndTag =" </Collection>\n</VTKFile>"; /*===============================================================================*/ string WbWriterVtkXmlBinary::writeCollection(const string& filename, const vector<string>& filenames, const double& timeStep, const bool& sepGroups) { diff --git a/src/basics/basics/writer/WbWriterVtkXmlBinary.h b/src/basics/basics/writer/WbWriterVtkXmlBinary.h index a74f78232d4be169166bcc824fa0dcfb1918233d..2beda26b7aa4830b30d47c8bc1c0cddc24c4c730 100644 --- a/src/basics/basics/writer/WbWriterVtkXmlBinary.h +++ b/src/basics/basics/writer/WbWriterVtkXmlBinary.h @@ -45,6 +45,10 @@ public: static WbWriterVtkXmlBinary instance; return &instance; } + + WbWriterVtkXmlBinary( const WbWriterVtkXmlBinary& ) = delete; + const WbWriterVtkXmlBinary& operator=( const WbWriterVtkXmlBinary& ) = delete; + private: WbWriterVtkXmlBinary() : WbWriter() { @@ -53,10 +57,7 @@ private: if(sizeof(float) !=4) throw UbException(UB_EXARGS,"machine error float type mismatch"); } - WbWriterVtkXmlBinary( const WbWriterVtkXmlBinary& ); //no copy allowed - const WbWriterVtkXmlBinary& operator=( const WbWriterVtkXmlBinary& ); //no copy allowed - - static std::string pvdEndTag; + static const std::string pvdEndTag; public: std::string getFileExtension() override { return ".bin.vtu"; } diff --git a/src/cpu/VirtualFluidsCore/Grid/Block3D.cpp b/src/cpu/VirtualFluidsCore/Grid/Block3D.cpp index d7eddebcfff804688368d5d178dce94c7176d97b..2dd9332a15d41c2d88693a8c4fcf5d2427535e53 100644 --- a/src/cpu/VirtualFluidsCore/Grid/Block3D.cpp +++ b/src/cpu/VirtualFluidsCore/Grid/Block3D.cpp @@ -39,10 +39,7 @@ int Block3D::counter = 0; -////////////////////////////////////////////////////////////////////////// -Block3D::Block3D() -{ -} + ////////////////////////////////////////////////////////////////////////// Block3D::Block3D(int x1, int x2, int x3, int level) : x1(x1), x2(x2), x3(x3), diff --git a/src/cpu/VirtualFluidsCore/Grid/Block3D.h b/src/cpu/VirtualFluidsCore/Grid/Block3D.h index a94ca50a065ff7328de90212d918ee41a5ee5449..c99d03b7d5444ad7bb0b5ea76acc627ca02f95d4 100644 --- a/src/cpu/VirtualFluidsCore/Grid/Block3D.h +++ b/src/cpu/VirtualFluidsCore/Grid/Block3D.h @@ -47,7 +47,7 @@ class ILBMKernel; class Block3D { public: - Block3D(); + Block3D() = default; Block3D(int x1, int x2, int x3, int level); virtual ~Block3D(); bool operator==(const Block3D& src) const; diff --git a/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp b/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp index e0fdf7f5e154ce843a183edf33284b5acfc13a6c..f1d1d653d136588cf03240913b82458fbdd1ca51 100644 --- a/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp +++ b/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp @@ -600,11 +600,12 @@ UbTupleDouble3 Grid3D::getBlockWorldCoordinates(int blockX1Index, int blockX2Ind double x2 = (double)blockX2Index*c1oShiftedLevel; double x3 = (double)blockX3Index*c1oShiftedLevel; - if (!trafo) return UbTupleDouble3(x1, x2, x3); + if (!trafo) + return { x1, x2, x3 }; - return UbTupleDouble3(trafo->transformBackwardToX1Coordinate(x1, x2, x3) + return {trafo->transformBackwardToX1Coordinate(x1, x2, x3) , trafo->transformBackwardToX2Coordinate(x1, x2, x3) - , trafo->transformBackwardToX3Coordinate(x1, x2, x3)); + , trafo->transformBackwardToX3Coordinate(x1, x2, x3) }; } ////////////////////////////////////////////////////////////////////////// //double Grid3D::getDeltaT(SPtr<Block3D> block) const