Ignore:
Timestamp:
Jul 1, 2013 3:31:32 PM (11 years ago)
Author:
gah
Message:

add octave/MATLAB version of example

Location:
trunk/examples/zoo/mesh
Files:
6 added
2 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/zoo/mesh/mesh.tcl

    r3690 r3732  
    66
    77# Read in the data since we're not simulating anything...
    8 source data.tcl
    9 source datatri.tcl
    108
    119# Open an XML run file to write into
     
    129127        $driver put $mesh.units "m"
    130128        $driver put $mesh.hide "yes"
    131 
    132         $driver put $mesh.unstructured.points $points
    133         $driver put $mesh.unstructured.triangles $triangles
     129       
     130        $driver put -type file -compress no $mesh.unstructured.points \
     131            points.txt
     132        $driver put -type file -compress no $mesh.unstructured.triangles \
     133            triangles.txt
    134134    }
    135135    "generic" {
     
    142142
    143143        set count 0
     144        set f [open "points.txt" "r"]
     145        set points [read $f]
     146        close $f
    144147        foreach { x y } $points {
    145148            $driver put $mesh.node($count) "$x $y"
     
    147150        }
    148151        set count 0
     152        set f [open "triangles.txt" "r"]
     153        set triangles [read $f]
     154        close $f
    149155        foreach { a b c } $triangles {
    150156            $driver put $mesh.element($count).nodes "$a $b $c"
     
    160166        $driver put $mesh.hide "yes"
    161167
    162         $driver put $mesh.unstructured.points $points
     168        $driver put -type file -compress no $mesh.unstructured.points points.txt
    163169        set cells {}
     170        set f [open "triangles.txt" "r"]
     171        set triangles [read $f]
     172        close $f
    164173        foreach { a b c } $triangles {
    165174            append cells "$a $b $c\n"
     
    171180        set mesh output.mesh
    172181
    173         $driver put $mesh.about.label "unstructured grid with heterogeneous cells"
     182        $driver put $mesh.about.label \
     183            "Unstructured Grid with Heterogeneous Cells"
    174184        $driver put $mesh.dim  2
    175185        $driver put $mesh.units "m"
     
    177187
    178188        set celltypes {}
     189        set f [open "triangles.txt" "r"]
     190        set triangles [read $f]
     191        close $f
    179192        foreach { a b c } $triangles {
    180193            append cells "$a $b $c\n"
    181194            append celltypes "triangle\n"
    182195        }
    183         $driver put $mesh.unstructured.points $points
     196        $driver put -type file -compress no $mesh.unstructured.points points.txt
    184197        $driver put $mesh.unstructured.celltypes "triangle"
    185198        $driver put $mesh.unstructured.cells $cells
     
    188201        set mesh output.mesh
    189202
    190         set f [open "mesh.vtk" "r"]
    191         set data [read $f]
    192         close $f
    193 
    194203        $driver put $mesh.about.label "vtk mesh"
    195204        $driver put $mesh.dim  2
    196205        $driver put $mesh.units "m"
    197206        $driver put $mesh.hide "yes"
    198         $driver put $mesh.vtk $data
     207        $driver put -type file -compress no $mesh.vtk mesh.vtk
    199208    }
    200209    "vtkfield" {
    201210
    202 
    203211        $driver put output.field(substrate).about.label "Substrate Surface"
    204         set f [open "file.vtk" "r"]
    205         set data [read $f]
    206         close $f
    207         $driver put output.field(substrate).component.vtk "$data"
     212        $driver put -type file -compress no \
     213            output.field(substrate).component.vtk file.vtk
    208214        $driver put output.string.current ""
    209215        Rappture::result $driver
     
    218224#$driver put output.field(substrate).about.type "contour"
    219225$driver put output.field(substrate).component.mesh $mesh
    220 $driver put output.field(substrate).component.values $substrate_data
     226$driver put -type file -compress no output.field(substrate).component.values \
     227    substrate_data.txt
    221228
    222229$driver put output.field(particle).about.label "Particle Surface"
    223230#$driver put output.field(particle).about.type "contour"
    224231$driver put output.field(particle).component.mesh $mesh
    225 $driver put output.field(particle).component.values $particle_data
     232$driver put -type file -compress no output.field(particle).component.values \
     233    particle_data.txt
    226234
    227235$driver put output.string.about.label "Mesh XML definition"
Note: See TracChangeset for help on using the changeset viewer.