Commit cc58dfc0 authored by Mohcine Chraibi's avatar Mohcine Chraibi

Filesystem

parent 01fe35f5
......@@ -30,7 +30,7 @@ configure-linux:
script:
- mkdir -p build
- cd build
- cmake -DBUILD_TESTING=ON -DCMAKE_CXX_COMPILER=g++-8 ..
- cmake -DBUILD_TESTING=ON -DCMAKE_CXX_COMPILER=g++-8 ..
- echo "configure | ${CI_PROJECT_DIR}"
stage: configure
tags:
......
This diff is collapsed.
......@@ -36,10 +36,9 @@
#include "../generic/FDSMeshStorage.h"
//#include <set>
#include "../../tinyxml/tinyxml.h"
//#include <filesystem>
#include <boost/filesystem.hpp>
//namespace fs = std::experimental::filesystem;
namespace fs = boost::filesystem;
#include <filesystem>
namespace fs = std::filesystem;
SmokeSensor::SmokeSensor(const Building *b) : AbstractSensor(b)
{
......
......@@ -36,10 +36,9 @@
//#include <algorithm>
//#include <math.h>
//#include <string>
//#include <filesystem>
#include <boost/filesystem.hpp>
//namespace fs = std::experimental::filesystem;
namespace fs = boost::filesystem;
#include <filesystem>
namespace fs = std::filesystem;
WalkingSpeed::WalkingSpeed(const std::string & projectFileName)
{
_FMStorage = nullptr;
......
......@@ -31,15 +31,14 @@
#include "../generic/FDSMesh.h"
#include "../generic/FDSMeshStorage.h"
#include "../../tinyxml/tinyxml.h"
#include <boost/filesystem.hpp>
using namespace boost::filesystem;
#include <filesystem>
namespace fs = std::filesystem;
ToxicityAnalysis::ToxicityAnalysis(const std::string & projectFileName, double fps): _projectFileName(projectFileName), _fps(fps)
{
_FMStorage = nullptr;
_dt = 1/20.; //time fraction for which doses are cumulated. TODO:
//parse in inifile?
_dt = 1/20.; // @todo time fraction for which doses are cumulated. Parse in inifile?
_t_prev = -1;
LoadJPSfireInfo(projectFileName);
}
......@@ -51,7 +50,7 @@ ToxicityAnalysis::~ToxicityAnalysis()
bool ToxicityAnalysis::LoadJPSfireInfo(const std::string projectFilename )
{
boost::filesystem::path p(projectFilename);
fs::path p(projectFilename);
std::string projectRootDir = p.parent_path().string();
TiXmlDocument doc(projectFilename);
......@@ -80,7 +79,7 @@ bool ToxicityAnalysis::LoadJPSfireInfo(const std::string projectFilename )
std::string irritant = "";
Log->Write("INFO:\tJPSfire Module C_toxicity_analysis: \n \tdata: %s \n\tupdate time: %.1f s | final time: %.1f s",
filepath.c_str(), updateIntervall, finalTime);
//TODO Is there a posibility to pass a variable number of arguments to a function?
//@todo Is there a posibility to pass a variable number of arguments to a function?
_FMStorage = std::make_shared<FDSMeshStorage>(filepath, finalTime, updateIntervall, study, irritant);
InitializeWriteOut();
......@@ -162,7 +161,7 @@ void ToxicityAnalysis::HazardAnalysis(Pedestrian* p)
{
double FEC_Smoke, FED_In = 0.0, FED_Heat = 0.0, FIC_Im, FIC_In;
// Smoke extinction in 1/m
double E = GetFDSQuantity(p, "EXTINCTION_COEFFICIENT"); //TODO: check this string.. SOOT??
double E = GetFDSQuantity(p, "EXTINCTION_COEFFICIENT"); //@todo check this string.. SOOT??
// gas species in ppm
double CO2 = 0., CO = 0., HCN = 0., HCL = 0., O2 = 0.;
......@@ -198,9 +197,9 @@ void ToxicityAnalysis::HazardAnalysis(Pedestrian* p)
void ToxicityAnalysis::InitializeWriteOut()
{
path p(_projectFileName);
fs::path p(_projectFileName);
std::string ToxAnalysisXML = "toxicity_output_" + p.stem().string() + p.extension().string();
path t(ToxAnalysisXML);
fs::path t(ToxAnalysisXML);
t = p.parent_path() / t;
_outputhandler = std::make_shared<ToxicityOutputHandler>(t.string().c_str());
_outputhandler->WriteToFileHeader();
......
......@@ -30,9 +30,9 @@
//#include <unistd.h>
//#include <glob.h>
// #include <filesystem>
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
//namespace fs = std::experimental::filesystem;
#include <filesystem>
namespace fs = std::filesystem;
FDSMeshStorage::FDSMeshStorage()
{
......@@ -237,7 +237,7 @@ void FDSMeshStorage::CreateFDSMeshes()
}
const FDSMesh &FDSMeshStorage::GetFDSMesh(const double &simTime, const double &pedElev, const std::string &quantity) throw (int)
const FDSMesh &FDSMeshStorage::GetFDSMesh(const double &simTime, const double &pedElev, const std::string &quantity)
{
//Smoke Sensor NOT active
int simT=simTime/_updateIntervall;
......@@ -256,7 +256,7 @@ const FDSMesh &FDSMeshStorage::GetFDSMesh(const double &simTime, const double &p
if (_fMContainer.count(Ztime.string()) == 0) {
//std::cout << str << std::endl;
std::cout << "\n time ERROR: requested grid not available: " << Ztime.string() << std::endl;
throw -1;
return(EXIT_FAILURE);
}
return _fMContainer.at(Ztime.string());
......@@ -270,7 +270,7 @@ const FDSMesh &FDSMeshStorage::GetFDSMesh(const double &simTime, const double &p
// }
}
const FDSMesh &FDSMeshStorage::GetFDSMesh(const double &pedElev, const Point &doorCentre, const double &simTime) throw (int)
const FDSMesh &FDSMeshStorage::GetFDSMesh(const double &pedElev, const Point &doorCentre, const double &simTime)
{
//Smoke Sensor active
......@@ -294,7 +294,7 @@ const FDSMesh &FDSMeshStorage::GetFDSMesh(const double &pedElev, const Point &do
door_xy = fs::canonical(door_xy).make_preferred();
if (_fMContainer.count(door_xy.string()) == 0) {
std::cout << "\n > ERROR: requested sfgrid not available: " << door_xy.string() << std::endl;
throw -1;
return(EXIT_FAILURE);
}
// if (_fMContainer.count(str) == 1) {
......
......@@ -53,8 +53,8 @@ public:
bool CreateElevationList();
void CreateDoorList();
void CreateFDSMeshes();
const FDSMesh& GetFDSMesh(const double &simTime, const double &pedElev,const std::string &quantity) throw (int);
const FDSMesh& GetFDSMesh(const double &pedElev, const Point &doorCentre, const double &simTime) throw (int);
const FDSMesh& GetFDSMesh(const double &simTime, const double &pedElev,const std::string &quantity);
const FDSMesh& GetFDSMesh(const double &pedElev, const Point &doorCentre, const double &simTime);
std::string GetStudy() const;
std::string IrritantOrNot() const;
......
......@@ -37,9 +37,9 @@
#include "../pedestrian/Pedestrian.h"
#include "../mpi/LCGrid.h"
#include "../IO/GeoFileParser.h"
#include <boost/filesystem.hpp>
//namespace fs = std::experimental::filesystem;
namespace fs = boost::filesystem;
#include <filesystem>
namespace fs = std::filesystem;
#endif
//#undef _OPENMP
......
......@@ -32,13 +32,15 @@
#include "../geometry/SubRoom.h"
#include "../IO/PedDistributionParser.h"
#include <boost/filesystem.hpp>
#include <boost/lambda/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/range/combine.hpp>
#include <filesystem>
using namespace std;
namespace fs = boost::filesystem;
namespace fs = std::filesystem;
using namespace boost::lambda;
/************************************************************
PedDistributor
......@@ -119,8 +121,8 @@ bool PedDistributor::Distribute(Building *building) const {
{
if(fs::is_regular_file(p))
{
std::string basename = fs::basename(p);
std::string extention = fs::extension(p);
std::string basename = p.stem(); //
std::string extention = p.extension();
auto tmpPositions = GetPositionsFromFile(p.string(), dist->GetAgentsNumber(), unit);
//check if positions are
//empty. May happen if file
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment