@@ -39,23 +39,28 @@ proc write::printGeometryConnectivities {group etype nnodes} {
3939 set s [mdpaIndent]
4040 set nDim $::Model::SpatialDimension
4141 set geometry_name ${etype}${nDim}${nnodes}
42- # Write header
43- WriteString " ${s} Begin Geometries $geometry_name // GUI group identifier: $group "
44- # increase indent (allows folding in text editor)
45- incr ::write::current_mdpa_indent_level
42+
4643 # Prepare the formats dict
4744 set formats [GetFormatDict $group " " $nnodes ]
48- # Write the connectivities
49- GiD_WriteCalculationFile connectivities $formats
50- # decrease indent
51- incr ::write::current_mdpa_indent_level -1
52- # Write footer
53- WriteString " ${s} End Geometries"
54- WriteString " "
45+ set num_elems [GiD_WriteCalculationFile connectivities -count $formats ]
46+ if {$num_elems > 0} {
47+
48+ # Write header
49+ WriteString " ${s} Begin Geometries $geometry_name // GUI group identifier: $group "
50+ # increase indent (allows folding in text editor)
51+ incr ::write::current_mdpa_indent_level
52+ # Write the connectivities
53+ GiD_WriteCalculationFile connectivities $formats
54+ # decrease indent
55+ incr ::write::current_mdpa_indent_level -1
56+ # Write footer
57+ WriteString " ${s} End Geometries"
58+ WriteString " "
5559
56- # Write the radius if it is a sphere or a circle
57- if {$etype == " Sphere" || $etype == " Circle" } {
58- write::writeSphereRadiusOnGroup $group
60+ # Write the radius if it is a sphere or a circle
61+ if {$etype == " Sphere" || $etype == " Circle" } {
62+ write::writeSphereRadiusOnGroup $group
63+ }
5964 }
6065 if {[GetConfigurationAttribute time_monitor]} {set endtime [clock seconds]; set ttime [expr {$endtime -$inittime }]; W " printGeometryConnectivities $geometry_name time: [ Kratos::Duration $ttime ] " }
6166}
0 commit comments