diff --git a/optimizer/Simulation/GenerateOpalSimulation.h b/optimizer/Simulation/GenerateOpalSimulation.h index d8460fe3632b16153a0df31af143d19509419208..632fb695383c57894c219278429e641f4c92458d 100644 --- a/optimizer/Simulation/GenerateOpalSimulation.h +++ b/optimizer/Simulation/GenerateOpalSimulation.h @@ -144,7 +144,7 @@ private: */ void fillDictionary() { - namespace fs = boost::filesystem; + namespace fs = std::filesystem; fs::path pwd = fs::current_path(); if (!fs::exists(varDictionary_) || fs::is_empty(varDictionary_)) diff --git a/src/Algorithms/OrbitThreader.cpp b/src/Algorithms/OrbitThreader.cpp index 9c06403e3718552b8f3aad2009ac2ba3fd768457..43c868955e61b6670003ea3239a5d1940751e009 100644 --- a/src/Algorithms/OrbitThreader.cpp +++ b/src/Algorithms/OrbitThreader.cpp @@ -73,7 +73,7 @@ OrbitThreader::OrbitThreader(const PartData &ref, opal->getInputBasename() + "_DesignPath.dat" }); if (opal->getOpenMode() == OpalData::OpenMode::WRITE || - !boost::filesystem::exists(fileName)) { + !std::filesystem::exists(fileName)) { logger_m.open(fileName); logger_m << "#" << std::setw(17) << "1 - s" diff --git a/src/Algorithms/ParallelCyclotronTracker.cpp b/src/Algorithms/ParallelCyclotronTracker.cpp index 015d6e4ce3134107ae0dc09eaf615e18bd6806ae..b1d7825d1c311842e08d42a84ae6488dd866b4cf 100644 --- a/src/Algorithms/ParallelCyclotronTracker.cpp +++ b/src/Algorithms/ParallelCyclotronTracker.cpp @@ -1053,7 +1053,7 @@ void ParallelCyclotronTracker::visitVacuum(const Vacuum& vac) { *gmsg << "* Residual gas = " << gas << endl; double pressure = elptr->getPressure(); - if ( boost::filesystem::exists(elptr->getPressureMapFN()) ) { + if ( std::filesystem::exists(elptr->getPressureMapFN()) ) { std::string pmfn = elptr->getPressureMapFN(); *gmsg << "* Pressure field map file = '" << pmfn << "'" << endl; *gmsg << "* Default pressure = " << pressure << " [mbar]" << endl; diff --git a/src/Amr/AmrYtWriter.cpp b/src/Amr/AmrYtWriter.cpp index 0a5bed7de31d85bfaca15d3aabf71e38b37764b4..27fe5655fd9e121e9c9e3f2d4b92f8cb663738a5 100644 --- a/src/Amr/AmrYtWriter.cpp +++ b/src/Amr/AmrYtWriter.cpp @@ -67,11 +67,11 @@ AmrYtWriter::AmrYtWriter(int step, int bin) { realData_m[idx++] ="magnetic_field_y"; realData_m[idx++] ="magnetic_field_z"; - namespace fs = boost::filesystem; + namespace fs = std::filesystem; fs::path dir = OpalData::getInstance()->getInputBasename(); std::string dataDir = OpalData::getInstance()->getAuxiliaryOutputDirectory(); - boost::filesystem::path path = dir.parent_path() / dataDir / "amr" / "yt"; + std::filesystem::path path = dir.parent_path() / dataDir / "amr" / "yt"; dir_m = amrex::Concatenate((path / "plt").string(), step, 10); dir_m += "-"; dir_m = amrex::Concatenate(dir_m, bin, 3); diff --git a/src/BasicActions/DumpEMFields.cpp b/src/BasicActions/DumpEMFields.cpp index b114c1f476927a0bf1c32458570620327416eb5d..4f0c028822f553db7d90b1ccb0e4e3a5776c5d3c 100644 --- a/src/BasicActions/DumpEMFields.cpp +++ b/src/BasicActions/DumpEMFields.cpp @@ -292,7 +292,7 @@ void DumpEMFields::writeFieldThis(Component* field) { *gmsg << *this << endl; std::string fname; - if (boost::filesystem::path(filename_m).is_absolute() == true) { + if (std::filesystem::path(filename_m).is_absolute() == true) { fname = filename_m; } else { fname = Util::combineFilePath({ diff --git a/src/BasicActions/DumpFields.cpp b/src/BasicActions/DumpFields.cpp index 3103a69c54a020d0e1a9996502e70dbae14fd3e2..6547544aafe6be7a4b76163c52aa423c7fee0537 100644 --- a/src/BasicActions/DumpFields.cpp +++ b/src/BasicActions/DumpFields.cpp @@ -146,7 +146,7 @@ void DumpFields::writeFieldThis(Component* field) { *gmsg << *this << endl; std::string fname; - if (boost::filesystem::path(filename_m).is_absolute() == true) { + if (std::filesystem::path(filename_m).is_absolute() == true) { fname = filename_m; } else { fname = Util::combineFilePath({ diff --git a/src/Classic/AbsBeamline/Cyclotron.cpp b/src/Classic/AbsBeamline/Cyclotron.cpp index 01207240ff4928df54fddb6015f108fc8d683305..c70a821cc8748cfab9f89ee8c5f1bed64753572b 100644 --- a/src/Classic/AbsBeamline/Cyclotron.cpp +++ b/src/Classic/AbsBeamline/Cyclotron.cpp @@ -186,7 +186,7 @@ std::string Cyclotron::getFieldMapFN() const { throw GeneralClassicException( "Cyclotron::getFieldMapFN", "The attribute FMAPFN isn't set for the CYCLOTRON element"); - } else if (boost::filesystem::exists(fmapfn_m)) { + } else if (std::filesystem::exists(fmapfn_m)) { return fmapfn_m; } else { throw GeneralClassicException("Cyclotron::getFieldMapFN", diff --git a/src/Classic/AbsBeamline/ElementBase.cpp b/src/Classic/AbsBeamline/ElementBase.cpp index 869d23628c5e76d5f562b5e2836d64e0de75fa68..daeb171572dc1d1b2a9f0ad814b14c8311e75393 100644 --- a/src/Classic/AbsBeamline/ElementBase.cpp +++ b/src/Classic/AbsBeamline/ElementBase.cpp @@ -66,9 +66,7 @@ #include "Solvers/ParticleMatterInteractionHandler.h" #include "Solvers/WakeFunction.h" #include "Structure/BoundaryGeometry.h" - -#include <boost/filesystem.hpp> - +#include <filesystem> const std::map<ElementType, std::string> ElementBase::elementTypeToString_s = { {ElementType::ANY, "Any"}, @@ -180,7 +178,7 @@ std::string ElementBase::getOutputFN() const { if (outputfn_m.empty()) { return getName(); } else { - boost::filesystem::path filePath(outputfn_m); + std::filesystem::path filePath(outputfn_m); return filePath.replace_extension().native(); } } diff --git a/src/Classic/AbsBeamline/Monitor.cpp b/src/Classic/AbsBeamline/Monitor.cpp index 37ec547ee48219500076bfb09ad8bc8ce0d16af3..0cccf0e84faed866f68aaf4400257c88e4468a88 100644 --- a/src/Classic/AbsBeamline/Monitor.cpp +++ b/src/Classic/AbsBeamline/Monitor.cpp @@ -164,7 +164,7 @@ void Monitor::initialise(PartBunchBase<double, 3> *bunch, double &startField, do if (OpalData::getInstance()->getOpenMode() == OpalData::OpenMode::WRITE || currentPosition < startField) { - namespace fs = boost::filesystem; + namespace fs = std::filesystem; fs::path lossFileName = fs::path(filename_m + ".h5"); if (fs::exists(lossFileName)) { diff --git a/src/Classic/AbsBeamline/RFCavity.cpp b/src/Classic/AbsBeamline/RFCavity.cpp index e1a15560d0caedcc2a64325fe0ef9020b36cb74b..60e76d924248bef080925e47d9c5f65fc74a4c9e 100644 --- a/src/Classic/AbsBeamline/RFCavity.cpp +++ b/src/Classic/AbsBeamline/RFCavity.cpp @@ -347,7 +347,7 @@ std::string RFCavity::getFieldMapFN() const { throw GeneralClassicException("RFCavity::getFieldMapFN", "The attribute \"FMAPFN\" isn't set " "for the \"RFCAVITY\" element!"); - } else if (boost::filesystem::exists(filename_m)) { + } else if (std::filesystem::exists(filename_m)) { return filename_m; } else { throw GeneralClassicException("RFCavity::getFieldMapFN", diff --git a/src/Classic/AbsBeamline/Vacuum.cpp b/src/Classic/AbsBeamline/Vacuum.cpp index ea902932bd027a6f559b35682b70e5f29fc9b55b..e8abe0e890962f6611816fb69b2e0827d35838a2 100644 --- a/src/Classic/AbsBeamline/Vacuum.cpp +++ b/src/Classic/AbsBeamline/Vacuum.cpp @@ -249,7 +249,7 @@ void Vacuum::initialise(PartBunchBase<double, 3>* bunch) { updateParticleAttributes(); - if (boost::filesystem::exists(pmapfn_m)) { + if (std::filesystem::exists(pmapfn_m)) { getPressureFromFile(); // calculate the radii of initial grid. initR(PP_m.rmin_m, PP_m.delr_m, PField_m.nrad_m); diff --git a/src/Classic/Fields/Fieldmap.cpp b/src/Classic/Fields/Fieldmap.cpp index 552d9e4f9d1799bfec23a4ac4261145b4aa0dbba..5bcb8416cdb1cb9617d88287c3654b3f037c1b06 100644 --- a/src/Classic/Fields/Fieldmap.cpp +++ b/src/Classic/Fields/Fieldmap.cpp @@ -41,7 +41,7 @@ #include <fstream> #include <ios> -namespace fs = boost::filesystem; +namespace fs = std::filesystem; #define REGISTER_PARSE_TYPE(X) template <> struct _Fieldmap::TypeParseTraits<X> \ { static const char* name; } ; const char* _Fieldmap::TypeParseTraits<X>::name = #X @@ -744,7 +744,7 @@ void _Fieldmap::write3DField(unsigned int nx, if (Ippl::myNode() != 0 || (ef.size() != numpoints && bf.size() != numpoints)) return; - boost::filesystem::path p(Filename_m); + std::filesystem::path p(Filename_m); std::string fname = Util::combineFilePath({ OpalData::getInstance()->getAuxiliaryOutputDirectory(), p.stem().string() + ".vtk" diff --git a/src/Classic/Structure/LossDataSink.cpp b/src/Classic/Structure/LossDataSink.cpp index 853fdc7888b647008e43f81b945829d97954aadf..40061695a94e2b3a36817b22bf15425afe5422a1 100644 --- a/src/Classic/Structure/LossDataSink.cpp +++ b/src/Classic/Structure/LossDataSink.cpp @@ -332,7 +332,7 @@ void LossDataSink::save(unsigned int numSets, OpalData::OpenMode openMode) { openMode = OpalData::getInstance()->getOpenMode(); } - namespace fs = boost::filesystem; + namespace fs = std::filesystem; if (h5hut_mode_m) { fileName_m = outputName_m + std::string(".h5"); if (openMode == OpalData::OpenMode::WRITE || !fs::exists(fileName_m)) { diff --git a/src/Classic/Utilities/MSLang/Mask.cpp b/src/Classic/Utilities/MSLang/Mask.cpp index ec70fa947a9a452daa04abd62acfe0ba8acb73b2..262dd22f15ba872aa38897554ad9b8d0a48103e8 100644 --- a/src/Classic/Utilities/MSLang/Mask.cpp +++ b/src/Classic/Utilities/MSLang/Mask.cpp @@ -127,7 +127,7 @@ namespace mslang { filename = filename.substr(1, filename.length() - 2); } - if (!boost::filesystem::exists(filename)) { + if (!std::filesystem::exists(filename)) { ERRORMSG("file '" << filename << "' doesn't exists" << endl); return false; } diff --git a/src/Classic/Utilities/Util.cpp b/src/Classic/Utilities/Util.cpp index 72e73b14eca7255054d64d4031c6f858739798b4..b13ef3c1625cbc9b6609b4f2bdb07fb8af39db70 100644 --- a/src/Classic/Utilities/Util.cpp +++ b/src/Classic/Utilities/Util.cpp @@ -195,7 +195,7 @@ namespace Util { } std::string combineFilePath(std::initializer_list<std::string> ilist) { - boost::filesystem::path path; + std::filesystem::path path; for (auto entry : ilist) { path /= entry; } diff --git a/src/Distribution/ClosedOrbitFinder.h b/src/Distribution/ClosedOrbitFinder.h index 5f900a15d171f9efedc1e79e554c9d4b512c605e..4eec5971c149691fa9c21e72e9f8cb7defe7a92f 100644 --- a/src/Distribution/ClosedOrbitFinder.h +++ b/src/Distribution/ClosedOrbitFinder.h @@ -456,7 +456,7 @@ bool ClosedOrbitFinder<Value_type, Size_type, Stepper>::findOrbit(value_type acc E_fin = cycl_m->getFMHighE(); } - namespace fs = boost::filesystem; + namespace fs = std::filesystem; fs::path dir = OpalData::getInstance()->getInputBasename(); dir = dir.parent_path() / OpalData::getInstance()->getAuxiliaryOutputDirectory(); std::string tunefile = (dir / "tunes.dat").string(); diff --git a/src/Distribution/Distribution.cpp b/src/Distribution/Distribution.cpp index 93468bd9af0daf6f712e9a90546fda1d5ed9e1bf..a2a91b71fc839aa1d239e5428b3ea26382730b05 100644 --- a/src/Distribution/Distribution.cpp +++ b/src/Distribution/Distribution.cpp @@ -1036,7 +1036,7 @@ void Distribution::createDistributionFromFile(size_t /*numberOfParticles*/, doub // Data input file is only read by node 0. std::ifstream inputFile; std::string fileName = Attributes::getString(itsAttr[Attrib::Distribution::FNAME]); - if (!boost::filesystem::exists(fileName)) { + if (!std::filesystem::exists(fileName)) { throw OpalException( "Distribution::createDistributionFromFile", "Open file operation failed, please check if '" + fileName + "' really exists."); diff --git a/src/Distribution/LaserProfile.cpp b/src/Distribution/LaserProfile.cpp index ce17907721b0d3d7d6791cb0e4a89ca8a5b083c3..4d11369d1ffcbb3dd7ef3fbb521f81ffb3e48bc1 100644 --- a/src/Distribution/LaserProfile.cpp +++ b/src/Distribution/LaserProfile.cpp @@ -82,7 +82,7 @@ LaserProfile::~LaserProfile() { unsigned short * LaserProfile::readFile(const std::string &fileName, const std::string &imageName) { - namespace fs = boost::filesystem; + namespace fs = std::filesystem; if (!fs::exists(fileName)) { throw OpalException("LaserProfile::readFile", "given file '" + fileName + "' does not exist"); diff --git a/src/Distribution/SigmaGenerator.cpp b/src/Distribution/SigmaGenerator.cpp index a71a483f2dc608b56afc53a3593b575290bd9f23..bd511e11c704a7d2afd1dd3a8451c0a3e393ec02 100644 --- a/src/Distribution/SigmaGenerator.cpp +++ b/src/Distribution/SigmaGenerator.cpp @@ -209,8 +209,8 @@ bool SigmaGenerator::match(double accuracy, OpalData::getInstance()->getAuxiliaryOutputDirectory(), "maps" }); - if (!boost::filesystem::exists(fpath)) { - boost::filesystem::create_directory(fpath); + if (!std::filesystem::exists(fpath)) { + std::filesystem::create_directory(fpath); } std::pair<double,double> tunes = cof.getTunes(); diff --git a/src/Elements/OpalBeamline.cpp b/src/Elements/OpalBeamline.cpp index bac23d44b4aeada47439a07762f7a53d8c70fd69..e3e5422efddbba29d4e8b139ddea9b319a18f6b1 100644 --- a/src/Elements/OpalBeamline.cpp +++ b/src/Elements/OpalBeamline.cpp @@ -365,7 +365,7 @@ void OpalBeamline::save3DLattice() { OpalData::getInstance()->getInputBasename() + "_ElementPositions.txt" }); if (OpalData::getInstance()->getOpenMode() == OpalData::OpenMode::APPEND && - boost::filesystem::exists(fileName)) { + std::filesystem::exists(fileName)) { pos.open(fileName, std::ios_base::app); } else { pos.open(fileName); diff --git a/src/Main.cpp b/src/Main.cpp index 70e89a22a12d2972ebe28d885e0f19200bf854ff..0ac4a5b5d1d5dc375c26f38913966a73a39490d0 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -147,7 +147,7 @@ int main(int argc, char *argv[]) { int opalMain(int argc, char *argv[]) { - namespace fs = boost::filesystem; + namespace fs = std::filesystem; #ifdef ENABLE_AMR bool initAMR = checkInitAmrFlag(argc, argv); @@ -186,7 +186,7 @@ int opalMain(int argc, char *argv[]) { */ if(Ippl::myNode() == 0) { if (!fs::exists(opal->getAuxiliaryOutputDirectory())) { - boost::system::error_code error_code; + std::error_code error_code; if (!fs::create_directory(opal->getAuxiliaryOutputDirectory(), error_code)) { std::cerr << error_code.message() << std::endl; // use error code to prevent create_directory from throwing an exception @@ -207,7 +207,7 @@ int opalMain(int argc, char *argv[]) { FileStream::setEcho(Options::echo); char *startup = getenv("HOME"); - boost::filesystem::path p = strncat(startup, "/init.opal", 20); + std::filesystem::path p = strncat(startup, "/init.opal", 20); if (startup != nullptr && is_regular_file(p)) { FileStream::setEcho(false); diff --git a/src/Optimize/OpalSimulation.cpp b/src/Optimize/OpalSimulation.cpp index fd4c0f3139aa3a5423d0a3432ed0cf68b653bcda..cb61204696ef8d416fe464aed7333999402a9b26 100644 --- a/src/Optimize/OpalSimulation.cpp +++ b/src/Optimize/OpalSimulation.cpp @@ -48,7 +48,7 @@ OpalSimulation::OpalSimulation(Expressions::Named_t objectives, , comm_(comm) , id_m(-1) { - namespace fs = boost::filesystem; + namespace fs = std::filesystem; simTmpDir_ = args->getArg<std::string>("simtmpdir"); if (simTmpDir_.empty()) { @@ -155,7 +155,7 @@ bool OpalSimulation::hasResultsAvailable() { void OpalSimulation::createSymlink_m(const std::string& path) { - namespace fs = boost::filesystem; + namespace fs = std::filesystem; for (auto &p: fs::directory_iterator(path)) { fs::path source = p.path(); @@ -178,7 +178,7 @@ void OpalSimulation::copyH5_m() { if (restartfile.empty()) return; - namespace fs = boost::filesystem; + namespace fs = std::filesystem; if ( !fs::exists(restartfile) ) { std::cerr << "H5 file '" + restartfile + "' doesn't exist." << "\n" << "in OpalSimulation::copyH5_m()" << std::endl; @@ -198,7 +198,7 @@ void OpalSimulation::copyH5_m() { void OpalSimulation::setupSimulation() { - namespace fs = boost::filesystem; + namespace fs = std::filesystem; CmdArguments_t args = getArgs(); std::string restartfile = args->getArg<std::string>("restartfile", "", false); @@ -241,7 +241,7 @@ void OpalSimulation::setupSimulation() { } void OpalSimulation::setupFSStructure() { - namespace fs = boost::filesystem; + namespace fs = std::filesystem; int rank = 0; MPI_Comm_rank(comm_, &rank); @@ -254,11 +254,11 @@ void OpalSimulation::setupFSStructure() { try { fs::create_directory(simulationDirName_); fs::permissions(simulationDirName_, - fs::owner_all | - fs::group_read | - fs::group_exe | - fs::others_read | - fs::others_exe); + fs::perms::owner_all | + fs::perms::group_read | + fs::perms::group_exec | + fs::perms::others_read | + fs::perms::others_exec); } catch (fs::filesystem_error &e) { std::cerr << e.what() << "\n" @@ -271,11 +271,11 @@ void OpalSimulation::setupFSStructure() { fs::create_directory(dataDir); fs::permissions(dataDir, - fs::owner_all | - fs::group_read | - fs::group_exe | - fs::others_read | - fs::others_exe); + fs::perms::owner_all | + fs::perms::group_read | + fs::perms::group_exec | + fs::perms::others_read | + fs::perms::others_exec); } catch (fs::filesystem_error &e) { std::cerr << e.what() << "\n" @@ -326,7 +326,7 @@ void OpalSimulation::restoreOut() { void OpalSimulation::run() { - namespace fs = boost::filesystem; + namespace fs = std::filesystem; // make sure input file is not already existing MPI_Barrier(comm_); @@ -623,7 +623,7 @@ void OpalSimulation::invalidBunch() { } void OpalSimulation::cleanUp() { - namespace fs = boost::filesystem; + namespace fs = std::filesystem; try { int my_rank = 0; MPI_Comm_rank(comm_, &my_rank); @@ -639,7 +639,7 @@ void OpalSimulation::cleanUp() { } void OpalSimulation::cleanUp(const std::vector<std::string>& keep) { - namespace fs = boost::filesystem; + namespace fs = std::filesystem; if ( keep.empty() ) { // if empty we keep all files diff --git a/src/Optimize/OptimizeCmd.cpp b/src/Optimize/OptimizeCmd.cpp index 7dc555dc1c01f36da82a7d365f481710676eb357..f4cc616b0ad93eb6452e727772854266e37a7583 100644 --- a/src/Optimize/OptimizeCmd.cpp +++ b/src/Optimize/OptimizeCmd.cpp @@ -57,8 +57,6 @@ #include "Expression/ProbeVariable.h" #include "Expression/SeptumExpr.h" -#include <boost/filesystem.hpp> - #include <map> #include <set> #include <string> @@ -196,7 +194,7 @@ OptimizeCmd *OptimizeCmd::clone(const std::string &name) { } void OptimizeCmd::execute() { - namespace fs = boost::filesystem; + namespace fs = std::filesystem; auto opal = OpalData::getInstance(); opal->setOptimizerFlag(); diff --git a/src/Sample/SampleCmd.cpp b/src/Sample/SampleCmd.cpp index b9dcbbc75567d46d3006493d8d9b7311ded84a90..f7aaffb47fdf7da0315fdccc9fae3890c5e529b9 100644 --- a/src/Sample/SampleCmd.cpp +++ b/src/Sample/SampleCmd.cpp @@ -147,7 +147,7 @@ SampleCmd *SampleCmd::clone(const std::string &name) { void SampleCmd::execute() { - namespace fs = boost::filesystem; + namespace fs = std::filesystem; auto opal = OpalData::getInstance(); opal->setOptimizerFlag(); diff --git a/src/Sample/Sampler.cpp b/src/Sample/Sampler.cpp index ba55f778dd8b74cca756b860f578eeeea48a2610..92fc1a8a3f3be1a7221e519a87c4e403dc0612ef 100644 --- a/src/Sample/Sampler.cpp +++ b/src/Sample/Sampler.cpp @@ -76,8 +76,8 @@ Sampler::Sampler(const std::map<std::string, << "_samples_" << comms_.island_id << ".json"; jsonFname_m = filename.str(); - if ( !boost::filesystem::exists(resultDir) ) { - boost::filesystem::create_directory(resultDir); + if ( !std::filesystem::exists(resultDir) ) { + std::filesystem::create_directory(resultDir); } DVarContainer_t::iterator itr; diff --git a/src/Solvers/AMR_MG/AmrMultiGrid.cpp b/src/Solvers/AMR_MG/AmrMultiGrid.cpp index 23864e50e07740f0a1c5646b8f30aba14e9c4607..96fdce06344079781c608dbca87ca29b89c47d7a 100644 --- a/src/Solvers/AMR_MG/AmrMultiGrid.cpp +++ b/src/Solvers/AMR_MG/AmrMultiGrid.cpp @@ -100,7 +100,7 @@ AmrMultiGrid::AmrMultiGrid(AmrBoxLib* itsAmrObject_p, const BaseSolver solver = this->convertToEnumBaseSolver_m(bsolver); this->initBaseSolver_m(solver, rebalance, reuse); - if (boost::filesystem::exists(fname_m)) { + if (std::filesystem::exists(fname_m)) { flag_m = std::ios::app; INFOMSG("Appending solver information to existing file: " << fname_m << endl); } else { diff --git a/src/Structure/BoundaryGeometry.cpp b/src/Structure/BoundaryGeometry.cpp index a2480cb41f7bbd80157b37d7c666dd0fe6e8d012..25783bea2062ea6447883b1910bfe08f2bc13d55 100644 --- a/src/Structure/BoundaryGeometry.cpp +++ b/src/Structure/BoundaryGeometry.cpp @@ -1623,13 +1623,14 @@ BoundaryGeometry::computeMeshVoxelization (void) { }); bool writeVTK = false; - if (!boost::filesystem::exists(vtkFileName)) { + if (!std::filesystem::exists(vtkFileName)) { writeVTK = true; } else { - std::time_t t_geom = boost::filesystem::last_write_time(h5FileName_m); - std::time_t t_vtk = boost::filesystem::last_write_time(vtkFileName); - if (std::difftime(t_geom,t_vtk) > 0) + auto t_geom = boost::filesystem::last_write_time(h5FileName_m); + auto t_vtk = boost::filesystem::last_write_time(vtkFileName); + if (std::difftime(t_geom, t_vtk) > 0) { writeVTK = true; + } } if (writeVTK) { @@ -2024,7 +2025,7 @@ Change orientation if diff is: *gmsg << level2 << "* Initializing Boundary Geometry..." << endl; IpplTimings::startTimer (Tinitialize_m); - if (!boost::filesystem::exists(h5FileName_m)) { + if (!std::filesystem::exists(h5FileName_m)) { throw OpalException("BoundaryGeometry::initialize", "Failed to open file '" + h5FileName_m + "', please check if it exists"); diff --git a/src/Structure/FieldWriter.hpp b/src/Structure/FieldWriter.hpp index f26f7338f7c8ee75972357246de1312eebf460be..1e90d46eb7f39e3cb56f7a8a27d9c90c91d6d996 100644 --- a/src/Structure/FieldWriter.hpp +++ b/src/Structure/FieldWriter.hpp @@ -55,8 +55,8 @@ void FieldWriter::dumpField(FieldType& field, std::string name, * '******': step padded with zeros to 6 digits */ std::string dirname = OpalData::getInstance()->getAuxiliaryOutputDirectory(); - boost::filesystem::path file(dirname); - boost::format filename("%1%-%2%-%|3$06|.dat"); + std::filesystem::path file(dirname); + std::format filename("%1%-%2%-%|3$06|.dat"); std::string basename = OpalData::getInstance()->getInputBasename(); filename % basename % (name + std::string("_") + type) % step; file /= filename.str(); diff --git a/src/Structure/H5PartWrapper.cpp b/src/Structure/H5PartWrapper.cpp index 6a03872f17921c28309920dac030b24f2ef6ad0b..2947bdf3e8b3572db9f6e579a6b8b89e2b5ca4f7 100644 --- a/src/Structure/H5PartWrapper.cpp +++ b/src/Structure/H5PartWrapper.cpp @@ -128,7 +128,7 @@ void H5PartWrapper::storeCavityInformation() { void H5PartWrapper::copyFile(const std::string &sourceFile, int lastStep, h5_int32_t flags) { - namespace fs = boost::filesystem; + namespace fs = std::filesystem; if (!fs::exists(sourceFile)) { throw OpalException("H5PartWrapper::copyFile", "source file '" + sourceFile + "' does not exist"); @@ -252,7 +252,7 @@ void H5PartWrapper::copyFile(const std::string &sourceFile, int lastStep, h5_int } void H5PartWrapper::copyFileSystem(const std::string &sourceFile) { - // namespace fs = boost::filesystem; + // namespace fs = std::filesystem; if (sourceFile == fileName_m) return; diff --git a/src/Structure/MemoryProfiler.cpp b/src/Structure/MemoryProfiler.cpp index 53dbc1ef3204b444c742ffdf30e7e1b3d43ffbc3..22d758d05295a30366a72cba2fa702ad8d95548b 100644 --- a/src/Structure/MemoryProfiler.cpp +++ b/src/Structure/MemoryProfiler.cpp @@ -146,7 +146,7 @@ void MemoryProfiler::update() { static pid_t pid = getpid(); std::string fname = "/proc/" + std::to_string(pid) + "/status"; - if ( !boost::filesystem::exists(fname) ) { + if ( !std::filesystem::exists(fname) ) { throw OpalException("MemoryProfiler::update()", "File '" + fname + "' doesn't exist."); } diff --git a/src/Structure/SDDSWriter.cpp b/src/Structure/SDDSWriter.cpp index 73433b05a8ce83a5c4e50f181ba9c49a7c46701d..911c8ee5fc9463d7fe2c0ec7131988c1ddd6ab8e 100644 --- a/src/Structure/SDDSWriter.cpp +++ b/src/Structure/SDDSWriter.cpp @@ -34,7 +34,7 @@ SDDSWriter::SDDSWriter(const std::string& fname, bool restart) , mode_m(std::ios::out) , indent_m(" ") { - namespace fs = boost::filesystem; + namespace fs = std::filesystem; if (fs::exists(fname_m) && restart) { mode_m = std::ios::app; diff --git a/src/Structure/SDDSWriter.h b/src/Structure/SDDSWriter.h index 5858415d66f91eeab7d27b8bb447d8941d5a667b..97e2739f97e18ede2a12f7fb276de9d80853ed67 100644 --- a/src/Structure/SDDSWriter.h +++ b/src/Structure/SDDSWriter.h @@ -153,7 +153,7 @@ private: inline bool SDDSWriter::exists() const { - return boost::filesystem::exists(fname_m); + return std::filesystem::exists(fname_m); } diff --git a/tests/opal_src/BasicActions/DumpEMFieldsTest.cpp b/tests/opal_src/BasicActions/DumpEMFieldsTest.cpp index e9922db0c8b72c832c6e3e940dbdd17e6e4e9374..69d746488d8a4774d81dac6925592b519b1df03f 100644 --- a/tests/opal_src/BasicActions/DumpEMFieldsTest.cpp +++ b/tests/opal_src/BasicActions/DumpEMFieldsTest.cpp @@ -145,7 +145,7 @@ void clear_files(std::set<std::string> const& files) { std::string auxDirectory = OpalData::getInstance()->getAuxiliaryOutputDirectory(); for (const std::string& fname : files) { - boost::filesystem::remove(Util::combineFilePath({auxDirectory, fname})); + std::filesystem::remove(Util::combineFilePath({auxDirectory, fname})); } } @@ -153,7 +153,7 @@ TEST(DumpEMFieldsTest, writeFieldsCartTest) { OpalTestUtilities::SilenceTest silencer; std::string auxDirectory = OpalData::getInstance()->getAuxiliaryOutputDirectory(); - boost::filesystem::create_directory(auxDirectory); + std::filesystem::create_directory(auxDirectory); std::string fname1 = "test5"; std::string fname2 = "test6"; @@ -226,7 +226,7 @@ TEST(DumpEMFieldsTest, writeFieldsCylTest) { OpalTestUtilities::SilenceTest silencer; std::string auxDirectory = OpalData::getInstance()->getAuxiliaryOutputDirectory(); - boost::filesystem::create_directory(auxDirectory); + std::filesystem::create_directory(auxDirectory); std::string fnameCyl = "testCyl"; diff --git a/tests/opal_src/BasicActions/DumpFieldsTest.cpp b/tests/opal_src/BasicActions/DumpFieldsTest.cpp index f3895dd48a2d8f6eba758e5490ea683e9e067cd8..f12b0a312a44c039e627ea79260d9cf4f5be2d12 100644 --- a/tests/opal_src/BasicActions/DumpFieldsTest.cpp +++ b/tests/opal_src/BasicActions/DumpFieldsTest.cpp @@ -113,7 +113,7 @@ void clear_files(std::set<std::string> const& files) { std::string auxDirectory = OpalData::getInstance()->getAuxiliaryOutputDirectory(); for (const std::string& fname : files) { - boost::filesystem::remove(Util::combineFilePath({auxDirectory, fname})); + std::filesystem::remove(Util::combineFilePath({auxDirectory, fname})); } } @@ -122,7 +122,7 @@ TEST(DumpFieldsTest, writeFieldsTest) { std::string auxDirectory = OpalData::getInstance()->getAuxiliaryOutputDirectory(); - boost::filesystem::create_directory(auxDirectory); + std::filesystem::create_directory(auxDirectory); std::string fname1 = "test1"; std::string fname2 = "test2";