Your corresponding C++ type for this array would be

std::vector<std::vector<int>>

such as for storing cells in mixed meshes, like quads and triangles mixed?

If so, you need a variable-length array data type of type integer, i.e., HDF5 will see it as

vector<hvl_t>

It's not overly efficient to use variable-length data types, so it would be better to sort the cells into groups 3-element and 4-elements, and save that as two datasets of constant-length data type, but if the size of elements must be mixed in one dataset, then a variable length data type will be a direct match of that structure.

                Werner


On 17.10.2016 18:34, Steven Walton wrote:
So I'm wondering if there is a good way to write an irregular shaped 2D array into hdf5. And example of this would be like storing vtk node connections for an unstructured grid. First number noting the cell type and the next numbers denoting the nodes.

9 23 41 54 12
9 46 29 19 60
5 93 18 58
5 29 58 17
9 50 38 58 95

So the array has some rows that are length 5 and others that are length 4 (or arbitrary). I understand how to do this with C++ vectors and push_back, but those don't create contiguous arrays. Is there another way to create this in a way that HDF would accept?

-Steven


_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

--
___________________________________________________________________________
Dr. Werner Benger                Visualization Research
Center for Computation & Technology at Louisiana State University (CCT/LSU)
2019  Digital Media Center, Baton Rouge, Louisiana 70803
Tel.: +1 225 578 4809                        Fax.: +1 225 578-5362

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Reply via email to