IAP GITLAB

Skip to content
Snippets Groups Projects
Commit a7a109b4 authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan: Committed by Maximilian Reininghaus
Browse files

got rid of std::filesystem as it is not available with g++ 7

parent cd14971e
No related branches found
No related tags found
2 merge requests!234WIP: Initial example of python as script language from C++,!205UrQMD improvements
/*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
*
* See file AUTHORS for a list of contributors.
*
* This software is distributed under the terms of the GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#include <corsika/utl/CorsikaData.h>
#include <cstdlib>
#include <stdexcept>
#include <string>
std::filesystem::path corsika::utl::CorsikaData(std::filesystem::path const& key) {
std::string corsika::utl::CorsikaData(std::string const& key) {
if (auto const* p = std::getenv("CORSIKA_DATA"); p != nullptr) {
auto const path = std::filesystem::path(p) / key;
auto const path = std::string(p) + "/" + key;
return path;
} else {
throw std::runtime_error("CORSIKA_DATA not set");
......
......@@ -8,12 +8,12 @@
* the license.
*/
#include <filesystem>
//#include <filesystem>
#include <string>
namespace corsika::utl {
/**
* returns the full path of the file \p filename within the CORSIKA_DATA directory
*/
std::filesystem::path CorsikaData(std::filesystem::path const& filename);
std::string CorsikaData(std::string const& filename);
} // namespace corsika::utl
......@@ -31,7 +31,7 @@ using SetupStack = corsika::setup::Stack;
using SetupParticle = corsika::setup::Stack::StackIterator;
using SetupProjectile = corsika::setup::StackView::StackIterator;
UrQMD::UrQMD(std::filesystem::path const& xs_file) {
UrQMD::UrQMD(std::string const& xs_file) {
readXSFile(xs_file);
iniurqmd_();
}
......@@ -435,11 +435,11 @@ std::pair<int, int> corsika::process::UrQMD::ConvertToUrQMD(
return mapPDGToUrQMD.at(static_cast<int>(GetPDG(code)));
}
void UrQMD::readXSFile(std::filesystem::path const& filename) {
void UrQMD::readXSFile(std::string const& filename) {
std::ifstream file(filename, std::ios::in);
if (!file.is_open()) {
throw std::runtime_error(filename.native() + " could not be opened.");
throw std::runtime_error(filename + " could not be opened.");
}
std::string line;
......
......@@ -21,15 +21,14 @@
#include <boost/multi_array.hpp>
#include <array>
#include <filesystem>
#include <random>
#include <string>
#include <utility>
namespace corsika::process::UrQMD {
class UrQMD : public corsika::process::InteractionProcess<UrQMD> {
public:
UrQMD(
std::filesystem::path const& path = utl::CorsikaData("UrQMD/UrQMD-1.3.1-xs.dat"));
UrQMD(std::string const& path = utl::CorsikaData("UrQMD/UrQMD-1.3.1-xs.dat"));
void Init() {}
corsika::units::si::GrammageType GetInteractionLength(
corsika::setup::Stack::StackIterator const&) const;
......@@ -51,7 +50,7 @@ namespace corsika::process::UrQMD {
bool CanInteract(particles::Code) const;
private:
void readXSFile(std::filesystem::path const&);
void readXSFile(std::string const&);
corsika::random::RNG& fRNG =
corsika::random::RNGManager::GetInstance().GetRandomStream("UrQMD");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment