wiki:rp_xml_ele_unirect2d

Version 2 (modified by gah, 16 years ago) (diff)

--

<unirect2d>

A unirect2d object defines a uniform rectangular (regular) grid in two dimensions. The grid represents the points in 2D space associated with the values a field object.

<unirect2d id="mygrid">
  <about>
    <label>2D Rectangular Uniform Mesh</label>
  </about>
  <axis>
    <label>X Axis Label</label>
    <min>1.0</min>
    <max>100.0</max>
    <steps>10</steps>
    <units>um</units>
  </axis>
  <axis>
    <label>Y Axis Label</label>
    <min>-1.0</min>
    <max>1.0</max>
    <steps>5</steps>
    <units>um</units>
</unirect2d>

In this example, the <cloud> contains a series of (x,y) points defining the mesh. The <field> includes a <mesh> attribute pointing to output.cloud(m2d) as the underlying mesh. The values within the field correspond to the points defined in the cloud. The first value represents the field at the first mesh point, the second value at the second mesh point, and so forth.


<unirect2d id="mygrid">
   <about>
    <label>2D Mesh</label>
  </about>
  <axis>
    <min>1.0</min>
    <max>10.0</max>
    <npoints>100</npoints>
    <label>X axis</label>
    <units>secs</units>
  </axis>
  <axis>
    <min>0.0</min>
    <max>500.0</max>
    <npoints>500</npoints>
    <label>Y axis</label>
    <units>um</units>
  </axis>
</unirect2d>

Each unirect2d object must have two axis elements representing one dimension. An axis describes the dimension. It must contain elements defining the minimum and maximum points in the dimension, along with the number of points.

The order of the axes is important. It defines the relationship of points to the values in the field. The values are ordered so that last axis varies first.

<meshgrid id="mygrid">
  <axis>
    <label>X Axis Label</label>
    <min>1.0</min>
    <max>100.0</max>
    <steps>10</steps>
    <units>um</units>
  </axis>
  <axis>
    <label>Y Axis Label</label>
    <min>-1.0</min>
    <max>1.0</max>
    <steps>5</steps>
    <units>um</units>
  </axis>  <axis>
    <label>Z Axis Label</label>
    <min>1.0</min>
    <max>100.0</max>
    <steps>10</steps>
    <units>um</units>
  </axis><units>um</units>
  ...
</meshgrid>

<field id="f2d">
  <about>
    <label>2D Field</label>
  </about>
  <component>
    <mesh>output.meshgrid(mygrid)</mesh>
    <values>0
0
0
0
...
    </values>
  </component>
</field>

In this example, the <cloud> contains a series of (x,y) points defining the mesh. The <field> includes a <mesh> attribute pointing to output.cloud(m2d) as the underlying mesh. The values within the field correspond to the points defined in the cloud. The first value represents the field at the first mesh point, the second value at the second mesh point, and so forth.


<mesh id="m3d">
  <about>
    <label>3D Mesh</label>
  </about>
  <units>um</units>
  <hide>yes</hide>
  <node id="0">0 0 0</node>
  <node id="1">1 0 0</node>
  <node id="2">2 0 0</node>
  <node id="3">3 0 0</node>
  ...
  <element id="0">
    <nodes>0 1 5 6 25 26 30 31</nodes>
  </element>
  <element id="1">
    <nodes>1 2 6 7 26 27 31 32</nodes>
  </element>
  ...
</mesh>

<field id="f3d">
  <about>
    <label>3D Field</label>
  </about>
  <component>
    <mesh>output.mesh(m3d)</mesh>
    <values>0
0
0
0
...
    </values>
  </component>
</field>

Meshes can also be defined with explicit connectivity. A <cloud> is just a set of points, which is converted into a mesh automatically via Delaunay triangularization. But a <mesh> element defines a set of points and their connectivity. Each point is defined as a <node> with a specific id. In this example, we have a 3D mesh, so each <node> contains an (x,y,z) coordinate. The mesh also contains a series of <element> objects, which indicate how the nodes are stitched together to form a mesh. The first element is a cube composed of nodes with identifiers (id=) 0, 1, 5, 6, 25, 26, 30, and 31. Note that this mesh has a hole in the center. There is no element defined that connects the inner nodes. This is not an error. It represents a hole in the underlying structure.

The <field> contains a <mesh> attribute that points to output.mesh(m3d) as the underlying mesh. Each value in the field corresponds to a node in the mesh. The first value represents the field at the first node (id=0), the next value at the next node (id=1), and so forth.

NOTE: The newlines after each value in the field and each point in the cloud are significant. They help Rappture differentiate between a scalar and a vector value in a field, or between a 2D point and a 3D point in a cloud.