Skip to content

Commit b913416

Browse files
committed
add queue size limitation
1 parent 9c70de1 commit b913416

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
77

88
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
99
set(TIGHT_INCLUSION_TOPLEVEL_PROJECT ON)
10+
message(STATUS "Tight-Inclusion CCD top-level project")
1011
else()
1112
set(TIGHT_INCLUSION_TOPLEVEL_PROJECT OFF)
13+
message(STATUS "Tight-Inclusion CCD bottom-level project")
14+
# message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}")
15+
# message(STATUS "${CMAKE_SOURCE_DIR}")
1216
endif()
1317

1418
### Configuration
@@ -24,6 +28,7 @@ OPTION(TIGHT_INCLUSION_WITH_TESTS "Enable test functions"
2428
OPTION(TIGHT_INCLUSION_WITH_TIMER "Enable profiling timers, for debug" OFF)
2529
OPTION(TIGHT_INCLUSION_WITH_NO_ZERO_TOI "Enable refinement if CCD produces a zero ToI" OFF)
2630
OPTION(TIGHT_INCLUSION_WITH_DOUBLE_PRECISION "Enable double precision floating point numbers as input" ON)
31+
OPTION(TIGHT_INCLUSION_LIMIT_QUEUE_SIZE "Enable limitation of maximal queue size" OFF)
2732

2833
if(NOT TIGHT_INCLUSION_WITH_DOUBLE_PRECISION)
2934
OPTION(TIGHT_INCLUSION_FLOAT_WITH_DOUBLE_INPUT "Enable converting double queries to float" OFF)
@@ -71,13 +76,19 @@ if (TIGHT_INCLUSION_WITH_DOUBLE_PRECISION)
7176
else()
7277
message(STATUS "Using Single Precision Floating Points")
7378
endif()
79+
if(TIGHT_INCLUSION_LIMIT_QUEUE_SIZE)
80+
target_compile_definitions(tight_inclusion PUBLIC TI_LIMIT_QUEUE_SIZE)
81+
message(STATUS "TICCD limiting maximal queue size")
82+
endif()
83+
7484
if(TIGHT_INCLUSION_FLOAT_WITH_DOUBLE_INPUT)
7585
target_compile_definitions(tight_inclusion PUBLIC TIGHT_INCLUSION_FWDI)
7686
message(STATUS "Converting double inputs to float for tests")
7787
endif()
7888
target_compile_definitions(tight_inclusion PUBLIC NOMINMAX)
7989

8090
if(TIGHT_INCLUSION_TOPLEVEL_PROJECT)
91+
#message(STATUS "Tight-Inclusion CCD top-level project")
8192
if (TIGHT_INCLUSION_WITH_TESTS)
8293
add_executable(Tight_Inclusion_bin
8394
app/main.cpp

tight_inclusion/Types.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#pragma once
22
#include <Eigen/Core>
33
#define CHECK_QUEUE_SIZE
4+
//#define TI_LIMIT_QUEUE_SIZE
5+
6+
#ifdef TI_LIMIT_QUEUE_SIZE
7+
#define MAX_QSIZE 1000
8+
#endif
49

510
inline bool ticcd_using_double()
611
{

tight_inclusion/interval_root_finder.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,6 +1858,13 @@ namespace inclusion_ccd
18581858
queue_size = istack.size();
18591859
}
18601860
#endif
1861+
#ifdef TI_LIMIT_QUEUE_SIZE
1862+
long tmpsize1 = istack.size();
1863+
if (tmpsize1 > MAX_QSIZE) {
1864+
return true;
1865+
}
1866+
#endif
1867+
18611868

18621869
current = istack.top().first;
18631870
int level = istack.top().second;

0 commit comments

Comments
 (0)