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

Include or not adjacent cells when using extract_points method #960

Merged
merged 1 commit into from
Oct 22, 2020

Conversation

mglesser
Copy link
Contributor

Overview

An input parameter ("adjacent_cells") is added to the "extract_points" method. For backward compatibility it is set to "True" by default. In this case, the output includes the cells that contain at least one of the extracted points. When it set to False, the output includes the cells that contain exclusively points from the extracted points list.
Please note that when using quadratic mesh, the list of nodes shall include the corner nodes AND the middle nodes for the adjacent_cells = False case.

A test function is provided to check the behavior of the "extract_points" method on a simple mesh.

resolves #953

@codecov
Copy link

codecov bot commented Oct 22, 2020

Codecov Report

Merging #960 into master will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #960      +/-   ##
==========================================
+ Coverage   86.95%   86.98%   +0.02%     
==========================================
  Files          36       36              
  Lines        9047     9065      +18     
==========================================
+ Hits         7867     7885      +18     
  Misses       1180     1180              

Copy link
Member

@akaszynski akaszynski left a comment

Choose a reason for hiding this comment

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

Thanks for adding this and the test as well.

@akaszynski akaszynski merged commit e8f205d into pyvista:master Oct 22, 2020
@akaszynski akaszynski mentioned this pull request Nov 8, 2020
@math-artist
Copy link
Contributor

I have tried using this new function and it keeps missing one point. I can't figure out where this is happening.

len(ind) at the beginning is always one more than _get_output(extract_sel).n_points.

This is causing me issues for adding filtered scalars. I have checked numpy code, numpy_to_idarr and everything is ok. This data loss is probably happenning during the extract:

        selection = vtk.vtkSelection()
        selection.AddNode(selectionNode)

        # extract
        extract_sel = vtk.vtkExtractSelection()
        extract_sel.SetInputData(0, dataset)
        extract_sel.SetInputData(1, selection)
        extract_sel.Update()
        return _get_output(extract_sel)

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.

"extract_points" method boundary conditions
3 participants