1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
puts "========="
puts "OCC25788"
puts "========="
puts ""
###############################################
# Parallelization of the BOP Builder algorithm on second level
###############################################
# box plate to cut the holes from
box b1 100 100 1
# N defines number of holes along each of X and Y, thus total N^2 holes
# will be drilled; note that the algorithm iself is likely to be quadratic
# for number of shapes, i.e. CPU
set N 40
set holes {}
for {set i 1} {$i < $N} {incr i} {
for {set j 1} {$j < $N} {incr j} {
pcylinder p_${i}_$j 0.5 1
ttranslate p_${i}_$j [expr $i * 100. / $N] [expr $j * 100. / $N] 0.
lappend holes p_${i}_$j
}
}
eval compound $holes b2
bclearobjects
bcleartools
baddobjects b1
baddtools b2
brunparallel 1
dchrono cpu reset
dchrono cpu start
bcut r b1 b2
dchrono cpu stop
set chrono_info [dchrono cpu show]
if { [regexp {Debug mode} [dversion]] } {
if { [regexp {Windows} [dversion]] } {
set max_time 200
} else {
set max_time 200
}
} else {
if { [regexp {Windows} [dversion]] } {
set max_time 50
} else {
set max_time 50
}
}
regexp {CPU user time: ([-0-9.+eE]+) seconds} ${chrono_info} full z
puts "$z"
if { $z > ${max_time} } {
puts "Elapsed time is more than ${max_time} seconds - Faulty"
} else {
puts "Elapsed time is less than ${max_time} seconds - OK"
}
|