Commit 4bfb797d authored by Mohcine Chraibi's avatar Mohcine Chraibi

Optimize includes + jpsfire fix

parent 40851b44
Pipeline #5815 failed with stages
in 57 seconds
...@@ -36,6 +36,12 @@ endif () ...@@ -36,6 +36,12 @@ endif ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${warnings}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${warnings}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${warnings}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${warnings}")
# TODO clean up. no flags.
#set(CMAKE_CXX_STANDARD 11)
#set(CMAKE_CXX_STANDARD_REQUIRED ON)
#set(CMAKE_CXX_EXTENSIONS OFF)
if (NOT BUILD_TESTING) if (NOT BUILD_TESTING)
set(BUILD_TESTING OFF) # test units & python tests are not generated. set(BUILD_TESTING OFF) # test units & python tests are not generated.
endif (NOT BUILD_TESTING) endif (NOT BUILD_TESTING)
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "GeoFileParser.h" #include "GeoFileParser.h"
#include "../tinyxml/tinyxml.h" #include "../tinyxml/tinyxml.h"
#include "../geometry/Goal.h"
#include "../geometry/SubRoom.h" #include "../geometry/SubRoom.h"
GeoFileParser::GeoFileParser(Configuration* configuration) GeoFileParser::GeoFileParser(Configuration* configuration)
......
...@@ -33,8 +33,6 @@ ...@@ -33,8 +33,6 @@
#include "../mpi/LCGrid.h" #include "../mpi/LCGrid.h"
#define _USE_MATH_DEFINES #define _USE_MATH_DEFINES
#include <math.h>
using namespace std; using namespace std;
......
...@@ -28,9 +28,6 @@ ...@@ -28,9 +28,6 @@
#include "OutputHandler.h" #include "OutputHandler.h"
#include <stdio.h>
#include <stdarg.h>
#include <cstdlib>
#include <cmath> #include <cmath>
using namespace std; using namespace std;
......
...@@ -29,9 +29,6 @@ ...@@ -29,9 +29,6 @@
/********* include files ******************************************************/ /********* include files ******************************************************/
#include <iostream> #include <iostream>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "TraVisToClient.h" #include "TraVisToClient.h"
#include "../general/Macros.h" #include "../general/Macros.h"
......
...@@ -30,12 +30,7 @@ ...@@ -30,12 +30,7 @@
#include "../../pedestrian/Pedestrian.h" #include "../../pedestrian/Pedestrian.h"
#include "../generic/FDSMesh.h" #include "../generic/FDSMesh.h"
#include "../generic/FDSMeshStorage.h" #include "../generic/FDSMeshStorage.h"
#include "../../pedestrian/PedDistributor.h"
#include "../../tinyxml/tinyxml.h" #include "../../tinyxml/tinyxml.h"
#include <set>
#include <algorithm>
#include <math.h>
#include "../../IO/OutputHandler.h"
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
using namespace boost::filesystem; using namespace boost::filesystem;
......
#include "FDSMesh.h" #include "FDSMesh.h"
#include <cmath> #include <cmath>
#include <string>
#include <fstream>
#include <iostream>
#include <sstream>
std::vector<std::string> &split2(const std::string &s, char delim, std::vector<std::string> &elems) { std::vector<std::string> &split2(const std::string &s, char delim, std::vector<std::string> &elems) {
std::stringstream ss(s); std::stringstream ss(s);
...@@ -163,17 +159,23 @@ void FDSMesh::ReadMatrix(std::string line, std::ifstream &pFile) ...@@ -163,17 +159,23 @@ void FDSMesh::ReadMatrix(std::string line, std::ifstream &pFile)
while (std::getline(pFile, line)) { while (std::getline(pFile, line)) {
n = 0; n = 0;
strVec = split2(line, ',', strVec); strVec = split2(line, ',', strVec);
for (auto &elem : strVec) for (auto &elem : strVec) {
{
//std::cout << elem << " col " << n << " line " << m << std::endl; //std::cout << elem << " col " << n << " line " << m << std::endl;
if (elem=="nan" || elem=="NAN" || elem=="NaN" || elem=="-inf" || elem=="inf") if (elem=="nan" || elem=="NAN" || elem=="NaN" || elem=="-inf" || elem=="inf") {
{
_matrix[m][n].SetValue(1.0); _matrix[m][n].SetValue(1.0);
//Log->Write("ERROR: Mesh values consist of nan!"); //Log->Write("ERROR: Mesh values consist of nan!");
//exit(EXIT_FAILURE); //exit(EXIT_FAILURE);
} }
else else {
_matrix[m][n].SetValue(std::stod(elem)); double temp = 0;
try {
temp = std::stod(elem);
}
catch (...) {
std::cout << "can not convert " << elem << std::endl;
}
_matrix[m][n].SetValue(temp);
}
++n; ++n;
} }
strVec.clear(); strVec.clear();
......
...@@ -27,11 +27,8 @@ ...@@ -27,11 +27,8 @@
* *
**/ **/
#include "FDSMeshStorage.h" #include "FDSMeshStorage.h"
#include "../../IO/OutputHandler.h"
//#include <unistd.h> //#include <unistd.h>
#include <stdio.h>
//#include <glob.h> //#include <glob.h>
#include <string>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
namespace fs=boost::filesystem; namespace fs=boost::filesystem;
...@@ -161,7 +158,7 @@ void FDSMeshStorage::CreateTimeList() ...@@ -161,7 +158,7 @@ void FDSMeshStorage::CreateTimeList()
{ {
/// Create time list for mesh refreshment /// Create time list for mesh refreshment
_timelist.clear(); _timelist.clear();
double i=0; double i=0;
while (i<=_finalTime) while (i<=_finalTime)
{ {
_timelist.push_back(i); _timelist.push_back(i);
...@@ -174,12 +171,12 @@ void FDSMeshStorage::CreateTimeList() ...@@ -174,12 +171,12 @@ void FDSMeshStorage::CreateTimeList()
if (_doorlist.size() > 0) { // Smoke sensor active if (_doorlist.size() > 0) { // Smoke sensor active
check_str = _filepath + _quantitylist[0] + "/" + check_str = _filepath + _quantitylist[0] + "/" +
_doorlist[0] + "/t_" + std::to_string(elem) + ".csv"; _doorlist[0] + "/t_" + std::to_string(elem) + ".csv";
// std::cout << "1: " << check_str << std::endl; std::cout << "1: " << check_str << std::endl;
} }
else if (_doorlist.size() == 0) { // Smoke sensor not active else if (_doorlist.size() == 0) { // Smoke sensor not active
check_str = _filepath + _quantitylist[0] + "/Z_" + check_str = _filepath + _quantitylist[0] + "/Z_" +
std::to_string(_elevationlist[0]) + "/t_" + std::to_string(elem) + ".csv"; std::to_string(_elevationlist[0]) + "/t_" + std::to_string(elem) + ".csv";
// std::cout << "2: " << check_str << std::endl; std::cout << "2: " << check_str << std::endl;
} }
if (fs::exists(check_str) == false ) if (fs::exists(check_str) == false )
......
...@@ -35,12 +35,9 @@ ...@@ -35,12 +35,9 @@
#include "math/GompertzModel.h" #include "math/GompertzModel.h"
#include "math/GradientModel.h" #include "math/GradientModel.h"
#include "pedestrian/AgentsQueue.h" #include "pedestrian/AgentsQueue.h"
#include "pedestrian/AgentsSourcesManager.h"
#ifdef _OPENMP #ifdef _OPENMP
#include <omp.h>
#else #else
#define omp_get_thread_num() 0 #define omp_get_thread_num() 0
#define omp_get_max_threads() 1 #define omp_get_max_threads() 1
......
...@@ -7,12 +7,12 @@ See template_test/How_to_make_new_test.txt ...@@ -7,12 +7,12 @@ See template_test/How_to_make_new_test.txt
import fnmatch import fnmatch
import glob import glob
import logging import logging
from os import path import numpy as np
import os import os
from stat import S_ISREG, ST_MODE, ST_MTIME
import subprocess import subprocess
import sys import sys
import numpy as np from os import path
from stat import S_ISREG, ST_MODE, ST_MTIME
__author__ = 'Oliver Schmidts' __author__ = 'Oliver Schmidts'
__email__ = 'dev@jupedsim.org' __email__ = 'dev@jupedsim.org'
......
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
measure the fundamental diagram in a 1d scenario. measure the fundamental diagram in a 1d scenario.
return density, velocity return density, velocity
""" """
import glob
import numpy as np import numpy as np
import os import os
import glob
from sys import *
import sys import sys
from sys import *
utestdir = os.path.abspath(os.path.dirname(os.path.dirname(sys.path[0]))) utestdir = os.path.abspath(os.path.dirname(os.path.dirname(sys.path[0])))
path.append(utestdir) path.append(utestdir)
from utils import * from utils import *
......
...@@ -22,9 +22,10 @@ Source ...@@ -22,9 +22,10 @@ Source
""" """
import matplotlib.pyplot as plt
import os import os
import sys import sys
import matplotlib.pyplot as plt
utestdir = os.path.abspath(os.path.dirname(os.path.dirname(sys.path[0]))) utestdir = os.path.abspath(os.path.dirname(os.path.dirname(sys.path[0])))
from sys import * from sys import *
sys.path.append(utestdir) sys.path.append(utestdir)
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
plot fundamental diagram produced by runtest plot fundamental diagram produced by runtest
just to check the results without reruning the test just to check the results without reruning the test
""" """
import glob
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np import numpy as np
import glob
simfiles = glob.glob("Output/Fundamental_Diagram/Individual_FD/*.dat") simfiles = glob.glob("Output/Fundamental_Diagram/Individual_FD/*.dat")
expfiles = glob.glob("data/*.txt") expfiles = glob.glob("data/*.txt")
......
...@@ -16,9 +16,10 @@ Source ...@@ -16,9 +16,10 @@ Source
""" """
import matplotlib.pyplot as plt
import os import os
import sys import sys
import matplotlib.pyplot as plt
utestdir = os.path.abspath(os.path.dirname(os.path.dirname(sys.path[0]))) utestdir = os.path.abspath(os.path.dirname(os.path.dirname(sys.path[0])))
from sys import * from sys import *
sys.path.append(utestdir) sys.path.append(utestdir)
......
...@@ -17,9 +17,10 @@ Source ...@@ -17,9 +17,10 @@ Source
""" """
import matplotlib.pyplot as plt
import os import os
import sys import sys
import matplotlib.pyplot as plt
utestdir = os.path.abspath(os.path.dirname(os.path.dirname(sys.path[0]))) utestdir = os.path.abspath(os.path.dirname(os.path.dirname(sys.path[0])))
from sys import * from sys import *
sys.path.append(utestdir) sys.path.append(utestdir)
......
...@@ -17,9 +17,10 @@ Source ...@@ -17,9 +17,10 @@ Source
""" """
import matplotlib.pyplot as plt
import os import os
import sys import sys
import matplotlib.pyplot as plt
utestdir = os.path.abspath(os.path.dirname(os.path.dirname(sys.path[0]))) utestdir = os.path.abspath(os.path.dirname(os.path.dirname(sys.path[0])))
from sys import * from sys import *
sys.path.append(utestdir) sys.path.append(utestdir)
......
...@@ -18,9 +18,10 @@ Source ...@@ -18,9 +18,10 @@ Source
Table 4.4 Jun Zhang Diss. Table 4.4 Jun Zhang Diss.
""" """
import matplotlib.pyplot as plt
import os import os
import sys import sys
import matplotlib.pyplot as plt
utestdir = os.path.abspath(os.path.dirname(os.path.dirname(sys.path[0]))) utestdir = os.path.abspath(os.path.dirname(os.path.dirname(sys.path[0])))
from sys import * from sys import *
sys.path.append(utestdir) sys.path.append(utestdir)
......
...@@ -18,9 +18,10 @@ Source ...@@ -18,9 +18,10 @@ Source
""" """
import matplotlib.pyplot as plt
import os import os
import sys import sys
import matplotlib.pyplot as plt
utestdir = os.path.abspath(os.path.dirname(os.path.dirname(sys.path[0]))) utestdir = os.path.abspath(os.path.dirname(os.path.dirname(sys.path[0])))
from sys import * from sys import *
sys.path.append(utestdir) sys.path.append(utestdir)
......
#!/usr/bin/env python3 #!/usr/bin/env python3
import glob
import logging
import matplotlib.pyplot as plt
import multiprocessing
import numpy as np import numpy as np
import os, logging, time, sys import os
from sys import argv, exit import subprocess
import subprocess, glob import sys
import time
from os import path from os import path
import multiprocessing from sys import argv, exit
import matplotlib.pyplot as plt
def get_empirical_flow(): def get_empirical_flow():
files = glob.glob("experiments/*.txt") files = glob.glob("experiments/*.txt")
...@@ -79,7 +84,7 @@ if __name__ == "__main__": ...@@ -79,7 +84,7 @@ if __name__ == "__main__":
# lib_path = os.path.abspath(lib_path) # lib_path = os.path.abspath(lib_path)
sys.path.append(lib_path) sys.path.append(lib_path)
from utils import SUCCESS, FAILURE from utils import SUCCESS, FAILURE
from utils import parse_file, flow, rolling_flow from utils import parse_file, rolling_flow
# from utils import get_maxtime # from utils import get_maxtime
os.chdir("..") os.chdir("..")
TRUNK = os.getcwd() TRUNK = os.getcwd()
......
...@@ -2,14 +2,16 @@ ...@@ -2,14 +2,16 @@
# todo: spaghetti code. directory mess # todo: spaghetti code. directory mess
import numpy as np import glob
from xml.dom import minidom import logging
import os, argparse, logging, time
from os import path, system
from sys import argv ,exit
import subprocess, glob, sys
import multiprocessing
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np
import os
import subprocess
import sys
import time
from os import path
from sys import argv, exit
#========================= #=========================
testnr = 10 testnr = 10
......
#! /usr/bin/env python #! /usr/bin/env python
import glob
import logging
import numpy as np import numpy as np
import os
import subprocess
import sys
from os import path
from sys import argv, exit
from xml.dom import minidom from xml.dom import minidom
import os, argparse, logging, time
from os import path, system
from sys import argv ,exit
import subprocess, glob
import multiprocessing
import matplotlib.pyplot as plt
import re, sys
#========================= #=========================
testnr = 11 testnr = 11
......
#! /usr/bin/env python #! /usr/bin/env python
import glob
import logging
import numpy as np import numpy as np
import os
import subprocess
import sys
from os import path
from sys import argv, exit
from xml.dom import minidom from xml.dom import minidom
import os, argparse, logging, time
from os import path, system
from sys import argv ,exit
import subprocess, glob
import multiprocessing
import matplotlib.pyplot as plt
import re, sys
#========================= #=========================
testnr = 11 testnr = 11
......
#! /usr/bin/env python #! /usr/bin/env python
import logging
import numpy as np import numpy as np
from xml.dom import minidom import os
import os, argparse, logging, time import subprocess
from os import path, system from os import path
from sys import argv ,exit from sys import argv, exit
import subprocess, glob
import multiprocessing
import matplotlib.pyplot as plt
import re
#========================= #=========================
testnr = 11 testnr = 11
......
...@@ -22,9 +22,6 @@ import os ...@@ -22,9 +22,6 @@ import os
import sys import sys
from sys import * from sys import *
utestdir = os.path.abspath(os.path.dirname(os.path.dirname(sys.path[0]))) utestdir = os.path.abspath(os.path.dirname(os.path.dirname(sys.path[0])))
import scipy
import scipy.stats
import matplotlib.pyplot as plt
sys.path.append(utestdir) sys.path.append(utestdir)
from JPSRunTest import JPSRunTestDriver from JPSRunTest import JPSRunTestDriver
from utils import * from utils import *
......
...@@ -16,10 +16,11 @@ Source ...@@ -16,10 +16,11 @@ Source
""" """
import os
import sys
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np import numpy as np
import os
import sys
utestdir = os.path.abspath(os.path.dirname(os.path.dirname(sys.path[0]))) utestdir = os.path.abspath(os.path.dirname(os.path.dirname(sys.path[0])))
from sys import * from sys import *
sys.path.append(utestdir) sys.path.append(utestdir)
......
# help: python3 makeini.py -h # help: python3 makeini.py -h
import os, sys, glob import argparse
from shutil import copy2, rmtree, move import errno