Changeset 4395 for trunk


Ignore:
Timestamp:
Jun 18, 2014 11:22:33 AM (10 years ago)
Author:
ldelgass
Message:

Set number of cells in mesh for uniform/rectilinear/curvilinear grids

File:
1 edited

Legend:

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

    r4393 r4395  
    6363        return $_numPoints
    6464    }
    65 
     65    public method numcells {} {
     66        return $_numCells
     67    }
    6668
    6769    private common _xp2obj       ;      # used for fetch/release ref counting
     
    551553            set _dim 3
    552554            set _numPoints [expr $xNum * $yNum * $zNum]
     555            set _numCells [expr ($xNum - 1) * ($yNum - 1) * ($zNum - 1)]
    553556            if { ($_numPoints*3) != $numCoords } {
    554557                puts stderr "WARNING: bad grid \"$path\": invalid grid: \# of points does not match dimensions <xdim> * <ydim> * <zdim>"
     
    573576            set _dim 2
    574577            set _numPoints [expr $xNum * $yNum]
     578            set _numCells [expr ($xNum - 1) * ($yNum - 1)]
    575579            if { ($_numPoints*2) != $numCoords } {
    576580                puts stderr "WARNING: bad grid \"$path\": \# of points does not match dimensions <xdim> * <ydim>"
     
    597601            set _dim 1
    598602            set _numPoints $xNum
     603            set _numCells [expr $xNum - 1]
    599604            if { $_numPoints != $numCoords } {
    600605                puts stderr "WARNING: bad grid \"$path\": \# of points does not match <xdim>"
     
    623628            set xSpace [expr ($xMax - $xMin) / double($xNum - 1)]
    624629            set _numPoints $xNum
     630            set _numCells [expr $xNum - 1]
    625631            append out "DATASET STRUCTURED_POINTS\n"
    626632            append out "DIMENSIONS $xNum 1 1\n"
     
    635641            set ySpace [expr ($yMax - $yMin) / double($yNum - 1)]
    636642            set _numPoints [expr $xNum * $yNum]
     643            set _numCells [expr ($xNum - 1) * ($yNum - 1)]
    637644            append out "DATASET STRUCTURED_POINTS\n"
    638645            append out "DIMENSIONS $xNum $yNum 1\n"
     
    649656            set zSpace [expr ($zMax - $zMin) / double($zNum - 1)]
    650657            set _numPoints [expr $xNum * $yNum * $zNum]
     658            set _numCells [expr ($xNum - 1) * ($yNum - 1) * ($zNum - 1)]
    651659            append out "DATASET STRUCTURED_POINTS\n"
    652660            append out "DIMENSIONS $xNum $yNum $zNum\n"
     
    701709    if { $_dim == 3 } {
    702710        set _numPoints [expr $xNum * $yNum * $zNum]
     711        set _numCells [expr ($xNum - 1) * ($yNum - 1) * ($zNum - 1)]
    703712        append out "DATASET RECTILINEAR_GRID\n"
    704713        append out "DIMENSIONS $xNum $yNum $zNum\n"
     
    720729    } elseif { $_dim == 2 } {
    721730        set _numPoints [expr $xNum * $yNum]
     731        set _numCells [expr ($xNum - 1) * ($yNum - 1)]
    722732        append out "DATASET RECTILINEAR_GRID\n"
    723733        append out "DIMENSIONS $xNum $yNum 1\n"
     
    739749    } elseif { $_dim == 1 } {
    740750        set _numPoints $xNum
     751        set _numCells [expr $xNum - 1]
    741752        append out "DATASET RECTILINEAR_GRID\n"
    742753        append out "DIMENSIONS $xNum 1 1\n"
     
    11601171        }
    11611172    }
     1173    set _numPoints [$xv length]
     1174
    11621175    # Step 3: Write the points and cells as vtk data.
    11631176    if { $numCells == 0 } {
Note: See TracChangeset for help on using the changeset viewer.