Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sudhanshu Sane
VTK-m
Commits
4ade5f57
Commit
4ade5f57
authored
May 18, 2017
by
Kitware Robot
Committed by
Ben Boeckel
May 25, 2017
Browse files
clang-format: apply to the entire tree
parent
9e56a5d8
Changes
706
Hide whitespace changes
Inline
Side-by-side
CMake/VTKmDetectCUDAVersion.cu
View file @
4ade5f57
...
...
@@ -25,25 +25,33 @@
int
main
()
{
int
count
=
0
;
if
(
cudaSuccess
!=
cudaGetDeviceCount
(
&
count
))
return
1
;
if
(
count
==
0
)
return
1
;
if
(
cudaSuccess
!=
cudaGetDeviceCount
(
&
count
))
return
1
;
if
(
count
==
0
)
return
1
;
int
prev_arch
=
0
;
for
(
int
device
=
0
;
device
<
count
;
++
device
)
{
{
cudaDeviceProp
prop
;
if
(
cudaSuccess
==
cudaGetDeviceProperties
(
&
prop
,
device
))
{
{
int
arch
=
(
prop
.
major
*
10
)
+
prop
.
minor
;
int
compute_level
=
arch
;
//arch 21 has no equivalent compute level.
if
(
compute_level
==
21
)
{
compute_level
=
20
;
}
if
(
compute_level
==
21
)
{
compute_level
=
20
;
}
//handle multiple cards of the same architecture
if
(
arch
==
prev_arch
)
{
continue
;
}
if
(
arch
==
prev_arch
)
{
continue
;
}
prev_arch
=
arch
;
printf
(
" --generate-code=arch=compute_%d,code=sm_%d"
,
compute_level
,
arch
);
}
}
}
return
0
;
}
examples/clipping/Clipping.cxx
View file @
4ade5f57
...
...
@@ -34,29 +34,24 @@
typedef
vtkm
::
Vec
<
vtkm
::
Float32
,
3
>
FloatVec3
;
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
<
4
)
{
std
::
cout
<<
"Usage: "
<<
std
::
endl
<<
"$ "
<<
argv
[
0
]
<<
" <input_vtk_file> [fieldName] <isoval> <output_vtk_file>"
<<
"$ "
<<
argv
[
0
]
<<
" <input_vtk_file> [fieldName] <isoval> <output_vtk_file>"
<<
std
::
endl
;
return
1
;
}
typedef
VTKM_DEFAULT_DEVICE_ADAPTER_TAG
DeviceAdapter
;
std
::
cout
<<
"Device Adapter Name: "
<<
vtkm
::
cont
::
DeviceAdapterTraits
<
DeviceAdapter
>::
GetName
()
std
::
cout
<<
"Device Adapter Name: "
<<
vtkm
::
cont
::
DeviceAdapterTraits
<
DeviceAdapter
>::
GetName
()
<<
std
::
endl
;
vtkm
::
io
::
reader
::
VTKDataSetReader
reader
(
argv
[
1
]);
vtkm
::
cont
::
DataSet
input
=
reader
.
ReadDataSet
();
vtkm
::
cont
::
Field
scalarField
=
(
argc
==
5
)
?
input
.
GetField
(
argv
[
2
])
:
input
.
GetField
(
0
);
vtkm
::
cont
::
Field
scalarField
=
(
argc
==
5
)
?
input
.
GetField
(
argv
[
2
])
:
input
.
GetField
(
0
);
vtkm
::
Float32
clipValue
=
std
::
stof
(
argv
[
argc
-
2
]);
vtkm
::
worklet
::
Clip
clip
;
...
...
@@ -64,10 +59,8 @@ int main(int argc, char *argv[])
vtkm
::
cont
::
Timer
<
DeviceAdapter
>
total
;
vtkm
::
cont
::
Timer
<
DeviceAdapter
>
timer
;
vtkm
::
cont
::
CellSetExplicit
<>
outputCellSet
=
clip
.
Run
(
input
.
GetCellSet
(
0
),
scalarField
.
GetData
().
ResetTypeList
(
vtkm
::
TypeListTagScalarAll
()),
clipValue
,
DeviceAdapter
());
clip
.
Run
(
input
.
GetCellSet
(
0
),
scalarField
.
GetData
().
ResetTypeList
(
vtkm
::
TypeListTagScalarAll
()),
clipValue
,
DeviceAdapter
());
vtkm
::
Float64
clipTime
=
timer
.
GetElapsedTime
();
vtkm
::
cont
::
DataSet
output
;
...
...
@@ -75,7 +68,7 @@ int main(int argc, char *argv[])
timer
.
Reset
();
vtkm
::
cont
::
DynamicArrayHandle
coords
=
clip
.
ProcessField
(
input
.
GetCoordinateSystem
(
0
),
DeviceAdapter
());
clip
.
ProcessField
(
input
.
GetCoordinateSystem
(
0
),
DeviceAdapter
());
vtkm
::
Float64
processCoordinatesTime
=
timer
.
GetElapsedTime
();
output
.
AddCoordinateSystem
(
vtkm
::
cont
::
CoordinateSystem
(
"coordinates"
,
coords
));
...
...
@@ -88,10 +81,8 @@ int main(int argc, char *argv[])
continue
;
// clip only supports point fields for now.
}
vtkm
::
cont
::
DynamicArrayHandle
data
=
clip
.
ProcessField
(
inField
.
GetData
().
ResetTypeList
(
vtkm
::
TypeListTagAll
()),
DeviceAdapter
());
output
.
AddField
(
vtkm
::
cont
::
Field
(
inField
.
GetName
(),
vtkm
::
cont
::
Field
::
ASSOC_POINTS
,
data
));
clip
.
ProcessField
(
inField
.
GetData
().
ResetTypeList
(
vtkm
::
TypeListTagAll
()),
DeviceAdapter
());
output
.
AddField
(
vtkm
::
cont
::
Field
(
inField
.
GetName
(),
vtkm
::
cont
::
Field
::
ASSOC_POINTS
,
data
));
}
vtkm
::
Float64
processScalarsTime
=
timer
.
GetElapsedTime
();
...
...
examples/contour_tree/ContourTreeMesh2D.cxx
View file @
4ade5f57
...
...
@@ -20,48 +20,48 @@
// Copyright (c) 2016, Los Alamos National Security, LLC
// All rights reserved.
//
// Copyright 2016. Los Alamos National Security, LLC.
// This software was produced under U.S. Government contract DE-AC52-06NA25396
// for Los Alamos National Laboratory (LANL), which is operated by
// Los Alamos National Security, LLC for the U.S. Department of Energy.
// The U.S. Government has rights to use, reproduce, and distribute this
// software. NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC
// MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE
// USE OF THIS SOFTWARE. If software is modified to produce derivative works,
// such modified software should be clearly marked, so as not to confuse it
// Copyright 2016. Los Alamos National Security, LLC.
// This software was produced under U.S. Government contract DE-AC52-06NA25396
// for Los Alamos National Laboratory (LANL), which is operated by
// Los Alamos National Security, LLC for the U.S. Department of Energy.
// The U.S. Government has rights to use, reproduce, and distribute this
// software. NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC
// MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE
// USE OF THIS SOFTWARE. If software is modified to produce derivative works,
// such modified software should be clearly marked, so as not to confuse it
// with the version available from LANL.
//
// Additionally, redistribution and use in source and binary forms, with or
// without modification, are permitted provided that the following conditions
// Additionally, redistribution and use in source and binary forms, with or
// without modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// 3. Neither the name of Los Alamos National Security, LLC, Los Alamos
// National Laboratory, LANL, the U.S. Government, nor the names of its
// contributors may be used to endorse or promote products derived from
// 3. Neither the name of Los Alamos National Security, LLC, Los Alamos
// National Laboratory, LANL, the U.S. Government, nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND
// CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
// BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS
// NATIONAL SECURITY, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND
// CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
// BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS
// NATIONAL SECURITY, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//============================================================================
// This code is based on the algorithm presented in the paper:
// “Parallel Peak Pruning for Scalable SMP Contour Tree Computation.”
// Hamish Carr, Gunther Weber, Christopher Sewell, and James Ahrens.
// Proceedings of the IEEE Symposium on Large Data Analysis and Visualization
// This code is based on the algorithm presented in the paper:
// “Parallel Peak Pruning for Scalable SMP Contour Tree Computation.”
// Hamish Carr, Gunther Weber, Christopher Sewell, and James Ahrens.
// Proceedings of the IEEE Symposium on Large Data Analysis and Visualization
// (LDAV), October 2016, Baltimore, Maryland.
#ifndef VTKM_DEVICE_ADAPTER
...
...
@@ -81,7 +81,8 @@ int main(int argc, char* argv[])
{
std
::
cout
<<
"ContourTreeMesh2D Example"
<<
std
::
endl
;
if
(
argc
!=
2
)
{
if
(
argc
!=
2
)
{
std
::
cout
<<
"Parameter is fileName"
<<
std
::
endl
;
std
::
cout
<<
"File is expected to be ASCII with xdim ydim integers "
<<
std
::
endl
;
std
::
cout
<<
"followed by vector data last dimension varying fastest"
<<
std
::
endl
;
...
...
@@ -90,7 +91,8 @@ int main(int argc, char* argv[])
// open input file
std
::
ifstream
inFile
(
argv
[
1
]);
if
(
inFile
.
bad
())
return
0
;
if
(
inFile
.
bad
())
return
0
;
// read size of mesh
vtkm
::
Id2
vdims
;
...
...
@@ -120,8 +122,8 @@ int main(int argc, char* argv[])
vtkm
::
filter
::
ContourTreeMesh2D
filter
;
result
=
filter
.
Execute
(
inDataSet
,
std
::
string
(
"values"
));
vtkm
::
cont
::
Field
resultField
=
result
.
GetField
();
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Pair
<
vtkm
::
Id
,
vtkm
::
Id
>
>
saddlePeak
;
vtkm
::
cont
::
Field
resultField
=
result
.
GetField
();
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Pair
<
vtkm
::
Id
,
vtkm
::
Id
>>
saddlePeak
;
resultField
.
GetData
().
CopyTo
(
saddlePeak
);
return
0
;
...
...
examples/contour_tree/ContourTreeMesh3D.cxx
View file @
4ade5f57
...
...
@@ -20,48 +20,48 @@
// Copyright (c) 2016, Los Alamos National Security, LLC
// All rights reserved.
//
// Copyright 2016. Los Alamos National Security, LLC.
// This software was produced under U.S. Government contract DE-AC52-06NA25396
// for Los Alamos National Laboratory (LANL), which is operated by
// Los Alamos National Security, LLC for the U.S. Department of Energy.
// The U.S. Government has rights to use, reproduce, and distribute this
// software. NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC
// MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE
// USE OF THIS SOFTWARE. If software is modified to produce derivative works,
// such modified software should be clearly marked, so as not to confuse it
// Copyright 2016. Los Alamos National Security, LLC.
// This software was produced under U.S. Government contract DE-AC52-06NA25396
// for Los Alamos National Laboratory (LANL), which is operated by
// Los Alamos National Security, LLC for the U.S. Department of Energy.
// The U.S. Government has rights to use, reproduce, and distribute this
// software. NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC
// MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE
// USE OF THIS SOFTWARE. If software is modified to produce derivative works,
// such modified software should be clearly marked, so as not to confuse it
// with the version available from LANL.
//
// Additionally, redistribution and use in source and binary forms, with or
// without modification, are permitted provided that the following conditions
// Additionally, redistribution and use in source and binary forms, with or
// without modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// 3. Neither the name of Los Alamos National Security, LLC, Los Alamos
// National Laboratory, LANL, the U.S. Government, nor the names of its
// contributors may be used to endorse or promote products derived from
// 3. Neither the name of Los Alamos National Security, LLC, Los Alamos
// National Laboratory, LANL, the U.S. Government, nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND
// CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
// BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS
// NATIONAL SECURITY, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND
// CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
// BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS
// NATIONAL SECURITY, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//============================================================================
// This code is based on the algorithm presented in the paper:
// “Parallel Peak Pruning for Scalable SMP Contour Tree Computation.”
// Hamish Carr, Gunther Weber, Christopher Sewell, and James Ahrens.
// Proceedings of the IEEE Symposium on Large Data Analysis and Visualization
// This code is based on the algorithm presented in the paper:
// “Parallel Peak Pruning for Scalable SMP Contour Tree Computation.”
// Hamish Carr, Gunther Weber, Christopher Sewell, and James Ahrens.
// Proceedings of the IEEE Symposium on Large Data Analysis and Visualization
// (LDAV), October 2016, Baltimore, Maryland.
#ifndef VTKM_DEVICE_ADAPTER
...
...
@@ -81,7 +81,8 @@ int main(int argc, char* argv[])
{
std
::
cout
<<
"ContourTreeMesh3D Example"
<<
std
::
endl
;
if
(
argc
!=
2
)
{
if
(
argc
!=
2
)
{
std
::
cout
<<
"Parameter is fileName"
<<
std
::
endl
;
std
::
cout
<<
"File is expected to be ASCII with xdim ydim zdim integers "
<<
std
::
endl
;
std
::
cout
<<
"followed by vector data last dimension varying fastest"
<<
std
::
endl
;
...
...
@@ -90,15 +91,15 @@ int main(int argc, char* argv[])
// open input file
std
::
ifstream
inFile
(
argv
[
1
]);
if
(
inFile
.
bad
())
return
0
;
if
(
inFile
.
bad
())
return
0
;
// read size of mesh
vtkm
::
Id3
vdims
;
inFile
>>
vdims
[
0
];
inFile
>>
vdims
[
1
];
inFile
>>
vdims
[
2
];
std
::
size_t
nVertices
=
static_cast
<
std
::
size_t
>
(
vdims
[
0
]
*
vdims
[
1
]
*
vdims
[
2
]);
std
::
size_t
nVertices
=
static_cast
<
std
::
size_t
>
(
vdims
[
0
]
*
vdims
[
1
]
*
vdims
[
2
]);
// read data
std
::
vector
<
vtkm
::
Float32
>
values
(
nVertices
);
...
...
@@ -122,8 +123,8 @@ int main(int argc, char* argv[])
vtkm
::
filter
::
ContourTreeMesh3D
filter
;
result
=
filter
.
Execute
(
inDataSet
,
std
::
string
(
"values"
));
vtkm
::
cont
::
Field
resultField
=
result
.
GetField
();
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Pair
<
vtkm
::
Id
,
vtkm
::
Id
>
>
saddlePeak
;
vtkm
::
cont
::
Field
resultField
=
result
.
GetField
();
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Pair
<
vtkm
::
Id
,
vtkm
::
Id
>>
saddlePeak
;
resultField
.
GetData
().
CopyTo
(
saddlePeak
);
return
0
;
...
...
examples/demo/Demo.cxx
View file @
4ade5f57
...
...
@@ -34,17 +34,11 @@
#include
<iostream>
void
makeScene
(
const
vtkm
::
cont
::
DataSet
&
inputData
,
const
vtkm
::
rendering
::
ColorTable
&
colorTable
,
const
std
::
string
&
fieldName
,
vtkm
::
rendering
::
Scene
&
scene
)
void
makeScene
(
const
vtkm
::
cont
::
DataSet
&
inputData
,
const
vtkm
::
rendering
::
ColorTable
&
colorTable
,
const
std
::
string
&
fieldName
,
vtkm
::
rendering
::
Scene
&
scene
)
{
scene
.
AddActor
(
vtkm
::
rendering
::
Actor
(
inputData
.
GetCellSet
(),
inputData
.
GetCoordinateSystem
(),
inputData
.
GetField
(
fieldName
),
colorTable
));
scene
.
AddActor
(
vtkm
::
rendering
::
Actor
(
inputData
.
GetCellSet
(),
inputData
.
GetCoordinateSystem
(),
inputData
.
GetField
(
fieldName
),
colorTable
));
}
// This example reads an input vtk file specified on the command-line (or generates a default
...
...
@@ -78,7 +72,7 @@ int main(int argc, char* argv[])
fieldName
=
"SCALARS:pointvar"
;
}
typedef
vtkm
::
rendering
::
MapperRayTracer
Mapper
;
typedef
vtkm
::
rendering
::
MapperRayTracer
Mapper
;
typedef
vtkm
::
rendering
::
CanvasRayTracer
Canvas
;
// Set up a camera for rendering the input data
...
...
@@ -91,7 +85,7 @@ int main(int argc, char* argv[])
camera
.
ResetToBounds
(
coordsBounds
);
vtkm
::
Vec
<
vtkm
::
Float32
,
3
>
totalExtent
;
vtkm
::
Vec
<
vtkm
::
Float32
,
3
>
totalExtent
;
totalExtent
[
0
]
=
vtkm
::
Float32
(
coordsBounds
.
X
.
Max
-
coordsBounds
.
X
.
Min
);
totalExtent
[
1
]
=
vtkm
::
Float32
(
coordsBounds
.
Y
.
Max
-
coordsBounds
.
Y
.
Min
);
totalExtent
[
2
]
=
vtkm
::
Float32
(
coordsBounds
.
Z
.
Max
-
coordsBounds
.
Z
.
Min
);
...
...
@@ -107,15 +101,11 @@ int main(int argc, char* argv[])
// Create a scene for rendering the input data
vtkm
::
rendering
::
Scene
scene
;
vtkm
::
rendering
::
Color
bg
(
0.2
f
,
0.2
f
,
0.2
f
,
1.0
f
);
Canvas
canvas
(
512
,
512
);
Canvas
canvas
(
512
,
512
);
makeScene
(
inputData
,
colorTable
,
fieldName
,
scene
);
// Create a view and use it to render the input data using OS Mesa
vtkm
::
rendering
::
View3D
view
(
scene
,
mapper
,
canvas
,
camera
,
bg
);
vtkm
::
rendering
::
View3D
view
(
scene
,
mapper
,
canvas
,
camera
,
bg
);
view
.
Initialize
();
view
.
Paint
();
view
.
SaveAs
(
"demo_input.pnm"
);
...
...
@@ -125,8 +115,7 @@ int main(int argc, char* argv[])
filter
.
SetGenerateNormals
(
false
);
filter
.
SetMergeDuplicatePoints
(
false
);
filter
.
SetIsoValue
(
0
,
isovalue
);
vtkm
::
filter
::
ResultDataSet
result
=
filter
.
Execute
(
inputData
,
inputData
.
GetField
(
fieldName
)
);
vtkm
::
filter
::
ResultDataSet
result
=
filter
.
Execute
(
inputData
,
inputData
.
GetField
(
fieldName
));
filter
.
MapFieldOntoOutput
(
result
,
inputData
.
GetField
(
fieldName
));
vtkm
::
cont
::
DataSet
&
outputData
=
result
.
GetDataSet
();
// Render a separate image with the output isosurface
...
...
@@ -134,12 +123,7 @@ int main(int argc, char* argv[])
vtkm
::
rendering
::
Scene
scene2
;
makeScene
(
outputData
,
colorTable
,
fieldName
,
scene2
);
vtkm
::
rendering
::
View3D
view2
(
scene2
,
mapper
,
canvas
,
camera
,
bg
);
vtkm
::
rendering
::
View3D
view2
(
scene2
,
mapper
,
canvas
,
camera
,
bg
);
view2
.
Initialize
();
view2
.
Paint
();
view2
.
SaveAs
(
"demo_output.pnm"
);
...
...
examples/dynamic_dispatcher/main.cxx
View file @
4ade5f57
...
...
@@ -31,18 +31,13 @@
struct
ExampleFieldWorklet
:
public
vtkm
::
worklet
::
WorkletMapField
{
typedef
void
ControlSignature
(
FieldIn
<>
,
FieldIn
<>
,
FieldIn
<>
,
FieldOut
<>
,
FieldOut
<>
,
FieldOut
<>
);
typedef
void
ExecutionSignature
(
_1
,
_2
,
_3
,
_4
,
_5
,
_6
);
typedef
void
ControlSignature
(
FieldIn
<>
,
FieldIn
<>
,
FieldIn
<>
,
FieldOut
<>
,
FieldOut
<>
,
FieldOut
<>
);
typedef
void
ExecutionSignature
(
_1
,
_2
,
_3
,
_4
,
_5
,
_6
);
template
<
typename
T
,
typename
U
,
typename
V
>
VTKM_EXEC
void
operator
()(
const
vtkm
::
Vec
<
T
,
3
>
&
vec
,
const
U
&
scalar1
,
const
V
&
scalar2
,
vtkm
::
Vec
<
T
,
3
>&
out_vec
,
U
&
out_scalar1
,
V
&
out_scalar2
)
const
template
<
typename
T
,
typename
U
,
typename
V
>
VTKM_EXEC
void
operator
()(
const
vtkm
::
Vec
<
T
,
3
>&
vec
,
const
U
&
scalar1
,
const
V
&
scalar2
,
vtkm
::
Vec
<
T
,
3
>&
out_vec
,
U
&
out_scalar1
,
V
&
out_scalar2
)
const
{
out_vec
=
vec
*
scalar1
;
out_scalar1
=
static_cast
<
U
>
(
scalar1
+
scalar2
);
...
...
@@ -50,46 +45,35 @@ struct ExampleFieldWorklet : public vtkm::worklet::WorkletMapField
std
::
cout
<<
"hello world"
<<
std
::
endl
;
}
template
<
typename
T
,
typename
U
,
typename
V
,
typename
W
,
typename
X
,
typename
Y
>
VTKM_EXEC
void
operator
()(
const
T
&
,
const
U
&
,
const
V
&
,
W
&
,
X
&
,
Y
&
)
const
template
<
typename
T
,
typename
U
,
typename
V
,
typename
W
,
typename
X
,
typename
Y
>
VTKM_EXEC
void
operator
()(
const
T
&
,
const
U
&
,
const
V
&
,
W
&
,
X
&
,
Y
&
)
const
{
//no-op
//no-op
}
};
int
main
(
int
argc
,
char
**
argv
)
{
(
void
)
argc
;
(
void
)
argv
;
std
::
vector
<
vtkm
::
Vec
<
vtkm
::
Float32
,
3
>
>
inputVec
(
10
);
std
::
vector
<
vtkm
::
Int32
>
inputScalar1
(
10
);
std
::
vector
<
vtkm
::
Float64
>
inputScalar2
(
10
);
std
::
vector
<
vtkm
::
Vec
<
vtkm
::
Float32
,
3
>>
inputVec
(
10
);
std
::
vector
<
vtkm
::
Int32
>
inputScalar1
(
10
);
std
::
vector
<
vtkm
::
Float64
>
inputScalar2
(
10
);
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
vtkm
::
Float32
,
3
>
>
handleV
=
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
vtkm
::
Float32
,
3
>>
handleV
=
vtkm
::
cont
::
make_ArrayHandle
(
inputVec
);
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Int32
>
handleS1
=
vtkm
::
cont
::
make_ArrayHandle
(
inputScalar1
);
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Int32
>
handleS1
=
vtkm
::
cont
::
make_ArrayHandle
(
inputScalar1
);
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Float64
>
handleS2
=
vtkm
::
cont
::
make_ArrayHandle
(
inputScalar2
);
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Float64
>
handleS2
=
vtkm
::
cont
::
make_ArrayHandle
(
inputScalar2
);
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
vtkm
::
Float32
,
3
>
>
handleOV
;
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Int32
>
handleOS1
;
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Float64
>
handleOS2
;
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
vtkm
::
Float32
,
3
>>
handleOV
;
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Int32
>
handleOS1
;
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Float64
>
handleOS2
;
vtkm
::
cont
::
DynamicArrayHandle
out1
(
handleOV
),
out2
(
handleOS1
),
out3
(
handleOS2
);
vtkm
::
worklet
::
DispatcherMapField
<
ExampleFieldWorklet
>
dispatcher
;
dispatcher
.
Invoke
(
handleV
,
handleS1
,
handleS2
,
out1
,
out2
,
out3
);
}
examples/hello_world/HelloWorld.cxx
View file @
4ade5f57
...
...
@@ -35,25 +35,25 @@
//Suppress warnings about glut being deprecated on OSX
#if (defined(VTKM_GCC) || defined(VTKM_CLANG))
#
pragma GCC diagnostic push
#
pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
//OpenGL Graphics includes
//glew needs to go before glut
//that is why this is after the TransferToOpenGL include
#if defined
(__APPLE__)
#
include <GLUT/glut.h>
#if defined(__APPLE__)
#include
<GLUT/glut.h>
#else
#
include <GL/glut.h>
#include
<GL/glut.h>
#endif
#include
"LoadShaders.h"
template
<
typename
DeviceAdapter
,
typename
T
>
template
<
typename
DeviceAdapter
,
typename
T
>
struct
HelloVTKMInterop
{
vtkm
::
Vec
<
vtkm
::
Int32
,
2
>
Dims
;
vtkm
::
Vec
<
vtkm
::
Int32
,
2
>
Dims
;
GLuint
ProgramId
;
GLuint
VAOId
;
...
...
@@ -63,71 +63,69 @@ struct HelloVTKMInterop
vtkm
::
cont
::
Timer
<
DeviceAdapter
>
Timer
;
std
::
vector
<
vtkm
::
Vec
<
T
,
3
>
>
InputData
;
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
T
,
3
>
>
InHandle
;
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
T
,
3
>
>
OutCoords
;
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
vtkm
::
UInt8
,
4
>
>
OutColors
;
HelloVTKMInterop
(
vtkm
::
Int32
width
,
vtkm
::
Int32
height
)
:
Dims
(
256
,
256
)
,
ProgramId
()
,
VAOId
()
,
VBOState
()
,
ColorState
()
,
Timer
()
,
InputData
()
,
InHandle
()
,
OutCoords
()
,
OutColors
()
std
::
vector
<
vtkm
::
Vec
<
T
,
3
>
>
InputData
;
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
T
,
3
>
>
InHandle
;
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
T
,
3
>
>
OutCoords
;
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Vec
<
vtkm
::
UInt8
,
4
>
>
OutColors
;
HelloVTKMInterop
(
vtkm
::
Int32
width
,
vtkm
::
Int32
height
)
:
Dims
(
256
,
256
)
,
ProgramId
()
,
VAOId
()
,
VBOState
()
,
ColorState
()
,
Timer
()
,
InputData
()
,
InHandle
()
,
OutCoords
()
,
OutColors
()
{
int
dim
=
256
;
this
->
InputData
.
reserve
(
static_cast
<
std
::
size_t
>
(
dim
*
dim
)
);
for
(
int
i
=
0
;
i
<
dim
;
++
i
)
this
->
InputData
.
reserve
(
static_cast
<
std
::
size_t
>
(
dim
*
dim
));
for
(
int
i
=
0
;
i
<
dim
;
++
i
)
{
for
(
int
j
=
0
;
j
<
dim
;
++
j
)
for
(
int
j
=
0
;
j
<
dim
;
++
j
)
{
this
->
InputData
.
push_back
(
vtkm
::
Vec
<
T
,
3
>
(
2.
f
*
static_cast
<
T
>
(
i
/
dim
)
-
1.
f
,
0.
f
,
2.
f
*
static_cast
<
T
>
(
j
/
dim
)
-
1.
f
));
this
->
InputData
.
push_back
(
vtkm
::
Vec
<
T
,
3
>
(
2.
f
*
static_cast
<
T
>
(
i
/
dim
)
-
1.
f
,
0.
f
,
2.
f
*
static_cast
<
T
>
(
j
/
dim
)
-
1.
f
));
}
}
this
->
Dims
=
vtkm
::
Vec
<
vtkm
::
Int32
,
2
>
(
dim
,
dim
);
this
->
Dims
=
vtkm
::
Vec
<
vtkm
::
Int32
,
2
>
(
dim
,
dim
);
this
->
InHandle
=
vtkm
::
cont
::
make_ArrayHandle
(
this
->
InputData
);
glGenVertexArrays
(
1
,
&
this
->
VAOId
);
glBindVertexArray
(
this
->
VAOId
);
glGenVertexArrays
(
1
,
&
this
->
VAOId
);
glBindVertexArray
(
this
->
VAOId
);
this
->
ProgramId
=
LoadShaders
();