From f4ac0b374a1cdddd940b99a407eded971c95ead2 Mon Sep 17 00:00:00 2001 From: Markus Holzer <markus.holzer@fau.de> Date: Thu, 25 Mar 2021 11:12:52 +0000 Subject: [PATCH] Remove Boost Property Tree --- src/core/config/ConfigToBoostPropertyTree.cpp | 58 ---------------- src/core/config/ConfigToBoostPropertyTree.h | 36 ---------- src/core/config/all.h | 3 - tests/core/CMakeLists.txt | 13 +--- tests/core/config/MultiArrayIOTest.cpp | 2 +- tests/core/config/PropertyTreeTest.cpp | 69 ------------------- tests/core/math/PhysicalCheckTest.cpp | 1 - 7 files changed, 4 insertions(+), 178 deletions(-) delete mode 100644 src/core/config/ConfigToBoostPropertyTree.cpp delete mode 100644 src/core/config/ConfigToBoostPropertyTree.h delete mode 100644 tests/core/config/PropertyTreeTest.cpp diff --git a/src/core/config/ConfigToBoostPropertyTree.cpp b/src/core/config/ConfigToBoostPropertyTree.cpp deleted file mode 100644 index 45a04fc47..000000000 --- a/src/core/config/ConfigToBoostPropertyTree.cpp +++ /dev/null @@ -1,58 +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 ConfigToBoostPropertyTree.cpp -//! \ingroup core -//! \author Christian Godenschwager <christian.godenschwager@fau.de> -// -//====================================================================================================================== - -#include "waLBerlaDefinitions.h" -#ifdef WALBERLA_BUILD_WITH_BOOST - -#include "ConfigToBoostPropertyTree.h" - -#include <boost/property_tree/ptree.hpp> - - -namespace walberla { -namespace config { - -boost::property_tree::iptree configBlockHandleToBoostPropertyTree( const Config::BlockHandle & blockHandle ) -{ - boost::property_tree::iptree propTree; - - //typedef std::pair<const std::string &, const std::string &> PairType; - for( Config::const_iterator it = blockHandle.begin(); it != blockHandle.end(); ++it ) - propTree.put( it->first, it->second ); - - Config::Blocks blocks; - blockHandle.getBlocks(blocks); - - for( const Config::BlockHandle & handle : blocks ) - propTree.add_child( handle.getKey(), configBlockHandleToBoostPropertyTree( handle ) ); - - return propTree; -} - -boost::property_tree::iptree configToBoostPropertyTree( const Config & config ) -{ - return configBlockHandleToBoostPropertyTree( config.getGlobalBlock() ); -} - -} // namespace config -} // namespace walberla - -#endif diff --git a/src/core/config/ConfigToBoostPropertyTree.h b/src/core/config/ConfigToBoostPropertyTree.h deleted file mode 100644 index f1f8c0afc..000000000 --- a/src/core/config/ConfigToBoostPropertyTree.h +++ /dev/null @@ -1,36 +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 ConfigToBoostPropertyTree.h -//! \ingroup core -//! \author Christian Godenschwager <christian.godenschwager@fau.de> -// -//====================================================================================================================== - -#pragma once - -#include "Config.h" - -#include <boost/property_tree/ptree_fwd.hpp> - - -namespace walberla { -namespace config { - -boost::property_tree::iptree configToBoostPropertyTree( const Config & config ); -boost::property_tree::iptree configBlockHandleToBoostPropertyTree( const Config::BlockHandle & blockHandle ); - -} // namespace config -} // namespace walberla diff --git a/src/core/config/all.h b/src/core/config/all.h index 43bbd4f68..b60175027 100644 --- a/src/core/config/all.h +++ b/src/core/config/all.h @@ -23,7 +23,4 @@ #pragma once #include "Config.h" -#ifdef WALBERLA_BUILD_WITH_BOOST -#include "ConfigToBoostPropertyTree.h" -#endif #include "Create.h" diff --git a/tests/core/CMakeLists.txt b/tests/core/CMakeLists.txt index 992b516f4..a34c73191 100644 --- a/tests/core/CMakeLists.txt +++ b/tests/core/CMakeLists.txt @@ -21,18 +21,11 @@ waLBerla_execute_test( NAME CellIntervalTest ) waLBerla_compile_test( FILES config/ConfigTest.cpp ) waLBerla_execute_test( NAME ConfigTest COMMAND $<TARGET_FILE:ConfigTest> ${CMAKE_CURRENT_SOURCE_DIR}/config/ConfigTest.dat ) -if( WALBERLA_BUILD_WITH_BOOST ) - waLBerla_compile_test( FILES config/PropertyTreeTest.cpp) - #waLBerla_execute_test(NAME PropertyTreeTest COMMAND $<TARGET_FILE:PropertyTreeTest> ) -endif( WALBERLA_BUILD_WITH_BOOST ) - - if( WALBERLA_BUILD_WITH_BOOST ) waLBerla_compile_test( FILES config/MultiArrayIOTest.cpp ) waLBerla_execute_test( NAME MultiArrayIOTest COMMAND $<TARGET_FILE:MultiArrayIOTest> ) endif( WALBERLA_BUILD_WITH_BOOST ) - ######### # debug # ######### @@ -89,9 +82,9 @@ waLBerla_compile_test( FILES math/GenericAABBTest.cpp DEPENDS stencil domain_dec waLBerla_execute_test( NAME GenericAABBTest ) if( WALBERLA_BUILD_WITH_BOOST ) - waLBerla_compile_test( FILES math/PhysicalCheckTest.cpp DEPENDS stencil ) - waLBerla_execute_test( NAME PhysicalCheckTest - COMMAND $<TARGET_FILE:PhysicalCheckTest> ${CMAKE_CURRENT_SOURCE_DIR}/math/PhysicalCheckTestInput.prm ) +waLBerla_compile_test( FILES math/PhysicalCheckTest.cpp DEPENDS stencil ) +waLBerla_execute_test( NAME PhysicalCheckTest + COMMAND $<TARGET_FILE:PhysicalCheckTest> ${CMAKE_CURRENT_SOURCE_DIR}/math/PhysicalCheckTestInput.prm ) endif( WALBERLA_BUILD_WITH_BOOST ) diff --git a/tests/core/config/MultiArrayIOTest.cpp b/tests/core/config/MultiArrayIOTest.cpp index 0a33fe811..515b1071b 100644 --- a/tests/core/config/MultiArrayIOTest.cpp +++ b/tests/core/config/MultiArrayIOTest.cpp @@ -58,4 +58,4 @@ int main( int argc, char ** argv ) return 0; -} +} \ No newline at end of file diff --git a/tests/core/config/PropertyTreeTest.cpp b/tests/core/config/PropertyTreeTest.cpp deleted file mode 100644 index 7b3848a21..000000000 --- a/tests/core/config/PropertyTreeTest.cpp +++ /dev/null @@ -1,69 +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 PropertyTreeTest.cpp -//! \ingroup core -//! \author Christian Godenschwager <christian.godenschwager@fau.de> -// -//====================================================================================================================== - -#include "core/Abort.h" -#include "core/config/Config.h" -#include "core/config/ConfigToBoostPropertyTree.h" -#include "core/debug/TestSubsystem.h" -#include "core/mpi/MPIManager.h" - -#include <boost/property_tree/info_parser.hpp> -#include <boost/property_tree/ptree.hpp> -#include <boost/property_tree/xml_parser.hpp> - - -void write_property_tree( std::ostringstream & ss, const boost::property_tree::iptree & ptree, const std::string & path) -{ - if(ptree.empty()) - ss << path << " = " << ptree.data() << "\n"; - else - for( boost::property_tree::iptree::const_iterator it = ptree.begin(); it != ptree.end(); ++it ) - write_property_tree(ss, it->second, path.empty() ? it->first : path + "." + it->first); -} - -int main( int argc, char** argv ) -{ - walberla::debug::enterTestMode(); - walberla::MPIManager::instance()->initializeMPI(&argc, &argv); - - if( argc != 2 ) - WALBERLA_ABORT( "Wrong number of Arguments!\nUsage: PropertyTreeTest <InputFileName>" ); - - using walberla::Config; - using boost::property_tree::iptree; - - Config config; - - config.readParameterFile( argv[1] ); - - iptree propertyTree = walberla::config::configToBoostPropertyTree( config ); - - std::ostringstream ss; - - //write_xml( ss, propertyTree ); - //write_info( ss, propertyTree ); - - write_property_tree(ss, propertyTree, ""); - - std::cout << ss.str() << std::endl; - - return 0; -} diff --git a/tests/core/math/PhysicalCheckTest.cpp b/tests/core/math/PhysicalCheckTest.cpp index abb019c4a..d92517723 100644 --- a/tests/core/math/PhysicalCheckTest.cpp +++ b/tests/core/math/PhysicalCheckTest.cpp @@ -27,7 +27,6 @@ #include "core/math/PhysicalCheck.h" #include <iostream> -#include <map> #include <string> #include <vector> -- GitLab