-
Notifications
You must be signed in to change notification settings - Fork 92
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
Remove VTKFileCollection #1015
Remove VTKFileCollection #1015
Conversation
Like I wrote in #1004, I could not really use the VTKCollection wrapper in my code/solver, because it was not flexible enough (I need to use WriteVTK functions directly instead). Maybe other users find the current version of the wrapper convenient, and then we can keep it, but otherwise I would suggest reverting (i.e. merging this PR). |
OK, if no one objects, I'll finish this up during the weekend and merge :) |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1015 +/- ##
==========================================
- Coverage 93.58% 93.57% -0.02%
==========================================
Files 39 39
Lines 5895 5885 -10
==========================================
- Hits 5517 5507 -10
Misses 378 378 ☔ View full report in Codecov by Sentry. |
@@ -209,8 +209,9 @@ for t in Δt:Δt:T | |||
#Finally, we can solve the time step and save the solution afterwards. | |||
u = A \ b | |||
|
|||
addstep!(pvd, t) do io | |||
write_solution(io, dh, u) | |||
VTKGridFile("transient-heat-$step", dh) do vtk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR looks good but just skimming through this, perhaps this should be open_vtk
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean? That we have some function open_vtk
which supportes the do syntax and which automatically figures out the correct format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just mean it might look better to have something like
open_vtk("transient-heat-$step", dh) do vtk::VTKGridFile
write_solution(vtk, dh, u)
pvd[t] = vtk
end
instead of the current
VTKGridFile("transient-heat-$step", dh) do vtk::VTKGridFile
write_solution(vtk, dh, u)
pvd[t] = vtk
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But how does open_vtk
figure out that it is a VTKGridFile
(which maps for us to VTU) and not e.g. a multiblock file or structured mesh file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't figure it out, it always return it. Perhaps open_vtk(VTKBlockFile, ....)
could be the interface or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR looks good but just skimming through this, perhaps this should be open_vtk instead?
While I agree that it looks better, it also looks like it comes from WriteVTK? So in that case, perhaps don't export but make public? Having to write Ferrite.open_vtk
is perhaps equally good as VTKGridFile
, but looks nicer (and is even more clear that comes from Ferrite)?
Sharing some more thoughts below, to make those notes easier to find in the future.
Scope of
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this PR looks good, and it keeps it relatively flexible to add more advanced stuff (DG export etc) when we need it in the future?
This PR removes
VTKFileCollection
introduced in #692, since it doesn't seem very flexible. This puts us back to the 0.3.14 behavior, having to specify the filename of each vtu (VTKGridFile
) file manually, but allowing this behavior seems to be a reasonable low-level interface.So far, only updated the
quasi_incompressible_hyperelasticity.jl
example to see the diff. Once I get some feedback, I will revert the others to (if we decide to go this way).In the future, I would like to make this nicer, specifically I think that WriteVTK.jl should allow something like
vtk = vtk_grid(pvd, grid, time)
which automatically gives a filename for thevtk
derived from thepvd
. A similar syntax already exists there for the block files,vtk = vtk_grid(vtm, griddata)
. We could then mirror this, simply by