Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-solvers
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
Show more breadcrumbs
agnumpde
dune-solvers
Commits
06274677
Commit
06274677
authored
9 years ago
by
Carsten Gräser
Browse files
Options
Downloads
Patches
Plain Diff
Rename HybridAlgorithm:: to Hybrid:: and if_() to ifElse()
I like these names proposed by Oliver
parent
efd3d83b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/solvers/common/algorithm.hh
+19
-19
19 additions, 19 deletions
dune/solvers/common/algorithm.hh
with
19 additions
and
19 deletions
dune/solvers/common/algorithm.hh
+
19
−
19
View file @
06274677
...
...
@@ -13,7 +13,7 @@
namespace
Dune
{
namespace
Solvers
{
namespace
Hybrid
Algorithm
{
namespace
Hybrid
{
namespace
Imp
{
...
...
@@ -82,7 +82,7 @@ namespace Imp {
template
<
class
T
>
constexpr
auto
size
(
const
T
&
t
)
{
return
Hybrid
Algorithm
::
Imp
::
size
(
&
t
,
PriorityTag
<
42
>
());
return
Hybrid
::
Imp
::
size
(
&
t
,
PriorityTag
<
42
>
());
}
...
...
@@ -133,7 +133,7 @@ namespace Imp {
template
<
class
Container
,
class
Index
>
constexpr
decltype
(
auto
)
elementAt
(
Container
&&
c
,
Index
&&
i
)
{
return
Hybrid
Algorithm
::
Imp
::
elementAt
(
std
::
forward
<
Container
>
(
c
),
std
::
forward
<
Index
>
(
i
),
PriorityTag
<
42
>
());
return
Hybrid
::
Imp
::
elementAt
(
std
::
forward
<
Container
>
(
c
),
std
::
forward
<
Index
>
(
i
),
PriorityTag
<
42
>
());
}
...
...
@@ -222,7 +222,7 @@ namespace Imp {
template
<
class
Begin
,
class
End
>
constexpr
auto
integralRange
(
const
Begin
&
begin
,
const
End
&
end
)
{
return
Hybrid
Algorithm
::
Imp
::
integralRange
(
begin
,
end
,
PriorityTag
<
42
>
());
return
Hybrid
::
Imp
::
integralRange
(
begin
,
end
,
PriorityTag
<
42
>
());
}
/**
...
...
@@ -239,7 +239,7 @@ constexpr auto integralRange(const Begin& begin, const End& end)
template
<
class
End
>
constexpr
auto
integralRange
(
const
End
&
end
)
{
return
Hybrid
Algorithm
::
Imp
::
integralRange
(
Dune
::
Indices
::
_0
,
end
,
PriorityTag
<
42
>
());
return
Hybrid
::
Imp
::
integralRange
(
Dune
::
Indices
::
_0
,
end
,
PriorityTag
<
42
>
());
}
...
...
@@ -249,14 +249,14 @@ namespace Imp {
template
<
class
Range
,
class
F
,
class
Index
,
Index
...
i
>
constexpr
void
forEachIndex
(
Range
&&
range
,
F
&&
f
,
std
::
integer_sequence
<
Index
,
i
...
>
)
{
std
::
initializer_list
<
int
>
{(
f
(
Hybrid
Algorithm
::
elementAt
(
range
,
std
::
integral_constant
<
Index
,
i
>
())),
0
)...};
std
::
initializer_list
<
int
>
{(
f
(
Hybrid
::
elementAt
(
range
,
std
::
integral_constant
<
Index
,
i
>
())),
0
)...};
}
template
<
class
Range
,
class
F
,
std
::
enable_if_t
<
IsIntegralConstant
<
decltype
(
Hybrid
Algorithm
::
size
(
std
::
declval
<
Range
>()))
>::
value
,
int
>
=
0
>
std
::
enable_if_t
<
IsIntegralConstant
<
decltype
(
Hybrid
::
size
(
std
::
declval
<
Range
>()))
>::
value
,
int
>
=
0
>
constexpr
void
forEach
(
Range
&&
range
,
F
&&
f
,
PriorityTag
<
1
>
)
{
auto
size
=
Hybrid
Algorithm
::
size
(
range
);
auto
size
=
Hybrid
::
size
(
range
);
auto
indices
=
std
::
make_index_sequence
<
size
>
();
forEachIndex
(
std
::
forward
<
Range
>
(
range
),
std
::
forward
<
F
>
(
f
),
indices
);
}
...
...
@@ -286,7 +286,7 @@ namespace Imp {
*
* This supports looping over the following ranges
* * ranges obtained from integralRange()
* * all ranges that provide Hybrid
Algorithm
::size() and Hybrid
Algorithm
::elementAt()
* * all ranges that provide Hybrid::size() and Hybrid::elementAt()
*
* This especially included instances of std::integer_sequence,
* std::tuple, Dune::TupleVector, and Dune::MultiTypeBlockVector.
...
...
@@ -294,7 +294,7 @@ namespace Imp {
template
<
class
Range
,
class
F
>
constexpr
void
forEach
(
Range
&&
range
,
F
&&
f
)
{
Hybrid
Algorithm
::
Imp
::
forEach
(
std
::
forward
<
Range
>
(
range
),
std
::
forward
<
F
>
(
f
),
PriorityTag
<
42
>
());
Hybrid
::
Imp
::
forEach
(
std
::
forward
<
Range
>
(
range
),
std
::
forward
<
F
>
(
f
),
PriorityTag
<
42
>
());
}
...
...
@@ -302,19 +302,19 @@ constexpr void forEach(Range&& range, F&& f)
namespace
Imp
{
template
<
class
IfFunc
,
class
ElseFunc
>
constexpr
void
if
_
(
std
::
true_type
,
IfFunc
&&
ifFunc
,
ElseFunc
&&
elseFunc
)
constexpr
void
if
Else
(
std
::
true_type
,
IfFunc
&&
ifFunc
,
ElseFunc
&&
elseFunc
)
{
ifFunc
([](
auto
&&
x
)
{
return
std
::
forward
<
decltype
(
x
)
>
(
x
);});
}
template
<
class
IfFunc
,
class
ElseFunc
>
constexpr
void
if
_
(
std
::
false_type
,
IfFunc
&&
ifFunc
,
ElseFunc
&&
elseFunc
)
constexpr
void
if
Else
(
std
::
false_type
,
IfFunc
&&
ifFunc
,
ElseFunc
&&
elseFunc
)
{
elseFunc
([](
auto
&&
x
)
{
return
std
::
forward
<
decltype
(
x
)
>
(
x
);});
}
template
<
class
IfFunc
,
class
ElseFunc
>
constexpr
void
if
_
(
const
bool
&
condition
,
IfFunc
&&
ifFunc
,
ElseFunc
&&
elseFunc
)
constexpr
void
if
Else
(
const
bool
&
condition
,
IfFunc
&&
ifFunc
,
ElseFunc
&&
elseFunc
)
{
if
(
condition
)
ifFunc
([](
auto
&&
x
)
{
return
std
::
forward
<
decltype
(
x
)
>
(
x
);});
...
...
@@ -345,20 +345,20 @@ namespace Imp {
* a static if statement.
*/
template
<
class
Condition
,
class
IfFunc
,
class
ElseFunc
>
constexpr
void
if
_
(
const
Condition
&
condition
,
IfFunc
&&
ifFunc
,
ElseFunc
&&
elseFunc
)
constexpr
void
if
Else
(
const
Condition
&
condition
,
IfFunc
&&
ifFunc
,
ElseFunc
&&
elseFunc
)
{
Imp
::
if
_
(
condition
,
std
::
forward
<
IfFunc
>
(
ifFunc
),
std
::
forward
<
ElseFunc
>
(
elseFunc
));
Imp
::
if
Else
(
condition
,
std
::
forward
<
IfFunc
>
(
ifFunc
),
std
::
forward
<
ElseFunc
>
(
elseFunc
));
}
/**
* \brief A conditional expression
*
* This provides an if
_
conditional with empty else clause.
* This provides an if
Else
conditional with empty else clause.
*/
template
<
class
Condition
,
class
IfFunc
>
constexpr
void
if
_
(
const
Condition
&
condition
,
IfFunc
&&
ifFunc
)
constexpr
void
if
Else
(
const
Condition
&
condition
,
IfFunc
&&
ifFunc
)
{
if
_
(
condition
,
std
::
forward
<
IfFunc
>
(
ifFunc
),
[](
auto
&&
i
)
{});
if
Else
(
condition
,
std
::
forward
<
IfFunc
>
(
ifFunc
),
[](
auto
&&
i
)
{});
}
...
...
@@ -367,7 +367,7 @@ constexpr void if_(const Condition& condition, IfFunc&& ifFunc)
}
// namespace Hybrid
Algorithm
}
// namespace Hybrid
...
...
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