Skip to content

Commit a33f174

Browse files
Merge branch 'write-geoms-migration' into potential-geom-migration
2 parents d1ed236 + b99f19b commit a33f174

2 files changed

Lines changed: 23 additions & 14 deletions

File tree

kratos.gid/scripts/Writing/WriteGeometries.tcl

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

kratos.gid/scripts/Writing/WriteMaterials.tcl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ proc write::getPropertiesListByConditionXPath {cnd_xpath {write_claw_name "True"
170170
set props_dict [dict create]
171171
set props [list ]
172172

173+
# first property
174+
set first [dict create "model_part_name" $model_part_name "properties_id" 0 "Material" [dict create Variables [dict create]]]
175+
lappend props $first
176+
173177
set doc $gid_groups_conds::doc
174178
set root [$doc documentElement]
175179

0 commit comments

Comments
 (0)