Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Sudhanshu Sane
VTK-m
Commits
4c23f502
Commit
4c23f502
authored
Nov 28, 2018
by
Robert Maynard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ArrayHandleVirtual can be used as AtomicArrayInOut tag type
parent
b57dc5d2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
0 deletions
+56
-0
vtkm/cont/arg/TransportTagAtomicArray.h
vtkm/cont/arg/TransportTagAtomicArray.h
+47
-0
vtkm/cont/arg/TypeCheckTagAtomicArray.h
vtkm/cont/arg/TypeCheckTagAtomicArray.h
+9
-0
No files found.
vtkm/cont/arg/TransportTagAtomicArray.h
View file @
4c23f502
...
...
@@ -23,7 +23,10 @@
#include <vtkm/Types.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/ArrayHandleAny.h>
#include <vtkm/cont/StorageBasic.h>
#include <vtkm/cont/StorageVirtual.h>
#include <vtkm/cont/arg/Transport.h>
...
...
@@ -70,6 +73,50 @@ struct Transport<vtkm::cont::arg::TransportTagAtomicArray,
return
obj
.
PrepareForExecution
(
Device
());
}
};
template
<
typename
T
,
typename
Device
>
struct
Transport
<
vtkm
::
cont
::
arg
::
TransportTagAtomicArray
,
vtkm
::
cont
::
ArrayHandle
<
T
,
vtkm
::
cont
::
StorageTagVirtual
>
,
Device
>
{
using
ExecObjectType
=
vtkm
::
exec
::
AtomicArrayExecutionObject
<
T
,
Device
>
;
using
ExecType
=
vtkm
::
cont
::
AtomicArray
<
T
>
;
template
<
typename
InputDomainType
>
VTKM_CONT
ExecObjectType
operator
()(
vtkm
::
cont
::
ArrayHandle
<
T
,
vtkm
::
cont
::
StorageTagVirtual
>&
array
,
const
InputDomainType
&
,
vtkm
::
Id
,
vtkm
::
Id
)
const
{
using
S
=
vtkm
::
cont
::
StorageTagBasic
;
const
vtkm
::
cont
::
StorageVirtual
*
storage
=
array
.
GetStorage
();
if
(
!
storage
)
{
throw
vtkm
::
cont
::
ErrorBadValue
(
"ArrayHandleVirtual must not have a nullptr for storage."
);
}
if
(
!
storage
->
IsType
(
typeid
(
vtkm
::
cont
::
internal
::
Storage
<
T
,
S
>
)))
{
#if defined(VTKM_ENABLE_LOGGING)
using
AH
=
vtkm
::
cont
::
ArrayHandle
<
T
,
S
>
;
VTKM_LOG_CAST_FAIL
(
array
,
AH
);
#endif
throw
vtkm
::
cont
::
ErrorBadValue
(
"Arrays being used as atomic's must always have storage that "
"is of the type StorageTagBasic."
);
}
const
auto
*
any
=
static_cast
<
const
vtkm
::
cont
::
StorageAny
<
T
,
S
>*>
(
storage
);
VTKM_LOG_CAST_SUCC
(
array
,
*
any
);
// Note: we ignore the size of the domain because the randomly accessed
// array might not have the same size depending on how the user is using
// the array.
ExecType
obj
(
any
->
GetHandle
());
return
obj
.
PrepareForExecution
(
Device
());
}
};
}
}
}
// namespace vtkm::cont::arg
...
...
vtkm/cont/arg/TypeCheckTagAtomicArray.h
View file @
4c23f502
...
...
@@ -26,6 +26,7 @@
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/StorageBasic.h>
#include <vtkm/cont/StorageVirtual.h>
#include <vtkm/cont/AtomicArray.h>
...
...
@@ -59,6 +60,14 @@ struct TypeCheck<TypeCheckTagAtomicArray<TypeList>,
static
constexpr
bool
value
=
(
vtkm
::
ListContains
<
TypeList
,
T
>::
value
&&
vtkm
::
ListContains
<
vtkm
::
cont
::
AtomicArrayTypeListTag
,
T
>::
value
);
};
template
<
typename
T
,
typename
TypeList
>
struct
TypeCheck
<
TypeCheckTagAtomicArray
<
TypeList
>
,
vtkm
::
cont
::
ArrayHandle
<
T
,
vtkm
::
cont
::
StorageTagVirtual
>>
{
static
constexpr
bool
value
=
(
vtkm
::
ListContains
<
TypeList
,
T
>::
value
&&
vtkm
::
ListContains
<
vtkm
::
cont
::
AtomicArrayTypeListTag
,
T
>::
value
);
};
}
}
}
// namespace vtkm::cont::arg
...
...
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