Skip to content

Commit cd93f66

Browse files
Detect quadratic import and warn user
1 parent efbf82f commit cd93f66

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

kratos.gid/scripts/Controllers/MdpaImportMesh.tcl

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,14 @@ proc Kratos::GuessElementTypeFromMDPA {line} {
241241
set detected_mesh_quad [Kratos::GuessQuadMesh $element_name $dim $nnodes]
242242
set is_quadratic [GiD_Set Model(QuadraticType)]
243243
if { $detected_mesh_quad eq "0" } {
244-
if {$is_quadratic ne "0"} {W "We have changed the mesh mode to linear. Check preferences to change it back."}
244+
if {$is_quadratic ne "0"} {W "We have changed the mesh mode to linear. Check Mesh menu to change it back."}
245245
GiD_Set Model(QuadraticType) 0
246-
} elseif {$is_quadratic eq "1"} {
247-
if {is_quadratic ne "1"} {W "We have changed the mesh mode to quadratic. Check preferences to change it back."}
246+
}
247+
if {$detected_mesh_quad eq "1"} {
248+
if {$is_quadratic ne "1"} {W "We have changed the mesh mode to quadratic. Check Mesh menu to change it back."}
248249
GiD_Set Model(QuadraticType) 1
249250
}
250-
251+
251252
switch $nnodes {
252253
2 {
253254
set element_type "Line"
@@ -314,16 +315,20 @@ proc Kratos::GuessElementTypeFromMDPA {line} {
314315
}
315316

316317
proc Kratos::GuessQuadMesh {element_name dim nnodes} {
317-
set guess -1
318-
# If element name contains "Line"
319-
if {[string first "Line" $element_name] != -1} {
320-
if {$nnodes eq 2} {
321-
set guess 0
322-
} elseif {$nnodes eq 3} {
323-
set guess 1
324-
}
325-
}
326-
return $guess
318+
if {$nnodes eq 6 && $dim eq 2} {return 1}
319+
if {$nnodes eq 4 && $dim eq 2} {return 0}
320+
if {$nnodes eq 4 && $dim eq 3} {return 0}
321+
if {$nnodes eq 8 && $dim eq 2} {return 1}
322+
if {$nnodes eq 8 && $dim eq 3} {return 0}
323+
if {$nnodes eq 2 } {return 0}
324+
if {$nnodes eq 9 } {return 2}
325+
if {$nnodes eq 20 } {return 1}
326+
if {$nnodes eq 27 } {return 2}
327+
if {$nnodes eq 15 } {return 1}
328+
if {$nnodes eq 18 } {return 2}
329+
if {$nnodes eq 5 } {return 0}
330+
if {$nnodes eq 13 } {return 1}
331+
return -1
327332
}
328333

329334
#register the proc to be automatically called when dropping a file

0 commit comments

Comments
 (0)