Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General polyhedrons handling #31

Open
AliE89 opened this issue Nov 24, 2020 · 20 comments
Open

General polyhedrons handling #31

AliE89 opened this issue Nov 24, 2020 · 20 comments
Assignees

Comments

@AliE89
Copy link

AliE89 commented Nov 24, 2020

Ciao Stefano,

Hope you are doing well. This is just a question out of the box. Can VTKFortran deal with general polyhedrons?

@AliE89
Copy link
Author

AliE89 commented Nov 24, 2020

Since there is no polydata support I guess I am skrewed... Would it be difficult to add?

@szaghi
Copy link
Owner

szaghi commented Mar 12, 2021

@AliE89

I am sorry for my delay, my bad.

Currently, it is not supported and I do not know how difficult is to add it. I cannot promise anything, but I'll try to figure out the effort necessary in the future.

@szaghi szaghi self-assigned this Mar 12, 2021
@AliE89
Copy link
Author

AliE89 commented Mar 12, 2021 via email

@szaghi
Copy link
Owner

szaghi commented Mar 12, 2021

@AliE89

Sure, let me some days and give me a reminder in the middle of the next week, hoping I will be less busy than now.

@AliE89
Copy link
Author

AliE89 commented Mar 12, 2021 via email

@szaghi
Copy link
Owner

szaghi commented Mar 12, 2021

@AliE89

FLUBIO rocks!

@szaghi
Copy link
Owner

szaghi commented Mar 12, 2021

@AliE89

I am working on a totally new code for work, an AMR very high order IB solver, highly parallel (tailored to exascale on GPU cluster). Unfortunately is not FOSS, but I will like to share my experience if you are interested.

@AliE89
Copy link
Author

AliE89 commented Mar 12, 2021 via email

@szaghi
Copy link
Owner

szaghi commented Mar 12, 2021

@AliE89

I am now following FLUBIO on gitlab, I hope to find the time to study it soon. I read your paper, nice! I read that you are from Poli-Genova, we have worked a lot with Genova, maybe we can try to a web call soon or later.

Cheers

@AliE89
Copy link
Author

AliE89 commented Mar 12, 2021 via email

@AliE89
Copy link
Author

AliE89 commented Feb 27, 2022

Ciao Stefano,

Hope you are doing well.

It took me ages, but in the end I got polyhedron right. I think that library-wise you just need to do a very small modificiation in the function write_connectivity() in vtk_fortran_vtk_file_xml_writer_abstract.f90 to allow it to get 2 optional arrays (faces and faceoffsets).

I did like this:

`er(I4P), intent(in) :: nc !< Number of cells.
integer(I4P), intent(in) :: connectivity(1:) !< Mesh connectivity.
integer(I4P), intent(in) :: offset(1:) !< Cell offset.
integer(I4P), optional, intent(in) :: faces(1:) !< Cell offset.
integer(I4P), optional, intent(in) :: faceoffsets(1:) !< Cell offset.
integer(I1P), intent(in) :: cell_type(1:) !< VTK cell type.
integer(I4P) :: error !< Error status.

call self%write_start_tag(name='Cells')
error = self%write_dataarray(data_name='connectivity', x=connectivity)
error = self%write_dataarray(data_name='offsets', x=offset)
error = self%write_dataarray(data_name='types', x=cell_type)

if(present(faces).and. present(faceoffsets)) then
error = self%write_dataarray(data_name='faces', x=faces)
error = self%write_dataarray(data_name='faceoffsets', x=faceoffsets)
endif
`

I would be happy if you like to merge this in the library or find an equivalent solution such that I can stay on thsi repo avoing tedius patching :)

Let me know your throughts!

@szaghi
Copy link
Owner

szaghi commented Feb 28, 2022

Dear @AliE89

I am fine thanks, I hope you are too.

Thank you very much for your help it is really appreciated. Do you like to create a Pull Request? I will happy to accept and merge your PR. In case you cannot I try to put your patch directly into the library during this week.

Cheers

@AliE89
Copy link
Author

AliE89 commented Feb 28, 2022

Sure, I'll prepare and MR, no problems.

Just a couple of notes for users interested in polyhedra:

  • Connectivity list (i.e. the address of the points composing the polyhedron) can be mixed up, you do not need to follow a particular order as in Hexas for examples.
    -Points composing each face (to be passed in the array "faces") must be oriented, otherwise paraview will break them when visualising the geometry.

I attach an example file of 2 adjacent cubes, while you can find a good way to orient points laying on plane here: https://stackoverflow.com/questions/47949485/sorting-a-list-of-3d-points-in-clockwise-order
test.vtu.txt

@szaghi
Copy link
Owner

szaghi commented Feb 28, 2022

@AliE89 Thank you again

@AliE89
Copy link
Author

AliE89 commented Feb 28, 2022

I cannot push my branch unfortunately to your repo. I must missing some settings... I'll attach the new file here:
vtk_fortran_vtk_file_xml_writer_abstract.zip

@szaghi
Copy link
Owner

szaghi commented Feb 28, 2022

@AliE89 I'll merge it ASAP

Cheers

szaghi added a commit that referenced this issue Mar 3, 2022
Add patch of @AliE89 for polyhedrons handling: see issue #31 for more
details.
szaghi added a commit that referenced this issue Mar 3, 2022
Add patch of @AliE89 to support polyhedrons, see issue #31.

Minor: update sumbmodules and licenses date.
@szaghi
Copy link
Owner

szaghi commented Mar 3, 2022

Dear @AliE89 I have just pushed a new version (v2.0.2) that integrates your patch, thank you very much for your support.

Cheers

P.S. feel free to close this issue if your patch is enough for your goal.

@AliE89
Copy link
Author

AliE89 commented Mar 13, 2022

Hi Stefano,
vtk_fortran_vtk_file_xml_writer_abstract.zip

sorry really my bad. I just realized there is a bug in the file a shared with you. We need to close the after faces and faceoffsets, really missed. I attached here the correct one.

Cheers

@szaghi
Copy link
Owner

szaghi commented Mar 14, 2022

Hi @AliE89

thank you very much for the fix. I'll patch the library ASAP.

Cheers

@AliE89
Copy link
Author

AliE89 commented Mar 14, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants