Changeset 3573


Ignore:
Timestamp:
Mar 25, 2013, 2:05:41 PM (7 years ago)
Author:
gah
Message:

improve warning messages

Location:
trunk/gui/scripts
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/field.tcl

    r3572 r3573  
    527527        foreach fname $_comp2fldName($cname) {
    528528            if { ![info exists limits($fname)] } {
    529                 puts stderr "field \"$fname\" unknown in \"$cname\""
     529                puts stderr "ERROR: field \"$fname\" unknown in \"$cname\""
    530530                continue
    531531            }
     
    766766        set _comp2style($cname) ""
    767767        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."
    769769            continue
    770770        }
     
    832832            set contents [$_field get $cname.vtk]
    833833            if { $contents == "" } {
    834                 puts stderr "no data fo \"$cname.vtk\""
     834                puts stderr "WARNING: no data fo \"$_path.$cname.vtk\""
    835835                continue;               # Ignore this component
    836836            }
     
    851851            set contents [$_field get -decode no $cname.$type]
    852852            if { $contents == "" } {
    853                 puts stderr "no data for \"$cname.$type\""
     853                puts stderr "WARNING: no data for \"$_path.$cname.$type\""
    854854                continue;               # Ignore this component
    855855            }
     
    885885    }
    886886    if { [array size _isValidComponent] == 0 } {
    887         puts stderr "no valid components for field \"$_path\""
     887        puts stderr "WARNING: no valid components for field \"$_path\""
    888888        return 0
    889889    }
     
    897897        }
    898898        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] ,]"
    900900            return 0
    901901        }
     
    12011201    }
    12021202    if { $dataAttrs == ""} {
    1203         puts stderr "No point data found in \"$_path\""
     1203        puts stderr "WARNING: no point data found in \"$_path\""
    12041204        return 0
    12051205    }
  • trunk/gui/scripts/mesh.tcl

    r3571 r3573  
    7777    private method ReadUnstructuredGrid { path }
    7878    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 }
    8787    private method GetCellType { name }
    8888    private method GetNumIndices { type }
     
    190190    }
    191191    if { $subcount ==  0 } {
    192         puts stderr "no mesh specified for $path"
     192        puts stderr "WARNING: no mesh specified for \"$path\"."
    193193        return
    194194    }
    195195    if { $subcount > 1 } {
    196         puts stderr "too many mesh types specified."
     196        puts stderr "WARNING: too many mesh types specified for \"$path\"."
    197197        return
    198198    }
     
    371371    set string [$_xmlobj get $path.dim]
    372372    if { $string == "" } {
    373         puts stderr "no tag <dim> found in mesh."
     373        puts stderr "WARNING: no tag <dim> found in mesh \"$path\"."
    374374        return 0
    375375    }
     
    379379        }
    380380    }
    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."
    382382    return 0
    383383}
     
    386386    set string [$_xmlobj get $path]
    387387    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\""
    389389        return 0.0
    390390    }
     
    395395    set string [$_xmlobj get $path]
    396396    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\""
    398398        return 0.0
    399399    }
     
    469469    if { $_dim == 0 } {
    470470        # No data found.
    471         puts stderr "no relevant subelements found in <mesh><grid>"
     471        puts stderr "WARNING: bad grid \"$path\": no data found"
    472472        return 0
    473473    }
     
    475475        # This is the 2D/3D curilinear case. We found <xdim>, <ydim>, or <zdim>
    476476        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."
    478478            return 0
    479479        }
    480480        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."
    482482            return 0
    483483        }
    484484        set points [$_xmlobj get $path.grid.points]
    485485        if { $points == "" } {
    486             puts stderr "missing <points> from grid description."
     486            puts stderr "WARNING: bad grid \"$path\": no <points> found."
    487487            return 0
    488488        }
    489489        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."
    491491            return 0
    492492        }
     
    502502            $all set $points
    503503            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>"
    505505                return 0
    506506            }
    507507            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"
    509509                return 0
    510510            }
     
    524524            set _numPoints [expr $xNum * $yNum]
    525525            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>"
    527527                return 0
    528528            }
    529529            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"
    531531                return 0
    532532            }
     
    576576            }
    577577        } else {
    578             puts stderr "bad dimension of mesh \"$_dim\""
     578            puts stderr "WARNING: bad grid \"$path\": bad dimension \"$_dim\""
    579579            return 0
    580580        }
     
    651651        set _vtkdata $out
    652652    } else {
    653         puts stderr "invalid dimension of grid \"$_dim\""
     653        puts stderr "WARNING: bad grid \"$path\": invalid dimension \"$_dim\""
    654654        return 0
    655655    }
     
    658658}
    659659
    660 itcl::body Rappture::Mesh::WritePointCloud { xv yv zv } {
     660itcl::body Rappture::Mesh::WritePointCloud { path xv yv zv } {
    661661    set _type "cloud"
    662662    set _numPoints [$xv length]
     
    675675}
    676676
    677 itcl::body Rappture::Mesh::WriteTriangles { xv yv zv triangles } {
     677itcl::body Rappture::Mesh::WriteTriangles { path xv yv zv triangles } {
    678678    set _type "triangles"
    679     if { $triangles == "" } {
    680         puts stderr "no triangle indices specified in mesh"
    681         return 0
    682     }
    683679    set _numPoints [$xv length]
    684680    set count 0
     
    708704}
    709705
    710 itcl::body Rappture::Mesh::WriteQuads { xv yv zv quads } {
     706itcl::body Rappture::Mesh::WriteQuads { path xv yv zv quads } {
    711707    set _type "quads"
    712     if { $quads == "" } {
    713         puts stderr "no <quads> indices specified in mesh"
    714         return 0
    715     }
    716708    set _numPoints [$xv length]
    717709    set count 0
     
    741733}
    742734
    743 itcl::body Rappture::Mesh::WriteTetrahedrons { xv yv zv tetras } {
     735itcl::body Rappture::Mesh::WriteTetrahedrons { path xv yv zv tetras } {
    744736    set _type "tetrahedrons"
    745     if { $tetras == "" } {
    746         puts stderr "no <tetrahederons> indices specified in mesh"
    747         return 0
    748     }
    749737    set _numPoints [$xv length]
    750738    set count 0
     
    774762}
    775763
    776 itcl::body Rappture::Mesh::WriteHexahedrons { xv yv zv hexas } {
     764itcl::body Rappture::Mesh::WriteHexahedrons { path xv yv zv hexas } {
    777765    set _type "hexahedrons"
    778     if { $hexas == "" } {
    779         puts stderr "no <hexahederons> indices specified in mesh"
    780         return 0
    781     }
    782766    set _numPoints [$xv length]
    783767    set count 0
     
    807791}
    808792
    809 itcl::body Rappture::Mesh::WriteWedges { xv yv zv wedges } {
     793itcl::body Rappture::Mesh::WriteWedges { path xv yv zv wedges } {
    810794    set _type "wedges"
    811     if { $wedges == "" } {
    812         puts stderr "no <wedges> indices specified in mesh"
    813         return 0
    814     }
    815795    set _numPoints [$xv length]
    816796    set count 0
     
    840820}
    841821
    842 itcl::body Rappture::Mesh::WritePyramids { xv yv zv pyramids } {
     822itcl::body Rappture::Mesh::WritePyramids { path xv yv zv pyramids } {
    843823    set _type "pyramids"
    844     if { $pyramids == "" } {
    845         puts stderr "no <pyramids> indices specified in mesh"
    846         return 0
    847     }
    848824    set _numPoints [$xv length]
    849825    set count 0
     
    873849}
    874850
    875 itcl::body Rappture::Mesh::WriteHybridCells { xv yv zv cells celltypes } {
     851itcl::body Rappture::Mesh::WriteHybridCells { path xv yv zv cells celltypes } {
    876852    set _type "unstructured"
    877     if { $cells == "" } {
    878         puts stderr "no <cells> description found for <unstructured>."
    879         return 0
    880     }
    881853    set lines [split $cells \n]
    882854    set numCellTypes [llength $celltypes]
     
    900872            set numIndices [GetNumIndices $celltype]
    901873            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\""
    903875                return 0
    904876            }
     
    937909            set numIndices [GetNumIndices $celltype]
    938910            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\""
    940912                return 0
    941913            }
     
    982954    set celltypes [$_xmlobj get $path.unstructured.celltypes]
    983955    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."
    985957        return 0
    986958    }
    987959    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."
    989961        return 0
    990962    }
     
    1017989            Rappture::ReadPoints $data dim points
    1018990            if { $points == "" } {
    1019                 puts stderr "no <points> found for unstructured grid"
     991                puts stderr "WARNING: bad unstructured grid \"$path\": no <points> found."
    1020992                return 0
    1021993            }
    1022994            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\""
    1024996                return 0
    1025997            }
     
    10311003            blt::vector destroy $all
    10321004        } else {
    1033             puts stderr "no points specified for unstructured grid"
     1005            puts stderr "WARNING: bad unstructured grid \"$path\": no points specified."
    10341006            return 0
    10351007        }
     
    10511023            Rappture::ReadPoints $data dim points
    10521024            if { $points == "" } {
    1053                 puts stderr "no <points> found for <cells> mesh"
     1025                puts stderr "WARNING: bad unstructured grid \"$path\": no <points> found."
    10541026                return 0
    10551027            }
    10561028            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\""
    10581030                return 0
    10591031            }
     
    10651037            blt::vector destroy $all
    10661038        } else {
    1067             puts stderr "no points specified for unstructured grid"
     1039            puts stderr "WARNING: bad unstructured grid \"$path\": no points specified."
    10681040            return 0
    10691041        }
     
    10711043    # Step 3: Write the points and cells as vtk data.
    10721044    if { $numCells == 0 } {
    1073         set result [WritePointCloud $xv $yv $zv]
     1045        set result [WritePointCloud $path $xv $yv $zv]
    10741046    } elseif { $type == "cells" } {
    10751047        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]
    10771053    } else {
    10781054        set cmd "Write[string totitle $type]"
    10791055        set cells [$_xmlobj get $path.unstructured.$type]
    10801056        if { $cells == "" } {
    1081             puts stderr "no cells in \"$path.unstructured.$type\""
     1057            puts stderr "WARNING: bad unstructured grid \"$path\": no cells found."
    10821058            return 0
    10831059        }
    1084         set result [$cmd $xv $yv $zv $cells]
     1060        set result [$cmd $path $xv $yv $zv $cells]
    10851061    }
    10861062    # Clean up.
     
    11521128        set numNodes [llength $nodeList]
    11531129        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"
    11551131            return 0
    11561132        }
  • trunk/gui/scripts/resultviewer.tcl

    r3571 r3573  
    287287        }
    288288        ::Rappture::Field {
     289            if { ![$dataobj isvalid] } {
     290                return;                 # Ignore invalid field objects.
     291            }
    289292            set dims [lindex [lsort [$dataobj components -dimensions]] end]
    290293            switch -- $dims {
     
    325328                }
    326329                default {
    327                     puts stderr "can't handle \"$dims\" dimension field"
     330                    puts stderr "WARNING: can't handle \"$dims\" dimension field"
    328331                    return
    329332                }
     
    331334        }
    332335        ::Rappture::Mesh {
     336            if { ![$dataobj isvalid] } {
     337                return;                 # Ignore invalid mesh objects.
     338            }
    333339            switch -- [$dataobj dimensions] {
    334340                2 {
Note: See TracChangeset for help on using the changeset viewer.