Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Michael Migliore
VTK
Commits
88877418
Commit
88877418
authored
Mar 13, 2017
by
Robert Maynard
Browse files
vtkmContour now supports multiple iso-contour values
parent
e7b39312
Changes
4
Hide whitespace changes
Inline
Side-by-side
Accelerators/Vtkm/Testing/Cxx/CMakeLists.txt
View file @
88877418
...
...
@@ -9,6 +9,7 @@ vtk_add_test_cxx(${vtk-module}CxxTests tests
TestVTKMExternalFaces.cxx
TestVTKMLevelOfDetail.cxx
TestVTKMMarchingCubes.cxx
TestVTKMMarchingCubes2.cxx
TestVTKMThreshold.cxx
TestVTKMThreshold2.cxx
)
...
...
Accelerators/Vtkm/Testing/Cxx/TestVTKMMarchingCubes2.cxx
0 → 100644
View file @
88877418
/*=========================================================================
Program: Visualization Toolkit
Module: TestCutter.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include
"vtkActor.h"
#include
"vtkCellData.h"
#include
"vtkElevationFilter.h"
#include
"vtkImageData.h"
#include
"vtkImageMandelbrotSource.h"
#include
"vtkmContour.h"
#include
"vtkNew.h"
#include
"vtkPointData.h"
#include
"vtkPolyDataMapper.h"
#include
"vtkRegressionTestImage.h"
#include
"vtkRenderer.h"
#include
"vtkRTAnalyticSource.h"
#include
"vtkRenderWindow.h"
#include
"vtkRenderWindowInteractor.h"
const
int
EXTENT
=
30
;
int
TestVTKMMarchingCubes2
(
int
argc
,
char
*
argv
[])
{
vtkNew
<
vtkRenderer
>
ren
;
vtkNew
<
vtkRenderWindow
>
renWin
;
vtkNew
<
vtkRenderWindowInteractor
>
iren
;
renWin
->
AddRenderer
(
ren
.
GetPointer
());
iren
->
SetRenderWindow
(
renWin
.
GetPointer
());
vtkNew
<
vtkRTAnalyticSource
>
imageSource
;
imageSource
->
SetWholeExtent
(
-
EXTENT
,
EXTENT
,
-
EXTENT
,
EXTENT
,
-
EXTENT
,
EXTENT
);
vtkNew
<
vtkElevationFilter
>
ev
;
ev
->
SetInputConnection
(
imageSource
->
GetOutputPort
());
ev
->
SetLowPoint
(
-
EXTENT
,
-
EXTENT
,
-
EXTENT
);
ev
->
SetHighPoint
(
EXTENT
,
EXTENT
,
EXTENT
);
vtkNew
<
vtkmContour
>
cg
;
cg
->
SetInputConnection
(
ev
->
GetOutputPort
());
cg
->
SetInputArrayToProcess
(
0
,
0
,
0
,
vtkDataObject
::
FIELD_ASSOCIATION_POINTS
,
"RTData"
);
cg
->
SetValue
(
0
,
200.0
);
cg
->
SetValue
(
1
,
220.0
);
cg
->
ComputeScalarsOn
();
cg
->
ComputeNormalsOn
();
vtkNew
<
vtkPolyDataMapper
>
mapper
;
mapper
->
SetInputConnection
(
cg
->
GetOutputPort
());
mapper
->
ScalarVisibilityOn
();
mapper
->
SetScalarModeToUsePointFieldData
();
mapper
->
SelectColorArray
(
"Elevation"
);
mapper
->
SetScalarRange
(
0.0
,
1.0
);
vtkNew
<
vtkActor
>
actor
;
actor
->
SetMapper
(
mapper
.
GetPointer
());
ren
->
AddActor
(
actor
.
GetPointer
());
ren
->
ResetCamera
();
renWin
->
Render
();
int
retVal
=
vtkRegressionTestImage
(
renWin
.
GetPointer
());
if
(
retVal
==
vtkRegressionTester
::
DO_INTERACTOR
)
{
iren
->
Start
();
retVal
=
vtkRegressionTester
::
PASSED
;
}
if
(
!
cg
->
GetOutput
()
->
GetPointData
()
->
GetNormals
())
{
std
::
cerr
<<
"Output normals not set.
\n
"
;
return
EXIT_FAILURE
;
}
return
(
!
retVal
);
}
Accelerators/Vtkm/Testing/Data/Baseline/TestVTKMMarchingCubes2.png.md5
0 → 100644
View file @
88877418
28b5b58cdf20178d59e05164aba3f462
Accelerators/Vtkm/vtkmContour.cxx
View file @
88877418
...
...
@@ -71,20 +71,18 @@ int vtkmContour::RequestData(vtkInformation* request,
{
return
1
;
}
else
if
(
numContours
>
1
)
{
vtkWarningMacro
(
<<
"VTKm contour algorithm currently only supports a "
<<
"single contour value.
\n
"
<<
"Falling back to serial implementation."
);
return
this
->
Superclass
::
RequestData
(
request
,
inputVector
,
outputVector
);
}
vtkm
::
filter
::
MarchingCubes
filter
;
// set local variables
filter
.
SetGenerateNormals
(
this
->
GetComputeNormals
()
!=
0
);
filter
.
SetIsoValue
(
this
->
GetValue
(
0
));
filter
.
SetNumberOfIsoValues
(
numContours
);
for
(
int
i
=
0
;
i
<
numContours
;
++
i
)
{
filter
.
SetIsoValue
(
i
,
this
->
GetValue
(
i
));
}
// convert the input dataset to a vtkm::cont::DataSet
vtkm
::
cont
::
DataSet
in
=
tovtkm
::
Convert
(
input
);
...
...
Write
Preview
Supports
Markdown
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