Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
amdis
amdis-core
Commits
35255bb2
Commit
35255bb2
authored
May 06, 2019
by
Praetorius, Simon
Browse files
add static size information for Eigen matrix type
parent
f194064a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/amdis/common/StaticSize.hpp
View file @
35255bb2
...
...
@@ -25,6 +25,12 @@ namespace Dune
class
MultiTypeBlockVector
;
}
namespace
Eigen
{
template
<
typename
_Scalar
,
int
_Rows
,
int
_Cols
,
int
_Options
,
int
_MaxRows
,
int
_MaxCols
>
class
Matrix
;
}
namespace
AMDiS
{
namespace
Impl
...
...
@@ -60,6 +66,14 @@ namespace AMDiS
struct
SizeImpl
<
Dune
::
MultiTypeBlockVector
<
Ts
...
>>
:
std
::
integral_constant
<
std
::
size_t
,
sizeof
...(
Ts
)
>
{};
template
<
class
T
,
int
N
,
int
...
opts
>
struct
SizeImpl
<
Eigen
::
Matrix
<
T
,
N
,
1
,
opts
...
>>
:
std
::
integral_constant
<
std
::
size_t
,
(
N
>=
0
?
std
::
size_t
(
N
)
:
0u
)
>
{};
template
<
class
T
,
int
N
,
int
...
opts
>
struct
SizeImpl
<
Eigen
::
Matrix
<
T
,
1
,
N
,
opts
...
>>
:
std
::
integral_constant
<
std
::
size_t
,
(
N
>=
0
?
std
::
size_t
(
N
)
:
0u
)
>
{};
// Specialization for arithmetic types
template
<
class
T
>
struct
SizeImpl
<
T
,
std
::
enable_if_t
<
std
::
is_arithmetic
<
T
>::
value
>
>
...
...
@@ -93,6 +107,10 @@ namespace AMDiS
struct
RowsImpl
<
T
,
std
::
enable_if_t
<
std
::
is_arithmetic
<
T
>::
value
>
>
:
std
::
integral_constant
<
std
::
size_t
,
1
>
{};
template
<
class
T
,
int
N
,
int
M
,
int
...
opts
>
struct
RowsImpl
<
Eigen
::
Matrix
<
T
,
N
,
M
,
opts
...
>>
:
std
::
integral_constant
<
std
::
size_t
,
(
N
>=
0
?
std
::
size_t
(
N
)
:
0u
)
>
{};
}
// end namespace Impl
/// Get the number of rows in a fixed-size matrix
...
...
@@ -121,6 +139,10 @@ namespace AMDiS
struct
ColsImpl
<
T
,
std
::
enable_if_t
<
std
::
is_arithmetic
<
T
>::
value
>
>
:
std
::
integral_constant
<
std
::
size_t
,
1
>
{};
template
<
class
T
,
int
N
,
int
M
,
int
...
opts
>
struct
ColsImpl
<
Eigen
::
Matrix
<
T
,
N
,
M
,
opts
...
>>
:
std
::
integral_constant
<
std
::
size_t
,
(
M
>=
0
?
std
::
size_t
(
M
)
:
0u
)
>
{};
}
// end namespace Impl
/// Get the number of columns in a fixed-size matrix
...
...
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