[[PageOutline]] = Introduction = A mesh defines the vertices in 2D or 3D for a set of values of a [wiki:rp_xml_ele_field ''] element. The '''''' describes where each value of the [wiki:rp_xml_ele_field ] is found. A mesh contains ''mesh elements'' that indicate their connectivity (topology) and geometry. Meshes can be structured or unstructured grids. Structured grids get their name from their nature of having a structure implicitly defined by the arrangement of the data. Structured grids have a basic rectangular matrix structure that makes storage and use easy as integer offsets (typically named ''i'', ''j'', and ''k'') can be used to access individual data points. Data points are arranged into rectangular or cubic structures by simply connecting them to their neighboring ''i'', ''j'', and ''k'' cells. For example, volume rendering requires a uniform rectangular grid. Within structured grids there are several subtypes: * Cartesian or Uniform Grid * Rectilinear Grid * Curvilinear Grid Unstructured grids are the exact opposite of structured grids, where the connectivity between points must be explicitly defined for every set of points. This makes them significantly more difficult and complex, and the nice relationships between neighboring cells or edges is no longer automatic and must be constructed manually. However, they are much more flexible in their ability to define complex shapes because they have no constraints on their arrangement. Unstructured grids are typically defined as points and cells. Cells are collections of points to define basic 2D or 3D primitives such as triangles, cubes, and tetrahedra. Pick the one that most closely resembles the structure of your data set. = How to specify meshes = {{{ 3 um yes ... }}} All meshes should have '''''', '''''' and '''''' subelements. There are three basic formats for meshes, given by the subelements '''''', '''''', and ''''''. It is an error to have more than one in a '''''' definition. ''' }}} == Point Clouds == The point cloud is a special case of a unstructured grid. A point cloud mesh contains no explicit connectivity. It is implicitly converted into triangular mesh in 2D or a tetrahedral mesh in 3D. The '''''' subelement indicates where the individual points are located in the cloud. Each line of '''''' specifies a point in the cloud. There are no '''''' or '''''' subelements. . '''''Note: It is a bad idea to convert your data that has a known mesh into a point cloud. The mesh generated for point clouds will be inferior to the one actually used by the dataset.''''' '''''':: These are the points of the mesh. Each line specifies a point in the cloud. Each line should contain two numbers in 2D, or three numbers in 3D, representing coordinates of the point The following is an example of a 2D cloud. {{{ 2 m yes 0.0 0.0 0.0204081632653 0.0 0.0408163265306 0.0 0.0612244897959 0.0 ... 0.918367346939 1.0 0.938775510204 1.0 0.959183673469 1.0 0.979591836735 1.0 1.0 1.0 }}} = VTK Legacy File Format = A '''''' element uses the VTK legacy file format to describe the mesh. The advantage of describing the mesh in VTK file format is that you can have heterogeneous cell types. The '''''' element contains only a part of a VTK file. It consists of * a '''DATASET''' keyword and the dataset type ('''STRUCTURED_POINTS''', '''STRUCTURED_GRID''', '''UNSTRUCTUTRED_GRID''', '''POLYDATA''', or '''RECTILINEAR_GRID''') and * the dataset definition itself. '''POINT_DATA''' and '''CELL_DATA''' are not included. They will be added by the '''''' that is using this mesh. {{{ 2 m yes DATASET UNSTRUCTURED_GRID POINTS 2500 float 0.0 0.0 0 0.0204082 0.0 0 0.0408163 0.0 0 0.0612245 0.0 0 0.0816327 0.0 0 0.102041 0.0 0 ... CELLS 4802 19208 3 93 44 43 3 98 49 48 3 19 70 20 3 25 76 26 3 29 80 30 3 34 85 35 ... CELL_TYPES 4802 5 5 5 5 5 5 ... }}} = Old Mesh Format = There is a general form of a '''''' that lets you the specify each element and explicitly describe their connectivity. '''''Note: This format is deprecated in favor of the mesh types described above.''''' {{{ um yes 0 0 0 1 0 0 2 0 0 3 0 0 ... 0 1 5 6 25 26 30 31 1 2 6 7 26 27 31 32 ... }}} In the general form a '''''', you can explicitly define a set of points and their connectivity. Each point is defined as a '''''' with a specific id. In this example, we have a 3D mesh, so each '''''' contains an (x,y,z) coordinate. The mesh also contains a series of '''''' 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. 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. '''''':: These are the points of the mesh. Each '''''' subelement contains the x y and z coordinates of a point. The "id" is important. It is used by '''''' subelements to stitch together points to form a cell element. '''''':: These are the cells of the mesh. Each '''''' contains the node ids of the points that compose the cell. You can see working code in the [browser:trunk/examples/zoo zoo of examples] in the [browser:trunk/examples/zoo/mesh mesh example] or on the hub in the directory /apps/rappture/examples/zoo/mesh.