mmorse1217 / lean-vtk

A minimal VTK file writer for triangle, quad, hex and tet meshes in 2D and 3D. Only C++ standard lib as dependencies.
MIT License
47 stars 14 forks source link

Initial functionality to write VTK FieldData #2

Open nDimensionalSpace opened 2 years ago

nDimensionalSpace commented 2 years ago

Currently only works for int and double scalars. Verified to work for the intended use case . . . Screenshot attached. Functionality added to a single test ("single_hex"). Resolves #1 .

Screen Shot 2021-09-14 at 9 01 23 AM

mmorse1217 commented 2 years ago

It looks like from the vtk documentation that FieldData is essentially arbitrary data that is unrelated to the actual structure stored in the file. I think this means that FieldData can also be arrays as well as single numbers, which I'm not sure that your implementation can handle.

It might be best to reuse the VTKDataNode class again here for FieldData to avoid reinventing the wheel. Is there some functionality that VTKDataNode is missing that we would need?

nDimensionalSpace commented 2 years ago

Yes, FieldData can contain a data array completely analogous to what, e.g., cell data can contain. Oh, my implementation for sure does not handle it; I didn't bother with that just because I don't have a pragmatic use case for it . . .

I think VTKDataNode will work just swimmingly; will swap it in in the next week or so.