File: end

package info (click to toggle)
oce 0.17.2-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 297,992 kB
  • ctags: 203,291
  • sloc: cpp: 1,176,369; ansic: 67,206; sh: 11,647; tcl: 6,890; cs: 5,221; python: 2,867; java: 1,522; makefile: 338; xml: 292; perl: 37
file content (205 lines) | stat: -rw-r--r-- 5,850 bytes parent folder | download | duplicates (2)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# Get name of shape

if { [string compare ${TheFileName} ""] != 0 } {
    set is_brep [regexp "\.brep" $TheFileName]
    if {$is_brep == 0} {
        set is_brep [regexp "\.rle" $TheFileName]
    }
    if {$is_brep == 1} {
        puts [brestore [locate_data_file $TheFileName] res]
    } else {
        if { [array get Draw_Groups "DE: STEP"] == "" } {
	    pload XDE
        }
        
        stepread [locate_data_file ${TheFileName}] a *
        tpcompound res
    }
}

puts [checkshape res]

tclean res

if { [string compare $command "shading"] == 0 } {
    vinit
    vdisplay res
    vsetdispmode res 1
    vfit
}

if { [string compare $command "incmesh"] == 0 } {
    set os "ALL"
    if {[array get env os_type] != ""} {
	set os $env(os_type)
    }
    if { [string compare $parallel "-parallel"] != 0 || [info exists count_parallel] == 0 } {
       set count_parallel 1
    }
    for {set i 1} {$i <= $count_parallel} {incr i} {
    	tclean res
	puts "i = $i"
    	incmesh res ${Deflection} ${parallel}
    }
}

if { [string compare $command "mesh"] == 0 } {
    set ResultList [mesh res_mesh res ${Deflection}]
}

# Collect TODO for area
if { [string compare $bug_area ""] != 0 } {
# The difference between the area of a geometry surface and the area of mesh triangles should be less than rel_tol value.
# If rel_tol is 100 we suppose that the mesh cannot be created.
    if { $rel_tol == 100 } {
	puts "TODO $bug_area All:^\\s*Error  : The meshing algo cannot create mesh.\\s*$"
    } else {
	puts "TODO ?$bug_area All:^\\s*Error   : area by triangles differs from the actual area by \[-.0-9\]+ %\\s*$"
    }
}

# Collect TODO for number of triangles without mesh
if { [string compare $bug_withouttri ""] != 0 } {
# It may be different for different OS
    foreach os_withouttri [array names nbwithouttri] {
	if { $nbwithouttri($os_withouttri) != 0 } { 
	    puts "TODO $bug_withouttri $os_withouttri:^\\s*Error: Faces without triangulation: $nbwithouttri($os_withouttri)\\b\\s*"
	}
    }
}

# Collect TODO for number of free links
if { [string compare $bug_freelinks ""] != 0 } {
# It may be different for different OS
    foreach os_freelinks [array names nbfree] {
	if { $nbfree($os_freelinks) != 0 } { 
	    puts "TODO $bug_freelinks $os_freelinks:^\\s*Error: Free links: $nbfree($os_freelinks)\\b\\s*"
	}
    }
}

# Collect TODO for number of cross faces
if { [string compare $bug_cross ""] != 0 } {
# It may be different for different OS
    foreach os_cross [array names nbcross] {
	if { $nbcross($os_cross) != 0 } { 
	    puts "TODO $bug_cross $os_cross:Error: Cross face errors"
	}
    }
}

# Collect TODO for number of async edges
if { [string compare $bug_async ""] != 0 } {
# It may be different for different OS
    foreach os_async [array names nbasync] {
	if { $nbasync($os_async) != 0 } { 
	    puts "TODO $bug_async $os_async:^\\s*Error: Async edges: $nbasync($os_async)\\b\\s*"
	}
    }
}

# Collect TODO for number of free nodes
if { [string compare $bug_freenodes ""] != 0 } {
# It may be different for different OS
    foreach os_freenodes [array names nbfreenodes] {
	if { $nbfreenodes($os_freenodes) != 0 } { 
	    puts "TODO $bug_freenodes $os_freenodes:Error: Free nodes"
	}
    }
}

# Number of triangles
set tri 0
# Number of nodes
set nod 0
# Deflection
set def 0

# Collect number of triangles, number of nodes and deflection.
if { [string compare $command "mesh"] != 0 } {
    set full [trinfo res]
    regexp "(\[0-9\]+) +triangles.*\[^0-9]\(\[0-9\]+) +nodes.*deflection +(\[0-9\]|\.+)" $full reg_out tri nod def
} else {
    set full [split $ResultList "()"]
    set tri [lindex [lindex $full 2] 0]
    set lin [lindex [lindex $full 4] 0]
    set nod [lindex [lindex $full 6] 0]
}

if { $tri == 0 || $nod == 0 } {                                                                     
    puts " "
    puts "Error  : The meshing algo cannot create mesh."    
}             

puts " "
puts "XML property: triangles $tri"
puts "XML property: nodes $nod"
puts " "

# Check if area of triangles is valid
proc CheckTriArea {shape {eps 0}} {
  upvar #0 $shape a
  set area [triarea a $eps]
  set t_area [lindex $area 0]
  set g_area [expr abs([lindex $area 1])]
  puts "area by triangles: $t_area"
  puts "area by geometry:  $g_area"
  expr ($t_area - $g_area) / $g_area * 100
}

puts "\nChecking triangulation area (triarea command)..."
set rel_err [expr abs([CheckTriArea res $area_eps])]
if { $rel_err > $rel_tol } {
    puts "Error   : area by triangles differs from the actual area by $rel_err %"
} else {
    if { $rel_tol > 1 && $rel_tol < 100 } {
	puts "Error: Improvement: The current area difference is $rel_err instead of $rel_tol"
    }
}

# Check if topology of mesh is valid
puts "\nChecking mesh topology (tricheck command)..."
set l [tricheck res]
if {$l != ""} {
    puts $l
    set withouttri [regsub -all "face \[0-9\]+ has no triangulation" $l "FOUND" ll]
    if { $withouttri != 0 } {
	puts "Error: Faces without triangulation: $withouttri"
    }
    if { [regexp "Free_links +(\[0-9\]+) +Cross_face_errors +(\[0-9\]+) +Async_edges +(\[0-9\]+) +Free_nodes +(\[0-9\]+)" $l full freelinks crossfaces asyncedges freenodes] } {
	if { $freelinks != 0 } {
	    puts "Error: Free links: $freelinks"
	}
	if { $crossfaces != 0 } {
	    puts "Error: Cross face errors: $crossfaces"
	}
	if { $asyncedges != 0 } {
	    puts "Error: Async edges: $asyncedges"
	}
	if { $freenodes != 0 } {
	    puts "Error: Free nodes: $freenodes"
	}
    }
}

if { [info exists imagedir] == 0 } {
   set imagedir .
}
if { [info exists test_image ] == 0 } {
   set test_image photo
}

if { [string compare $command "shading"] == 0 } {
    vdump $imagedir/${test_image}.png
} else {
    isos 0
    smallview
    donly res
    fit
    triangles res
    xwd $imagedir/${test_image}.png
}

puts ""
puts "TEST COMPLETED" 
puts ""