Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
agnumpde
dune-tnnmg
Commits
78660533
Commit
78660533
authored
Oct 19, 2020
by
oliver.sander_at_tu-dresden.de
Browse files
Merge branch 'remove-more-deprecated-function-stuff' into 'master'
Stop using deprecated class VirtualFunction See merge request
!19
parents
9861405e
39b1d069
Pipeline
#32272
passed with stage
in 5 minutes and 15 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
dune/tnnmg/test/multitypegstest.cc
View file @
78660533
...
...
@@ -40,30 +40,6 @@
using
namespace
Dune
;
template
<
class
DomainType
,
class
RangeType
,
class
F
>
class
FunctionFromLambda
:
public
Dune
::
VirtualFunction
<
DomainType
,
RangeType
>
{
public:
FunctionFromLambda
(
F
f
)
:
f_
(
f
)
{}
void
evaluate
(
const
DomainType
&
x
,
RangeType
&
y
)
const
{
y
=
f_
(
x
);
}
private:
F
f_
;
};
template
<
class
Domain
,
class
Range
,
class
F
>
auto
makeFunction
(
F
&&
f
)
{
return
FunctionFromLambda
<
Domain
,
Range
,
std
::
decay_t
<
F
>>
(
std
::
forward
<
F
>
(
f
));
}
template
<
class
MatrixType
,
class
VectorType
,
class
BitVector
>
void
solveProblem
(
const
MatrixType
&
mat
,
VectorType
&
x
,
const
VectorType
&
rhs
,
const
BitVector
&
ignore
,
int
maxIterations
=
100
,
double
tolerance
=
1.0e-8
)
...
...
@@ -186,8 +162,7 @@ bool checkWithGrid(const GridType& grid, const std::string fileName="")
rhs
[
_0
].
resize
(
A
[
_0
][
_0
].
N
());
rhs
[
_1
].
resize
(
A
[
_1
][
_1
].
N
());
rhs
=
0
;
// ConstantFunction<DomainType, RangeType> f(5);
auto
f
=
makeFunction
<
DomainType
,
RangeType
>
([](
const
DomainType
&
x
)
{
return
(
x
.
two_norm
()
<
.7
)
?
200
:
0
;});
auto
f
=
[](
const
DomainType
&
x
)
->
RangeType
{
return
(
x
.
two_norm
()
<
.7
)
?
200
:
0
;};
assemblePQ1RHS
(
gridView
,
rhs
[
_0
],
f
);
assemblePQ1RHS
(
gridView
,
rhs
[
_1
],
f
);
...
...
dune/tnnmg/test/nonlineargsperformancetest.cc
View file @
78660533
...
...
@@ -8,7 +8,6 @@
// dune-common includes
#include
<dune/common/bitsetvector.hh>
#include
<dune/common/fmatrix.hh>
#include
<dune/common/function.hh>
#include
<dune/common/fvector.hh>
#include
<dune/common/timer.hh>
...
...
@@ -30,30 +29,6 @@
#include
<dune/solvers/test/common.hh>
template
<
class
DomainType
,
class
RangeType
,
class
F
>
class
FunctionFromLambda
:
public
Dune
::
VirtualFunction
<
DomainType
,
RangeType
>
{
public:
FunctionFromLambda
(
F
f
)
:
f_
(
f
)
{}
void
evaluate
(
const
DomainType
&
x
,
RangeType
&
y
)
const
{
y
=
f_
(
x
);
}
private:
F
f_
;
};
template
<
class
Domain
,
class
Range
,
class
F
>
auto
makeFunction
(
F
&&
f
)
{
return
FunctionFromLambda
<
Domain
,
Range
,
std
::
decay_t
<
F
>>
(
std
::
forward
<
F
>
(
f
));
}
template
<
class
MatrixType
,
class
VectorType
,
class
BitVector
>
...
...
@@ -201,8 +176,7 @@ bool checkWithGrid(const GridType& grid, const std::string fileName="")
Vector
rhs
(
A
.
N
());
rhs
=
0
;
// ConstantFunction<DomainType, RangeType> f(5);
auto
f
=
makeFunction
<
DomainType
,
RangeType
>
([](
const
DomainType
&
x
)
{
return
(
x
.
two_norm
()
<
.7
)
?
200
:
0
;});
auto
f
=
[](
const
DomainType
&
x
)
->
RangeType
{
return
(
x
.
two_norm
()
<
.7
)
?
200
:
0
;};
assemblePQ1RHS
(
gridView
,
rhs
,
f
);
Vector
u
(
A
.
N
());
...
...
dune/tnnmg/test/nonlineargstest.cc
View file @
78660533
...
...
@@ -45,30 +45,6 @@
#include
<dune/solvers/test/common.hh>
template
<
class
DomainType
,
class
RangeType
,
class
F
>
class
FunctionFromLambda
:
public
Dune
::
VirtualFunction
<
DomainType
,
RangeType
>
{
public:
FunctionFromLambda
(
F
f
)
:
f_
(
f
)
{}
void
evaluate
(
const
DomainType
&
x
,
RangeType
&
y
)
const
{
y
=
f_
(
x
);
}
private:
F
f_
;
};
template
<
class
Domain
,
class
Range
,
class
F
>
auto
makeFunction
(
F
&&
f
)
{
return
FunctionFromLambda
<
Domain
,
Range
,
std
::
decay_t
<
F
>>
(
std
::
forward
<
F
>
(
f
));
}
// template<class F>
// std::tuple<double, double, int> bisection(const F& f, double start, double guess, double tol)
...
...
@@ -265,8 +241,7 @@ bool checkWithGrid(const GridType& grid, const std::string fileName="")
Vector
rhs
(
A
.
N
());
rhs
=
0
;
// ConstantFunction<DomainType, RangeType> f(5);
auto
f
=
makeFunction
<
DomainType
,
RangeType
>
([](
const
DomainType
&
x
)
{
return
(
x
.
two_norm
()
<
.7
)
?
200
:
0
;});
auto
f
=
[](
const
DomainType
&
x
)
->
RangeType
{
return
(
x
.
two_norm
()
<
.7
)
?
RangeType
(
200.0
)
:
RangeType
(
0.0
);};
assemblePQ1RHS
(
gridView
,
rhs
,
f
);
Vector
u
(
A
.
N
());
...
...
dune/tnnmg/test/tnnmgsteptest.cc
View file @
78660533
...
...
@@ -38,29 +38,6 @@
#include
<dune/solvers/test/common.hh>
template
<
class
DomainType
,
class
RangeType
,
class
F
>
class
FunctionFromLambda
:
public
Dune
::
VirtualFunction
<
DomainType
,
RangeType
>
{
public:
FunctionFromLambda
(
F
f
)
:
f_
(
f
)
{}
void
evaluate
(
const
DomainType
&
x
,
RangeType
&
y
)
const
{
y
=
f_
(
x
);
}
private:
F
f_
;
};
template
<
class
Domain
,
class
Range
,
class
F
>
auto
makeFunction
(
F
&&
f
)
{
return
FunctionFromLambda
<
Domain
,
Range
,
std
::
decay_t
<
F
>>
(
std
::
forward
<
F
>
(
f
));
}
// TODO include those last two parameters
...
...
@@ -186,7 +163,7 @@ Dune::TestSuite checkWithGrid(const GridType& grid)
Vector
rhs
(
A
.
N
());
rhs
=
0
;
auto
f
=
makeFunction
<
DomainType
,
RangeType
>
(
[](
const
DomainType
&
x
)
{
return
(
x
.
two_norm
()
<
.7
)
?
200
:
0
;}
)
;
auto
f
=
[](
const
DomainType
&
x
)
->
RangeType
{
return
(
x
.
two_norm
()
<
.7
)
?
200
:
0
;};
assemblePQ1RHS
(
gridView
,
rhs
,
f
);
Vector
u
(
A
.
N
());
...
...
Write
Preview
Supports
Markdown
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