Commit d612973e authored by Christian Godenschwager's avatar Christian Godenschwager
Browse files

Merge branch 'cpp14' into 'master'

Replace boost filesystem, any and optional if available in standard library

See merge request walberla/walberla!81
parents 651db8e5 bc684190
......@@ -163,7 +163,8 @@ if( CMAKE_CXX_COMPILER MATCHES "icpc" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "icpc"
ENDIF(XILD)
MARK_AS_ADVANCED(XILD)
if( CMAKE_VERSION VERSION_LESS 3.6.0 )
add_flag ( CMAKE_CXX_FLAGS "-std=c++14" )
set( CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14" )
add_flag ( CMAKE_CXX_FLAGS ${CMAKE_CXX14_STANDARD_COMPILE_OPTION} )
endif()
else()
option ( WALBERLA_CXX_COMPILER_IS_INTEL "Use Intel compiler" OFF )
......@@ -278,9 +279,10 @@ if( WALBERLA_CXX_COMPILER_IS_GNU OR WALBERLA_CXX_COMPILER_IS_INTEL )
add_flag ( CMAKE_CXX_FLAGS "-Wall -Wconversion -Wshadow" )
endif()
# C++11 language features for NEC compiler
# C++ language features for NEC compiler
if( WALBERLA_CXX_COMPILER_IS_NEC )
add_flag ( CMAKE_CXX_FLAGS "-Kcpp14 -Krtti -Kexceptions -size_t64 -Kgcc" )
set( CMAKE_CXX14_STANDARD_COMPILE_OPTION "-Kcpp14" )
add_flag ( CMAKE_CXX_FLAGS "${CMAKE_CXX14_STANDARD_COMPILE_OPTION} -Krtti -Kexceptions -size_t64 -Kgcc" )
add_flag ( CMAKE_CXX_FLAGS "-D__BIG_ENDIAN -D__BYTE_ORDER=__BIG_ENDIAN" )
add_flag ( CMAKE_CXX_FLAGS "-Tnoauto,used" )
add_flag ( CMAKE_EXE_LINKER_FLAGS "-Wl,-h,muldefs" )
......@@ -436,6 +438,70 @@ endif()
############################################################################################################################
##
## Find optional C++ libraries
##
############################################################################################################################
try_compile( WALBERLA_USE_STD_FILESYSTEM "${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/cmake/TestStdFilesystem.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_FILESYSTEM ${CMAKE_CXX14_STANDARD_COMPILE_OPTION} )
if( WALBERLA_USE_STD_FILESYSTEM )
message( STATUS "Found std::filesystem")
else()
try_compile( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM "${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/cmake/TestStdFilesystem.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM ${CMAKE_CXX14_STANDARD_COMPILE_OPTION} )
if( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
message( STATUS "Found std::experimental::filesystem")
endif()
if( NOT WALBERLA_CXX_COMPILER_IS_MSVC AND NOT WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
unset( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM CACHE )
try_compile( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM "${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/cmake/TestStdFilesystem.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM ${CMAKE_CXX14_STANDARD_COMPILE_OPTION}
LINK_LIBRARIES stdc++fs )
if( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
message( STATUS "Found std::experimental::filesystem in libstdc++fs")
list ( APPEND SERVICE_LIBS -lstdc++fs )
endif()
endif()
if( NOT WALBERLA_CXX_COMPILER_IS_MSVC AND NOT WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
unset( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM CACHE )
try_compile( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM "${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/cmake/TestStdFilesystem.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM ${CMAKE_CXX14_STANDARD_COMPILE_OPTION}
LINK_LIBRARIES c++experimental )
if( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
message( STATUS "Found std::experimental::filesystem in libc++experimental")
list ( APPEND SERVICE_LIBS -lc++experimental )
endif()
endif()
endif()
try_compile( WALBERLA_USE_STD_ANY "${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/cmake/TestStdAny.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_ANY ${CMAKE_CXX14_STANDARD_COMPILE_OPTION} )
if( WALBERLA_USE_STD_ANY )
message( STATUS "Found std::any")
else()
try_compile( WALBERLA_USE_STD_EXPERIMENTAL_ANY "${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/cmake/TestStdAny.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_EXPERIMENTAL_ANY ${CMAKE_CXX14_STANDARD_COMPILE_OPTION} )
if( WALBERLA_USE_STD_EXPERIMENTAL_ANY )
message( STATUS "Found std::experimental::any")
endif()
endif()
try_compile( WALBERLA_USE_STD_OPTIONAL "${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/cmake/TestStdOptional.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_OPTIONAL ${CMAKE_CXX14_STANDARD_COMPILE_OPTION} )
if( WALBERLA_USE_STD_OPTIONAL )
message( STATUS "Found std::optional")
else()
try_compile( WALBERLA_USE_STD_EXPERIMENTAL_OPTIONAL "${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/cmake/TestStdOptional.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_EXPERIMENTAL_OPTIONAL ${CMAKE_CXX14_STANDARD_COMPILE_OPTION} )
if( WALBERLA_USE_STD_EXPERIMENTAL_OPTIONAL )
message( STATUS "Found std::experimental::optional")
endif()
endif()
############################################################################################################################
##
## Visual Studio Setup
......@@ -574,7 +640,11 @@ endif()
#############################################################################################################################
set ( waLBerla_REQUIRED_MIN_BOOST_VERSION "1.48")
list ( APPEND waLBerla_REQUIRED_BOOST_COMPONENTS filesystem system )
if ( NOT WALBERLA_USE_STD_FILESYSTEM AND NOT WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
list ( APPEND waLBerla_REQUIRED_BOOST_COMPONENTS filesystem system )
else()
list ( APPEND waLBerla_OPTIONAL_BOOST_COMPONENTS system )
endif()
if ( WALBERLA_BUILD_WITH_PYTHON AND WALBERLA_CXX_COMPILER_IS_MSVC )
list( APPEND waLBerla_REQUIRED_BOOST_COMPONENTS python3 )
......@@ -601,14 +671,14 @@ if ( NOT BOOST_ROOT )
endforeach ( )
endif ( )
find_package ( Boost ${waLBerla_REQUIRED_MIN_BOOST_VERSION} COMPONENTS ${waLBerla_REQUIRED_BOOST_COMPONENTS} QUIET )
find_package ( Boost ${waLBerla_REQUIRED_MIN_BOOST_VERSION} COMPONENTS ${waLBerla_REQUIRED_BOOST_COMPONENTS} OPTIONAL_COMPONENTS ${waLBerla_OPTIONAL_BOOST_COMPONENTS} QUIET )
if( NOT Boost_FOUND )
message ( WARNING
"The specified configuration of the BOOST libraries was not found on your system! Now trying some other configuration..." )
foreach ( Boost_USE_STATIC_LIBS ON OFF )
foreach ( Boost_USE_MULTITHREADED ON OFF )
find_package ( Boost ${waLBerla_REQUIRED_MIN_BOOST_VERSION} COMPONENTS ${waLBerla_REQUIRED_BOOST_COMPONENTS} QUIET )
find_package ( Boost ${waLBerla_REQUIRED_MIN_BOOST_VERSION} COMPONENTS ${waLBerla_REQUIRED_BOOST_COMPONENTS} OPTIONAL_COMPONENTS ${waLBerla_OPTIONAL_BOOST_COMPONENTS} QUIET )
if ( Boost_FOUND )
set ( Boost_USE_STATIC_LIBS ${Boost_USE_STATIC_LIBS} CACHE BOOL "Use boost static libraries" FORCE )
set ( Boost_USE_MULTITHREADED ${Boost_USE_MULTITHREADED} CACHE BOOL "Use boost multithreaded libraries" FORCE )
......@@ -631,8 +701,10 @@ if ( Boost_FOUND )
else()
include_directories ( SYSTEM ${Boost_INCLUDE_DIRS} )
endif()
link_directories ( ${Boost_LIBRARY_DIRS} )
list ( APPEND SERVICE_LIBS ${Boost_LIBRARIES} )
if( waLBerla_REQUIRED_BOOST_COMPONENTS )
link_directories ( ${Boost_LIBRARY_DIRS} )
list ( APPEND SERVICE_LIBS ${Boost_LIBRARIES} )
endif()
add_definitions ( -DBOOST_ALL_NO_LIB ) # Disable Boost auto-linking (CMAKE does that for us...)
#fix for static lib usage: http://stackoverflow.com/questions/11812463/boost-python-link-errors-under-windows-msvc10
......@@ -649,7 +721,7 @@ if ( Boost_FOUND )
else( Boost_FOUND )
# Search again, this time with the REQUIRED option. This will give a CMAKE error and a detailed error message for the user
find_package ( Boost ${waLBerla_REQUIRED_MIN_BOOST_VERSION} REQUIRED ${waLBerla_REQUIRED_BOOST_COMPONENTS} )
find_package ( Boost ${waLBerla_REQUIRED_MIN_BOOST_VERSION} REQUIRED ${waLBerla_REQUIRED_BOOST_COMPONENTS} OPTIONAL_COMPONENTS ${waLBerla_OPTIONAL_BOOST_COMPONENTS} )
endif( Boost_FOUND )
......
......@@ -944,9 +944,9 @@ int main( int argc, char **argv )
WALBERLA_LOG_INFO_ON_ROOT("Basefolder for simulation results: " << basefolder);
// create base directory if it does not yet exist
boost::filesystem::path tpath( basefolder );
if( !boost::filesystem::exists( tpath ) )
boost::filesystem::create_directory( tpath );
filesystem::path tpath( basefolder );
if( !filesystem::exists( tpath ) )
filesystem::create_directory( tpath );
// setup of the LBM communication for synchronizing the pdf field between neighboring blocks
std::function< void () > commFunction;
......@@ -1255,9 +1255,9 @@ int main( int argc, char **argv )
pdfFieldVTK->addBeforeFunction(VTKInfoLogger( &timeloop, blocks, bodyStorageID, basefolder, uInfty ));
// create folder for log_vtk files to not pollute the basefolder
boost::filesystem::path tpath2( basefolder+"/log_vtk" );
if( !boost::filesystem::exists( tpath2 ) )
boost::filesystem::create_directory( tpath2 );
filesystem::path tpath2( basefolder+"/log_vtk" );
if( !filesystem::exists( tpath2 ) )
filesystem::create_directory( tpath2 );
field::FlagFieldCellFilter< FlagField_T > fluidFilter( flagFieldID );
......
......@@ -1285,7 +1285,7 @@ public:
markEmptyBlocks_( markEmptyBlocks ), state_( state )
{}
void operator()( std::vector< std::pair< const PhantomBlock *, boost::any > > & blockData, const PhantomBlockForest & )
void operator()( std::vector< std::pair< const PhantomBlock *, walberla::any > > & blockData, const PhantomBlockForest & )
{
for( auto it = blockData.begin(); it != blockData.end(); ++it )
{
......@@ -1309,7 +1309,7 @@ struct Pseudo2DPhantomWeightPackUnpack
buffer << block.getData< Pseudo2DPhantomWeight >().weight();
}
void operator()( mpi::RecvBuffer & buffer, const PhantomBlock &, boost::any & data )
void operator()( mpi::RecvBuffer & buffer, const PhantomBlock &, walberla::any & data )
{
Pseudo2DPhantomWeight::weight_t w;
buffer >> w;
......
......@@ -740,9 +740,9 @@ int main( int argc, char **argv ) {
if( !funcTest )
{
// create base directory if it does not yet exist
boost::filesystem::path tpath( vtkBaseFolder );
if( !boost::filesystem::exists( tpath ) )
boost::filesystem::create_directory( tpath );
filesystem::path tpath( vtkBaseFolder );
if( !filesystem::exists( tpath ) )
filesystem::create_directory( tpath );
}
......
......@@ -21,17 +21,16 @@
#include "geometry/mesh/TriangleMesh.h"
#include "geometry/mesh/TriangleMeshIO.h"
#include "core/Regex.h"
#include "core/Filesystem.h"
#include <fstream>
#include <iomanip>
#include <iostream>
#define BOOST_FILESYSTEM_NO_DEPRECATED
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
namespace fs = boost::filesystem;
namespace filesystem = walberla::filesystem;
bool verbose;
bool quiet;
......@@ -90,29 +89,29 @@ int main(int argc, char** argv)
if( quiet && verbose )
PRINT_ERR( "PovrayFileCompressor can't be quiet (-q) and verbose (-v) at the same time\n" )
fs::path inPath(argv[argc-2]);
if( !fs::exists(inPath) || !fs::is_directory(inPath) )
filesystem::path inPath(argv[argc-2]);
if( !filesystem::exists(inPath) || !filesystem::is_directory(inPath) )
PRINT_ERR( "Path " << inPath << " does not exist or is not a directory!\n" );
fs::path outPath(argv[argc-1]);
if( !fs::exists(outPath) )
fs::create_directories(outPath);
filesystem::path outPath(argv[argc-1]);
if( !filesystem::exists(outPath) )
filesystem::create_directories(outPath);
PRINT_DEF( "Input Path: " << inPath << "\nOutput Path: " << outPath << "\n" )
std::vector< std::vector<fs::path> > infiles;
std::vector< std::vector<filesystem::path> > infiles;
PRINT_DEF( "Collecting files to compress ..." )
for(auto pit = fs::directory_iterator(inPath); pit != fs::directory_iterator(); ++pit)
for(auto pit = filesystem::directory_iterator(inPath); pit != filesystem::directory_iterator(); ++pit)
{
if( !fs::is_directory( pit->status() ) )
if( !filesystem::is_directory( pit->status() ) )
continue;
PRINT_VER( "\nCollecting files to compress in: " << pit->path())
std::vector<fs::path> pfiles;
for(auto tit = fs::directory_iterator(pit->path()); tit != fs::directory_iterator(); ++tit)
std::vector<filesystem::path> pfiles;
for(auto tit = filesystem::directory_iterator(pit->path()); tit != filesystem::directory_iterator(); ++tit)
{
static const walberla::regex extensionExpression("\\.dat");
if( walberla::regex_match( tit->path().extension().string(), extensionExpression ) )
......@@ -140,14 +139,14 @@ int main(int argc, char** argv)
{
PRINT_VER( "Compress timestep " << t << "\n" )
PRINT_VER( "Merge Splitted Meshes: \n" )
PRINT_VER( "Merge Mesh: " << fs::absolute(infiles[0][t]).string().c_str() << "\n" )
std::ifstream is( fs::absolute(infiles[0][t]).string().c_str() );
PRINT_VER( "Merge Mesh: " << filesystem::absolute(infiles[0][t]).string().c_str() << "\n" )
std::ifstream is( filesystem::absolute(infiles[0][t]).string().c_str() );
walberla::geometry::readMeshPov(is, mesh, true);
is.close();
for( size_t p = 1u; p < processes; ++p ){
PRINT_VER( "Merge Mesh: " << fs::absolute(infiles[p][t]).string().c_str() << "\n" )
std::ifstream tis( fs::absolute(infiles[p][t]).string().c_str() );
PRINT_VER( "Merge Mesh: " << filesystem::absolute(infiles[p][t]).string().c_str() << "\n" )
std::ifstream tis( filesystem::absolute(infiles[p][t]).string().c_str() );
walberla::geometry::readMeshPov(tis, mesh, false);
tis.close();
}
......@@ -172,7 +171,7 @@ int main(int argc, char** argv)
}
}
fs::path oPath = fs::absolute(outPath) / infiles[0][t].filename();
filesystem::path oPath = filesystem::absolute(outPath) / infiles[0][t].filename();
PRINT_VER( "Write New Mesh File: " << (oPath.string().c_str()) << "\n" )
std::ofstream os( oPath.string().c_str() );
walberla::geometry::writeMeshPov( os, mesh, 0u, n );
......
#include <iostream>
#if defined(WALBERLA_USE_STD_ANY)
#include <any>
#elif defined(WALBERLA_USE_STD_EXPERIMENTAL_ANY)
#include <experimental/any>
#endif
int main() {
#if defined(WALBERLA_USE_STD_ANY)
auto a = std::any(42);
#elif defined(WALBERLA_USE_STD_EXPERIMENTAL_ANY)
auto a = std::experimental::any(42);
#endif
std::cout << std::experimental::any_cast<int>(a) << std::endl;
return 0;
}
#include <iostream>
#if defined(WALBERLA_USE_STD_FILESYSTEM)
#include <filesystem>
#elif defined(WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM)
#include <experimental/filesystem>
#endif
int main() {
#if defined(WALBERLA_USE_STD_FILESYSTEM)
std::filesystem::path p("/tmp/test.txt");
#elif defined(WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM)
std::experimental::filesystem::path p("/tmp/test.txt");
#endif
std::cout << p.extension().string() << std::endl;
return 0;
}
#include <iostream>
#if defined(WALBERLA_USE_STD_OPTIONAL)
#include <optional>
#elif defined(WALBERLA_USE_STD_EXPERIMENTAL_OPTIONAL)
#include <experimental/optional>
#endif
int main() {
#if defined(WALBERLA_USE_STD_OPTIONAL)
auto a = std::optional<int>();
auto b = std::optional<int>(42);
#elif defined(WALBERLA_USE_STD_EXPERIMENTAL_OPTIONAL)
auto a = std::experimental::optional<int>();
auto b = std::experimental::optional<int>(42);
#endif
if (b)
std::cout << a.value_or(b.value()) << std::endl;
return 0;
}
......@@ -28,11 +28,10 @@
#include "core/debug/Debug.h"
#include "core/math/AABB.h"
#include "core/uid/SUID.h"
#include "core/Any.h"
#include <vector>
#include <boost/any.hpp>
namespace walberla {
......@@ -86,7 +85,7 @@ public:
void addData( const T & data ) { data_ = data; }
template< typename T >
T getData() const { return boost::any_cast<T>( data_ ); }
T getData() const { return walberla::any_cast<T>( data_ ); }
bool hasData() const { return !(data_.empty()); }
......@@ -143,7 +142,7 @@ private:
uint_t level_;
// set by the user/application via callback
boost::any data_;
walberla::any data_;
std::vector< NeighborBlock* > neighborhoodSection_[26]; // the 26 neighborhood sections (can be restored from 'neighborhood_')
std::vector< NeighborBlock > neighborhood_; // all neighbor blocks
......
......@@ -256,13 +256,13 @@ void PhantomBlockForest::assignBlockData( const PhantomBlockDataAssignmentFuncti
{
if( function )
{
std::vector< std::pair< const PhantomBlock *, boost::any > > blockData;
std::vector< std::pair< const PhantomBlock *, walberla::any > > blockData;
for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
{
auto & block = it->second;
WALBERLA_ASSERT_NOT_NULLPTR( block.get() );
blockData.push_back( std::make_pair( block.get(), boost::any() ) );
blockData.push_back( std::make_pair( block.get(), walberla::any() ) );
}
function( blockData, *this );
......@@ -484,7 +484,7 @@ void PhantomBlockForest::migrate( const PhantomBlockDataPackFunction & packBlock
if( unpackBlockData )
{
WALBERLA_ASSERT( static_cast<bool>(packBlockData) );
boost::any data;
walberla::any data;
unpackBlockData( buffer, *phantom, data );
phantom->addData( data );
}
......
......@@ -45,7 +45,7 @@ public:
typedef std::function< Set<SUID> ( const std::vector< std::pair< BlockID, Set<SUID> > > & source, const BlockID & destintation ) >
BlockStateDeterminationFunction;
typedef std::function< void ( std::vector< std::pair< const PhantomBlock *, boost::any > > & blockData,
typedef std::function< void ( std::vector< std::pair< const PhantomBlock *, walberla::any > > & blockData,
const PhantomBlockForest & phantomForest ) >
PhantomBlockDataAssignmentFunction;
......@@ -58,7 +58,7 @@ public:
MigrationPreparationFunction; // = load balancing
typedef std::function< void ( mpi::SendBuffer & buffer, const PhantomBlock & block ) > PhantomBlockDataPackFunction;
typedef std::function< void ( mpi::RecvBuffer & buffer, const PhantomBlock & block, boost::any & data ) > PhantomBlockDataUnpackFunction;
typedef std::function< void ( mpi::RecvBuffer & buffer, const PhantomBlock & block, walberla::any & data ) > PhantomBlockDataUnpackFunction;
......
......@@ -119,7 +119,7 @@ struct DynamicParMetisBlockInfoPackUnpack
block.getData< DynamicParMetisBlockInfo >().toBuffer( buffer );
}
void operator()( mpi::RecvBuffer & buffer, const PhantomBlock &, boost::any & data )
void operator()( mpi::RecvBuffer & buffer, const PhantomBlock &, walberla::any & data )
{
data = DynamicParMetisBlockInfo( buffer );
}
......
......@@ -53,7 +53,7 @@ struct PODPhantomWeightPackUnpack
buffer << block.getData< PODPhantomWeight<T> >().weight();
}
void operator()( mpi::RecvBuffer & buffer, const PhantomBlock &, boost::any & data )
void operator()( mpi::RecvBuffer & buffer, const PhantomBlock &, walberla::any & data )
{
typename PODPhantomWeight<T>::weight_t w;
buffer >> w;
......
//======================================================================================================================
//
// 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 Any.h
//! \ingroup core
//! \author Michael Kuron <mkuron@icp.uni-stuttgart.de>
//
//======================================================================================================================
#pragma once
#if defined(WALBERLA_USE_STD_ANY)
#include <any>
#elif defined(WALBERLA_USE_STD_EXPERIMENTAL_ANY)
#include <experimental/any>
#else
#include <boost/any.hpp>
#endif
namespace walberla {
#if defined(WALBERLA_USE_STD_ANY)
using std::any;
using std::any_cast;
#elif defined(WALBERLA_USE_STD_EXPERIMENTAL_ANY)
using std::experimental::any;
using std::experimental::any_cast;
#else
using boost::any;
using boost::any_cast;
#endif
}
//======================================================================================================================
//
// 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 Filesystem.h
//! \ingroup core
//! \author Michael Kuron <mkuron@icp.uni-stuttgart.de>
//
//======================================================================================================================
#pragma once
#if defined(WALBERLA_USE_STD_FILESYSTEM)
#include <filesystem>
#elif defined(WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM)
#include <experimental/filesystem>
#else
#include <boost/filesystem.hpp>
#endif
namespace walberla {
namespace filesystem {
#if defined(WALBERLA_USE_STD_FILESYSTEM)
using namespace std::filesystem;
#elif defined(WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM)
using namespace std::experimental::filesystem;
#else
using namespace boost::filesystem;
#endif
}
}
//======================================================================================================================
//
// 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) OPTIONAL later version.
//
// waLBerla is distributed in the hope that it will be useful, but WITHOUT
// OPTIONAL 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 Optional.h
//! \ingroup core
//! \author Michael Kuron <mkuron@icp.uni-stuttgart.de>
//
//======================================================================================================================
#pragma once
#if defined(WALBERLA_USE_STD_OPTIONAL)
#include <optional>
#elif defined(WALBERLA_USE_STD_EXPERIMENTAL_OPTIONAL)
#include <experimental/optional>
#else
#include <boost/optional.hpp>
#endif
namespace walberla {
#if defined(WALBERLA_USE_STD_OPTIONAL)
using std::optional;
using std::nullopt;
#elif defined(WALBERLA_USE_STD_EXPERIMENTAL_OPTIONAL)
using std::experimental::optional;
using std::experimental::nullopt;
#else
using boost::optional;
const boost::none_t nullopt = boost::none;
#endif
}
......@@ -262,7 +262,7 @@ void Config::parseFromFile( const char* filename, Block& block, unsigned int lev
}
else {
removeTrailingWhiteSpaces( value );
std::string file( (boost::filesystem::path( getDirectory( filename ) ) / value).string() );
std::string file( (filesystem::path( getDirectory( filename ) ) / value).string() );
parseFromFile( file.c_str(), block, level+1 );
}
}
......@@ -395,7 +395,7 @@ void Config::extractBlock( const char* filename, std::stringstream& input, Block
}
else {
removeTrailingWhiteSpaces( value );
std::string file( (boost::filesystem::path( getDirectory( filename ) ) / value).string() );
std::string file( (filesystem::path( getDirectory( filename ) ) / value).string() );
parseFromFile( file.c_str(), block, level+1 );
}
}
......