diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2b95e2803b2d6bd4dbf4fcb6a21d98da5becd05a..f0d830a8c46226f00816cd6aa8fcf465e04605d7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1430,7 +1430,7 @@ doc: ############################################################################### clang-tidy: - image: i10git.cs.fau.de:5005/walberla/buildenvs/clang:9.0 + image: i10git.cs.fau.de:5005/walberla/buildenvs/clang:10.0 script: - $CXX --version - clang-tidy -version @@ -1919,4 +1919,4 @@ benchmark_ClangBuildAnalyzer: - ClangBuildAnalyzer --analyze CBA image: i10git.cs.fau.de:5005/walberla/buildenvs/clang:9.0 tags: - - docker-benchmark \ No newline at end of file + - docker-benchmark diff --git a/src/blockforest/python/Exports.cpp b/src/blockforest/python/Exports.cpp index cd4419689565be345c325c78d52dd7d14221d82e..08873381e321bf8525bf3a5f39916c17233d2532 100644 --- a/src/blockforest/python/Exports.cpp +++ b/src/blockforest/python/Exports.cpp @@ -41,6 +41,8 @@ #include "stencil/D3Q19.h" #include "stencil/D3Q27.h" +#include <memory> + #include <sstream> #ifdef _MSC_VER @@ -62,7 +64,7 @@ namespace blockforest { using walberla::blockforest::communication::UniformBufferedScheme; -bool checkForThreeTuple( object obj ) +bool checkForThreeTuple( object obj ) //NOLINT { if( ! extract<tuple> ( obj ).check() ) return false; @@ -72,7 +74,7 @@ bool checkForThreeTuple( object obj ) } -object python_createUniformBlockGrid(tuple args, dict kw) +object python_createUniformBlockGrid(tuple args, dict kw) //NOLINT { if( len(args) > 0 ) { PyErr_SetString( PyExc_ValueError, "This function takes only keyword arguments" ); @@ -124,7 +126,7 @@ object python_createUniformBlockGrid(tuple args, dict kw) shared_ptr<Config> cfg = python_coupling::configFromPythonDict( kw ); try { - shared_ptr< StructuredBlockForest > blocks = createUniformBlockGridFromConfig( cfg->getGlobalBlock(), NULL, keepGlobalBlockInformation ); + shared_ptr< StructuredBlockForest > blocks = createUniformBlockGridFromConfig( cfg->getGlobalBlock(), nullptr, keepGlobalBlockInformation ); return object(blocks); } catch( std::exception & e) @@ -235,9 +237,9 @@ shared_ptr<StructuredBlockForest> createStructuredBlockForest( Vector3<uint_t> b MPIManager::instance()->useWorldComm(); // create StructuredBlockForest (encapsulates a newly created BlockForest) - auto bf = shared_ptr< BlockForest >( new BlockForest( uint_c( MPIManager::instance()->rank() ), sforest, keepGlobalBlockInformation ) ); + auto bf = std::make_shared< BlockForest >( uint_c( MPIManager::instance()->rank() ), sforest, keepGlobalBlockInformation ); - auto sbf = shared_ptr< StructuredBlockForest >( new StructuredBlockForest( bf, cellsPerBlock[0], cellsPerBlock[1], cellsPerBlock[2] ) ); + auto sbf = std::make_shared< StructuredBlockForest >( bf, cellsPerBlock[0], cellsPerBlock[1], cellsPerBlock[2] ); sbf->createCellBoundingBoxes(); return sbf; @@ -286,7 +288,7 @@ std::string printSetupBlock(const SetupBlock & b ) void exportBlockForest() { - class_< StructuredBlockForest, + class_< StructuredBlockForest, //NOLINT shared_ptr<StructuredBlockForest>, bases<StructuredBlockStorage>, boost::noncopyable > ( "StructuredBlockForest", no_init ); diff --git a/src/pe/contact/Contact.cpp b/src/pe/contact/Contact.cpp index ce7c59ebeb4662606397cde1e3ea0cb72ef54123..88e635eb2872ccd1b9cd7740ecbb8f4730b2f9bf 100644 --- a/src/pe/contact/Contact.cpp +++ b/src/pe/contact/Contact.cpp @@ -67,19 +67,6 @@ Contact::Contact( GeomID g1, GeomID g2, const Vec3& gpos, const Vec3& normal, re } //************************************************************************************************* -//================================================================================================= -// -// DESTRUCTOR -// -//================================================================================================= - -//************************************************************************************************* -/*!\brief Destructor for the Contact class. - */ -Contact::~Contact() -= default; -//************************************************************************************************* - //================================================================================================= // // GET FUNCTIONS diff --git a/src/pe/contact/Contact.h b/src/pe/contact/Contact.h index 51adfc7c3ed7f46c9f2983b33abad630936bcb20..dc40db14d3d9ffb0641a9cd1cbdb3efbc17c1cb1 100644 --- a/src/pe/contact/Contact.h +++ b/src/pe/contact/Contact.h @@ -92,13 +92,6 @@ public: //@} //********************************************************************************************** - //**Destructor********************************************************************************** - /*!\name Destructor */ - //@{ - ~Contact(); - //@} - //********************************************************************************************** - public: //**Get functions******************************************************************************* /*!\name Get functions */ diff --git a/src/python_coupling/CreateConfig.cpp b/src/python_coupling/CreateConfig.cpp index b3d1e512251a2c89a2f42f468365b133fdd0a95c..0a4416c3306b05d4268f01aaeba4ffa3568e033d 100644 --- a/src/python_coupling/CreateConfig.cpp +++ b/src/python_coupling/CreateConfig.cpp @@ -83,9 +83,11 @@ namespace python_coupling { class PythonMultipleConfigGenerator : public config::ConfigGenerator { public: - PythonMultipleConfigGenerator( bp::stl_input_iterator< bp::dict > iterator ) : iter_( iterator ), firstTime_(true) {} + PythonMultipleConfigGenerator( bp::stl_input_iterator< bp::dict > iterator ) //NOLINT + : iter_( iterator ), firstTime_(true) //NOLINT + {} - virtual shared_ptr<Config> next() + shared_ptr<Config> next() override { // this seemingly unnecessary complicated firstTime variable is used // since in alternative version where (++iter_) is at the end of the function @@ -119,7 +121,7 @@ namespace python_coupling { public: PythonSingleConfigGenerator( const shared_ptr<Config> & config ): config_ ( config ) {} - virtual shared_ptr<Config> next() + shared_ptr<Config> next() override { auto res = config_; config_.reset(); diff --git a/src/python_coupling/Manager.cpp b/src/python_coupling/Manager.cpp index 9ccf4a597e06b5a80f0346702484112ecdbd41f1..b7af694e847bb6cf068ee799529d84e2672f80b6 100644 --- a/src/python_coupling/Manager.cpp +++ b/src/python_coupling/Manager.cpp @@ -53,7 +53,7 @@ Manager::Manager() { } -Manager::~Manager( ) +Manager::~Manager( ) //NOLINT { // To work reliably this would have to be called at the end of the // main function. At this position this leads to a segfault in some cases @@ -114,7 +114,11 @@ void Manager::triggerInitialization() } catch ( boost::python::error_already_set & ) { - PyObject *type_ptr = NULL, *value_ptr = NULL, *traceback_ptr = NULL; + PyObject *type_ptr = nullptr; + + PyObject *value_ptr = nullptr; + + PyObject *traceback_ptr = nullptr; PyErr_Fetch(&type_ptr, &value_ptr, &traceback_ptr); if( type_ptr ) diff --git a/src/python_coupling/Shell.cpp b/src/python_coupling/Shell.cpp index 85cb228121ae7814b0afadee4a7f386a9de7df1e..5749511e067a1f848f6266667dbf2073bcfe1336 100644 --- a/src/python_coupling/Shell.cpp +++ b/src/python_coupling/Shell.cpp @@ -116,7 +116,7 @@ namespace python_coupling { else line = PyOS_Readline( stdin, stdout, (char*)prompt2_.c_str() ); - if ( line == NULL || *line == '\0' ) { // interrupt or EOF + if ( line == nullptr || *line == '\0' ) { // interrupt or EOF result.clear(); return false; } @@ -134,7 +134,7 @@ namespace python_coupling { if ( lineCounter == 1 && commandComplete ) return true; - if ( strTrimmedLine.size() == 0 && isCompleteCommand(result) ) // multiline commands have to end with empty line + if ( strTrimmedLine.empty() && isCompleteCommand(result) ) // multiline commands have to end with empty line return true; } diff --git a/src/python_coupling/basic_exports/BasicExports.cpp b/src/python_coupling/basic_exports/BasicExports.cpp index d43a339f956486c8aec218208ca771836e2715d6..2d180f58f3bcfe837465486b21c1df094dea65a8 100644 --- a/src/python_coupling/basic_exports/BasicExports.cpp +++ b/src/python_coupling/basic_exports/BasicExports.cpp @@ -67,7 +67,7 @@ struct NumpyIntConversion auto typeName = std::string( Py_TYPE(pyObj)->tp_name ); if ( typeName.substr(0,9) == "numpy.int" ) return pyObj; - return 0; + return nullptr; } static void construct( PyObject* pyObj, converter::rvalue_from_python_stage1_data* data ) @@ -94,7 +94,7 @@ struct NumpyFloatConversion auto typeName = std::string( Py_TYPE(pyObj)->tp_name ); if ( typeName.substr(0,11) == "numpy.float" ) return pyObj; - return 0; + return nullptr; } static void construct(PyObject* pyObj, converter::rvalue_from_python_stage1_data* data) @@ -208,7 +208,7 @@ struct PythonTuple_to_Vector3 using namespace boost::python; if ( ! ( PySequence_Check(obj) && PySequence_Size( obj ) == 3 )) - return NULL; + return nullptr; object element0 ( handle<>( borrowed( PySequence_GetItem(obj,0) ))); object element1 ( handle<>( borrowed( PySequence_GetItem(obj,1) ))); @@ -219,7 +219,7 @@ struct PythonTuple_to_Vector3 extract<T>( element2 ).check() ) return obj; else - return NULL; + return nullptr; } static void construct( PyObject* obj, boost::python::converter::rvalue_from_python_stage1_data* data ) @@ -302,7 +302,7 @@ struct PythonTuple_to_Cell using namespace boost::python; if ( ! ( PySequence_Check(obj) && PySequence_Size( obj ) == 3 )) - return NULL; + return nullptr; object element0 ( handle<>( borrowed( PySequence_GetItem(obj,0) ))); object element1 ( handle<>( borrowed( PySequence_GetItem(obj,1) ))); @@ -313,7 +313,7 @@ struct PythonTuple_to_Cell extract<cell_idx_t>( element2 ).check() ) return obj; else - return NULL; + return nullptr; } static void construct( PyObject* obj, boost::python::converter::rvalue_from_python_stage1_data* data ) @@ -670,7 +670,7 @@ void exportTiming() // //====================================================================================================================== -boost::python::object IBlock_getData( boost::python::object iblockObject, const std::string & stringID ) +boost::python::object IBlock_getData( boost::python::object iblockObject, const std::string & stringID ) //NOLINT { IBlock * block = boost::python::extract<IBlock*>( iblockObject ); @@ -701,7 +701,7 @@ boost::python::object IBlock_getData( boost::python::object iblockObject, const } -boost::python::list IBlock_blockDataList( boost::python::object iblockObject ) +boost::python::list IBlock_blockDataList( boost::python::object iblockObject ) //NOLINT { IBlock * block = boost::python::extract<IBlock*>( iblockObject ); @@ -722,7 +722,7 @@ boost::python::list IBlock_blockDataList( boost::python::object iblockObject ) boost::python::object IBlock_iter( boost::python::object iblockObject ) { - boost::python::list resultList = IBlock_blockDataList( iblockObject ); + boost::python::list resultList = IBlock_blockDataList( iblockObject ); //NOLINT return resultList.attr("__iter__"); } @@ -847,13 +847,13 @@ void exportLogging() //====================================================================================================================== -object * blockDataCreationHelper( IBlock * block, StructuredBlockStorage * bs, object callable ) +object * blockDataCreationHelper( IBlock * block, StructuredBlockStorage * bs, object callable ) //NOLINT { object * res = new object( callable( ptr(block), ptr(bs) ) ); return res; } -uint_t StructuredBlockStorage_addBlockData( StructuredBlockStorage & s, const std::string & name, object functionPtr ) +uint_t StructuredBlockStorage_addBlockData( StructuredBlockStorage & s, const std::string & name, object functionPtr ) //NOLINT { BlockDataID res = s.addStructuredBlockData(name) << StructuredBlockDataCreator<object>( std::bind( &blockDataCreationHelper, std::placeholders::_1, std::placeholders::_2, functionPtr ) ); @@ -865,7 +865,7 @@ uint_t StructuredBlockStorage_addBlockData( StructuredBlockStorage & s, const st // boost::python comes with iteration helpers but non of this worked: // .def("__iter__" range(&StructuredBlockStorage::begin, &StructuredBlockStorage::end)) // .def("__iter__", range<return_value_policy<copy_non_const_reference> >( beginPtr, endPtr) ) -boost::python::object StructuredBlockStorage_iter( boost::python::object structuredBlockStorage ) +boost::python::object StructuredBlockStorage_iter( boost::python::object structuredBlockStorage ) //NOLINT { shared_ptr<StructuredBlockStorage> s = extract< shared_ptr<StructuredBlockStorage> > ( structuredBlockStorage ); @@ -884,7 +884,7 @@ boost::python::object StructuredBlockStorage_iter( boost::python::object structu } -boost::python::object StructuredBlockStorage_getItem( boost::python::object structuredBlockStorage, uint_t i ) +boost::python::object StructuredBlockStorage_getItem( boost::python::object structuredBlockStorage, uint_t i ) //NOLINT { shared_ptr<StructuredBlockStorage> s = extract< shared_ptr<StructuredBlockStorage> > ( structuredBlockStorage ); @@ -1090,7 +1090,7 @@ void exportStructuredBlockStorage() void exportCommunication() { using communication::UniformPackInfo; - class_< UniformPackInfo, shared_ptr<UniformPackInfo>, boost::noncopyable> + class_< UniformPackInfo, shared_ptr<UniformPackInfo>, boost::noncopyable> //NOLINT ( "UniformPackInfo", no_init ); using communication::UniformMPIDatatypeInfo; @@ -1143,7 +1143,13 @@ void exportStencilDirections() .value("BSW", stencil::BSW) .export_values() ; - boost::python::list cx, cy, cz, dirStrings; + boost::python::list cx; + + boost::python::list cy; + + boost::python::list cz; + + boost::python::list dirStrings; for( uint_t i=0; i < stencil::NR_OF_DIRECTIONS; ++i ) { cx.append( stencil::cx[i] ); diff --git a/src/python_coupling/basic_exports/MPIExport.cpp b/src/python_coupling/basic_exports/MPIExport.cpp index 99a9ed2b64e2be551f8c11fbc136d70a6e13703b..5811cbab58a6a6497984546d7f19dbe3741e1031 100644 --- a/src/python_coupling/basic_exports/MPIExport.cpp +++ b/src/python_coupling/basic_exports/MPIExport.cpp @@ -45,7 +45,7 @@ namespace python_coupling { // //=================================================================================================================== - static object broadcast_string( object value, int sendRank ) + static object broadcast_string( object value, int sendRank ) //NOLINT { if ( extract<std::string>(value).check() ) { @@ -58,7 +58,7 @@ namespace python_coupling { return object( extractedValue ); } - static object broadcast_int( object value, int sendRank ) + static object broadcast_int( object value, int sendRank ) //NOLINT { if ( extract<int64_t>(value).check() ) { @@ -71,7 +71,7 @@ namespace python_coupling { return object( extractedValue ); } - static object broadcast_real( object value, int sendRank ) + static object broadcast_real( object value, int sendRank ) //NOLINT { if ( extract<real_t>(value).check() ) { @@ -92,7 +92,7 @@ namespace python_coupling { //=================================================================================================================== - static object reduce_int( object value, mpi::Operation op, int recvRank ) + static object reduce_int( object value, mpi::Operation op, int recvRank ) //NOLINT { if ( extract<int64_t>(value).check() ) { @@ -105,7 +105,7 @@ namespace python_coupling { return object( extractedValue ); } - static object reduce_real( object value, mpi::Operation op, int recvRank ) + static object reduce_real( object value, mpi::Operation op, int recvRank ) //NOLINT { if ( extract<real_t>(value).check() ) { @@ -119,7 +119,7 @@ namespace python_coupling { } - static object allreduce_int( object value, mpi::Operation op ) + static object allreduce_int( object value, mpi::Operation op ) //NOLINT { if ( extract<int64_t>(value).check() ) { @@ -132,7 +132,7 @@ namespace python_coupling { return object( extractedValue ); } - static object allreduce_real( object value, mpi::Operation op ) + static object allreduce_real( object value, mpi::Operation op ) //NOLINT { if ( extract<real_t>(value).check() ) { @@ -152,7 +152,7 @@ namespace python_coupling { // //=================================================================================================================== - static IntStdVector gather_int( object value, int recvRank ) + static IntStdVector gather_int( object value, int recvRank ) //NOLINT { if ( ! extract<int64_t>(value).check() ) { @@ -163,7 +163,7 @@ namespace python_coupling { return mpi::gather( extractedValue , recvRank ); } - static RealStdVector gather_real( object value, int recvRank ) + static RealStdVector gather_real( object value, int recvRank ) //NOLINT { if ( ! extract<real_t>(value).check() ) { @@ -175,7 +175,7 @@ namespace python_coupling { } - static IntStdVector allgather_int( object value ) + static IntStdVector allgather_int( object value ) //NOLINT { if ( ! extract<int64_t>(value).check() ) { @@ -186,7 +186,7 @@ namespace python_coupling { return mpi::allGather( extractedValue ); } - static RealStdVector allgather_real( object value ) + static RealStdVector allgather_real( object value ) //NOLINT { if ( ! extract<real_t>(value).check() ) { diff --git a/src/timeloop/python/Exports.cpp b/src/timeloop/python/Exports.cpp index f068b9947005235edd4b3220c62caeff6ad81424..3411e7f298a25172ea88ff309d49d1eff8c5cdc7 100644 --- a/src/timeloop/python/Exports.cpp +++ b/src/timeloop/python/Exports.cpp @@ -42,13 +42,13 @@ namespace timeloop { #endif struct ITimeloopWrap : public ITimeloop, public wrapper<ITimeloop> { - void run() { this->get_override( "run" )(); } - void singleStep() { this->get_override( "singleStep" )(); } - void stop() { this->get_override( "stop" )(); } - void synchronizedStop( bool s ) { this->get_override( "synchronizedStop" )(s); } - void setCurrentTimeStep( uint_t ts) { this->get_override( "setCurrentTimeStep" )(ts); } - uint_t getCurrentTimeStep() const { return this->get_override( "getCurrentTimeStep" )(); } - uint_t getNrOfTimeSteps() const { return this->get_override( "getNrOfTimeSteps" )(); } + void run() override { this->get_override( "run" )(); } + void singleStep() override { this->get_override( "singleStep" )(); } + void stop() override { this->get_override( "stop" )(); } + void synchronizedStop( bool s ) override { this->get_override( "synchronizedStop" )(s); } + void setCurrentTimeStep( uint_t ts) override { this->get_override( "setCurrentTimeStep" )(ts); } + uint_t getCurrentTimeStep() const override { return this->get_override( "getCurrentTimeStep" )(); } + uint_t getNrOfTimeSteps() const override { return this->get_override( "getNrOfTimeSteps" )(); } }; #ifdef WALBERLA_CXX_COMPILER_IS_GNU diff --git a/src/vtk/python/Exports.cpp b/src/vtk/python/Exports.cpp index 86fe6e26f3ec502e9ec7288e3254b053c0084527..719a6baeb654db00896a650a411ab47187c3ccdb 100644 --- a/src/vtk/python/Exports.cpp +++ b/src/vtk/python/Exports.cpp @@ -67,7 +67,7 @@ void exportModuleToPython() void ( VTKOutput::*p_setSamplingResolution1) ( const real_t ) = &VTKOutput::setSamplingResolution; void ( VTKOutput::*p_setSamplingResolution2) ( const real_t, const real_t, const real_t ) = &VTKOutput::setSamplingResolution; - class_<BlockCellDataWriterInterface, + class_<BlockCellDataWriterInterface, //NOLINT boost::noncopyable, shared_ptr<BlockCellDataWriterInterface> > ("BlockCellDataWriterInterface", no_init) ;