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

New implementation to read and write VTK files #129

Merged
merged 42 commits into from Mar 23, 2022
Merged

New implementation to read and write VTK files #129

merged 42 commits into from Mar 23, 2022

Conversation

lang-m
Copy link
Member

@lang-m lang-m commented Mar 11, 2022

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Mar 15, 2022

Codecov Report

Merging #129 (5e898eb) into master (a20b19d) will increase coverage by 0.23%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #129      +/-   ##
==========================================
+ Coverage   95.46%   95.69%   +0.23%     
==========================================
  Files          20       20              
  Lines        1986     2046      +60     
==========================================
+ Hits         1896     1958      +62     
+ Misses         90       88       -2     
Impacted Files Coverage Δ
discretisedfield/ovf2vtk.py 100.00% <ø> (+10.52%) ⬆️
discretisedfield/util/__init__.py 100.00% <ø> (ø)
discretisedfield/field.py 97.69% <100.00%> (+0.08%) ⬆️
discretisedfield/mesh.py 99.00% <100.00%> (+0.02%) ⬆️
discretisedfield/util/util.py 96.55% <100.00%> (+0.86%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a20b19d...5e898eb. Read the comment docs.

Copy link
Member

@marijanbeg marijanbeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good, I have added a few comments

discretisedfield/field.py Outdated Show resolved Hide resolved
discretisedfield/field.py Outdated Show resolved Hide resolved
discretisedfield/field.py Outdated Show resolved Hide resolved
discretisedfield/field.py Outdated Show resolved Hide resolved
discretisedfield/field.py Outdated Show resolved Hide resolved
discretisedfield/field.py Outdated Show resolved Hide resolved
discretisedfield/field.py Outdated Show resolved Hide resolved
discretisedfield/field.py Outdated Show resolved Hide resolved
discretisedfield/mesh.py Outdated Show resolved Hide resolved
@lang-m lang-m requested a review from marijanbeg March 15, 2022 19:09
Comment on lines +435 to +436
return vertices(*(np.linspace(pmin, pmax, n + 1) for pmin, pmax, n in
zip(self.region.pmin, self.region.pmax, self.n)))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marijanbeg If you are happy with this (not anymore lazy) calculation of the vertices/midpoints we can merge the PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @lang-m, could you please remind me why we decided this not to be lazy?

Copy link
Member Author

@lang-m lang-m Mar 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Copied from Zulip, looks like you've missed it there, and slightly extended]

I think using np.linspace would be a lot better, because:

  • it is generally more convenient to use (no need to convert to a list first) and all parts within discretisedfield can use/need a numpy array "version" anyways.
  • faster for larger n (example: 2000 cells, generator: 750μs, numpy: 200 μs with the additional calls to the mesh/region for (smaller) numbers of cells in the other two directions); subsequent calls are ~50 ns (due to caching).
  • easier to use because we can assign and reuse it, whereas more care is necessary with the generator expression.

<https://docs.enthought.com/mayavi/mayavi/>`_.
<https://docs.enthought.com/mayavi/mayavi/>`_. To show contour lines in
Paraview one has to first convert Cell Data to Point Data using a
filter.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding that explanation - this will be useful for people ;-)

@lang-m lang-m merged commit ba617be into master Mar 23, 2022
@lang-m lang-m deleted the vtk-files branch March 23, 2022 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants