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
056bcfa4
Commit
056bcfa4
authored
7 years ago
by
Carsten Gräser
Browse files
Options
Downloads
Patches
Plain Diff
[bugfix] Fix sparseRangeFor()
Several bugs in sparseRangeFor have been fixed.
parent
5289423b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/matrix-vector/algorithm.hh
+10
-5
10 additions, 5 deletions
dune/matrix-vector/algorithm.hh
with
10 additions
and
5 deletions
dune/matrix-vector/algorithm.hh
+
10
−
5
View file @
056bcfa4
...
@@ -15,19 +15,24 @@ namespace MatrixVector {
...
@@ -15,19 +15,24 @@ namespace MatrixVector {
* \brief Hybrid for loop over sparse range
* \brief Hybrid for loop over sparse range
*/
*/
template
<
class
Range
,
class
F
,
template
<
class
Range
,
class
F
,
typename
=
std
::
enable_if_t
<
Dune
::
IsTupleOrDerived
<
Range
>
::
value
>
>
std
::
enable_if_t
<
Dune
::
IsTupleOrDerived
<
std
::
decay_t
<
Range
>
>
::
value
,
int
>
=
0
>
void
sparseRangeFor
(
const
Range
&
range
,
F
&&
f
)
{
void
sparseRangeFor
(
Range
&
&
range
,
F
&&
f
)
{
using
namespace
Dune
::
Hybrid
;
using
namespace
Dune
::
Hybrid
;
forEach
(
integralRange
(
size
(
range
)),
[
&
](
auto
&&
i
)
{
f
(
range
[
i
],
i
);
});
forEach
(
integralRange
(
size
(
range
)),
[
&
](
auto
&&
i
)
{
f
(
range
[
i
],
i
);
});
}
}
/**
/**
* \brief Hybrid for loop over sparse range
* \brief Hybrid for loop over sparse range
*/
*/
template
<
class
Range
,
class
F
>
template
<
class
Range
,
class
F
,
std
::
enable_if_t
<
not
Dune
::
IsTupleOrDerived
<
std
::
decay_t
<
Range
>
>::
value
,
int
>
=
0
>
void
sparseRangeFor
(
Range
&&
range
,
F
&&
f
)
void
sparseRangeFor
(
Range
&&
range
,
F
&&
f
)
{
{
for
(
auto
it
=
range
.
begin
();
it
!=
range
.
end
();
++
it
)
auto
it
=
range
.
begin
();
auto
end
=
range
.
end
();
for
(;
it
!=
end
;
++
it
)
f
(
*
it
,
it
.
index
());
f
(
*
it
,
it
.
index
());
}
}
...
...
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