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
1d61f88b
Commit
1d61f88b
authored
Apr 26, 2020
by
oliver.sander_at_tu-dresden.de
Browse files
Use Functional::VectorType only if USE_OLD_TNNMG is set
Otherwise use Functional::Vector
parent
9ad49eff
Pipeline
#28051
passed with stage
in 8 minutes and 42 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
dune/tnnmg/functionals/test/functionaltest.hh
View file @
1d61f88b
...
...
@@ -76,7 +76,11 @@ void testConvexity(const Functional& functional,
*/
template
<
class
Functional
>
void
testHomogeneity
(
const
Functional
&
functional
,
#ifdef USE_OLD_TNNMG
const
std
::
vector
<
typename
Functional
::
VectorType
>&
testDirections
)
#else
const
std
::
vector
<
typename
Functional
::
Vector
>&
testDirections
)
#endif
{
for
(
auto
&&
testDirection
:
testDirections
)
{
...
...
@@ -105,12 +109,20 @@ void testHomogeneity(const Functional& functional,
*/
template
<
class
Functional
>
void
testGradient
(
Functional
&
functional
,
const
std
::
vector
<
typename
Functional
::
VectorType
>&
testPoints
)
#ifdef USE_OLD_TNNMG
const
std
::
vector
<
typename
Functional
::
VectorType
>&
testPoints
)
#else
const
std
::
vector
<
typename
Functional
::
Vector
>&
testPoints
)
#endif
{
for
(
auto
&&
testPoint
:
testPoints
)
{
// Get the gradient at the current test point as computed by 'functional'
#ifdef USE_OLD_TNNMG
typename
Functional
::
VectorType
gradient
(
testPoint
.
size
());
#else
typename
Functional
::
Vector
gradient
(
testPoint
.
size
());
#endif
gradient
=
0
;
functional
.
addGradient
(
testPoint
,
gradient
);
...
...
@@ -158,7 +170,11 @@ void testGradient(Functional& functional,
*/
template
<
class
Functional
>
void
testHessian
(
Functional
&
functional
,
#ifdef USE_OLD_TNNMG
const
std
::
vector
<
typename
Functional
::
VectorType
>&
testPoints
)
#else
const
std
::
vector
<
typename
Functional
::
Vector
>&
testPoints
)
#endif
{
for
(
auto
&&
testPoint
:
testPoints
)
{
...
...
@@ -251,7 +267,11 @@ void testHessian(Functional& functional,
*/
template
<
class
Functional
>
void
testDirectionalSubdifferential
(
const
Functional
&
functional
,
#ifdef USE_OLD_TNNMG
const
std
::
vector
<
typename
Functional
::
VectorType
>&
testPoints
)
#else
const
std
::
vector
<
typename
Functional
::
Vector
>&
testPoints
)
#endif
{
// Step size. Best value: square root of the machine precision
const
double
eps
=
std
::
sqrt
(
std
::
numeric_limits
<
double
>::
epsilon
());
...
...
@@ -300,7 +320,11 @@ void testDirectionalSubdifferential(const Functional& functional,
*/
template
<
class
Functional
>
void
testSubDiff
(
Functional
&
functional
,
#ifdef USE_OLD_TNNMG
const
std
::
vector
<
typename
Functional
::
VectorType
>&
testPoints
)
#else
const
std
::
vector
<
typename
Functional
::
Vector
>&
testPoints
)
#endif
{
for
(
auto
&&
testPoint
:
testPoints
)
{
...
...
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