Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VTK
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Michael Migliore
VTK
Commits
4b34c3d7
Commit
4b34c3d7
authored
May 05, 2017
by
Sujin Philip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ImplicitFunctionConverter
Converts vtkImplicitFunction to equivalent VTK-m implicit function.
parent
1355b5ff
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
200 additions
and
0 deletions
+200
-0
Accelerators/Vtkm/CMakeLists.txt
Accelerators/Vtkm/CMakeLists.txt
+3
-0
Accelerators/Vtkm/vtkmlib/ImplicitFunctionConverter.cu
Accelerators/Vtkm/vtkmlib/ImplicitFunctionConverter.cu
+16
-0
Accelerators/Vtkm/vtkmlib/ImplicitFunctionConverter.cxx
Accelerators/Vtkm/vtkmlib/ImplicitFunctionConverter.cxx
+129
-0
Accelerators/Vtkm/vtkmlib/ImplicitFunctionConverter.h
Accelerators/Vtkm/vtkmlib/ImplicitFunctionConverter.h
+52
-0
No files found.
Accelerators/Vtkm/CMakeLists.txt
View file @
4b34c3d7
...
...
@@ -58,6 +58,7 @@ set(cpu_accelerator_srcs
vtkmConnectivityExec.cxx
vtkmGradient.cxx
vtkmlib/Portals.cxx
vtkmlib/ImplicitFunctionConverter.cxx
)
#implementation of the algorithms for gpu accelerators
...
...
@@ -75,6 +76,7 @@ set(cuda_accelerator_srcs
vtkmConnectivityExec.cu
vtkmGradient.cu
vtkmlib/Portals.cu
vtkmlib/ImplicitFunctionConverter.cu
)
set
(
VTKM_FILTER_INCLUDE_AOS
${
VTK_DISPATCH_AOS_ARRAYS
}
)
...
...
@@ -91,6 +93,7 @@ set_source_files_properties(
vtkmlib/DataSetConverters
vtkmlib/Storage
vtkmlib/Portals
vtkmlib/ImplicitFunctionConverter
vtkmCellSetExplicit
vtkmCellSetSingleType
vtkmConnectivityExec
...
...
Accelerators/Vtkm/vtkmlib/ImplicitFunctionConverter.cu
0 → 100644
View file @
4b34c3d7
//=============================================================================
//
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt 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.
//
// Copyright 2012 Sandia Corporation.
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
//=============================================================================
#include "ImplicitFunctionConverter.cxx"
Accelerators/Vtkm/vtkmlib/ImplicitFunctionConverter.cxx
0 → 100644
View file @
4b34c3d7
//=============================================================================
//
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt 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.
//
// Copyright 2012 Sandia Corporation.
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
//=============================================================================
#include "ImplicitFunctionConverter.h"
#include "vtkmFilterPolicy.h"
#include "vtkBox.h"
#include "vtkPlane.h"
#include "vtkSphere.h"
#include <vtkm/cont/ImplicitFunction.h>
namespace
tovtkm
{
inline
vtkm
::
Vec
<
vtkm
::
FloatDefault
,
3
>
MakeFVec3
(
const
double
x
[
3
])
{
return
vtkm
::
Vec
<
vtkm
::
FloatDefault
,
3
>
(
static_cast
<
vtkm
::
FloatDefault
>
(
x
[
0
]),
static_cast
<
vtkm
::
FloatDefault
>
(
x
[
1
]),
static_cast
<
vtkm
::
FloatDefault
>
(
x
[
2
]));
}
ImplicitFunctionConverter
::
ImplicitFunctionConverter
()
:
InFunction
(
nullptr
),
OutFunction
(
nullptr
),
MTime
(
0
)
{
}
void
ImplicitFunctionConverter
::
Set
(
vtkImplicitFunction
*
function
)
{
this
->
InFunction
=
function
;
vtkBox
*
box
=
nullptr
;
vtkPlane
*
plane
=
nullptr
;
vtkSphere
*
sphere
=
nullptr
;
if
((
box
=
vtkBox
::
SafeDownCast
(
function
)))
{
double
xmin
[
3
],
xmax
[
3
];
box
->
GetXMin
(
xmin
);
box
->
GetXMax
(
xmax
);
auto
b
=
new
vtkm
::
cont
::
Box
(
MakeFVec3
(
xmin
),
MakeFVec3
(
xmax
));
b
->
ResetDevices
(
vtkmInputFilterPolicy
::
DeviceAdapterList
());
this
->
OutFunction
.
reset
(
b
);
}
else
if
((
plane
=
vtkPlane
::
SafeDownCast
(
function
)))
{
double
origin
[
3
],
normal
[
3
];
plane
->
GetOrigin
(
origin
);
plane
->
GetNormal
(
normal
);
auto
p
=
new
vtkm
::
cont
::
Plane
(
MakeFVec3
(
origin
),
MakeFVec3
(
normal
));
p
->
ResetDevices
(
vtkmInputFilterPolicy
::
DeviceAdapterList
());
this
->
OutFunction
.
reset
(
p
);
}
else
if
((
sphere
=
vtkSphere
::
SafeDownCast
(
function
)))
{
double
center
[
3
],
radius
;
sphere
->
GetCenter
(
center
);
radius
=
sphere
->
GetRadius
();
auto
s
=
new
vtkm
::
cont
::
Sphere
(
MakeFVec3
(
center
),
static_cast
<
vtkm
::
FloatDefault
>
(
radius
));
s
->
ResetDevices
(
vtkmInputFilterPolicy
::
DeviceAdapterList
());
this
->
OutFunction
.
reset
(
s
);
}
this
->
MTime
=
function
->
GetMTime
();
}
const
std
::
shared_ptr
<
vtkm
::
cont
::
ImplicitFunction
>&
ImplicitFunctionConverter
::
Get
()
const
{
if
(
this
->
MTime
<
this
->
InFunction
->
GetMTime
())
{
vtkBox
*
box
=
nullptr
;
vtkPlane
*
plane
=
nullptr
;
vtkSphere
*
sphere
=
nullptr
;
if
((
box
=
vtkBox
::
SafeDownCast
(
this
->
InFunction
)))
{
double
xmin
[
3
],
xmax
[
3
];
box
->
GetXMin
(
xmin
);
box
->
GetXMax
(
xmax
);
auto
b
=
static_cast
<
vtkm
::
cont
::
Box
*>
(
this
->
OutFunction
.
get
());
b
->
SetMinPoint
(
MakeFVec3
(
xmin
));
b
->
SetMaxPoint
(
MakeFVec3
(
xmax
));
}
else
if
((
plane
=
vtkPlane
::
SafeDownCast
(
this
->
InFunction
)))
{
double
origin
[
3
],
normal
[
3
];
plane
->
GetOrigin
(
origin
);
plane
->
GetNormal
(
normal
);
auto
p
=
static_cast
<
vtkm
::
cont
::
Plane
*>
(
this
->
OutFunction
.
get
());
p
->
SetOrigin
(
MakeFVec3
(
origin
));
p
->
SetNormal
(
MakeFVec3
(
normal
));
}
else
if
((
sphere
=
vtkSphere
::
SafeDownCast
(
this
->
InFunction
)))
{
double
center
[
3
],
radius
;
sphere
->
GetCenter
(
center
);
radius
=
sphere
->
GetRadius
();
auto
s
=
static_cast
<
vtkm
::
cont
::
Sphere
*>
(
this
->
OutFunction
.
get
());
s
->
SetCenter
(
MakeFVec3
(
center
));
s
->
SetRadius
(
static_cast
<
vtkm
::
FloatDefault
>
(
radius
));
}
this
->
MTime
=
this
->
InFunction
->
GetMTime
();
}
return
this
->
OutFunction
;
}
}
// tovtkm
Accelerators/Vtkm/vtkmlib/ImplicitFunctionConverter.h
0 → 100644
View file @
4b34c3d7
//=============================================================================
//
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt 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.
//
// Copyright 2012 Sandia Corporation.
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
//=============================================================================
#ifndef vtkmlib_ImplicitFunctionConverter_h
#define vtkmlib_ImplicitFunctionConverter_h
#include "vtkAcceleratorsVTKmModule.h"
#include "vtkType.h" // For vtkMTimeType
#include <memory> // For std::shared_ptr
class
vtkImplicitFunction
;
namespace
vtkm
{
namespace
cont
{
class
ImplicitFunction
;
}}
// vtkm::cont
namespace
tovtkm
{
class
VTKACCELERATORSVTKM_EXPORT
ImplicitFunctionConverter
{
public:
ImplicitFunctionConverter
();
void
Set
(
vtkImplicitFunction
*
);
const
std
::
shared_ptr
<
vtkm
::
cont
::
ImplicitFunction
>&
Get
()
const
;
private:
vtkImplicitFunction
*
InFunction
;
std
::
shared_ptr
<
vtkm
::
cont
::
ImplicitFunction
>
OutFunction
;
mutable
vtkMTimeType
MTime
;
};
}
#endif // vtkmlib_ImplicitFunctionConverter_h
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