Skip to content

Commit

Permalink
Merge pull request #972 from KratosMultiphysics/new-line-geom-mesh-re…
Browse files Browse the repository at this point in the history
…lation

New line geom mesh relation
  • Loading branch information
jginternational authored May 30, 2024
2 parents 71d2594 + fc042bc commit 3f4cbda
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 28 deletions.
2 changes: 1 addition & 1 deletion kratos.gid/apps/Stent/start.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ proc ::Stent::CustomToolbarItems { } {
}

proc ::Stent::BeforeMeshGeneration { size } {
::Structural::BeforeMeshGeneration $size
catch {::Structural::BeforeMeshGeneration $size}
}
10 changes: 0 additions & 10 deletions kratos.gid/apps/Structural/start.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@ proc ::Structural::Init { app } {
::Structural::write::Init
}

# Create the old-gid condition relation_line_geo_mesh to link geometry and mesh entities.
# Topic: Local axes, beams
# TODO: remove this when GiD creates this relation automatically
proc ::Structural::BeforeMeshGeneration { size } {
GiD_UnAssignData condition relation_line_geo_mesh Lines all
foreach group [GiD_Groups list] {
GiD_AssignData condition relation_line_geo_mesh Lines {0} [GiD_EntitiesGroups get $group lines]
}
}

# Some conditions applied over small displacement parts must change the topology name... una chufa
proc ::Structural::ApplicationSpecificGetCondition {condition group etype nnodes} {
return [Structural::write::ApplicationSpecificGetCondition $condition $group $etype $nnodes]
Expand Down
24 changes: 14 additions & 10 deletions kratos.gid/apps/Structural/write/write.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,6 @@ proc ::Structural::write::writeHinges { } {
# format for writing ids
set id_f [dict get $write::formats_dict ID]

# Preprocess old_conditions. Each mesh linear element remembers the origin line in geometry
set match_dict [dict create]
foreach line [GiD_Info conditions relation_line_geo_mesh mesh] {
lassign $line E eid - geom_line
dict lappend match_dict $geom_line $eid
}

# Process groups assigned to Hinges
if {$::Model::SpatialDimension eq "3D"} {
set xp1 "[spdAux::getRoute [GetAttribute nodal_conditions_un]]/condition\[@n = 'CONDENSED_DOF_LIST'\]/group"
Expand Down Expand Up @@ -297,9 +290,20 @@ proc ::Structural::write::writeHinges { } {

# Write Left and Rigth end of each geometrical bar
foreach geom_line [GiD_EntitiesGroups get $group lines] {
set linear_elements [dict get $match_dict $geom_line]
set first [::tcl::mathfunc::min {*}$linear_elements]
set end [::tcl::mathfunc::max {*}$linear_elements]
# ask the mesh for the linear elements of this line
# check https://gidsimulation.atlassian.net/wiki/spaces/GCM/pages/2385543949/Geometry
# set linear_elements [lindex [GiD_Geometry get line $geom_line mesh] 4]
# set first [::tcl::mathfunc::min {*}$linear_elements]
# set end [::tcl::mathfunc::max {*}$linear_elements]

lassign [lrange [GiD_Geometry get line $geom_line] 2 3] first_point end_point
set first [GiD_Geometry get point $first_point node]
set end [GiD_Geometry get point $end_point node]
if {$first eq "" || $end eq ""} {
W "Error: Line $geom_line has no nodes. Please make sure the mesh is attached to the geometry."
continue
}

if {[llength $first_list] > 0} {
set value [join $first_list ,]
write::WriteString [format "$id_f \[%d\] (%s)" $first [llength $first_list] $value]
Expand Down
8 changes: 1 addition & 7 deletions kratos.gid/kratos.cnd
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,5 @@ CANREPEAT: yes
QUESTION: pair_name
VALUE: -
END CONDITION
CONDITION: relation_line_geo_mesh
CONDTYPE: over lines
CONDMESHTYPE: over body elements
CANREPEAT: no
QUESTION: id#FUNC#(NumEntity)
VALUE: 0
END CONDITION


0 comments on commit 3f4cbda

Please sign in to comment.