Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
phcerdan
VTK-m
Commits
9fd821ed
Commit
9fd821ed
authored
Jun 21, 2018
by
Dave Pugmire
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Template on DeviceAdapter.
parent
961f6a58
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
22 deletions
+28
-22
vtkm/worklet/CoordinateSystemTransform.h
vtkm/worklet/CoordinateSystemTransform.h
+16
-12
vtkm/worklet/testing/UnitTestCoordinateSystemTransform.cxx
vtkm/worklet/testing/UnitTestCoordinateSystemTransform.cxx
+12
-10
No files found.
vtkm/worklet/CoordinateSystemTransform.h
View file @
9fd821ed
...
...
@@ -84,9 +84,10 @@ public:
VTKM_CONT
void
SetCartesianToCylindrical
()
{
cartesianToCylindrical
=
true
;
}
VTKM_CONT
void
SetCylindricalToCartesian
()
{
cartesianToCylindrical
=
false
;
}
template
<
typename
CoordsStorageType
>
template
<
typename
CoordsStorageType
,
typename
DeviceAdapterTag
>
void
Run
(
const
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
T
,
3
>
,
CoordsStorageType
>&
inPoints
,
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
T
,
3
>
,
CoordsStorageType
>&
outPoints
)
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
T
,
3
>
,
CoordsStorageType
>&
outPoints
,
DeviceAdapterTag
)
const
{
if
(
cartesianToCylindrical
)
{
...
...
@@ -100,9 +101,10 @@ public:
}
}
template
<
typename
CoordsStorageType
>
template
<
typename
CoordsStorageType
,
typename
DeviceAdapterTag
>
void
Run
(
const
vtkm
::
cont
::
CoordinateSystem
&
inPoints
,
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
T
,
3
>
,
CoordsStorageType
>&
outPoints
)
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
T
,
3
>
,
CoordsStorageType
>&
outPoints
,
DeviceAdapterTag
)
const
{
if
(
cartesianToCylindrical
)
{
...
...
@@ -183,34 +185,36 @@ public:
VTKM_CONT
void
SetCartesianToSpherical
()
{
CartesianToSpherical
=
true
;
}
VTKM_CONT
void
SetSphericalToCartesian
()
{
CartesianToSpherical
=
false
;
}
template
<
typename
CoordsStorageType
>
template
<
typename
CoordsStorageType
,
typename
DeviceAdapterTag
>
void
Run
(
const
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
T
,
3
>
,
CoordsStorageType
>&
inPoints
,
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
T
,
3
>
,
CoordsStorageType
>&
outPoints
)
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
T
,
3
>
,
CoordsStorageType
>&
outPoints
,
DeviceAdapterTag
)
const
{
if
(
CartesianToSpherical
)
{
vtkm
::
worklet
::
DispatcherMapField
<
CarToSphere
>
dispatcher
;
vtkm
::
worklet
::
DispatcherMapField
<
CarToSphere
,
DeviceAdapterTag
>
dispatcher
;
dispatcher
.
Invoke
(
inPoints
,
outPoints
);
}
else
{
vtkm
::
worklet
::
DispatcherMapField
<
SphereToCar
>
dispatcher
;
vtkm
::
worklet
::
DispatcherMapField
<
SphereToCar
,
DeviceAdapterTag
>
dispatcher
;
dispatcher
.
Invoke
(
inPoints
,
outPoints
);
}
}
template
<
typename
CoordsStorageType
>
template
<
typename
CoordsStorageType
,
typename
DeviceAdapterTag
>
void
Run
(
const
vtkm
::
cont
::
CoordinateSystem
&
inPoints
,
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
T
,
3
>
,
CoordsStorageType
>&
outPoints
)
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
T
,
3
>
,
CoordsStorageType
>&
outPoints
,
DeviceAdapterTag
)
const
{
if
(
CartesianToSpherical
)
{
vtkm
::
worklet
::
DispatcherMapField
<
CarToSphere
>
dispatcher
;
vtkm
::
worklet
::
DispatcherMapField
<
CarToSphere
,
DeviceAdapterTag
>
dispatcher
;
dispatcher
.
Invoke
(
inPoints
,
outPoints
);
}
else
{
vtkm
::
worklet
::
DispatcherMapField
<
SphereToCar
>
dispatcher
;
vtkm
::
worklet
::
DispatcherMapField
<
SphereToCar
,
DeviceAdapterTag
>
dispatcher
;
dispatcher
.
Invoke
(
inPoints
,
outPoints
);
}
}
...
...
vtkm/worklet/testing/UnitTestCoordinateSystemTransform.cxx
View file @
9fd821ed
...
...
@@ -149,6 +149,8 @@ void TestCoordinateSystemTransform()
{
std
::
cout
<<
"Testing CylindricalCoordinateTransform Worklet"
<<
std
::
endl
;
using
DeviceAdapter
=
VTKM_DEFAULT_DEVICE_ADAPTER_TAG
;
//Test cartesian to cyl
vtkm
::
cont
::
DataSet
dsCart
=
MakeTestDataSet
(
CART
);
vtkm
::
worklet
::
CylindricalCoordinateTransform
<
vtkm
::
FloatDefault
>
cylTrn
;
...
...
@@ -157,10 +159,10 @@ void TestCoordinateSystemTransform()
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
vtkm
::
FloatDefault
,
3
>>
revResult
;
cylTrn
.
SetCartesianToCylindrical
();
cylTrn
.
Run
(
dsCart
.
GetCoordinateSystem
(),
carToCylPts
);
cylTrn
.
Run
(
dsCart
.
GetCoordinateSystem
(),
carToCylPts
,
DeviceAdapter
()
);
cylTrn
.
SetCylindricalToCartesian
();
cylTrn
.
Run
(
carToCylPts
,
revResult
);
cylTrn
.
Run
(
carToCylPts
,
revResult
,
DeviceAdapter
()
);
ValidateCoordTransform
(
dsCart
.
GetCoordinateSystem
(),
carToCylPts
,
revResult
,
{
false
,
false
,
false
});
...
...
@@ -168,10 +170,10 @@ void TestCoordinateSystemTransform()
vtkm
::
cont
::
DataSet
dsCyl
=
MakeTestDataSet
(
CYL
);
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
vtkm
::
FloatDefault
,
3
>>
cylToCarPts
;
cylTrn
.
SetCylindricalToCartesian
();
cylTrn
.
Run
(
dsCyl
.
GetCoordinateSystem
(),
cylToCarPts
);
cylTrn
.
Run
(
dsCyl
.
GetCoordinateSystem
(),
cylToCarPts
,
DeviceAdapter
()
);
cylTrn
.
SetCartesianToCylindrical
();
cylTrn
.
Run
(
cylToCarPts
,
revResult
);
cylTrn
.
Run
(
cylToCarPts
,
revResult
,
DeviceAdapter
()
);
ValidateCoordTransform
(
dsCyl
.
GetCoordinateSystem
(),
cylToCarPts
,
revResult
,
{
false
,
true
,
false
});
...
...
@@ -181,10 +183,10 @@ void TestCoordinateSystemTransform()
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
vtkm
::
FloatDefault
,
3
>>
carToSphPts
;
sphTrn
.
SetCartesianToSpherical
();
sphTrn
.
Run
(
dsCart
.
GetCoordinateSystem
(),
carToSphPts
);
sphTrn
.
Run
(
dsCart
.
GetCoordinateSystem
(),
carToSphPts
,
DeviceAdapter
()
);
sphTrn
.
SetSphericalToCartesian
();
sphTrn
.
Run
(
carToSphPts
,
revResult
);
sphTrn
.
Run
(
carToSphPts
,
revResult
,
DeviceAdapter
()
);
ValidateCoordTransform
(
dsCart
.
GetCoordinateSystem
(),
carToSphPts
,
revResult
,
{
false
,
true
,
true
});
...
...
@@ -193,17 +195,17 @@ void TestCoordinateSystemTransform()
vtkm
::
cont
::
DataSet
dsSph
=
MakeTestDataSet
(
SPH
);
sphTrn
.
SetSphericalToCartesian
();
sphTrn
.
Run
(
dsSph
.
GetCoordinateSystem
(),
sphToCarPts
);
sphTrn
.
Run
(
dsSph
.
GetCoordinateSystem
(),
sphToCarPts
,
DeviceAdapter
()
);
sphTrn
.
SetCartesianToSpherical
();
sphTrn
.
Run
(
sphToCarPts
,
revResult
);
sphTrn
.
Run
(
sphToCarPts
,
revResult
,
DeviceAdapter
()
);
ValidateCoordTransform
(
dsSph
.
GetCoordinateSystem
(),
sphToCarPts
,
revResult
,
{
false
,
true
,
true
});
sphTrn
.
SetSphericalToCartesian
();
sphTrn
.
Run
(
dsSph
.
GetCoordinateSystem
(),
sphToCarPts
);
sphTrn
.
Run
(
dsSph
.
GetCoordinateSystem
(),
sphToCarPts
,
DeviceAdapter
()
);
sphTrn
.
SetCartesianToSpherical
();
sphTrn
.
Run
(
sphToCarPts
,
revResult
);
sphTrn
.
Run
(
sphToCarPts
,
revResult
,
DeviceAdapter
()
);
ValidateCoordTransform
(
dsSph
.
GetCoordinateSystem
(),
sphToCarPts
,
revResult
,
{
false
,
true
,
true
});
}
...
...
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