ReadVTK.jl icon indicating copy to clipboard operation
ReadVTK.jl copied to clipboard

get_field(vtk) function added to get FieldData from VTK

Open andresegido opened this issue 2 years ago • 4 comments

Introduced functions 'get_field' and 'field_data' in order to be able to read FieldData from VTK files.

andresegido avatar Sep 28 '23 20:09 andresegido

Thanks for the suggestions! I just introduced them into my last commit.

andresegido avatar Oct 04 '23 12:10 andresegido

Thanks a lot for this contribution 🙏! This PR seems to be on the right track. There are some usability issues open (see the comments), and it would be great if you could add some simple tests for the new functionality.

Thanks a lot also from my side! Could you please add some tests of the new functionality? See test/runtests.jl

ranocha avatar Oct 04 '23 14:10 ranocha

Thanks a lot for this contribution 🙏! This PR seems to be on the right track. There are some usability issues open (see the comments), and it would be great if you could add some simple tests for the new functionality.

Thanks a lot also from my side! Could you please add some tests of the new functionality? See test/runtests.jl

Hi! I don't have much experiences writing tests, and much less in Julia; so I'm not sure about where to start...

Also, I did a quick check through the vtk files you use for your tests and none of them have any field data, so using them would not be desirable for such a test.

I have done some work with a dummy vtk file I have locally and it works as expected:

vtk = VTKFile("testing/Wing.vtu") fieldData = ReadVTK.get_field_data(vtk) nx = get_data(fieldData["nx"])

In this case, fieldData behaves as a ReadVTK.VTKData and nx reads the expected value.

This might help you appending some field data to one of your vtk files and preparing a test.

andresegido avatar Oct 04 '23 15:10 andresegido

The example files are collected in the repository https://github.com/JuliaVTK/ReadVTK_examples. You can open a PR there and upload a new file containing some field data. When that PR is merged, you can update the commit hash in https://github.com/JuliaVTK/ReadVTK.jl/blob/7668d43a85918756719d62bf95e1085cdf539304/test/runtests.jl#L5-L9 accordingly and write a proper test here.

ranocha avatar Oct 05 '23 13:10 ranocha