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
Matthew Letter
VTK-m
Commits
723792a4
Commit
723792a4
authored
Aug 30, 2018
by
Kenneth Moreland
Browse files
Use new integrators and evaluators for advection
parent
d49c29ce
Changes
4
Hide whitespace changes
Inline
Side-by-side
examples/particle_advection/ParticleAdvection.cxx
View file @
723792a4
...
...
@@ -70,15 +70,11 @@ void RunTest(const std::string& fname,
using
FieldType
=
vtkm
::
Float32
;
using
FieldHandle
=
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
FieldType
,
3
>>
;
using
FieldPortalConstType
=
typename
FieldHandle
::
template
ExecutionTypes
<
DeviceAdapter
>
::
PortalConst
;
vtkm
::
io
::
reader
::
BOVDataSetReader
rdr
(
fname
);
vtkm
::
cont
::
DataSet
ds
=
rdr
.
ReadDataSet
();
using
RGEvalType
=
vtkm
::
worklet
::
particleadvection
::
UniformGridEvaluate
<
FieldPortalConstType
,
FieldType
,
DeviceAdapter
>
;
using
RGEvalType
=
vtkm
::
worklet
::
particleadvection
::
UniformGridEvaluate
<
FieldHandle
>
;
using
RK4RGType
=
vtkm
::
worklet
::
particleadvection
::
RK4Integrator
<
RGEvalType
>
;
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
FieldType
,
3
>>
fieldArray
;
...
...
examples/temporal_advection/TemporalAdvection.cxx
View file @
723792a4
...
...
@@ -52,8 +52,6 @@ void RunTest(vtkm::Id numSteps, vtkm::Float32 stepSize, vtkm::Id advectType)
using
DeviceAdapter
=
VTKM_DEFAULT_DEVICE_ADAPTER_TAG
;
using
FieldType
=
vtkm
::
Float32
;
using
FieldHandle
=
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
FieldType
,
3
>>
;
using
FieldPortalConstType
=
typename
FieldHandle
::
template
ExecutionTypes
<
DeviceAdapter
>
::
PortalConst
;
// These lines read two datasets, which are BOVs.
// Currently VTKm does not support providing time series datasets
...
...
@@ -73,10 +71,7 @@ void RunTest(vtkm::Id numSteps, vtkm::Float32 stepSize, vtkm::Id advectType)
// The only change in this example and the vanilla particle advection example is
// this example makes use of the TemporalGridEvaluator.
using
GridEvaluator
=
vtkm
::
worklet
::
particleadvection
::
TemporalGridEvaluator
<
FieldPortalConstType
,
FieldType
,
DeviceAdapter
>
;
using
GridEvaluator
=
vtkm
::
worklet
::
particleadvection
::
TemporalGridEvaluator
<
FieldHandle
>
;
using
Integrator
=
vtkm
::
worklet
::
particleadvection
::
EulerIntegrator
<
GridEvaluator
>
;
GridEvaluator
eval
(
ds1
.
GetCoordinateSystem
(),
...
...
@@ -114,7 +109,7 @@ void RunTest(vtkm::Id numSteps, vtkm::Float32 stepSize, vtkm::Id advectType)
else
{
vtkm
::
worklet
::
Streamline
streamline
;
vtkm
::
worklet
::
StreamlineResult
<
FieldType
>
res
=
vtkm
::
worklet
::
StreamlineResult
res
=
streamline
.
Run
(
integrator
,
seedArray
,
numSteps
,
DeviceAdapter
());
vtkm
::
cont
::
DataSet
outData
;
vtkm
::
cont
::
CoordinateSystem
outputCoords
(
"coordinates"
,
res
.
positions
);
...
...
vtkm/filter/Lagrangian.hxx
View file @
723792a4
...
...
@@ -242,21 +242,16 @@ inline VTKM_CONT vtkm::cont::DataSet Lagrangian::DoExecute(
vtkm
::
cont
::
ArrayHandleCartesianProduct
<
AxisHandle
,
AxisHandle
,
AxisHandle
>
;
using
UniformType
=
vtkm
::
cont
::
ArrayHandleUniformPointCoordinates
;
using
FieldHandle
=
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
T
,
3
>
,
StorageType
>
;
using
FieldPortalConstType
=
typename
FieldHandle
::
template
ExecutionTypes
<
DeviceAdapter
>
::
PortalConst
;
using
PortalType_Position
=
typename
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
T
,
3
>>::
PortalControl
;
using
PortalType_DoublePosition
=
typename
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
vtkm
::
Float64
,
3
>>::
PortalControl
;
vtkm
::
worklet
::
ParticleAdvection
particleadvection
;
vtkm
::
worklet
::
ParticleAdvectionResult
<
T
>
res
;
vtkm
::
worklet
::
ParticleAdvectionResult
res
;
if
(
coords
.
GetData
().
IsType
<
RectilinearType
>
())
{
using
RectilinearGridEvalType
=
vtkm
::
worklet
::
particleadvection
::
RectilinearGridEvaluate
<
FieldPortalConstType
,
T
,
DeviceAdapter
,
StorageTyp
e
>
;
using
RectilinearGridEvalType
=
vtkm
::
worklet
::
particleadvection
::
RectilinearGridEvaluate
<
FieldHandl
e
>
;
using
RK4IntegratorType
=
vtkm
::
worklet
::
particleadvection
::
RK4Integrator
<
RectilinearGridEvalType
,
T
>
;
vtkm
::
worklet
::
particleadvection
::
RK4Integrator
<
RectilinearGridEvalType
>
;
/*
* If Euler step is preferred.
using EulerIntegratorType = vtkm::worklet::particleadvection::EulerIntegrator<RectilinearGridEvalType, T>;
...
...
@@ -271,10 +266,8 @@ inline VTKM_CONT vtkm::cont::DataSet Lagrangian::DoExecute(
}
else
if
(
coords
.
GetData
().
IsType
<
UniformType
>
())
{
using
UniformGridEvalType
=
vtkm
::
worklet
::
particleadvection
::
UniformGridEvaluate
<
FieldPortalConstType
,
T
,
DeviceAdapter
,
StorageType
>
;
using
RK4IntegratorType
=
vtkm
::
worklet
::
particleadvection
::
RK4Integrator
<
UniformGridEvalType
,
T
>
;
using
UniformGridEvalType
=
vtkm
::
worklet
::
particleadvection
::
UniformGridEvaluate
<
FieldHandle
>
;
using
RK4IntegratorType
=
vtkm
::
worklet
::
particleadvection
::
RK4Integrator
<
UniformGridEvalType
>
;
/*
* If Euler step is preferred.
using EulerIntegratorType = vtkm::worklet::particleadvection::EulerIntegrator<UniformGridEvalType, T>;
...
...
@@ -292,17 +285,14 @@ inline VTKM_CONT vtkm::cont::DataSet Lagrangian::DoExecute(
std
::
cout
<<
"Data set type is not rectilinear or uniform."
<<
std
::
endl
;
}
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
T
,
3
>>
particle_positions
=
res
.
positions
;
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Id
>
particle_stepstaken
=
res
.
stepsTaken
;
using
PortalType_Position
=
typename
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
T
,
3
>>::
PortalControl
;
using
PortalType_ID
=
typename
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Id
>::
PortalControl
;
auto
particle_positions
=
res
.
positions
;
auto
particle_stepstaken
=
res
.
stepsTaken
;
PortalType_DoublePosition
start_position
=
BasisParticlesOriginal
.
GetPortalControl
();
PortalType_Position
end_position
=
particle_positions
.
GetPortalControl
();
auto
start_position
=
BasisParticlesOriginal
.
GetPortalControl
();
auto
end_position
=
particle_positions
.
GetPortalControl
();
PortalType_ID
portal_stepstaken
=
particle_stepstaken
.
GetPortalControl
();
PortalType_ID
portal_validity
=
BasisParticlesValidity
.
GetPortalControl
();
auto
portal_stepstaken
=
particle_stepstaken
.
GetPortalControl
();
auto
portal_validity
=
BasisParticlesValidity
.
GetPortalControl
();
vtkm
::
cont
::
DataSet
outputData
;
vtkm
::
cont
::
DataSetBuilderExplicit
dataSetBuilder
;
...
...
vtkm/worklet/particleadvection/Integrators.h
View file @
723792a4
...
...
@@ -272,7 +272,7 @@ public:
template
<
typename
Device
>
class
ExecObject
:
public
Integrator
::
ExecObjectBaseImpl
<
decltype
(
std
::
declval
<
FieldEvaluateType
>
().
PrepareForExecution
(
Device
())),
RK4Integrator
::
ExecObject
<
Device
>>
typename
RK4Integrator
::
template
ExecObject
<
Device
>
>
{
VTKM_IS_DEVICE_ADAPTER_TAG
(
Device
);
...
...
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