Skip to content

Commit

Permalink
Merge pull request #944 from KratosMultiphysics/improve-write-geometries
Browse files Browse the repository at this point in the history
Get format dict for geometries no mid
  • Loading branch information
jginternational authored Jul 6, 2023
2 parents 6e4d23b + f1989cf commit cfd76d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion kratos.gid/scripts/Writing/WriteGeometries.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ proc write::printGeometryConnectivities {group etype nnodes} {
# increase indent (allows folding in text editor)
incr ::write::current_mdpa_indent_level
# Prepare the formats dict
set formats [GetFormatDict $group 0 $nnodes]
set formats [GetFormatDict $group "" $nnodes]
# Write the connectivities
GiD_WriteCalculationFile connectivities $formats
# decrease indent
Expand Down
12 changes: 9 additions & 3 deletions kratos.gid/scripts/Writing/Writing.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,18 @@ proc write::transformGroupName {groupid} {

# Warning! Indentation must be set before calling here!
proc write::GetFormatDict { groupid mid num} {
set s [mdpaIndent]

variable formats_dict
set id_f [dict get $formats_dict ID]
set mid_f [dict get $formats_dict MAT_ID]

set s [mdpaIndent]
set f "${s}$id_f [format $mid_f $mid] [string repeat "$id_f " $num]\n"
set mid_str ""
if {$mid ne ""} {
set mid_f [dict get $formats_dict MAT_ID]
set mid_str [format $mid_f $mid]
}

set f "${s}$id_f $mid_str [string repeat "$id_f " $num]\n"
return [dict create $groupid $f]
}

Expand Down

0 comments on commit cfd76d0

Please sign in to comment.