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
9861405e
Commit
9861405e
authored
May 26, 2020
by
oliver.sander_at_tu-dresden.de
Browse files
Merge branch 'use-if-constexpr' into 'master'
Port bcqfconstrainedlinearization.hh to 'if constexpr' See merge request
!15
parents
d13a9cbb
98810ea1
Pipeline
#28821
passed with stage
in 5 minutes and 18 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
9861405e
...
...
@@ -3,6 +3,13 @@ before_script:
-
duneci-install-module https://git.imp.fu-berlin.de/agnumpde/dune-matrix-vector.git
-
duneci-install-module https://git.imp.fu-berlin.de/agnumpde/dune-solvers.git
.common
:
&common
script
:
duneci-standard-test
artifacts
:
expire_in
:
2 years
reports
:
junit
:
junit/*.xml
dune:git clang C++17
:
image
:
registry.dune-project.org/docker/ci/dune:git-debian-10-clang-7-libcpp-17
script
:
duneci-standard-test
...
...
@@ -10,7 +17,3 @@ dune:git clang C++17:
dune:git gcc-8 C++17
:
image
:
registry.dune-project.org/docker/ci/dune:git-debian-10-gcc-8-17
script
:
duneci-standard-test
dune:git gcc-6 C++14
:
image
:
registry.dune-project.org/docker/ci/dune:git-debian-9-gcc-6-14
script
:
duneci-standard-test
dune/tnnmg/functionals/bcqfconstrainedlinearization.hh
View file @
9861405e
...
...
@@ -30,28 +30,34 @@ class BoxConstrainedQuadraticFunctionalConstrainedLinearization
static
void
determineTruncation
(
const
NV
&
x
,
const
NV
&
lower
,
const
NV
&
upper
,
NBV
&&
truncationFlags
,
const
T
&
truncationTolerance
)
{
namespace
H
=
Dune
::
Hybrid
;
H
::
ifElse
(
IsNumber
<
NV
>
(),
[
&
](
auto
id
){
if
((
id
(
x
)
<=
id
(
lower
)
+
truncationTolerance
)
||
(
id
(
x
)
>=
id
(
upper
)
-
truncationTolerance
))
id
(
truncationFlags
)
=
true
;
},
[
&
](
auto
id
){
H
::
forEach
(
H
::
integralRange
(
H
::
size
(
id
(
x
))),
[
&
](
auto
&&
i
)
{
if
constexpr
(
IsNumber
<
NV
>
())
{
if
((
x
<=
lower
+
truncationTolerance
)
||
(
x
>=
upper
-
truncationTolerance
))
truncationFlags
=
true
;
}
else
{
H
::
forEach
(
H
::
integralRange
(
H
::
size
(
x
)),
[
&
](
auto
&&
i
)
{
This
::
determineTruncation
(
x
[
i
],
lower
[
i
],
upper
[
i
],
truncationFlags
[
i
],
truncationTolerance
);
});
}
);
}
}
template
<
class
NV
,
class
NBV
>
static
void
truncateVector
(
NV
&
x
,
const
NBV
&
truncationFlags
)
{
namespace
H
=
Dune
::
Hybrid
;
H
::
ifElse
(
IsNumber
<
NV
>
(),
[
&
](
auto
id
){
if
(
id
(
truncationFlags
))
id
(
x
)
=
0
;
},
[
&
](
auto
id
){
H
::
forEach
(
H
::
integralRange
(
H
::
size
(
id
(
x
))),
[
&
](
auto
&&
i
)
{
if
constexpr
(
IsNumber
<
NV
>
())
{
if
(
truncationFlags
)
x
=
0
;
}
else
{
H
::
forEach
(
H
::
integralRange
(
H
::
size
(
x
)),
[
&
](
auto
&&
i
)
{
This
::
truncateVector
(
x
[
i
],
truncationFlags
[
i
]);
});
}
);
}
}
template
<
class
NM
,
class
RBV
,
class
CBV
>
...
...
@@ -59,17 +65,20 @@ class BoxConstrainedQuadraticFunctionalConstrainedLinearization
{
namespace
H
=
Dune
::
Hybrid
;
using
namespace
Dune
::
MatrixVector
;
H
::
ifElse
(
IsNumber
<
NM
>
(),
[
&
](
auto
id
){
if
(
id
(
rowTruncationFlags
)
or
id
(
colTruncationFlags
))
if
constexpr
(
IsNumber
<
NM
>
())
{
if
(
rowTruncationFlags
or
colTruncationFlags
)
A
=
0
;
},
[
&
](
auto
id
){
H
::
forEach
(
H
::
integralRange
(
H
::
size
(
id
(
rowTruncationFlags
))),
[
&
](
auto
&&
i
)
{
}
else
{
H
::
forEach
(
H
::
integralRange
(
H
::
size
(
rowTruncationFlags
)),
[
&
](
auto
&&
i
)
{
auto
&&
Ai
=
A
[
i
];
sparseRangeFor
(
Ai
,
[
&
](
auto
&&
Aij
,
auto
&&
j
)
{
This
::
truncateMatrix
(
Aij
,
rowTruncationFlags
[
i
],
colTruncationFlags
[
j
]);
});
});
}
);
}
}
public:
...
...
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