Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
CAMP
campvis-public
Commits
231a7c0f
Commit
231a7c0f
authored
Jul 15, 2014
by
Christian Schulte zu Berge
Browse files
Fixed some false positive GCC warnings.
parent
1d009b00
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/tools/concurrenthistogram.h
View file @
231a7c0f
...
...
@@ -117,7 +117,7 @@ namespace campvis {
* \param bucketNumbers Array of the bucket number for each dimension (must have at least ND elements).
* \return The array index for the given bucket numbers.
*/
size_t
getArrayIndex
(
size_t
*
bucketNumbers
)
const
;
size_t
getArrayIndex
(
size_t
bucketNumbers
[
ND
]
)
const
;
T
_min
[
ND
];
///< minimum value for each dimension
T
_max
[
ND
];
///< maximum value for each dimension
...
...
@@ -189,11 +189,14 @@ namespace campvis {
}
double
ratio
=
static_cast
<
double
>
(
sample
-
_min
[
dimension
])
/
static_cast
<
double
>
(
_max
[
dimension
]
-
_min
[
dimension
]);
return
static_cast
<
size_t
>
(
tgt
::
clamp
(
static_cast
<
int
>
(
ratio
*
_numBuckets
[
dimension
]),
static_cast
<
int
>
(
0
),
static_cast
<
int
>
(
_numBuckets
[
dimension
])
-
1
));
int
toReturn
=
static_cast
<
int
>
(
ratio
*
_numBuckets
[
dimension
]);
toReturn
=
std
::
max
(
toReturn
,
0
);
toReturn
=
std
::
min
(
toReturn
,
static_cast
<
int
>
(
_numBuckets
[
dimension
])
-
1
);
return
toReturn
;
}
template
<
typename
T
,
size_t
ND
>
size_t
campvis
::
ConcurrentGenericHistogramND
<
T
,
ND
>::
getArrayIndex
(
size_t
*
bucketNumbers
)
const
{
size_t
campvis
::
ConcurrentGenericHistogramND
<
T
,
ND
>::
getArrayIndex
(
size_t
bucketNumbers
[
ND
]
)
const
{
size_t
index
=
0
;
size_t
multiplier
=
1
;
for
(
size_t
i
=
0
;
i
<
ND
;
++
i
)
{
...
...
test/core/tools/concurrenthistogramtest.cpp
View file @
231a7c0f
...
...
@@ -50,7 +50,7 @@ protected:
max
=
new
int
[
ND
];
min
=
new
int
[
ND
];
numBuckets
=
new
size_t
[
ND
];
for
(
in
t
i
=
0
;
i
<
ND
;
i
++
)
{
for
(
size_
t
i
=
0
;
i
<
ND
;
i
++
)
{
min
[
i
]
=
0
;
max
[
i
]
=
100
;
numBuckets
[
i
]
=
max
[
i
]
-
min
[
i
]
+
1
;
...
...
@@ -135,7 +135,8 @@ TEST_F(ConcurrentHistogram1DTest, concurrentAddSampleTest) {
for
(
int
i
=
0
;
i
<
getND
();
i
++
)
{
for
(
size_t
j
=
0
;
j
<
numBuckets
[
i
];
j
++
)
{
EXPECT_EQ
(
histogram
[
i
],
_cgh
->
getNumElements
(
j
));
size_t
expected
=
static_cast
<
size_t
>
(
histogram
[
i
]);
EXPECT_EQ
(
expected
,
_cgh
->
getNumElements
(
j
));
}
}
}
...
...
@@ -162,7 +163,8 @@ TEST_F(ConcurrentHistogram2DTest, concurrentAddSampleTest) {
for
(
int
i
=
0
;
i
<
getND
();
i
++
)
{
for
(
size_t
j
=
0
;
j
<
numBuckets
[
i
];
j
++
)
{
EXPECT_EQ
(
histogram
[
i
],
_cgh
->
getNumElements
(
j
));
size_t
expected
=
static_cast
<
size_t
>
(
histogram
[
i
]);
EXPECT_EQ
(
expected
,
_cgh
->
getNumElements
(
j
));
}
break
;
}
...
...
@@ -183,7 +185,7 @@ protected:
max
=
new
int
[
ND
];
min
=
new
int
[
ND
];
numBuckets
=
new
size_t
[
ND
];
for
(
in
t
i
=
0
;
i
<
ND
;
i
++
)
{
for
(
size_
t
i
=
0
;
i
<
ND
;
i
++
)
{
min
[
i
]
=
0
;
max
[
i
]
=
9999
;
numBuckets
[
i
]
=
2
;
...
...
@@ -270,7 +272,8 @@ TEST_F(ConcurrentHistogram1DTestSpecific, concurrentAddSampleTest) {
for
(
int
i
=
0
;
i
<
getND
();
i
++
)
{
for
(
size_t
j
=
0
;
j
<
numBuckets
[
i
];
j
++
)
{
EXPECT_EQ
(
histogram
[
i
],
_cgh
->
getNumElements
(
j
));
size_t
expected
=
static_cast
<
size_t
>
(
histogram
[
i
]);
EXPECT_EQ
(
expected
,
_cgh
->
getNumElements
(
j
));
}
}
}
...
...
@@ -297,7 +300,8 @@ TEST_F(ConcurrentHistogram2DTestSpecific, concurrentAddSampleTest) {
for
(
int
i
=
0
;
i
<
getND
();
i
++
)
{
for
(
size_t
j
=
0
;
j
<
numBuckets
[
i
];
j
++
)
{
EXPECT_EQ
(
histogram
[
i
],
_cgh
->
getNumElements
(
j
));
size_t
expected
=
static_cast
<
size_t
>
(
histogram
[
i
]);
EXPECT_EQ
(
expected
,
_cgh
->
getNumElements
(
j
));
}
break
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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