Edges are not stored splicitly inside GiD, and is not possible to directly get this information (e.g. with .bas template commands)
You must do something to recover this information from the Element-to-node information that GiD store.
at Tcl level, you can use for example an auxilary array to assign an edge_id to all edges, without repetition (na:nb must be considered equal to nb:na)
You can create a problemtype with a problemtype.tcl file with this code (or invoke this Tcl from a macro)
proc GetEdgeKey { n0 n1 } {
if { $n0 $n1 } {
set key "$n0 $n1"
} else {
set key "$n1 $n0"
}
return $key
}
proc GetEdgesInformation { } {
#store all edges witout repetition in the array named Edges
set edges(Tetrahedra) { {0 1} {1 2} 2 0} {0 3} {1 3} {2 3}}
set elementtype Tetrahedra
foreach element [GiD_Info Mesh Elements $elementtype -sublist] {
set nodes [lrange $element 1 end-1]
foreach edge $edges($elementtype) {
set n0 [lindex $nodes [lindex $edge 0]]
set n1 [lindex $nodes [lindex $edge 1]]
set key [GetEdgeKey $n0 $n1]
set Edges($key) 1
}
}
#assign an id to each edge
set count 0
foreach key [array names Edges] {
incr count
set Edges($key) $count
}
#return the information you want
set res "Element-to-edge:\n"
foreach element [GiD_Info Mesh Elements $elementtype -sublist] {
set nodes [lrange $element 1 end-1]
foreach edge $edges($elementtype) {
set n0 [lindex $nodes [lindex $edge 0]]
set n1 [lindex $nodes [lindex $edge 1]]
set key [GetEdgeKey $n0 $n1]
append res "[lindex $element 0] $Edges($key) \n"
}
}
append res "Edge-to-node:\n"
foreach key [array names Edges] {
append res "$Edges($key) $key\n"
}
result $res
}
and then print the information returned by GetEdgesInformation to the calculation file invoking in the problemtype.bas file this tcl procedure
with
*tcl(GetEdgesInformation)
Note that I wrote a procedure considering only linear Tetrahedra, you must modify it to take into account other kind of elements
and I didn't tested it, maybe there is some small error that you must fix.
Tcl is an standard scripting language, and you can find a lot of information of its syntax at Internet.
The GiD_Info is an special GiD-Tcl command to get GiD mesh information, you can see its syntax at the GiD Help - customization - Tcl/Tk extension
Regards
Enrique Escolano
----- Original Message -----
From: Tao Chen 陈涛
To: GID Mail list
Sent: Wednesday, March 30, 2011 2:48 PM
Subject: [GiDlist] How to get the information of mesh edges?
Dear GiD,
How could I get information of mesh edges after meshing the geometry?
The data I need is as follows (Take the Tetrahedra element type of meshing for example).
Element-to-edge:
Element_ID Edge_ID1 Edge_ID2 Edge_ID3 Edge_ID4
Element_ID Edge_ID1 Edge_ID2 Edge_ID3 Edge_ID4
.
.
.
Element_ID Edge_ID1 Edge_ID2 Edge_ID3 Edge_ID4
Edge-to-node:
Edge_ID Node_ID1 Node_ID2
Edge_ID Node_ID1 Node_ID2
.
.
.
Edge_ID Node_ID1 Node_ID2
Thank you for reading my mail!
Best regards!
Yours, Tao Chen.
2011-3-30 20:49:06
--
┌───────────────────────────────────────────────────────
│Tao Chen
│Department of Applied Mathematics
│Department of Communication Engineering
│Communication University of China
│Room 319, Building 33, No.1 Dingfuzhuang East Street,
│Chaoyang District, Beijing, 100024, P.R. China
│Phone:+86-10-65783580
│E-mail:
chentao at cuc.edu.cn
│MSN:
chentaocuc at hotmail.com
└───────────────────────────────────────────────────────
------------------------------------------------------------------------------
_______________________________________________
GiDlist mailing list
GiDlist at listas.cimne.upc.edu
http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20110330/13a5aba4/attachment.htm