- Timestamp:
- Mar 25, 2013, 11:05:41 AM (11 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/field.tcl
r3572 r3573 527 527 foreach fname $_comp2fldName($cname) { 528 528 if { ![info exists limits($fname)] } { 529 puts stderr " field \"$fname\" unknown in \"$cname\""529 puts stderr "ERROR: field \"$fname\" unknown in \"$cname\"" 530 530 continue 531 531 } … … 766 766 set _comp2style($cname) "" 767 767 if { $type == "" } { 768 puts stderr " ignoring field component \"$_path.$cname\": no data found."768 puts stderr "WARNING: ignoring field component \"$_path.$cname\": no data found." 769 769 continue 770 770 } … … 832 832 set contents [$_field get $cname.vtk] 833 833 if { $contents == "" } { 834 puts stderr " no data fo \"$cname.vtk\""834 puts stderr "WARNING: no data fo \"$_path.$cname.vtk\"" 835 835 continue; # Ignore this component 836 836 } … … 851 851 set contents [$_field get -decode no $cname.$type] 852 852 if { $contents == "" } { 853 puts stderr " no data for \"$cname.$type\""853 puts stderr "WARNING: no data for \"$_path.$cname.$type\"" 854 854 continue; # Ignore this component 855 855 } … … 885 885 } 886 886 if { [array size _isValidComponent] == 0 } { 887 puts stderr " no valid components for field \"$_path\""887 puts stderr "WARNING: no valid components for field \"$_path\"" 888 888 return 0 889 889 } … … 897 897 } 898 898 if { $dim != $_comp2dims($cname) } { 899 puts stderr " field can't have components of different dimensions: [join [array get _comp2dims] ,]"899 puts stderr "WARNING: field can't have components of different dimensions: [join [array get _comp2dims] ,]" 900 900 return 0 901 901 } … … 1201 1201 } 1202 1202 if { $dataAttrs == ""} { 1203 puts stderr " No point data found in \"$_path\""1203 puts stderr "WARNING: no point data found in \"$_path\"" 1204 1204 return 0 1205 1205 } -
trunk/gui/scripts/mesh.tcl
r3571 r3573 77 77 private method ReadUnstructuredGrid { path } 78 78 private method ReadVtk { path } 79 private method WriteTriangles { xv yv zv triangles }80 private method WriteQuads { xv yv zv quads }81 private method WriteTetrahedrons { xv yv zv tetrahedrons }82 private method WriteHexahedrons { xv yv zv hexhedrons }83 private method WriteWedges { xv yv zv wedges }84 private method WritePyramids { xv yv zv pyramids }85 private method WriteHybridCells { xv yv zv cells celltypes }86 private method WritePointCloud { xv yv zv }79 private method WriteTriangles { path xv yv zv triangles } 80 private method WriteQuads { path xv yv zv quads } 81 private method WriteTetrahedrons { path xv yv zv tetrahedrons } 82 private method WriteHexahedrons { path xv yv zv hexhedrons } 83 private method WriteWedges { path xv yv zv wedges } 84 private method WritePyramids { path xv yv zv pyramids } 85 private method WriteHybridCells { path xv yv zv cells celltypes } 86 private method WritePointCloud { path xv yv zv } 87 87 private method GetCellType { name } 88 88 private method GetNumIndices { type } … … 190 190 } 191 191 if { $subcount == 0 } { 192 puts stderr " no mesh specified for $path"192 puts stderr "WARNING: no mesh specified for \"$path\"." 193 193 return 194 194 } 195 195 if { $subcount > 1 } { 196 puts stderr " too many mesh types specified."196 puts stderr "WARNING: too many mesh types specified for \"$path\"." 197 197 return 198 198 } … … 371 371 set string [$_xmlobj get $path.dim] 372 372 if { $string == "" } { 373 puts stderr " no tag <dim> found in mesh."373 puts stderr "WARNING: no tag <dim> found in mesh \"$path\"." 374 374 return 0 375 375 } … … 379 379 } 380 380 } 381 puts stderr " bad <dim> tag value \"$string\": should be 2 or 3."381 puts stderr "WARNING: bad <dim> tag value \"$string\": should be 2 or 3." 382 382 return 0 383 383 } … … 386 386 set string [$_xmlobj get $path] 387 387 if { [scan $string "%g" value] != 1 } { 388 puts stderr " can't get double value \"$string\" of \"$path\""388 puts stderr "ERROR: can't get double value \"$string\" of \"$path\"" 389 389 return 0.0 390 390 } … … 395 395 set string [$_xmlobj get $path] 396 396 if { [scan $string "%d" value] != 1 } { 397 puts stderr " can't get integer value \"$string\" of \"$path\""397 puts stderr "ERROR: can't get integer value \"$string\" of \"$path\"" 398 398 return 0.0 399 399 } … … 469 469 if { $_dim == 0 } { 470 470 # No data found. 471 puts stderr " no relevant subelements found in <mesh><grid>"471 puts stderr "WARNING: bad grid \"$path\": no data found" 472 472 return 0 473 473 } … … 475 475 # This is the 2D/3D curilinear case. We found <xdim>, <ydim>, or <zdim> 476 476 if { $numRectilinear > 0 || $numUniform > 0 } { 477 puts stderr " can't mix curvilinear and rectilinear grids."477 puts stderr "WARNING: bad grid \"$path\": can't mix curvilinear and rectilinear grids." 478 478 return 0 479 479 } 480 480 if { $numCurvilinear < 2 } { 481 puts stderr " curvilinear grid must be 2D or 3D."481 puts stderr "WARNING: bad grid \"$path\": curvilinear grid must be 2D or 3D." 482 482 return 0 483 483 } 484 484 set points [$_xmlobj get $path.grid.points] 485 485 if { $points == "" } { 486 puts stderr " missing <points> from grid description."486 puts stderr "WARNING: bad grid \"$path\": no <points> found." 487 487 return 0 488 488 } 489 489 if { ![info exists xNum] || ![info exists yNum] } { 490 puts stderr " invalid dimensions for curvilinear grid: missing <xdim> or <ydim> from grid description."490 puts stderr "WARNING: bad grid \"$path\": invalid dimensions for curvilinear grid: missing <xdim> or <ydim> from grid description." 491 491 return 0 492 492 } … … 502 502 $all set $points 503 503 if { ($_numPoints*3) != $numCoords } { 504 puts stderr " invalid grid: \# of points does not match dimensions <xdim> * <ydim>"504 puts stderr "WARNING: bad grid \"$path\": invalid grid: \# of points does not match dimensions <xdim> * <ydim>" 505 505 return 0 506 506 } 507 507 if { ($numCoords % 3) != 0 } { 508 puts stderr " wrong \# of coordinates for 3D grid"508 puts stderr "WARNING: bad grid \"$path\": wrong \# of coordinates for 3D grid" 509 509 return 0 510 510 } … … 524 524 set _numPoints [expr $xNum * $yNum] 525 525 if { ($_numPoints*2) != $numCoords } { 526 puts stderr " invalid grid: \# of points does not match dimensions <xdim> * <ydim> * <zdim>"526 puts stderr "WARNING: bad grid \"$path\": \# of points does not match dimensions <xdim> * <ydim> * <zdim>" 527 527 return 0 528 528 } 529 529 if { ($numCoords % 2) != 0 } { 530 puts stderr " wrong \# of coordinates for 2D grid"530 puts stderr "WARNING: bad grid \"$path\": wrong \# of coordinates for 2D grid" 531 531 return 0 532 532 } … … 576 576 } 577 577 } else { 578 puts stderr " bad dimension of mesh\"$_dim\""578 puts stderr "WARNING: bad grid \"$path\": bad dimension \"$_dim\"" 579 579 return 0 580 580 } … … 651 651 set _vtkdata $out 652 652 } else { 653 puts stderr " invalid dimension of grid\"$_dim\""653 puts stderr "WARNING: bad grid \"$path\": invalid dimension \"$_dim\"" 654 654 return 0 655 655 } … … 658 658 } 659 659 660 itcl::body Rappture::Mesh::WritePointCloud { xv yv zv } {660 itcl::body Rappture::Mesh::WritePointCloud { path xv yv zv } { 661 661 set _type "cloud" 662 662 set _numPoints [$xv length] … … 675 675 } 676 676 677 itcl::body Rappture::Mesh::WriteTriangles { xv yv zv triangles } {677 itcl::body Rappture::Mesh::WriteTriangles { path xv yv zv triangles } { 678 678 set _type "triangles" 679 if { $triangles == "" } {680 puts stderr "no triangle indices specified in mesh"681 return 0682 }683 679 set _numPoints [$xv length] 684 680 set count 0 … … 708 704 } 709 705 710 itcl::body Rappture::Mesh::WriteQuads { xv yv zv quads } {706 itcl::body Rappture::Mesh::WriteQuads { path xv yv zv quads } { 711 707 set _type "quads" 712 if { $quads == "" } {713 puts stderr "no <quads> indices specified in mesh"714 return 0715 }716 708 set _numPoints [$xv length] 717 709 set count 0 … … 741 733 } 742 734 743 itcl::body Rappture::Mesh::WriteTetrahedrons { xv yv zv tetras } {735 itcl::body Rappture::Mesh::WriteTetrahedrons { path xv yv zv tetras } { 744 736 set _type "tetrahedrons" 745 if { $tetras == "" } {746 puts stderr "no <tetrahederons> indices specified in mesh"747 return 0748 }749 737 set _numPoints [$xv length] 750 738 set count 0 … … 774 762 } 775 763 776 itcl::body Rappture::Mesh::WriteHexahedrons { xv yv zv hexas } {764 itcl::body Rappture::Mesh::WriteHexahedrons { path xv yv zv hexas } { 777 765 set _type "hexahedrons" 778 if { $hexas == "" } {779 puts stderr "no <hexahederons> indices specified in mesh"780 return 0781 }782 766 set _numPoints [$xv length] 783 767 set count 0 … … 807 791 } 808 792 809 itcl::body Rappture::Mesh::WriteWedges { xv yv zv wedges } {793 itcl::body Rappture::Mesh::WriteWedges { path xv yv zv wedges } { 810 794 set _type "wedges" 811 if { $wedges == "" } {812 puts stderr "no <wedges> indices specified in mesh"813 return 0814 }815 795 set _numPoints [$xv length] 816 796 set count 0 … … 840 820 } 841 821 842 itcl::body Rappture::Mesh::WritePyramids { xv yv zv pyramids } {822 itcl::body Rappture::Mesh::WritePyramids { path xv yv zv pyramids } { 843 823 set _type "pyramids" 844 if { $pyramids == "" } {845 puts stderr "no <pyramids> indices specified in mesh"846 return 0847 }848 824 set _numPoints [$xv length] 849 825 set count 0 … … 873 849 } 874 850 875 itcl::body Rappture::Mesh::WriteHybridCells { xv yv zv cells celltypes } {851 itcl::body Rappture::Mesh::WriteHybridCells { path xv yv zv cells celltypes } { 876 852 set _type "unstructured" 877 if { $cells == "" } {878 puts stderr "no <cells> description found for <unstructured>."879 return 0880 }881 853 set lines [split $cells \n] 882 854 set numCellTypes [llength $celltypes] … … 900 872 set numIndices [GetNumIndices $celltype] 901 873 if { $numIndices > 0 && $numIndices != $length } { 902 puts stderr " wrong \# of indices specified for celltype $celltype on line \"$line\""874 puts stderr "WARNING: bad unstructured grid \"$path\": wrong \# of indices specified for celltype $celltype on line \"$line\"" 903 875 return 0 904 876 } … … 937 909 set numIndices [GetNumIndices $celltype] 938 910 if { $numIndices > 0 && $numIndices != $length } { 939 puts stderr " wrong \# of indices specified for celltype $celltype on line \"$line\""911 puts stderr "WARNING: bad unstructured grid \"$path\": wrong \# of indices specified for celltype $celltype on line \"$line\"" 940 912 return 0 941 913 } … … 982 954 set celltypes [$_xmlobj get $path.unstructured.celltypes] 983 955 if { $numCells == 0 && $celltypes != "" } { 984 puts stderr " no <cells> description found for <unstructured>."956 puts stderr "WARNING: bad unstuctured grid \"$path\": no <cells> description found." 985 957 return 0 986 958 } 987 959 if { $numCells > 1 } { 988 puts stderr " too many <cells>, <triangles>, <quads>... descriptions found: should be only one."960 puts stderr "WARNING: bad unstructured grid \"$path\": too many <cells>, <triangles>, <quads>... descriptions found: should be only one." 989 961 return 0 990 962 } … … 1017 989 Rappture::ReadPoints $data dim points 1018 990 if { $points == "" } { 1019 puts stderr " no <points> found for unstructured grid"991 puts stderr "WARNING: bad unstructured grid \"$path\": no <points> found." 1020 992 return 0 1021 993 } 1022 994 if { $dim != 2 } { 1023 puts stderr " \# of coordinates per point is \"$dim\": does not agree with dimension specified for mesh \"$_dim\""995 puts stderr "WARNING: bad unstructured grid \"$path\": \# of coordinates per point is \"$dim\": does not agree with dimension specified for mesh \"$_dim\"" 1024 996 return 0 1025 997 } … … 1031 1003 blt::vector destroy $all 1032 1004 } else { 1033 puts stderr " no points specified for unstructured grid"1005 puts stderr "WARNING: bad unstructured grid \"$path\": no points specified." 1034 1006 return 0 1035 1007 } … … 1051 1023 Rappture::ReadPoints $data dim points 1052 1024 if { $points == "" } { 1053 puts stderr " no <points> found for <cells> mesh"1025 puts stderr "WARNING: bad unstructured grid \"$path\": no <points> found." 1054 1026 return 0 1055 1027 } 1056 1028 if { $dim != 3 } { 1057 puts stderr " \# of coordinates per point is \"$dim\": does not agree with dimension specified for mesh \"$_dim\""1029 puts stderr "WARNING: bad unstructured grid \"$path\": \# of coordinates per point is \"$dim\": does not agree with dimension specified for mesh \"$_dim\"" 1058 1030 return 0 1059 1031 } … … 1065 1037 blt::vector destroy $all 1066 1038 } else { 1067 puts stderr " no points specified for unstructured grid"1039 puts stderr "WARNING: bad unstructured grid \"$path\": no points specified." 1068 1040 return 0 1069 1041 } … … 1071 1043 # Step 3: Write the points and cells as vtk data. 1072 1044 if { $numCells == 0 } { 1073 set result [WritePointCloud $ xv $yv $zv]1045 set result [WritePointCloud $path $xv $yv $zv] 1074 1046 } elseif { $type == "cells" } { 1075 1047 set cells [$_xmlobj get $path.unstructured.cells] 1076 set result [WriteHybridCells $xv $yv $zv $cells $celltypes] 1048 if { $cells == "" } { 1049 puts stderr "WARNING: bad unstructured grid \"$path\": no cells found." 1050 return 0 1051 } 1052 set result [WriteHybridCells $path $xv $yv $zv $cells $celltypes] 1077 1053 } else { 1078 1054 set cmd "Write[string totitle $type]" 1079 1055 set cells [$_xmlobj get $path.unstructured.$type] 1080 1056 if { $cells == "" } { 1081 puts stderr " no cells in \"$path.unstructured.$type\""1057 puts stderr "WARNING: bad unstructured grid \"$path\": no cells found." 1082 1058 return 0 1083 1059 } 1084 set result [$cmd $ xv $yv $zv $cells]1060 set result [$cmd $path $xv $yv $zv $cells] 1085 1061 } 1086 1062 # Clean up. … … 1152 1128 set numNodes [llength $nodeList] 1153 1129 if { ![info exists node2celltype($numNodes)] } { 1154 puts stderr " unknown number of indices \"$_numNodes\": should be 3, 4, 5, 6, or 8"1130 puts stderr "WARNING: bad nodes/elements mesh \$path\": unknown number of indices \"$_numNodes\": should be 3, 4, 5, 6, or 8" 1155 1131 return 0 1156 1132 } -
trunk/gui/scripts/resultviewer.tcl
r3571 r3573 287 287 } 288 288 ::Rappture::Field { 289 if { ![$dataobj isvalid] } { 290 return; # Ignore invalid field objects. 291 } 289 292 set dims [lindex [lsort [$dataobj components -dimensions]] end] 290 293 switch -- $dims { … … 325 328 } 326 329 default { 327 puts stderr " can't handle \"$dims\" dimension field"330 puts stderr "WARNING: can't handle \"$dims\" dimension field" 328 331 return 329 332 } … … 331 334 } 332 335 ::Rappture::Mesh { 336 if { ![$dataobj isvalid] } { 337 return; # Ignore invalid mesh objects. 338 } 333 339 switch -- [$dataobj dimensions] { 334 340 2 {
Note: See TracChangeset
for help on using the changeset viewer.