Commit 54872839 authored by Mohcine Chraibi's avatar Mohcine Chraibi

Merge branch '281-continuous-walls' into 'develop'

A first working version of cutting big walls. 

- Doors "on" walls or "nearly on" walls are considered. 
Walls are then split and the overlapping part is removed:
x----o---o---x becomes
x----o   o---x

- Big walls are removed. Big walls are any walls that intersect other walls, crossing or transitions
  at a point different than their endpoint.

- in Utest we have some working unit tests for​ the function correct().
  Other cases where the function fails may exist. In this case, we have to add more unit tests and fix it if possible.

Closes #281

See merge request !36
parents 485a8fa3 a06b4f4a
Pipeline #14299 failed with stages
in 12 minutes and 36 seconds
......@@ -156,7 +156,7 @@ add_definitions("-DGIT_BRANCH=\"${GIT_BRANCH}\"")
# add a target to generate API documentation with Doxygen
find_package(Doxygen)
if (DOXYGEN_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
......@@ -787,7 +787,7 @@ endif()
# ----------------------------- cTest ------------------------------------------
if (BUILD_TESTING OR BUILD_CPPUNIT_TEST)
set(counter "0")
set(counter "0")
SET(BUILD_TEST_TIMEOUT 10800 CACHE STRING "Global timeout on all tests (seconds).")
SET(DART_TESTING_TIMEOUT "${BUILD_TEST_TIMEOUT}" CACHE STRING "" FORCE)
message(STATUS "Timeout: " ${BUILD_TEST_TIMEOUT} " s")
......@@ -805,12 +805,24 @@ if (BUILD_TESTING OR BUILD_CPPUNIT_TEST)
target_link_libraries(${test} core ${Boost_LIBRARIES})
add_test(NAME ${test} COMMAND ${test})
endforeach (test_src ${test_files})
# -- new clean geometry tests
file(GLOB_RECURSE cgeo_inifiles "${CMAKE_TEST_DIR}/test_geometry/clean_geometry/ini*.xml")
set(ini_counter "0")
foreach (cgeo-ini ${cgeo_inifiles})
MATH(EXPR ini_counter "${ini_counter}+1")
set(testName "test_clean_geometry_${ini_counter}")
message(STATUS "Add " ${testName})
add_test(NAME "${testName}" COMMAND jpscore "${cgeo-ini}")
endforeach()
endif (BUILD_TESTING OR BUILD_CPPUNIT_TEST)
if (BUILD_TESTING)
find_package(PythonInterp)
if (PYTHONINTERP_FOUND)
message(STATUS "Found Python: " ${PYTHON_EXECUTABLE})
find_package(PythonInterp)
if (PYTHONINTERP_FOUND)
message(STATUS "Found Python: " ${PYTHON_EXECUTABLE})
foreach (test_src ${test_py_files})
MATH(EXPR counter "${counter}+1")
GET_FILENAME_COMPONENT(test ${test_src} NAME_WE)
......
......@@ -134,7 +134,7 @@ bool GeoFileParser::LoadGeometry(Building* building)
SubRoom* subroom = nullptr;
if (type=="stair" || type=="escalator" || type=="idle_escalator") {
if (xSubRoom->FirstChildElement("up") == NULL) {
if (xSubRoom->FirstChildElement("up") == nullptr) {
Log->Write("ERROR:\t the attribute <up> and <down> are missing for the " + type);
Log->Write("ERROR:\t check your geometry file");
return false;
......@@ -147,7 +147,7 @@ bool GeoFileParser::LoadGeometry(Building* building)
((Stair *) subroom)->SetUp(Point(up_x, up_y));
((Stair *) subroom)->SetDown(Point(down_x, down_y));
} else if (type =="escalator_up") {
if (xSubRoom->FirstChildElement("up") == NULL) {
if (xSubRoom->FirstChildElement("up") == nullptr) {
Log->Write("ERROR:\t the attribute <up> and <down> are missing for the " + type);
Log->Write("ERROR:\t check your geometry file");
return false;
......@@ -162,7 +162,7 @@ bool GeoFileParser::LoadGeometry(Building* building)
((Escalator*) subroom)->SetEscalatorUp();
_configuration->set_has_directional_escalators(true);
} else if (type == "escalator_down") {
if (xSubRoom->FirstChildElement("up") == NULL) {
if (xSubRoom->FirstChildElement("up") ==nullptr) {
Log->Write("ERROR:\t the attribute <up> and <down> are missing for the " + type);
Log->Write("ERROR:\t check your geometry file");
return false;
......
......@@ -1524,10 +1524,10 @@ bool IniFileParser::ParseStrategyNodeToObject(const TiXmlNode& strategyNode)
if (pExitStrategy == 8 || pExitStrategy ==9){
_config->set_write_VTK_files_direction(false);
if (strategyNode.FirstChild("write_VTK_files")) {
const char* tmp =
const char* tmp1 =
strategyNode.FirstChild("write_VTK_files")->FirstChild()->Value();
//remark: std::strcmp returns 0 if the strings are equal
bool tmp_write_VTK = !std::strcmp(tmp, "true");
bool tmp_write_VTK = !std::strcmp(tmp1, "true");
_config->set_write_VTK_files_direction(tmp_write_VTK);
}
......
......@@ -300,7 +300,7 @@ void Simulation::UpdateRoutesAndLocations()
auto allRooms = _building->GetAllRooms();
#pragma omp parallel for shared(pedsToRemove, allRooms)
for (signed int p = 0; p < allPeds.size(); ++p) {
for (unsigned int p = 0; p < allPeds.size(); ++p) {
auto ped = allPeds[p];
Room* room = _building->GetRoom(ped->GetRoomID());
SubRoom* sub0 = room->GetSubRoom(ped->GetSubRoomID());
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<geometry version="0.8" caption="corner" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xsd.jupedsim.org/jps_geometry.xsd" unit="m">
<rooms>
<room id="0" caption="floor">
<subroom id="1" caption="Room 1" class="Not specified" A_x="0" B_y="0" C_z="0">
<polygon caption="wall">
<vertex px="5" py="8"/>
<vertex px="5" py="4"/>
</polygon>
<polygon caption="wall">
<vertex px="8" py="8"/>
<vertex px="8" py="7"/>
</polygon>
<polygon caption="wall">
<vertex px="8" py="5"/>
<vertex px="8" py="4"/>
</polygon>
<polygon caption="wall">
<vertex px="11" py="8"/>
<vertex px="5" py="8"/>
</polygon>
<polygon caption="wall">
<vertex px="5" py="4"/>
<vertex px="11" py="4"/>
</polygon>
</subroom>
<subroom id="2" caption="Room 2" class="Not specified" A_x="0" B_y="0" C_z="0">
<polygon caption="wall">
<vertex px="5" py="4"/>
<vertex px="11" py="4"/>
</polygon>
<polygon caption="wall">
<vertex px="11" py="8"/>
<vertex px="5" py="8"/>
</polygon>
<polygon caption="wall">
<vertex px="8" py="8"/>
<vertex px="8" py="7"/>
</polygon>
<polygon caption="wall">
<vertex px="8" py="5"/>
<vertex px="8" py="4"/>
</polygon>
</subroom>
<crossings>
<crossing id="0" subroom1_id="1" subroom2_id="2">
<vertex px="8" py="7"/>
<vertex px="8" py="5"/>
</crossing>
</crossings>
</room>
</rooms>
<transitions>
<transition id="0" caption="NaN" type="NaN" room1_id="0" subroom1_id="2" room2_id="-1" subroom2_id="-1">
<vertex px="11" py="8"/>
<vertex px="11" py="4"/>
</transition>
</transitions>
</geometry>
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<geometry version="0.8" caption="corner" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xsd.jupedsim.org/jps_geometry.xsd" unit="m">
<rooms>
<room id="0" caption="floor">
<subroom id="0" caption="Room 0" class="Not specified" A_x="0" B_y="0" C_z="0">
<polygon caption="wall">
<vertex px="5" py="8"/>
<vertex px="5" py="4"/>
</polygon>
<polygon caption="wall">
<vertex px="11" py="8"/>
<vertex px="5" py="8"/>
</polygon>
<polygon caption="wall">
<vertex px="5" py="4"/>
<vertex px="11" py="4"/>
</polygon>
<polygon caption="wall">
<vertex px="6" py="8"/>
<vertex px="6" py="7"/>
</polygon>
<polygon caption="wall">
<vertex px="6" py="4"/>
<vertex px="6" py="5"/>
</polygon>
</subroom>
<subroom id="1" caption="Room 1" class="Not specified" A_x="0" B_y="0" C_z="0">
<polygon caption="wall">
<vertex px="8" py="8"/>
<vertex px="8" py="7"/>
</polygon>
<polygon caption="wall">
<vertex px="8" py="5"/>
<vertex px="8" py="4"/>
</polygon>
<polygon caption="wall">
<vertex px="11" py="8"/>
<vertex px="5" py="8"/>
</polygon>
<polygon caption="wall">
<vertex px="5" py="4"/>
<vertex px="11" py="4"/>
</polygon>
<polygon caption="wall">
<vertex px="6" py="8"/>
<vertex px="6" py="7"/>
</polygon>
<polygon caption="wall">
<vertex px="6" py="4"/>
<vertex px="6" py="5"/>
</polygon>
</subroom>
<subroom id="2" caption="Room 2" class="Not specified" A_x="0" B_y="0" C_z="0">
<polygon caption="wall">
<vertex px="8" py="8"/>
<vertex px="8" py="7"/>
</polygon>
<polygon caption="wall">
<vertex px="8" py="5"/>
<vertex px="8" py="4"/>
</polygon>
<polygon caption="wall">
<vertex px="11" py="8"/>
<vertex px="5" py="8"/>
</polygon>
<polygon caption="wall">
<vertex px="5" py="4"/>
<vertex px="11" py="4"/>
</polygon>
</subroom>
<crossings>
<crossing id="0" subroom1_id="0" subroom2_id="1">
<vertex px="6" py="7"/>
<vertex px="6" py="5"/>
</crossing>
<crossing id="1" subroom1_id="1" subroom2_id="2">
<vertex px="8" py="7"/>
<vertex px="8" py="5"/>
</crossing>
</crossings>
</room>
</rooms>
<transitions>
<transition id="0" caption="NaN" type="NaN" room1_id="0" subroom1_id="2" room2_id="-1" subroom2_id="-1">
<vertex px="11" py="8"/>
<vertex px="11" py="4"/>
</transition>
</transitions>
</geometry>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<geometry version="0.8" caption="corner" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xsd.jupedsim.org/jps_geometry.xsd" unit="m">
<rooms>
<room id="0" caption="floor">
<subroom id="0" caption="Room 0" class="Not specified" A_x="0" B_y="0" C_z="0">
<polygon caption="wall">
<vertex px="0" py="8"/>
<vertex px="0" py="2"/>
</polygon>
<polygon caption="wall">
<vertex px="0" py="8"/>
<vertex px="10" py="8"/>
</polygon>
<polygon caption="wall">
<vertex px="0" py="2"/>
<vertex px="10" py="2"/>
</polygon>
</subroom>
<subroom id="1" caption="Room 1" class="Not specified" A_x="0" B_y="0" C_z="0">
<polygon caption="wall">
<vertex px="0" py="8"/>
<vertex px="10" py="8"/>
</polygon>
<polygon caption="wall">
<vertex px="0" py="2"/>
<vertex px="10" py="2"/>
</polygon>
</subroom>
<crossings>
<crossing id="1" subroom1_id="0" subroom2_id="1">
<vertex px="6" py="8"/>
<vertex px="6" py="2"/>
</crossing>
</crossings>
</room>
</rooms>
<transitions>
<transition id="0" caption="NaN" type="NaN" room1_id="0" subroom1_id="0" room2_id="-1" subroom2_id="-1">
<vertex px="2" py="8"/>
<vertex px="4" py="8"/>
</transition>
<transition id="1" caption="NaN" type="NaN" room1_id="0" subroom1_id="1" room2_id="-1" subroom2_id="-1">
<vertex px="10" py="8"/>
<vertex px="10" py="2"/>
</transition>
</transitions>
</geometry>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<geometry version="0.8" caption="corner" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xsd.jupedsim.org/jps_geometry.xsd" unit="m">
<rooms>
<room id="0" caption="floor">
<subroom id="1" caption="Room 1" class="Not specified" A_x="0" B_y="0" C_z="0">
<polygon caption="wall">
<vertex px="11" py="7"/>
<vertex px="5" py="7"/>
</polygon>
<polygon caption="wall">
<vertex px="5" py="7"/>
<vertex px="5" py="4"/>
</polygon>
<polygon caption="wall">
<vertex px="5" py="4"/>
<vertex px="11" py="4"/>
</polygon>
</subroom>
<crossings/>
</room>
</rooms>
<transitions>
<transition id="0" caption="NaN" type="NaN" room1_id="0" subroom1_id="1" room2_id="-1" subroom2_id="-1">
<vertex px="8" py="7"/>
<vertex px="8" py="4"/>
</transition>
</transitions>
</geometry>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<geometry version="0.8" caption="corner" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xsd.jupedsim.org/jps_geometry.xsd" unit="m">
<rooms>
<room id="0" caption="Raum">
<subroom id="1" caption="Room 1" class="Corridor" A_x="0" B_y="0" C_z="0.00">
<polygon>
<vertex px="9.90" py="9.90"/>
<vertex px="0.10" py="9.90"/>
</polygon>
<polygon>
<vertex px="0.10" py="9.90"/>
<vertex px="0.10" py="0.10"/>
</polygon>
<polygon>
<vertex px="3.62" py="6.27"/>
<vertex px="0.10" py="6.27"/>
</polygon>
<polygon>
<vertex px="3.62" py="6.27"/>
<vertex px="3.62" py="7.73"/>
</polygon>
<polygon>
<vertex px="3.62" py="7.73"/>
<vertex px="6.24" py="7.73"/>
</polygon>
<polygon>
<vertex px="5.06" py="9.90"/>
<vertex px="5.06" py="7.73"/>
</polygon>
</subroom>
<subroom id="2" caption="Room 2" class="Corridor" A_x="0" B_y="0" C_z="0.00">
<polygon>
<vertex px="9.90" py="0.10"/>
<vertex px="9.90" py="9.90"/>
</polygon>
<polygon>
<vertex px="9.90" py="9.90"/>
<vertex px="0.10" py="9.90"/>
</polygon>
<polygon>
<vertex px="5.06" py="9.90"/>
<vertex px="5.06" py="7.73"/>
</polygon>
<polygon>
<vertex px="3.62" py="7.73"/>
<vertex px="6.24" py="7.73"/>
</polygon>
<polygon>
<vertex px="6.24" py="7.73"/>
<vertex px="6.24" py="6.27"/>
</polygon>
<polygon>
<vertex px="6.24" py="6.27"/>
<vertex px="9.90" py="6.27"/>
</polygon>
</subroom>
<subroom id="3" caption="Room 3" class="Corridor" A_x="0" B_y="0" C_z="0.00">
<polygon>
<vertex px="0.10" py="0.10"/>
<vertex px="9.90" py="0.10"/>
</polygon>
<polygon>
<vertex px="4.94" py="0.10"/>
<vertex px="4.94" py="3.67"/>
</polygon>
<polygon>
<vertex px="4.94" py="3.67"/>
<vertex px="0.10" py="3.67"/>
</polygon>
<polygon>
<vertex px="0.10" py="9.90"/>
<vertex px="0.10" py="0.10"/>
</polygon>
</subroom>
<subroom id="4" caption="Room 4" class="Corridor" A_x="0" B_y="0" C_z="0.00">
<polygon>
<vertex px="0.10" py="0.10"/>
<vertex px="9.90" py="0.10"/>
</polygon>
<polygon>
<vertex px="9.90" py="0.10"/>
<vertex px="9.90" py="9.90"/>
</polygon>
<polygon>
<vertex px="4.94" py="3.67"/>
<vertex px="9.90" py="3.67"/>
</polygon>
<polygon>
<vertex px="4.94" py="0.10"/>
<vertex px="4.94" py="3.67"/>
</polygon>
</subroom>
<subroom id="5" caption="Room 5" class="Corridor" A_x="0" B_y="0" C_z="0.00">
<polygon>
<vertex px="9.90" py="0.10"/>
<vertex px="9.90" py="9.90"/>
</polygon>
<polygon>
<vertex px="6.24" py="6.27"/>
<vertex px="9.90" py="6.27"/>
</polygon>
<polygon>
<vertex px="6.24" py="7.73"/>
<vertex px="6.24" py="6.27"/>
</polygon>
<polygon>
<vertex px="3.62" py="7.73"/>
<vertex px="6.24" py="7.73"/>
</polygon>
<polygon>
<vertex px="3.62" py="7.73"/>
<vertex px="6.24" py="7.73"/>
</polygon>
<polygon>
<vertex px="3.62" py="6.27"/>
<vertex px="3.62" py="7.73"/>
</polygon>
<polygon>
<vertex px="3.62" py="6.27"/>
<vertex px="0.10" py="6.27"/>
</polygon>
<polygon>
<vertex px="0.10" py="9.90"/>
<vertex px="0.10" py="0.10"/>
</polygon>
<polygon>
<vertex px="4.94" py="3.67"/>
<vertex px="0.10" py="3.67"/>
</polygon>
<polygon>
<vertex px="4.94" py="3.67"/>
<vertex px="9.90" py="3.67"/>
</polygon>
</subroom>
<crossings>
<crossing id="9" subroom1_id="1" subroom2_id="5">
<vertex px="3.60" py="6.60"/>
<vertex px="3.60" py="7.40"/>
</crossing>
<crossing id="11" subroom1_id="1" subroom2_id="5">
<vertex px="1.50" py="6.30"/>
<vertex px="2.30" py="6.30"/>
</crossing>
<crossing id="0" subroom1_id="2" subroom2_id="5">
<vertex px="7.00" py="6.30"/>
<vertex px="7.80" py="6.30"/>
</crossing>
<crossing id="10" subroom1_id="2" subroom2_id="5">
<vertex px="6.20" py="6.60"/>
<vertex px="6.20" py="7.40"/>
</crossing>
<crossing id="2" subroom1_id="3" subroom2_id="5">
<vertex px="2.10" py="3.70"/>
<vertex px="2.90" py="3.70"/>
</crossing>
<crossing id="1" subroom1_id="4" subroom2_id="5">
<vertex px="7.00" py="3.70"/>
<vertex px="7.80" py="3.70"/>
</crossing>
</crossings>
</room>
</rooms>
<transitions>
<transition id="3" caption="NaN" type="NaN" room1_id="0" subroom1_id="5" room2_id="-1" subromm2_id="-1">
<vertex px="0.10" py="4.60"/>
<vertex px="0.10" py="5.40"/>
</transition>
<transition id="4" caption="NaN" type="NaN" room1_id="0" subroom1_id="5" room2_id="-1" subromm2_id="-1">
<vertex px="9.90" py="4.60"/>
<vertex px="9.90" py="5.40"/>
</transition>
</transitions>
</geometry>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<geometry version="0.8" caption="corner" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xsd.jupedsim.org/jps_geometry.xsd" unit="m">
<rooms>
<room id="0" caption="floor">
<subroom id="1" caption="Room 1" class="Not specified" A_x="0" B_y="0" C_z="0">
<polygon caption="wall">
<vertex px="4" py="0"/>
<vertex px="2" py="0"/>
</polygon>
<polygon caption="wall">
<vertex px="2" py="0"/>
<vertex px="0" py="2"/>
</polygon>
<polygon caption="wall">
<vertex px="0" py="2"/>
<vertex px="0" py="4"/>
</polygon>
<polygon caption="wall">
<vertex px="0" py="4"/>
<vertex px="2" py="6"/>
</polygon>
<polygon caption="wall">
<vertex px="2" py="6"/>
<vertex px="4" py="6"/>
</polygon>
<polygon caption="wall">
<vertex px="4" py="6"/>
<vertex px="6" py="4"/>
</polygon>
<polygon caption="wall">
<vertex px="6" py="4"/>
<vertex px="6" py="2"/>
</polygon>
<polygon caption="wall">
<vertex px="6" py="2"/>
<vertex px="4" py="0"/>
</polygon>
</subroom>
<crossings/>
</room>
</rooms>
<transitions>
<transition id="1" caption="auf_Linine_1" type="NaN" room1_id="0" subroom1_id="1" room2_id="-1" subroom2_id="-1">
<vertex px="0" py="2.5"/>
<vertex px="0" py="3.5"/>
</transition>
<transition id="2" caption="auf_Linine_2" type="NaN" room1_id="0" subroom1_id="1" room2_id="-1" subroom2_id="-1">
<vertex px="6" py="2.5"/>
<vertex px="6" py="3.5"/>
</transition>
<transition id="3" caption="neben_Linine_innen" type="NaN" room1_id="0" subroom1_id="1" room2_id="-1" subroom2_id="-1">
<vertex px="2.5" py="0.03"/>
<vertex px="3.5" py="0.03"/>
</transition>
<transition id="4" caption="neben_Linine_aussen" type="NaN" room1_id="0" subroom1_id="1" room2_id="-1" subroom2_id="-1">
<vertex px="2.5" py="6.03"/>
<vertex px="3.5" py="6.03"/>
</transition>
<transition id="5" caption="auf_Linine_schraeg" type="NaN" room1_id="0" subroom1_id="1" room2_id="-1" subroom2_id="-1">
<vertex px="0.5" py="4.5"/>
<vertex px="1.5" py="5.5"/>
</transition>
<transition id="6" caption="neben_Linine_innen_schraeg" type="NaN" room1_id="0" subroom1_id="1" room2_id="-1" subroom2_id="-1">
<vertex px="4.48" py="5.48"/>
<vertex px="5.48" py="4.48"/>
</transition>
<transition id="7" caption="neben_Linine_aussen_schraeg" type="NaN" room1_id="0" subroom1_id="1" room2_id="-1" subroom2_id="-1">
<vertex px="4.53" py="0.53"/>
<vertex px="5.53" py="1.53"/>
</transition>
</transitions>
</geometry>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<geometry version="0.8" caption="corner" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xsd.jupedsim.org/jps_geometry.xsd" unit="m">
<rooms>
<room id="0" caption="floor">
<subroom id="1" caption="Room 1" class="Not specified" A_x="0" B_y="0" C_z="0">
<polygon caption="wall">
<vertex px="1" py="0"/>
<vertex px="3" py="0"/>
</polygon>
<polygon caption="wall">
<vertex px="1" py="0"/>
<vertex px="0" py="1.5"/>
</polygon>
<polygon caption="wall">
<vertex px="0" py="1.5"/>
<vertex px="1" py="3"/>
</polygon>
<polygon caption="wall">
<vertex px="1" py="3"/>
<vertex px="3" py="3"/>
</polygon>
<polygon caption="wall">
<vertex px="3" py="3"/>