Changeset 4393


Ignore:
Timestamp:
Jun 18, 2014 9:17:01 AM (7 years ago)
Author:
ldelgass
Message:

Set _numCells in routines to write VTK for different cell types

File:
1 edited

Legend:

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

    r4390 r4393  
    454454    return $value
    455455}
    456 
    457456
    458457itcl::body Rappture::Mesh::ReadVtk { path } {
     
    789788    set _type "triangles"
    790789    set _numPoints [$xv length]
    791     set count 0
     790    set _numCells 0
    792791    set data {}
    793792    set celltypes {}
     
    795794        append data " 3 $a $b $c\n"
    796795        append celltypes "5\n"
    797         incr count
     796        incr _numCells
    798797    }
    799798    append out "DATASET UNSTRUCTURED_GRID\n"
     
    802801        append out " $x $y $z\n"
    803802    }
    804     append out "CELLS $count [expr $count * 4]\n"
     803    set count [expr $_numCells * 4]
     804    append out "CELLS $_numCells $count\n"
    805805    append out $data
    806     append out "CELL_TYPES $count\n"
     806    append out "CELL_TYPES $_numCells\n"
    807807    append out $celltypes
    808808    set _limits(x) [$xv limits]
     
    820820    set _type "quads"
    821821    set _numPoints [$xv length]
    822     set count 0
     822    set _numCells 0
    823823    set data {}
    824824    set celltypes {}
     
    826826        append data " 4 $a $b $c $d\n"
    827827        append celltypes "9\n"
    828         incr count
     828        incr _numCells
    829829    }
    830830    append out "DATASET UNSTRUCTURED_GRID\n"
     
    833833        append out " $x $y $z\n"
    834834    }
    835     append out "CELLS $count [expr $count * 5]\n"
     835    set count [expr $_numCells * 5]
     836    append out "CELLS $_numCells $count\n"
    836837    append out $data
    837     append out "CELL_TYPES $count\n"
     838    append out "CELL_TYPES $_numCells\n"
    838839    append out $celltypes
    839840    set _limits(x) [$xv limits]
     
    851852    set _type "tetrahedrons"
    852853    set _numPoints [$xv length]
    853     set count 0
     854    set _numCells 0
    854855    set data {}
    855856    set celltypes {}
     
    857858        append data " 4 $a $b $c $d\n"
    858859        append celltypes "10\n"
    859         incr count
     860        incr _numCells
    860861    }
    861862    append out "DATASET UNSTRUCTURED_GRID\n"
     
    864865        append out " $x $y $z\n"
    865866    }
    866     append out "CELLS $count [expr $count * 5]\n"
     867    set count [expr $_numCells * 5]
     868    append out "CELLS $_numCells $count\n"
    867869    append out $data
    868     append out "CELL_TYPES $count\n"
     870    append out "CELL_TYPES $_numCells\n"
    869871    append out $celltypes
    870872    set _limits(x) [$xv limits]
     
    879881    set _type "hexahedrons"
    880882    set _numPoints [$xv length]
    881     set count 0
     883    set _numCells 0
    882884    set data {}
    883885    set celltypes {}
     
    885887        append data " 8 $a $b $c $d $e $f $g $h\n"
    886888        append celltypes "12\n"
    887         incr count
     889        incr _numCells
    888890    }
    889891    append out "DATASET UNSTRUCTURED_GRID\n"
     
    892894        append out " $x $y $z\n"
    893895    }
    894     append out "CELLS $count [expr $count * 9]\n"
     896    set count [expr $_numCells * 9]
     897    append out "CELLS $_numCells $count\n"
    895898    append out $data
    896     append out "CELL_TYPES $count\n"
     899    append out "CELL_TYPES $_numCells\n"
    897900    append out $celltypes
    898901    set _limits(x) [$xv limits]
     
    907910    set _type "wedges"
    908911    set _numPoints [$xv length]
    909     set count 0
     912    set _numCells 0
    910913    set data {}
    911914    set celltypes {}
     
    913916        append data " 6 $a $b $c $d $e $f\n"
    914917        append celltypes "13\n"
    915         incr count
     918        incr _numCells
    916919    }
    917920    append out "DATASET UNSTRUCTURED_GRID\n"
     
    920923        append out " $x $y $z\n"
    921924    }
    922     append out "CELLS $count [expr $count * 7]\n"
     925    set count [expr $_numCells * 7]
     926    append out "CELLS $_numCells $count\n"
    923927    append out $data
    924     append out "CELL_TYPES $count\n"
     928    append out "CELL_TYPES $_numCells\n"
    925929    append out $celltypes
    926930    set _limits(x) [$xv limits]
     
    935939    set _type "pyramids"
    936940    set _numPoints [$xv length]
    937     set count 0
     941    set _numCells 0
    938942    set data {}
    939943    set celltypes {}
     
    941945        append data " 5 $a $b $c $d $e\n"
    942946        append celltypes "14\n"
    943         incr count
     947        incr _numCells
    944948    }
    945949    append out "DATASET UNSTRUCTURED_GRID\n"
     
    948952        append out " $x $y $z\n"
    949953    }
    950     append out "CELLS $count [expr $count * 6]\n"
     954    set count [expr $_numCells * 6]
     955    append out "CELLS $_numCells $count\n"
    951956    append out $data
    952     append out "CELL_TYPES $count\n"
     957    append out "CELL_TYPES $_numCells\n"
    953958    append out $celltypes
    954959    set _limits(x) [$xv limits]
Note: See TracChangeset for help on using the changeset viewer.