From 03e7f92700ca51a9dd7e74174ec5540551482f36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= <jgrad@icp.uni-stuttgart.de> Date: Wed, 20 Nov 2024 20:49:07 +0100 Subject: [PATCH] Remove unused and untested utility functions Number formatting can be achieved with an imbued locale. --- src/blockforest/BlockForest.h | 1 + src/blockforest/CMakeLists.txt | 1 - src/blockforest/Utility.cpp | 65 ---------------------------------- src/blockforest/Utility.h | 24 ------------- src/core/all.h | 1 - 5 files changed, 1 insertion(+), 91 deletions(-) delete mode 100644 src/blockforest/Utility.cpp diff --git a/src/blockforest/BlockForest.h b/src/blockforest/BlockForest.h index 58df1ba4c..c000ecff5 100644 --- a/src/blockforest/BlockForest.h +++ b/src/blockforest/BlockForest.h @@ -27,6 +27,7 @@ #include "PhantomBlockForest.h" #include "Types.h" +#include "core/EndianIndependentSerialization.h" #include "core/debug/Debug.h" #include "core/math/Uint.h" #include "core/timing/TimingPool.h" diff --git a/src/blockforest/CMakeLists.txt b/src/blockforest/CMakeLists.txt index 5be892061..0c4e8f8bc 100644 --- a/src/blockforest/CMakeLists.txt +++ b/src/blockforest/CMakeLists.txt @@ -45,7 +45,6 @@ target_sources( blockforest SetupBlock.cpp SetupBlockForest.cpp StructuredBlockForest.cpp - Utility.cpp ) add_subdirectory( communication ) diff --git a/src/blockforest/Utility.cpp b/src/blockforest/Utility.cpp deleted file mode 100644 index b31f41475..000000000 --- a/src/blockforest/Utility.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//====================================================================================================================== -// -// This file is part of waLBerla. waLBerla is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// waLBerla is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file Utility.cpp -//! \ingroup blockforest -//! \author Florian Schornbaum <florian.schornbaum@fau.de> -// -//====================================================================================================================== - -#include "Utility.h" - -#include <iomanip> -#include <sstream> -#include <stack> - - -namespace walberla { -namespace blockforest { - - - -std::string naturalNumberToGroupedThousandsString( uint_t number, const char separator ) { // for the documentation see the header file - - std::ostringstream oss; - - std::stack< uint_t > numbers; - - while( true ) { - - numbers.push( number % 1000 ); - - if( number <= 999 ) break; - - number /= 1000; - } - - oss << numbers.top(); - numbers.pop(); - - while( !numbers.empty() ) { - - oss << separator << std::setfill( '0' ) << std::setw( 3 ) << numbers.top(); - oss << std::setw( 0 ); - numbers.pop(); - } - - return oss.str(); -} - - - -} // namespace blockforest -} // namespace walberla diff --git a/src/blockforest/Utility.h b/src/blockforest/Utility.h index 8a6f30461..842b91662 100644 --- a/src/blockforest/Utility.h +++ b/src/blockforest/Utility.h @@ -28,9 +28,7 @@ #include "core/math/Uint.h" #include <limits> -#include <ostream> #include <string> -#include <vector> namespace walberla { @@ -110,27 +108,5 @@ inline memory_t bytesToMiB( memory_t bytes ) { } - -//********************************************************************************************************************** -/*! -* \brief Returns the string representation of 'number', every three digits the character 'separator' is inserted -* (172408725 -> "172 408 725") -*/ -//********************************************************************************************************************** -std::string naturalNumberToGroupedThousandsString( const uint_t number, const char separator = ' ' ); - -inline std::string naturalNumberToGroupedThousandsString( const real_t number, const char separator = ' ' ) { - - return naturalNumberToGroupedThousandsString( static_cast< uint_t >( 0.5 + number ), separator ); -} - - - -inline void fillStream( std::ostream& ostream, const char fill, uint_t length ) { - while( length-- > 0 ) ostream << fill; -} - - - } // namespace blockforest } // namespace walberla diff --git a/src/core/all.h b/src/core/all.h index 2e804b55a..0315463da 100644 --- a/src/core/all.h +++ b/src/core/all.h @@ -26,7 +26,6 @@ #include "AllSet.h" #include "Array.h" #include "DataTypes.h" -#include "EndianIndependentSerialization.h" #include "Environment.h" #include "FunctionTraits.h" #include "GetPID.h" -- GitLab