Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Pierre NARVOR
rtac_base
Commits
85607121
Commit
85607121
authored
Nov 02, 2021
by
Pierre NARVOR
Browse files
[types] Adapted Bounds and Shape to CUDA device side use
parent
0d258483
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/rtac_base/types/Bounds.h
View file @
85607121
...
...
@@ -4,6 +4,8 @@
#include <iostream>
#include <array>
#include <rtac_base/cuda_defines.h>
namespace
rtac
{
namespace
types
{
template
<
typename
T
>
...
...
@@ -11,11 +13,22 @@ struct Interval {
T
min
;
T
max
;
T
length
()
const
{
RTAC_HOSTDEVICE
T
length
()
const
{
return
this
->
max
-
this
->
min
;
}
RTAC_HOSTDEVICE
bool
is_inside
(
T
value
)
const
{
return
min
<
value
&&
value
<
max
;
}
};
};
//namespace types
};
//namespace rtac
#ifndef RTAC_CUDACC
namespace
rtac
{
namespace
types
{
template
<
typename
T
,
std
::
size_t
N
>
using
Bounds
=
std
::
array
<
Interval
<
T
>
,
N
>
;
...
...
@@ -38,4 +51,6 @@ std::ostream& operator<<(std::ostream& os, const rtac::types::Bounds<T,N>& bound
return
os
;
}
#endif //RTAC_CUDACC
#endif //_DEF_RTAC_BASE_TYPES_BOUNDS_H_
include/rtac_base/types/Shape.h
View file @
85607121
#ifndef _DEF_RTAC_BASE_TYPES_SHAPE_H_
#define _DEF_RTAC_BASE_TYPES_SHAPE_H_
#include <
iostream
>
#include <
rtac_base/cuda_defines.h
>
namespace
rtac
{
namespace
types
{
...
...
@@ -19,7 +19,7 @@ struct Shape
T
height
;
template
<
typename
RatioType
=
T
>
RatioType
ratio
()
const
RTAC_HOSTDEVICE
RatioType
ratio
()
const
{
return
((
RatioType
)
width
/
height
);
}
...
...
@@ -30,7 +30,7 @@ struct Shape
}
template
<
typename
SizeType
=
T
>
SizeType
size
()
const
RTAC_HOSTDEVICE
SizeType
size
()
const
{
return
width
*
height
;
}
...
...
@@ -39,11 +39,15 @@ struct Shape
};
//namespace types
};
//namespace rtac
#ifndef RTAC_CUDACC
#include <iostream>
template
<
typename
T
>
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
rtac
::
types
::
Shape
<
T
>&
shape
)
{
os
<<
"width : "
<<
shape
.
width
<<
", height : "
<<
shape
.
height
;
return
os
;
}
#endif //RTAC_CUDACC
#endif //_DEF_RTAC_BASE_TYPES_SHAPE_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