You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
documentation for volume mesh prism and pyramid element types (#18)
* Adding in some documentation on additional element types
* new cell indexing diagram
* docs wording tweaks
* adjust cell diagrams
* update volume mesh cell type docs
* fix video url
* clarify padding is -1
---------
Co-authored-by: Nicholas Sharp <nmwsharp@gmail.com>
Copy file name to clipboardExpand all lines: cpp/source/structures/volume_mesh/basics.md
+13-9Lines changed: 13 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,11 @@
1
1
# Volume Meshes
2
2
3
-
Volumetric meshes, such as tetrahedral (*tet*) and hexahedral (*hex*, cube-like) meshes, represent a region of 3D space. Polyscope can display tet and hex meshes, including those which have a mix of hex and tet elements. We'll use the term *cell* to refer generically to a tet or hex in a volume mesh. As always, Polyscope can also handle scalar, color, or vector quantities associated with the vertices or cells of the mesh, and you can click on the mesh elements to inspect values.
3
+
Visualize volumetric 3D meshes, with tetrahedral and hexahedral (cube-like) elements, or even more general prism or pyramidal elements. Meshes may be pure tet/hex/etc, or a mixture of different element types---we'll use the term *cell* to refer generically to either a tet, hex, prism or pyramid element in a volume mesh.
4
+
5
+
As always, Polyscope can visualize the mesh itself, as well as any combination of scalar, color, or vector quantities associated with the vertices or cells of the mesh. Try clicking on the mesh to inspect the value of any quantity at that location, or using *slice planes* to inspect the internal structure and quantities defined within.
Volume meshes are registered with Polyscope by passing the location of each vertex in the mesh, as well as the vertex indices for each cell. There are a few different variants to register meshes with tets, hexes, or a mix of the two. All of these register helpers return a pointer to a `polyscope::VolumeMesh` object which you can then add quantities to.
45
+
Volume meshes are registered with Polyscope by passing the location of each vertex in the mesh, as well as the vertex indices for each cell. There are a few different variants to register meshes with pure tets and hexes, or a more general mixture of tets, hexes, prisms and pyramids. All of these register helpers return a pointer to a `polyscope::VolumeMesh` object which you can then add quantities to.
44
46
45
-

@@ -60,19 +62,21 @@ Volume meshes are registered with Polyscope by passing the location of each vert
60
62
61
63
- `hexIndices` is the 2D array of vertex indices for each hexahedral cell, with dimension `(C,8)` where `C` is the number of hexes. The type should be [adaptable]([[url.prefix]]/data_adaptors) to a nested array of `size_t`; this allows many common types to be used as input, including `Eigen::MatrixXi` and `std::vector<std::array<size_t, 8>>`. All indices should be valid 0-based indices in to the vertex list.
Add a new volume mesh structure to Polyscope, which may have a mix of cell types. This variant takes a rectangular array as input, where all cell rows have 8 entries, but cells with less than 8 vertices are padded with negative values.
67
+
Add a new volume mesh structure to Polyscope, with a general mix of cell types.
68
+
69
+
This variant takes a rectangular array as input, where all cell rows have 8 entries, but cells which are specified by less than 8 vertices are padded with `-1`.
66
70
67
-
For instance, a row of the 2D array `hexIndices` which refers to a tet cell might hold `[12, 9, 22, 51, -1, -1, -1, -1]`.
71
+
For instance, a row of the 2D array `cellIndices` which refers to a tet cell might hold `[12, 9, 22, 51, -1, -1, -1, -1]`. A row in the 2D array `cellIndices` which refers to a prism cell might hold `[18, 32, 51, 17, 85, 23, -1, -1]`, etc.
68
72
69
73
- `vertexPositions` is the vector array of 3D vertex locations. The type should be [adaptable]([[url.prefix]]/data_adaptors) to an array of `float`-valued 3-vectors; this allows many common types to be used as input, including `Eigen::MatrixXd` and `std::vector<std::array<double, 3>>`. The length will be the number of vertices.
70
74
71
-
- `hexIndices` is the 2D array of vertex indices for each hexahedral cell, with dimension `(C,8)` where `C` is the number of tet/hexes. For tetelements, the rows of the array should be padded with negative indices, which will be ignored. The type should be [adaptable]([[url.prefix]]/data_adaptors) to a nested array of `unsigned int`; this allows many common types to be used as input, including `Eigen::MatrixXi` and `std::vector<std::array<int, 8>>`. All indices should be valid 0-based indices in to the vertex list. Signed types should be used to support the negative element conventionas described above.
75
+
- `cellIndices` is the 2D array of vertex indices for each cell, with dimension `(C,8)` where `C` is the number of cells. For tet, prism and pyramid elements, the rows of the array should be right-padded with `-1` as appropriate for the cell topology. The type should be [adaptable]([[url.prefix]]/data_adaptors) to a nested array of `unsigned int`; this allows many common types to be used as input, including `Eigen::MatrixXi` and `std::vector<std::array<int, 8>>`. All indices should be valid 0-based indices in to the vertex list, except padding entries which must be `-1`. Signed types should be used to support the `-1` padding convention. (NOTE: internally cell indices use `UINT32_MAX` for invalid entries, but you should pass padding as `-1` via a signed type to the input adaptor.)
Add a new volume mesh structure to Polyscope. This variant takes a mix of tet and hex elements, where each are given in their own separate list.
79
+
Add a new volume mesh structure to Polyscope. This variant takes a mix of tet and hex elements, where each are given in their own separate list. Note that prisms and pyramids are also supported by the class, but not this constructor; use the general variant.
76
80
77
81
- `vertexPositions` is the vector array of 3D vertex locations. The type should be [adaptable]([[url.prefix]]/data_adaptors) to an array of `float`-valued 3-vectors; this allows many common types to be used as input, including `Eigen::MatrixXd` and `std::vector<std::array<double, 3>>`. The length will be the number of vertices.
Copy file name to clipboardExpand all lines: py/source/structures/volume_mesh/basics.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
# Volume Meshes
2
2
3
-
Volumetric meshes, such as tetrahedral (*tet*) and hexahedral (*hex*, cube-like) meshes, represent a region of 3D space. Polyscope can display tet and hex meshes, including those which have a mix of hex and tet elements. We'll use the term *cell* to refer generically to a tetor hex in a volume mesh. As always, Polyscope can also handle scalar, color, or vector quantities associated with the vertices or cells of the mesh, and you can click on the mesh elements to inspect values.
3
+
Visualize volumetric 3D meshes, with tetrahedral and hexahedral (cube-like) elements, or even more general prism or pyramidal elements. Meshes may be pure tet/hex/etc, or a mixture of different element types---we'll use the term *cell* to refer generically to either a tet, hex, prism or pyramid element in a volume mesh. As always, Polyscope can also handle scalar, color, or vector quantities associated with the vertices or cells of the mesh, and you can click on the mesh elements to inspect values, or use *slice planes* to inspect the internal structure.
Volume meshes are registered with Polyscope by passing the location of each vertex in the mesh, as well as the vertex indices for each cell. There are a few different argument variants to register meshes with tets, hexes, or a mix of the two.
40
+
Volume meshes are registered with Polyscope by passing the location of each vertex in the mesh, as well as the vertex indices for each cell. There are a few different argument variants to register meshes with tets, hexes, or a general mix of element types.
41
41
42
-

@@ -50,13 +50,15 @@ Volume meshes are registered with Polyscope by passing the location of each vert
50
50
- `name` string, a name for the structure
51
51
- `vertices` an `Nx3` numpy float array of vertex locations
52
52
53
-
The elements are specified by a combination of the following arguments:
53
+
The element indices are specified by some combination of the following arguments:
54
54
55
55
- `tets` a `Tx4` numpy integer array of tetrahedra, as 0-based indices in to the vertices array
56
56
- `hexes` a `Hx8` numpy integer array of hexahedra, as 0-based indices in to the vertices array
57
-
- `mixed_cells` a `Mx8` numpy integer array which may contain a mix of tetrahedra and hexahedra. For any rows which are tets and thus have just 4 indices, the remaining indices should be set to any negative value.
57
+
- `mixed_cells` a `Mx8` numpy integer array which may contain a mix of tet, hex, prism, and pyramid elements. Each row holds 8 entries; cells with fewer than 8 vertices are right-padded with `-1`. For example, a tet row might be `[12, 9, 22, 51, -1, -1, -1, -1]`, or a pyramid row might be `[3, 7, 14, 2, 19, -1, -1, -1]`.
58
58
59
-
You may pass in `tets`, `hexes`, or both to specify the connectivty. Alternately, `mixed_cells` may be used. However, it is not supported to specify both `tets`/`hexes` and `mixed_cells`. For the purposes of element ordering, when `tets` and `hexes` are both passed, the cells are presumed to be ordered with all tetrahedral cells coming first, then hexahedral cells.
59
+
You may pass in `tets`, `hexes`, or both to specify the connectivity. Alternately, `mixed_cells` may be used for any combination of cell types, including pyramids and prisms as well. However, it is not supported to specify both `tets`/`hexes` and `mixed_cells`; just pass all cells as `mixed_cells` in this case.
60
+
61
+
For the purposes of element ordering, when `tets` and `hexes` are both passed, the cells are presumed to be ordered with all tetrahedral cells coming first, then hexahedral cells.
0 commit comments