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

Fix: Make sampleProfile return Profile type given PointID #26

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion vtkpytools/barfiletools/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def sampleDataBlockProfile(dataBlock, line_walldists, pointid=None,
cutterobj : vtk.vtkPlane, optional
VTK object that defines the profile location via intersection with the
'wall'
normal : numpy.ndarray
normal : numpy.ndarray, optional
If given, use this vector as the wall normal.

Returns
Expand All @@ -233,6 +233,9 @@ def sampleDataBlockProfile(dataBlock, line_walldists, pointid=None,
sample_line = sample_line.sample(dataBlock['grid'])
sample_line['WallDistance'] = line_walldists

sample_line = Profile(sample_line)
sample_line.setWallDataFromPointID(wall, pointid)

if cutterobj:
cutterout = vCutter(wall, cutterobj)
if cutterout.points.shape[0] != 1:
Expand Down
7 changes: 7 additions & 0 deletions vtkpytools/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ def setWallDataFromPolyDataPoint(self, PolyPoint):
self.walldata = dict(PolyPoint.point_arrays)
self.walldata['Point'] = PolyPoint.points

def setWallDataFromPointID(self, wall, pointid):
"""Set walldata attribute from point id of wall point """

for array_name in wall.array_names:
self.walldata[array_name] = wall[array_name][pointid]
self.walldata['Point'] = wall.points[pointid]

def readBinaryArray(path, ncols) -> np.ndarray:
"""Get array from Fortran binary file.

Expand Down