Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ecpcitest
vtk-m
Commits
93b8ee97
Commit
93b8ee97
authored
Sep 05, 2020
by
Subhashis Hazarika
Browse files
Pasing range explicitly to NDHistogram worklet for ALPINE 2D sampling milestone
parent
a3b8525e
Changes
2
Hide whitespace changes
Inline
Side-by-side
vtkm/worklet/NDimsHistogram.h
View file @
93b8ee97
...
...
@@ -66,6 +66,29 @@ public:
}
}
// Add a field and the bin number for this field along with specific range of the data
// Return: binDelta is delta of a bin
template
<
typename
HandleType
>
void
AddField
(
const
HandleType
&
fieldArray
,
vtkm
::
Id
numberOfBins
,
vtkm
::
Range
&
rangeOfValues
,
vtkm
::
Float64
&
binDelta
,
bool
rangeProvided
)
{
NumberOfBins
.
push_back
(
numberOfBins
);
if
(
fieldArray
.
GetNumberOfValues
()
!=
NumDataPoints
)
{
throw
vtkm
::
cont
::
ErrorBadValue
(
"Array lengths does not match"
);
}
else
{
CastAndCall
(
fieldArray
.
ResetTypes
(
vtkm
::
TypeListScalarAll
()),
vtkm
::
worklet
::
histogram
::
ComputeBins
(
Bin1DIndex
,
numberOfBins
,
rangeOfValues
,
binDelta
,
rangeProvided
));
}
}
// Execute N-Dim histogram worklet to get N-Dims histogram from input fields
// Input arguments:
// binId: returned bin id of NDims-histogram, binId has n arrays, if length of fieldName is n
...
...
vtkm/worklet/histogram/ComputeNDHistogram.h
View file @
93b8ee97
...
...
@@ -89,16 +89,35 @@ public:
,
NumOfBins
(
_numOfBins
)
,
MinMax
(
_minMax
)
,
BinDelta
(
_binDelta
)
,
RangeProvided
(
false
)
{
}
VTKM_CONT
ComputeBins
(
vtkm
::
cont
::
ArrayHandle
<
vtkm
::
Id
>&
_bin1DIdx
,
vtkm
::
Id
&
_numOfBins
,
vtkm
::
Range
&
_minMax
,
vtkm
::
Float64
&
_binDelta
,
bool
_rangeProvided
)
:
Bin1DIdx
(
_bin1DIdx
)
,
NumOfBins
(
_numOfBins
)
,
MinMax
(
_minMax
)
,
BinDelta
(
_binDelta
)
,
RangeProvided
(
_rangeProvided
)
{
}
template
<
typename
T
,
typename
Storage
>
VTKM_CONT
void
operator
()(
const
vtkm
::
cont
::
ArrayHandle
<
T
,
Storage
>&
field
)
const
{
const
vtkm
::
Vec
<
T
,
2
>
initValue
(
vtkm
::
cont
::
ArrayGetValue
(
0
,
field
));
vtkm
::
Vec
<
T
,
2
>
minMax
=
vtkm
::
cont
::
Algorithm
::
Reduce
(
field
,
initValue
,
vtkm
::
MinAndMax
<
T
>
());
MinMax
.
Min
=
static_cast
<
vtkm
::
Float64
>
(
minMax
[
0
]);
MinMax
.
Max
=
static_cast
<
vtkm
::
Float64
>
(
minMax
[
1
]);
if
(
!
RangeProvided
)
{
const
vtkm
::
Vec
<
T
,
2
>
initValue
(
vtkm
::
cont
::
ArrayGetValue
(
0
,
field
));
vtkm
::
Vec
<
T
,
2
>
minMax
=
vtkm
::
cont
::
Algorithm
::
Reduce
(
field
,
initValue
,
vtkm
::
MinAndMax
<
T
>
());
MinMax
.
Min
=
static_cast
<
vtkm
::
Float64
>
(
minMax
[
0
]);
MinMax
.
Max
=
static_cast
<
vtkm
::
Float64
>
(
minMax
[
1
]);
}
BinDelta
=
compute_delta
(
MinMax
.
Min
,
MinMax
.
Max
,
NumOfBins
);
SetHistogramBin
<
T
>
binWorklet
(
NumOfBins
,
MinMax
.
Min
,
BinDelta
);
...
...
@@ -112,6 +131,7 @@ private:
vtkm
::
Id
&
NumOfBins
;
vtkm
::
Range
&
MinMax
;
vtkm
::
Float64
&
BinDelta
;
bool
RangeProvided
;
};
// Convert N-dims bin index into 1D index
...
...
Atkins, Charles Vernon
@atkins3
mentioned in commit
f2a4361c
·
Apr 07, 2021
mentioned in commit
f2a4361c
mentioned in commit f2a4361c03d8381b9674ac129f3de668f7ffb3c3
Toggle commit list
Atkins, Charles Vernon
@atkins3
mentioned in commit
820461b0
·
May 13, 2021
mentioned in commit
820461b0
mentioned in commit 820461b046a6114656d14559fafde4a0e6ecc1e5
Toggle commit list
Atkins, Charles Vernon
@atkins3
mentioned in commit
c63bf12f
·
May 13, 2021
mentioned in commit
c63bf12f
mentioned in commit c63bf12f19aa8f80a243e6e9ae6d77e6a5c912e7
Toggle commit list
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