Changeset 5694 for branches/1.4


Ignore:
Timestamp:
Jun 13, 2015, 1:47:51 PM (9 years ago)
Author:
ldelgass
Message:

merge r5692:5693 from trunk (examples)

Location:
branches/1.4
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/1.4

  • branches/1.4/examples/zoo/field/field.py

    r5682 r5694  
    141141    """
    142142
    143 if vizmethod == "dx":
    144     #
    145     # Generate a uniform 3D mesh in OpenDX format...
    146     #
    147     f3d = rx['output.field(f3d)']
    148     f3d['about.label'] = "3D Field"
    149     f3d['component.style'] = "-color blue:yellow:red -levels 6"
    150 
    151     dx = """object 1 class gridpositions counts 5 5 2
    152         origin 0 0 0
    153         delta 1 0 0
    154         delta 0 1 0
    155         delta 0 0 1
    156         object 2 class gridconnections counts 5 5 2
    157         object 3 class array type double rank 0 items 50 data follows
    158     """
    159 
    160     xx, yy, zz = np.mgrid[xmin:xmax:5j, ymin:ymax:5j, 0:1:2j]
    161     pts = formula(xx, yy, zz)
    162     # Axis ordering for OpenDX is reversed (z fastest)
    163     dx += '\n'.join(map(str, (pts.ravel())))
    164 
    165     dx += """attribute "dep" string "positions"
    166     object "regular positions regular connections" class field
    167     component "positions" value 1
    168     component "connections" value 2
    169     component "data" value 3"""
    170 
    171     data = Rappture.encoding.encode(dx, Rappture.RPENC_ZB64)
    172     f3d['component.dx'] = data
    173 
    174 
    175143rx.close()
  • branches/1.4/examples/zoo/field/field.tcl

    r3692 r5694  
    115115}
    116116
    117 if {$vizmethod == "dx"} {
    118     #
    119     # Generate a uniform 3D mesh in OpenDX format...
    120     #
    121     $driver put output.field(f3d).about.label "3D Field"
    122     $driver put output.field(f3d).component.style "-color blue:yellow:red -levels 6"
    123 
    124     set dx "object 1 class gridpositions counts 5 5 2
    125 origin 0 0 0
    126 delta 1 0 0
    127 delta 0 1 0
    128 delta 0 0 1
    129 object 2 class gridconnections counts 5 5 2
    130 object 3 class array type double rank 0 items 50 data follows
    131 "
    132     # Axis ordering for OpenDX is reversed (z fastest)
    133     for {set x 0} {$x < 5} {incr x} {
    134         for {set y 0} {$y < 5} {incr y} {
    135             for {set z 0} {$z < 2} {incr z} {
    136                 set fval [expr $formula]
    137                 append dx "$fval\n"
    138             }
    139         }
    140     }
    141     append dx {attribute "dep" string "positions"
    142     object "regular positions regular connections" class field
    143     component "positions" value 1
    144     component "connections" value 2
    145     component "data" value 3}
    146 
    147     set data [Rappture::encoding::encode -as zb64 $dx]
    148     $driver put output.field(f3d).component.dx $data
    149 }
    150 
    151117#
    152118# Save the updated XML describing the run...
  • branches/1.4/examples/zoo/field/tool.xml

    r5682 r5694  
    4646      <value>unstructured</value>
    4747    </option>
    48     <option>
    49       <about>
    50         <label>Volume (OpenDX)</label>
    51         <description>Renders a 3D volume using the deprecated OpenDX mesh/field format.</description>
    52       </about>
    53       <value>dx</value>
    54     </option>
    5548    <default>grid</default>
    5649  </choice>
  • branches/1.4/examples/zoo/mesh/mesh.m

    r3752 r5694  
    9393                 0, 0);
    9494
    95   case 'generic'
    96     mesh = 'output.mesh';
    97     rpLibPutString(lib, 'output.mesh.about.label', \
    98                    'nodes and elements mesh', 0);
    99     rpLibPutString(lib, 'output.mesh.dim', '2', 0);
    100     rpLibPutString(lib, 'output.mesh.units', 'm', 0);
    101     rpLibPutString(lib, 'output.mesh.hide', 'yes', 0);
    102 
    103     f = fopen('triangles.txt');
    104     triangles = fscanf(f, '%d');
    105     fclose(f);
    106 
    107     % TO BE COMPLETED
    108 
    10995  case 'unstructured'
    11096    mesh = 'output.mesh';
  • branches/1.4/examples/zoo/mesh/mesh.py

    r5682 r5694  
    8484    mesh.put('unstructured.triangles', 'triangles.txt', type='file')
    8585
    86 if meshtype == 'generic':
    87     mesh['about.label'] = "nodes and elements mesh"
    88     with open('points.txt') as f:
    89         data = f.read()
    90     for i, line in enumerate(data.split('\n')):
    91         if line == '':
    92             break
    93         x, y = line.split()
    94         mesh['node(%s)' % i] = "%s %s" % (x, y)
    95     with open('triangles.txt') as f:
    96         data = f.read()
    97     for i, line in enumerate(data.split('\n')):
    98         if line == '':
    99             break
    100         x, y, z = line.split()
    101         mesh['element(%s).nodes' % i] = "%s %s %s" % (x, y, z)
    102 
    10386if meshtype == 'unstructured':
    10487    mesh['about.label'] = "Unstructured Grid"
  • branches/1.4/examples/zoo/mesh/mesh.tcl

    r5637 r5694  
    117117            triangles.txt
    118118    }
    119     "generic" {
    120         set mesh output.mesh
    121 
    122         $driver put $mesh.about.label "Mesh"
    123         $driver put $mesh.about.description "nodes and elements mesh"
    124         $driver put $mesh.dim  2
    125         $driver put $mesh.units "m"
    126         $driver put $mesh.hide $hide
    127 
    128         set count 0
    129         set f [open "points.txt" "r"]
    130         set points [read $f]
    131         close $f
    132         foreach { x y } $points {
    133             $driver put $mesh.node($count) "$x $y"
    134             incr count
    135         }
    136         set count 0
    137         set f [open "triangles.txt" "r"]
    138         set triangles [read $f]
    139         close $f
    140         foreach { a b c } $triangles {
    141             $driver put $mesh.element($count).nodes "$a $b $c"
    142             incr count
    143         }
    144     }
    145119    "unstructured" {
    146120        set mesh output.mesh
  • branches/1.4/examples/zoo/mesh/tool.xml

    r5682 r5694  
    6565    <option>
    6666     <about>
    67       <label>general nodes and elements description</label>
    68       <description>Unstructured 2 dimensional grid of cells using nodes and elements.</description>
    69      </about>
    70      <value>generic</value>
    71     </option>
    72     <option>
    73      <about>
    7467      <label>VTK mesh</label>
    7568      <description>Partial VTK file representing the mesh.</description>
  • branches/1.4/examples/zoo/mesh/tool_octave.xml

    • Property svn:mime-type changed from application/xml to text/xml
    r3752 r5694  
    5858    <option>
    5959     <about>
    60       <label>general nodes and elements description</label>
    61       <description>Unstructured 2 dimensional grid of cells using nodes and elements.</description>
    62      </about>
    63      <value>generic</value>
    64     </option>
    65     <option>
    66      <about>
    6760      <label>VTK mesh</label>
    6861      <description>Partial VTK file representing the mesh.</description>
Note: See TracChangeset for help on using the changeset viewer.