Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VTK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Spiros Tsalikis
VTK
Commits
6bd65269
Commit
6bd65269
authored
8 months ago
by
Vicente Bolea
Browse files
Options
Downloads
Patches
Plain Diff
vtk-m: vtkmAccelerator use new vtk-m API
parent
49afe9b2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Accelerators/Vtkm/Filters/vtkmWarpScalar.cxx
+16
-14
16 additions, 14 deletions
Accelerators/Vtkm/Filters/vtkmWarpScalar.cxx
Accelerators/Vtkm/Filters/vtkmWarpVector.cxx
+12
-10
12 additions, 10 deletions
Accelerators/Vtkm/Filters/vtkmWarpVector.cxx
with
28 additions
and
24 deletions
Accelerators/Vtkm/Filters/vtkmWarpScalar.cxx
+
16
−
14
View file @
6bd65269
...
...
@@ -21,7 +21,7 @@
#include
"vtkm/cont/DataSet.h"
#include
<vtkm/filter/field_transform/Warp
Scalar
.h>
#include
<vtkm/filter/field_transform/Warp.h>
VTK_ABI_NAMESPACE_BEGIN
vtkStandardNewMacro
(
vtkmWarpScalar
);
...
...
@@ -96,16 +96,18 @@ int vtkmWarpScalar::RequestData(vtkInformation* vtkNotUsed(request),
}
vtkm
::
Id
numberOfPoints
=
in
.
GetCoordinateSystem
().
GetData
().
GetNumberOfValues
();
vtkm
::
filter
::
field_transform
::
Warp
filter
;
// ScaleFactor in vtk is the scalarAmount in vtk-m.
vtkm
::
filter
::
field_transform
::
WarpScalar
warpScala
r
(
this
->
ScaleFactor
);
warpScala
r
.
SetUseCoordinateSystemAsField
(
true
);
filter
.
SetScaleFacto
r
(
this
->
ScaleFactor
);
filte
r
.
SetUseCoordinateSystemAsField
(
true
);
// Get/generate the normal field
if
(
inNormals
&&
!
this
->
UseNormal
)
{
// DataNormal
auto
inNormalsField
=
tovtkm
::
Convert
(
inNormals
,
vtkDataObject
::
FIELD_ASSOCIATION_POINTS
);
in
.
AddField
(
inNormalsField
);
warpScalar
.
SetNormal
Field
(
inNormals
->
GetName
());
filter
.
SetDirection
Field
(
inNormals
->
GetName
());
}
else
if
(
this
->
XYPlane
)
{
...
...
@@ -114,7 +116,7 @@ int vtkmWarpScalar::RequestData(vtkInformation* vtkNotUsed(request),
vtkm
::
cont
::
ArrayHandleConstant
<
vecType
>
vectorAH
=
vtkm
::
cont
::
make_ArrayHandleConstant
(
normal
,
numberOfPoints
);
in
.
AddPointField
(
"zNormal"
,
vectorAH
);
warpScalar
.
SetNormal
Field
(
"zNormal"
);
filter
.
SetDirection
Field
(
"zNormal"
);
}
else
{
...
...
@@ -124,7 +126,7 @@ int vtkmWarpScalar::RequestData(vtkInformation* vtkNotUsed(request),
vtkm
::
cont
::
ArrayHandleConstant
<
vecType
>
vectorAH
=
vtkm
::
cont
::
make_ArrayHandleConstant
(
normal
,
numberOfPoints
);
in
.
AddPointField
(
"instanceNormal"
,
vectorAH
);
warpScalar
.
SetNormal
Field
(
"instanceNormal"
);
filter
.
SetDirection
Field
(
"instanceNormal"
);
}
if
(
this
->
XYPlane
)
...
...
@@ -136,23 +138,23 @@ int vtkmWarpScalar::RequestData(vtkInformation* vtkNotUsed(request),
zValues
.
push_back
(
input
->
GetPoints
()
->
GetPoint
(
i
)[
2
]);
}
in
.
AddPointField
(
"scalarfactor"
,
zValues
);
warpScala
r
.
SetScal
arFactor
Field
(
"scalarfactor"
);
filte
r
.
SetScal
e
Field
(
"scalarfactor"
);
}
else
{
warpScala
r
.
SetScal
arFactor
Field
(
std
::
string
(
inScalars
->
GetName
()));
filte
r
.
SetScal
e
Field
(
std
::
string
(
inScalars
->
GetName
()));
}
auto
result
=
warpScala
r
.
Execute
(
in
);
vtkDataArray
*
warp
Scalar
Result
=
fromvtkm
::
Convert
(
result
.
GetField
(
"
w
arp
scalar
"
,
vtkm
::
cont
::
Field
::
Association
::
Points
));
auto
result
=
filte
r
.
Execute
(
in
);
vtkDataArray
*
warpResult
=
fromvtkm
::
Convert
(
result
.
GetField
(
"
W
arp"
,
vtkm
::
cont
::
Field
::
Association
::
Points
));
vtkPoints
*
newPts
=
vtkPoints
::
New
();
// Update points
newPts
->
SetNumberOfPoints
(
warp
Scalar
Result
->
GetNumberOfTuples
());
newPts
->
SetData
(
warp
Scalar
Result
);
newPts
->
SetNumberOfPoints
(
warpResult
->
GetNumberOfTuples
());
newPts
->
SetData
(
warpResult
);
output
->
SetPoints
(
newPts
);
newPts
->
Delete
();
warp
Scalar
Result
->
FastDelete
();
warpResult
->
FastDelete
();
}
catch
(
const
vtkm
::
cont
::
Error
&
e
)
{
...
...
This diff is collapsed.
Click to expand it.
Accelerators/Vtkm/Filters/vtkmWarpVector.cxx
+
12
−
10
View file @
6bd65269
...
...
@@ -21,7 +21,7 @@
#include
"vtkm/cont/DataSet.h"
#include
<vtkm/filter/field_transform/Warp
Vector
.h>
#include
<vtkm/filter/field_transform/Warp.h>
VTK_ABI_NAMESPACE_BEGIN
vtkStandardNewMacro
(
vtkmWarpVector
);
...
...
@@ -88,19 +88,21 @@ int vtkmWarpVector::RequestData(vtkInformation* vtkNotUsed(request),
vtkm
::
cont
::
Field
vectorField
=
tovtkm
::
Convert
(
vectors
,
vectorsAssociation
);
in
.
AddField
(
vectorField
);
vtkm
::
filter
::
field_transform
::
Warp
Vector
warpVector
(
this
->
ScaleFactor
)
;
warpVector
.
SetUseCoordinateSystemAsField
(
true
);
warpVector
.
SetVectorField
(
vectorField
.
GetName
(),
vectorField
.
GetAssociation
()
);
auto
result
=
warpVector
.
Execute
(
in
);
vtkm
::
filter
::
field_transform
::
Warp
filter
;
filter
.
SetScaleFactor
(
this
->
ScaleFactor
);
filter
.
SetUseCoordinateSystemAsField
(
true
);
filter
.
SetDirectionField
(
vectorField
.
GetName
()
);
vtkDataArray
*
warpVectorResult
=
fromvtkm
::
Convert
(
result
.
GetField
(
"warpvector"
,
vtkm
::
cont
::
Field
::
Association
::
Points
));
auto
result
=
filter
.
Execute
(
in
);
vtkDataArray
*
warpResult
=
fromvtkm
::
Convert
(
result
.
GetField
(
"Warp"
,
vtkm
::
cont
::
Field
::
Association
::
Points
));
vtkNew
<
vtkPoints
>
newPts
;
newPts
->
SetNumberOfPoints
(
warp
Vector
Result
->
GetNumberOfTuples
());
newPts
->
SetData
(
warp
Vector
Result
);
newPts
->
SetNumberOfPoints
(
warpResult
->
GetNumberOfTuples
());
newPts
->
SetData
(
warpResult
);
output
->
SetPoints
(
newPts
);
warp
Vector
Result
->
FastDelete
();
warpResult
->
FastDelete
();
}
catch
(
const
vtkm
::
cont
::
Error
&
e
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment