Skip to content

Commit 3f4cbda

Browse files
Merge pull request #972 from KratosMultiphysics/new-line-geom-mesh-relation
New line geom mesh relation
2 parents 71d2594 + fc042bc commit 3f4cbda

4 files changed

Lines changed: 16 additions & 28 deletions

File tree

kratos.gid/apps/Stent/start.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@ proc ::Stent::CustomToolbarItems { } {
4949
}
5050

5151
proc ::Stent::BeforeMeshGeneration { size } {
52-
::Structural::BeforeMeshGeneration $size
52+
catch {::Structural::BeforeMeshGeneration $size}
5353
}

kratos.gid/apps/Structural/start.tcl

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,6 @@ proc ::Structural::Init { app } {
2222
::Structural::write::Init
2323
}
2424

25-
# Create the old-gid condition relation_line_geo_mesh to link geometry and mesh entities.
26-
# Topic: Local axes, beams
27-
# TODO: remove this when GiD creates this relation automatically
28-
proc ::Structural::BeforeMeshGeneration { size } {
29-
GiD_UnAssignData condition relation_line_geo_mesh Lines all
30-
foreach group [GiD_Groups list] {
31-
GiD_AssignData condition relation_line_geo_mesh Lines {0} [GiD_EntitiesGroups get $group lines]
32-
}
33-
}
34-
3525
# Some conditions applied over small displacement parts must change the topology name... una chufa
3626
proc ::Structural::ApplicationSpecificGetCondition {condition group etype nnodes} {
3727
return [Structural::write::ApplicationSpecificGetCondition $condition $group $etype $nnodes]

kratos.gid/apps/Structural/write/write.tcl

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,6 @@ proc ::Structural::write::writeHinges { } {
249249
# format for writing ids
250250
set id_f [dict get $write::formats_dict ID]
251251

252-
# Preprocess old_conditions. Each mesh linear element remembers the origin line in geometry
253-
set match_dict [dict create]
254-
foreach line [GiD_Info conditions relation_line_geo_mesh mesh] {
255-
lassign $line E eid - geom_line
256-
dict lappend match_dict $geom_line $eid
257-
}
258-
259252
# Process groups assigned to Hinges
260253
if {$::Model::SpatialDimension eq "3D"} {
261254
set xp1 "[spdAux::getRoute [GetAttribute nodal_conditions_un]]/condition\[@n = 'CONDENSED_DOF_LIST'\]/group"
@@ -297,9 +290,20 @@ proc ::Structural::write::writeHinges { } {
297290

298291
# Write Left and Rigth end of each geometrical bar
299292
foreach geom_line [GiD_EntitiesGroups get $group lines] {
300-
set linear_elements [dict get $match_dict $geom_line]
301-
set first [::tcl::mathfunc::min {*}$linear_elements]
302-
set end [::tcl::mathfunc::max {*}$linear_elements]
293+
# ask the mesh for the linear elements of this line
294+
# check https://gidsimulation.atlassian.net/wiki/spaces/GCM/pages/2385543949/Geometry
295+
# set linear_elements [lindex [GiD_Geometry get line $geom_line mesh] 4]
296+
# set first [::tcl::mathfunc::min {*}$linear_elements]
297+
# set end [::tcl::mathfunc::max {*}$linear_elements]
298+
299+
lassign [lrange [GiD_Geometry get line $geom_line] 2 3] first_point end_point
300+
set first [GiD_Geometry get point $first_point node]
301+
set end [GiD_Geometry get point $end_point node]
302+
if {$first eq "" || $end eq ""} {
303+
W "Error: Line $geom_line has no nodes. Please make sure the mesh is attached to the geometry."
304+
continue
305+
}
306+
303307
if {[llength $first_list] > 0} {
304308
set value [join $first_list ,]
305309
write::WriteString [format "$id_f \[%d\] (%s)" $first [llength $first_list] $value]

kratos.gid/kratos.cnd

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,5 @@ CANREPEAT: yes
2929
QUESTION: pair_name
3030
VALUE: -
3131
END CONDITION
32-
CONDITION: relation_line_geo_mesh
33-
CONDTYPE: over lines
34-
CONDMESHTYPE: over body elements
35-
CANREPEAT: no
36-
QUESTION: id#FUNC#(NumEntity)
37-
VALUE: 0
38-
END CONDITION
32+
3933

0 commit comments

Comments
 (0)