Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-matrix-vector
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
agnumpde
dune-matrix-vector
Commits
14796027
There was a problem fetching the pipeline summary.
Commit
14796027
authored
7 years ago
by
Max Kahnt
Browse files
Options
Downloads
Patches
Plain Diff
Add todos for convenient resize compiler errors.
parent
301d1375
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/matrix-vector/genericvectortools.hh
+7
-1
7 additions, 1 deletion
dune/matrix-vector/genericvectortools.hh
with
7 additions
and
1 deletion
dune/matrix-vector/genericvectortools.hh
+
7
−
1
View file @
14796027
...
@@ -48,6 +48,7 @@ void truncate(Vector& v, const BitVector& tr) {
...
@@ -48,6 +48,7 @@ void truncate(Vector& v, const BitVector& tr) {
}
}
//! Resize vector recursively to size of given vector/matrix
//! Resize vector recursively to size of given vector/matrix
// EXPERIMENTAL: Its implementation is still subject to change.
// Note: We need the rvalue reference here, because we might obtain a
// Note: We need the rvalue reference here, because we might obtain a
// temporary recursively, e.g. in std::bitset the operator[] yields a
// temporary recursively, e.g. in std::bitset the operator[] yields a
// std::bitset::reference temporary due to its specific implementation.
// std::bitset::reference temporary due to its specific implementation.
...
@@ -114,11 +115,13 @@ auto getSize(const SizeProvider& sizeProvider) {
...
@@ -114,11 +115,13 @@ auto getSize(const SizeProvider& sizeProvider) {
}
}
/// compile-time helper traits
/// compile-time helper traits
// TODO these are not satifsying, because e.g. for custom matrices that
// do not specialiaze the MatrixTraits properly, the error messages are
// not very helpful. In particular they may trigger a misleading static_assert.
template
<
class
M
>
template
<
class
M
>
constexpr
auto
isMatrix
()
{
constexpr
auto
isMatrix
()
{
return
Std
::
bool_constant
<
MatrixTraits
<
M
>::
isMatrix
>
();
return
Std
::
bool_constant
<
MatrixTraits
<
M
>::
isMatrix
>
();
}
}
template
<
class
V
>
template
<
class
V
>
constexpr
auto
isVector
()
{
constexpr
auto
isVector
()
{
// Note: At the time this comment is written, the only use of
// Note: At the time this comment is written, the only use of
...
@@ -156,6 +159,8 @@ struct ScalarSwitch<Vector,
...
@@ -156,6 +159,8 @@ struct ScalarSwitch<Vector,
// vector to be resized.
// vector to be resized.
template
<
class
Resizeable
>
template
<
class
Resizeable
>
static
void
resize
(
Resizeable
&
v
,
const
Vector
&
sizeProvider
)
{
static
void
resize
(
Resizeable
&
v
,
const
Vector
&
sizeProvider
)
{
// TODO this assert may also be triggered when isMatrix/isVector do not
// work properly, e.g. due to a missing MatrixTraits specialization.
static_assert
(
not
IsNumber
<
Resizeable
>::
value
,
"SizeProvider seems to have nesting depth that is not applicable to given vector type."
);
static_assert
(
not
IsNumber
<
Resizeable
>::
value
,
"SizeProvider seems to have nesting depth that is not applicable to given vector type."
);
using
namespace
Hybrid
;
using
namespace
Hybrid
;
...
@@ -208,6 +213,7 @@ protected:
...
@@ -208,6 +213,7 @@ protected:
// priority tag forward helper
// priority tag forward helper
template
<
class
SizeProviderRow
>
template
<
class
SizeProviderRow
>
static
decltype
(
auto
)
subSizeProvider
(
SizeProviderRow
&&
row
)
{
static
decltype
(
auto
)
subSizeProvider
(
SizeProviderRow
&&
row
)
{
// TODO add static assert that fails or warns if subSizeProvider is not a matrix for a matrix or a vector for a vector
return
This
::
subSizeProvider
(
std
::
forward
<
SizeProviderRow
>
(
row
),
PriorityTag
<
42
>
());
return
This
::
subSizeProvider
(
std
::
forward
<
SizeProviderRow
>
(
row
),
PriorityTag
<
42
>
());
}
}
};
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment