Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dumux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
dumux-repositories
dumux
Commits
a399339a
Commit
a399339a
authored
5 years ago
by
Timo Koch
Browse files
Options
Downloads
Patches
Plain Diff
[rootfinding] Use C++17 invocable_r. Additionally checks return type is convertible
parent
fbedc32e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1917
Cleanup/use c++17 is invokable
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dumux/nonlinear/findscalarroot.hh
+5
-7
5 additions, 7 deletions
dumux/nonlinear/findscalarroot.hh
with
5 additions
and
7 deletions
dumux/nonlinear/findscalarroot.hh
+
5
−
7
View file @
a399339a
...
...
@@ -26,8 +26,7 @@
#include
<cmath>
#include
<limits>
#include
<dune/common/std/type_traits.hh>
#include
<type_traits>
#include
<dumux/common/exceptions.hh>
#include
<dumux/common/parameters.hh>
...
...
@@ -43,11 +42,10 @@ namespace Dumux {
* \param derivative Derivative of the residual
* \param tol Relative shift tolerance
* \param maxIter Maximum number of iterations
* \todo replace std::result_of by std::invoke_result for C++17
*/
template
<
class
Scalar
,
class
ResFunc
,
class
DerivFunc
,
typename
std
::
enable_if_t
<
Dune
::
S
td
::
is_invocable
<
ResFunc
,
Scalar
>
::
value
&&
Dune
::
S
td
::
is_invocable
<
DerivFunc
,
Scalar
>
::
value
>
...
>
typename
std
::
enable_if_t
<
s
td
::
is_invocable
_r_v
<
Scalar
,
ResFunc
,
Scalar
>
&&
s
td
::
is_invocable
_r_v
<
Scalar
,
DerivFunc
,
Scalar
>>
...
>
Scalar
findScalarRootNewton
(
Scalar
xOld
,
const
ResFunc
&
residual
,
const
DerivFunc
&
derivative
,
const
Scalar
tol
=
1e-13
,
const
int
maxIter
=
200
)
{
...
...
@@ -87,7 +85,7 @@ Scalar findScalarRootNewton(Scalar xOld, const ResFunc& residual, const DerivFun
* \param maxIter Maximum number of iterations
*/
template
<
class
Scalar
,
class
ResFunc
,
typename
std
::
enable_if_t
<
Dune
::
S
td
::
is_invocable
<
ResFunc
,
Scalar
>
::
value
>
...
>
typename
std
::
enable_if_t
<
s
td
::
is_invocable
_r_v
<
Scalar
,
ResFunc
,
Scalar
>
>
...
>
Scalar
findScalarRootNewton
(
Scalar
xOld
,
const
ResFunc
&
residual
,
const
Scalar
tol
=
1e-13
,
const
int
maxIter
=
200
)
{
...
...
@@ -109,7 +107,7 @@ Scalar findScalarRootNewton(Scalar xOld, const ResFunc& residual,
* \param maxIter Maximum number of iterations
*/
template
<
class
Scalar
,
class
ResFunc
,
typename
std
::
enable_if_t
<
Dune
::
S
td
::
is_invocable
<
ResFunc
,
Scalar
>
::
value
>
...
>
typename
std
::
enable_if_t
<
s
td
::
is_invocable
_r_v
<
Scalar
,
ResFunc
,
Scalar
>
>
...
>
Scalar
findScalarRootBrent
(
Scalar
a
,
Scalar
b
,
const
ResFunc
&
residual
,
const
Scalar
tol
=
1e-13
,
const
int
maxIter
=
200
)
{
...
...
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