Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
VTK
VTK
Commits
5ff0a170
Commit
5ff0a170
authored
May 13, 2019
by
Will Schroeder
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed error interpolating attributes with multiple contour values
These changes address issue
#17597
.
parent
c73b01a6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
11 deletions
+46
-11
Filters/Core/Testing/Python/CMakeLists.txt
Filters/Core/Testing/Python/CMakeLists.txt
+1
-0
Filters/Core/Testing/Python/TestContour3DLinearGridInterpolateAttributes.py
...ng/Python/TestContour3DLinearGridInterpolateAttributes.py
+32
-0
Filters/Core/vtkContour3DLinearGrid.cxx
Filters/Core/vtkContour3DLinearGrid.cxx
+13
-11
No files found.
Filters/Core/Testing/Python/CMakeLists.txt
View file @
5ff0a170
...
...
@@ -20,6 +20,7 @@ vtk_add_test_python(
TestContour3DLinearGrid.py
TestContour3DLinearGrid2.py
TestContour3DLinearGridCompositeInput.py
TestContour3DLinearGridInterpolateAttributes.py,NO_VALID
TestContour3DLinearGridScalarTree.py
TestDecimatePolylineMaximumError.py
TestElevationFilter.py
...
...
Filters/Core/Testing/Python/TestContour3DLinearGridInterpolateAttributes.py
0 → 100755
View file @
5ff0a170
#!/usr/bin/env python
import
vtk
from
vtk.util.misc
import
vtkGetDataRoot
VTK_DATA_ROOT
=
vtkGetDataRoot
()
# Set up source for linear cells
cellSource
=
vtk
.
vtkCellTypeSource
()
cellSource
.
SetCellType
(
12
)
cellSource
.
SetBlocksDimensions
(
10
,
10
,
10
)
cellSource
.
Update
()
# Add several contour values
contour
=
vtk
.
vtkContour3DLinearGrid
()
contour
.
SetInputConnection
(
cellSource
.
GetOutputPort
())
contour
.
SetInputArrayToProcess
(
0
,
0
,
0
,
vtk
.
vtkDataObject
.
FIELD_ASSOCIATION_POINTS
,
"DistanceToCenter"
)
contour
.
SetValue
(
0
,
4
)
contour
.
SetValue
(
1
,
5
)
contour
.
SetValue
(
2
,
6
)
contour
.
SetMergePoints
(
1
)
contour
.
SetSequentialProcessing
(
0
)
contour
.
SetInterpolateAttributes
(
1
);
contour
.
SetComputeNormals
(
1
);
contour
.
Update
()
# Ensure that the number of tuples in the output arrays matches the number of points
output
=
contour
.
GetOutput
()
ptData
=
output
.
GetPointData
()
for
i
in
range
(
ptData
.
GetNumberOfArrays
()):
numTuples
=
ptData
.
GetArray
(
i
).
GetNumberOfTuples
()
numPts
=
output
.
GetNumberOfPoints
()
print
(
"numTuples: %d numPts: %d"
%
(
numTuples
,
numPts
))
assert
(
numTuples
==
numPts
)
Filters/Core/vtkContour3DLinearGrid.cxx
View file @
5ff0a170
...
...
@@ -1372,8 +1372,8 @@ template <typename TIds>
int
ProcessMerged
(
vtkIdType
numCells
,
vtkPoints
*
inPts
,
CellIter
*
cellIter
,
int
sType
,
void
*
s
,
double
isoValue
,
vtkPoints
*
outPts
,
vtkCellArray
*
newPolys
,
vtkTypeBool
intAttr
,
vtkDataArray
*
inScalars
,
vtkPointData
*
inPD
,
vtkPointData
*
outPD
,
vtkScalarTree
*
st
,
vtkTypeBool
seqProcessing
,
int
&
numThreads
,
vtkIdType
totalPts
,
vtkIdType
totalTris
)
vtkPointData
*
inPD
,
vtkPointData
*
outPD
,
ArrayList
*
arrays
,
vtkScalarTree
*
st
,
vtkTypeBool
seqProcessing
,
int
&
numThreads
,
vtkIdType
totalPts
,
vtkIdType
totalTris
)
{
// Extract edges that the contour intersects. Templated on type of scalars.
// List below the explicit choice of scalars that can be processed.
...
...
@@ -1447,19 +1447,18 @@ int ProcessMerged(vtkIdType numCells, vtkPoints *inPts, CellIter *cellIter,
// Now process point data attributes if requested
if
(
intAttr
)
{
ArrayList
arrays
;
if
(
totalPts
<=
0
)
//first contour value generating output
{
outPD
->
InterpolateAllocate
(
inPD
,
numPts
);
outPD
->
RemoveArray
(
inScalars
->
GetName
());
arrays
.
ExcludeArray
(
inScalars
);
arrays
.
AddArrays
(
numPts
,
inPD
,
outPD
);
arrays
->
ExcludeArray
(
inScalars
);
arrays
->
AddArrays
(
numPts
,
inPD
,
outPD
);
}
else
{
arrays
.
Realloc
(
totalPts
+
numPts
);
arrays
->
Realloc
(
totalPts
+
numPts
);
}
ProduceAttributes
<
TIds
>
interpolate
(
mergeEdges
,
offsets
,
&
arrays
,
totalPts
);
ProduceAttributes
<
TIds
>
interpolate
(
mergeEdges
,
offsets
,
arrays
,
totalPts
);
EXECUTE_SMPFOR
(
seqProcessing
,
numPts
,
interpolate
);
}
...
...
@@ -1795,6 +1794,7 @@ ProcessPiece(vtkUnstructuredGrid *input, vtkDataArray *inScalars, vtkPolyData *o
{
vtkPointData
*
inPD
=
input
->
GetPointData
();
vtkPointData
*
outPD
=
output
->
GetPointData
();
ArrayList
arrays
;
// Determine the size/type of point and cell ids needed to index points
// and cells. Using smaller ids results in a greatly reduced memory footprint
...
...
@@ -1810,8 +1810,9 @@ ProcessPiece(vtkUnstructuredGrid *input, vtkDataArray *inScalars, vtkPolyData *o
{
if
(
!
ProcessMerged
<
int
>
(
numCells
,
inPts
,
cellIter
,
sType
,
sPtr
,
value
,
outPts
,
newPolys
,
this
->
InterpolateAttributes
,
inScalars
,
inPD
,
outPD
,
stree
,
this
->
SequentialProcessing
,
this
->
NumberOfThreadsUsed
,
totalPts
,
totalTris
)
)
inScalars
,
inPD
,
outPD
,
&
arrays
,
stree
,
this
->
SequentialProcessing
,
this
->
NumberOfThreadsUsed
,
totalPts
,
totalTris
)
)
{
return
;
}
...
...
@@ -1820,8 +1821,9 @@ ProcessPiece(vtkUnstructuredGrid *input, vtkDataArray *inScalars, vtkPolyData *o
{
if
(
!
ProcessMerged
<
vtkIdType
>
(
numCells
,
inPts
,
cellIter
,
sType
,
sPtr
,
value
,
outPts
,
newPolys
,
this
->
InterpolateAttributes
,
inScalars
,
inPD
,
outPD
,
stree
,
this
->
SequentialProcessing
,
this
->
NumberOfThreadsUsed
,
totalPts
,
totalTris
)
)
inScalars
,
inPD
,
outPD
,
&
arrays
,
stree
,
this
->
SequentialProcessing
,
this
->
NumberOfThreadsUsed
,
totalPts
,
totalTris
)
)
{
return
;
}
...
...
Will Schroeder
@will.schroeder
mentioned in commit
052f2268
·
May 13, 2019
mentioned in commit
052f2268
mentioned in commit 052f2268776203eb2beccff8c6ca988f9d0f2f1f
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment