- Timestamp:
- Mar 10, 2013 9:59:17 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/mesh.tcl
r3475 r3480 74 74 private method ReadUnstructuredGrid { path } 75 75 private method ReadVtk { path } 76 private method ReadTriangles { xv yv zv triangles }77 private method ReadQuads { xv yv zv quads }78 private method ReadTetrahedrons { xv yv zv tetrahedrons }79 private method ReadHexahedrons { xv yv zv hexhedrons }80 private method ReadWedges { xv yv zv wedges }81 private method ReadPyramids { xv yv zv pyramids }82 private method ReadCells { xv yv zv cells celltypes }83 private method ReadCloud { xv yv zv }76 private method WriteTriangles { xv yv zv triangles } 77 private method WriteQuads { xv yv zv quads } 78 private method WriteTetrahedrons { xv yv zv tetrahedrons } 79 private method WriteHexahedrons { xv yv zv hexhedrons } 80 private method WriteWedges { xv yv zv wedges } 81 private method WritePyramids { xv yv zv pyramids } 82 private method WriteHybridCells { xv yv zv cells celltypes } 83 private method WritePointCloud { xv yv zv } 84 84 private method GetCellType { name } 85 85 private method GetNumIndices { type } … … 401 401 append out "$_vtkdata\n" 402 402 403 # Write the contents to a file just in case it's binary.403 # Write the contents to a file just in case it's binary. 404 404 set tmpfile file[pid].vtk 405 405 set f [open "$tmpfile" "w"] … … 637 637 } 638 638 639 itcl::body Rappture::Mesh:: ReadCloud { xv yv zv } {639 itcl::body Rappture::Mesh::WritePointCloud { xv yv zv } { 640 640 set _type "cloud" 641 641 set _numPoints [$xv length] … … 653 653 } 654 654 655 itcl::body Rappture::Mesh:: ReadTriangles { xv yv zv triangles } {655 itcl::body Rappture::Mesh::WriteTriangles { xv yv zv triangles } { 656 656 set _type "triangles" 657 657 if { $triangles == "" } { … … 686 686 } 687 687 688 itcl::body Rappture::Mesh:: ReadQuads { xv yv zv quads } {688 itcl::body Rappture::Mesh::WriteQuads { xv yv zv quads } { 689 689 set _type "quads" 690 690 if { $quads == "" } { … … 719 719 } 720 720 721 itcl::body Rappture::Mesh:: ReadTetrahedrons { xv yv zv tetras } {721 itcl::body Rappture::Mesh::WriteTetrahedrons { xv yv zv tetras } { 722 722 set _type "tetrahedrons" 723 723 if { $tetras == "" } { … … 752 752 } 753 753 754 itcl::body Rappture::Mesh:: ReadHexahedrons { xv yv zv hexas } {754 itcl::body Rappture::Mesh::WriteHexahedrons { xv yv zv hexas } { 755 755 set _type "hexahedrons" 756 756 if { $hexas == "" } { … … 785 785 } 786 786 787 itcl::body Rappture::Mesh:: ReadWedges { xv yv zv wedges } {787 itcl::body Rappture::Mesh::WriteWedges { xv yv zv wedges } { 788 788 set _type "wedges" 789 789 if { $wedges == "" } { … … 818 818 } 819 819 820 itcl::body Rappture::Mesh:: ReadPyramids { xv yv zv pyramids } {820 itcl::body Rappture::Mesh::WritePyramids { xv yv zv pyramids } { 821 821 set _type "pyramids" 822 822 if { $pyramids == "" } { … … 829 829 set celltypes {} 830 830 foreach { a b c d e } $pyramids { 831 append data " 6$a $b $c $d $e\n"831 append data " 5 $a $b $c $d $e\n" 832 832 append celltypes "14\n" 833 833 incr count … … 838 838 append out " $x $y $z\n" 839 839 } 840 append out "CELLS $count [expr $count * 5]\n"840 append out "CELLS $count [expr $count * 6]\n" 841 841 append out $data 842 842 append out "CELL_TYPES $count\n" … … 851 851 } 852 852 853 itcl::body Rappture::Mesh:: ReadCells { xv yv zv cells celltypes } {853 itcl::body Rappture::Mesh::WriteHybridCells { xv yv zv cells celltypes } { 854 854 set _type "unstructured" 855 855 if { $cells == "" } { … … 943 943 set _type "unstructured" 944 944 945 # Step 1: Verify that there's only one cell tag .945 # Step 1: Verify that there's only one cell tag of any kind. 946 946 set numCells 0 947 947 foreach type { cells triangles quads tetrahedrons … … 977 977 set data [$_xmlobj get $path.unstructured.points] 978 978 if { $zcoords != "" } { 979 error "can't specify <zcoord > with a 2 dimensionalmesh"979 error "can't specify <zcoords> with a 2D mesh" 980 980 } 981 981 if { $xcoords != "" && $ycoords != "" } { … … 988 988 Rappture::ReadPoints $data dim points 989 989 if { $points == "" } { 990 error "no <points> found for <cells> mesh"990 error "no <points> found for unstructured grid" 991 991 } 992 992 if { $dim != 2 } { … … 1034 1034 } 1035 1035 } 1036 # Step 3: Read the cells and write thevtk data.1036 # Step 3: Write the points and cells as vtk data. 1037 1037 if { $numCells == 0 } { 1038 puts stderr "numCells=$numCells call ReadCloud" 1039 ReadCloud $xv $yv $zv 1038 WritePointCloud $xv $yv $zv 1040 1039 } elseif { $type == "cells" } { 1041 1040 set cells [$_xmlobj get $path.unstructured.cells] 1042 ReadCells $xv $yv $zv $cells $celltypes1041 WriteHybridCells $xv $yv $zv $cells $celltypes 1043 1042 } else { 1044 puts stderr "type=$type" 1045 set cmd "Read[string totitle $type]" 1043 set cmd "Write[string totitle $type]" 1046 1044 set cells [$_xmlobj get $path.unstructured.$type] 1047 1045 $cmd $xv $yv $zv $cells
Note: See TracChangeset
for help on using the changeset viewer.