- Timestamp:
- May 29, 2015, 7:22:49 PM (9 years ago)
- Location:
- trunk/examples/zoo/mesh
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/zoo/mesh/mesh.tcl
r5630 r5634 21 21 $xv seq 0 1 50 22 22 23 set hide no 24 23 25 switch -- $meshtype { 24 26 "cloud" { 25 26 27 28 29 30 $driver put $mesh.hide "yes" 31 32 33 34 35 36 37 38 39 27 set mesh output.mesh 28 29 $driver put $mesh.about.label "cloud in unstructured mesh" 30 $driver put $mesh.dim 2 31 $driver put $mesh.units "m" 32 $driver put $mesh.hide $hide 33 34 set points {} 35 foreach y [$xv range 0 end] { 36 foreach x [$xv range 0 end] { 37 append points "$x $y\n" 38 } 39 } 40 $driver put $mesh.unstructured.points $points 41 $driver put $mesh.unstructured.celltypes "" 40 42 } 41 43 "regular" { 42 43 44 45 46 47 $driver put $mesh.hide "yes" 48 49 50 51 52 53 54 44 set mesh output.mesh 45 46 $driver put $mesh.about.label "uniform grid mesh" 47 $driver put $mesh.dim 2 48 $driver put $mesh.units "m" 49 $driver put $mesh.hide $hide 50 51 $driver put $mesh.grid.xaxis.min 0.0 52 $driver put $mesh.grid.xaxis.max 1.0 53 $driver put $mesh.grid.xaxis.numpoints 50 54 $driver put $mesh.grid.yaxis.min 0.0 55 $driver put $mesh.grid.yaxis.max 1.0 56 $driver put $mesh.grid.yaxis.numpoints 50 55 57 } 56 58 "irregular" { 57 58 59 $driver put $mesh.about.label "irregular grid mesh"60 61 62 $driver put $mesh.hide "yes" 63 64 65 59 set mesh output.mesh 60 61 $driver put $mesh.about.label "irregular rectilinear grid mesh" 62 $driver put $mesh.dim 2 63 $driver put $mesh.units "m" 64 $driver put $mesh.hide $hide 65 66 $driver put $mesh.grid.xcoords [$xv range 0 end] 67 $driver put $mesh.grid.ycoords [$xv range 0 end] 66 68 } 67 69 "hybrid" { 68 set mesh output.mesh 69 70 $driver put $mesh.about.label "hybrid regular and irregular grid mesh" 71 $driver put $mesh.dim 2 72 $driver put $mesh.units "m" 73 $driver put $mesh.hide "yes" 74 75 $driver put $mesh.units "m" 76 $driver put $mesh.grid.xcoords [$xv range 0 end] 77 $driver put $mesh.grid.yaxis.min 0.0 78 $driver put $mesh.grid.yaxis.max 1.0 79 $driver put $mesh.grid.yaxis.numpoints 50 70 set mesh output.mesh 71 72 $driver put $mesh.about.label "hybrid regular and irregular rectilinear grid mesh" 73 $driver put $mesh.dim 2 74 $driver put $mesh.units "m" 75 $driver put $mesh.hide $hide 76 77 $driver put $mesh.grid.xcoords [$xv range 0 end] 78 $driver put $mesh.grid.yaxis.min 0.0 79 $driver put $mesh.grid.yaxis.max 1.0 80 $driver put $mesh.grid.yaxis.numpoints 50 81 } 82 "structured" { 83 set mesh output.mesh 84 85 $driver put $mesh.about.label "Structured (Curvilinear) Grid" 86 $driver put $mesh.dim 2 87 $driver put $mesh.units "m" 88 $driver put $mesh.hide $hide 89 90 $driver put $mesh.grid.xdim 50 91 $driver put $mesh.grid.ydim 50 92 set points {} 93 foreach y [$xv range 0 end] { 94 foreach x [$xv range 0 end] { 95 append points "$x $y\n" 96 } 97 } 98 $driver put $mesh.grid.points $points 80 99 } 81 100 "triangular" { 82 83 84 85 86 87 $driver put $mesh.hide "yes" 88 89 90 91 92 101 set mesh output.mesh 102 103 $driver put $mesh.about.label "triangles in unstructured mesh" 104 $driver put $mesh.dim 2 105 $driver put $mesh.units "m" 106 $driver put $mesh.hide $hide 107 108 $driver put -type file -compress no $mesh.unstructured.points \ 109 points.txt 110 $driver put -type file -compress no $mesh.unstructured.triangles \ 111 triangles.txt 93 112 } 94 113 "generic" { 95 96 97 98 99 100 $driver put $mesh.hide "yes" 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 114 set mesh output.mesh 115 116 $driver put $mesh.about.label "nodes and elements mesh" 117 $driver put $mesh.dim 2 118 $driver put $mesh.units "m" 119 $driver put $mesh.hide $hide 120 121 set count 0 122 set f [open "points.txt" "r"] 123 set points [read $f] 124 close $f 125 foreach { x y } $points { 126 $driver put $mesh.node($count) "$x $y" 127 incr count 128 } 129 set count 0 130 set f [open "triangles.txt" "r"] 131 set triangles [read $f] 132 close $f 133 foreach { a b c } $triangles { 134 $driver put $mesh.element($count).nodes "$a $b $c" 135 incr count 136 } 118 137 } 119 138 "unstructured" { 120 121 122 123 124 125 $driver put $mesh.hide "yes" 126 127 128 129 130 131 132 133 134 135 136 139 set mesh output.mesh 140 141 $driver put $mesh.about.label "Unstructured Grid" 142 $driver put $mesh.dim 2 143 $driver put $mesh.units "m" 144 $driver put $mesh.hide $hide 145 146 $driver put -type file -compress no $mesh.unstructured.points points.txt 147 set cells {} 148 set f [open "triangles.txt" "r"] 149 set triangles [read $f] 150 close $f 151 foreach { a b c } $triangles { 152 append cells "$a $b $c\n" 153 } 154 $driver put $mesh.unstructured.cells $cells 155 $driver put $mesh.unstructured.celltypes "triangle" 137 156 } 138 157 "cells" { 139 140 141 142 143 144 145 $driver put $mesh.hide "yes" 146 147 148 149 150 151 152 153 154 155 156 157 158 set mesh output.mesh 159 160 $driver put $mesh.about.label \ 161 "Unstructured Grid with Heterogeneous Cells" 162 $driver put $mesh.dim 2 163 $driver put $mesh.units "m" 164 $driver put $mesh.hide $hide 165 166 set celltypes {} 167 set f [open "triangles.txt" "r"] 168 set triangles [read $f] 169 close $f 170 foreach { a b c } $triangles { 171 append cells "$a $b $c\n" 172 append celltypes "triangle\n" 173 } 174 $driver put -type file -compress no $mesh.unstructured.points points.txt 175 $driver put $mesh.unstructured.celltypes $celltypes 176 $driver put $mesh.unstructured.cells $cells 158 177 } 159 178 "vtkmesh" { 160 161 162 163 164 165 $driver put $mesh.hide "yes" 166 179 set mesh output.mesh 180 181 $driver put $mesh.about.label "vtk mesh" 182 $driver put $mesh.dim 2 183 $driver put $mesh.units "m" 184 $driver put $mesh.hide $hide 185 $driver put -type file -compress no $mesh.vtk mesh.vtk 167 186 } 168 187 "vtkfield" { 169 188 170 171 172 189 $driver put output.field(substrate).about.label "Substrate Surface" 190 $driver put -type file -compress no \ 191 output.field(substrate).component.vtk file.vtk 173 192 $driver put output.string.current "" 174 175 193 Rappture::result $driver 194 exit 0 176 195 } 177 196 default { 178 197 error "unknown mesh type \"$meshtype\"" 179 198 } 180 199 } -
trunk/examples/zoo/mesh/tool.xml
- Property svn:mime-type changed from application/xml to text/xml
r3750 r5634 51 51 <option> 52 52 <about> 53 <label>mesh as a structured (curvilinear) grid</label> 54 <description>Structured 2D grid.</description> 55 </about> 56 <value>structured</value> 57 </option> 58 <option> 59 <about> 53 60 <label>mesh as unstructured grid</label> 54 61 <description>Unstructured 2D grid.</description>
Note: See TracChangeset
for help on using the changeset viewer.