Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-tectonic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
podlesny
dune-tectonic
Commits
d96d93a8
Commit
d96d93a8
authored
11 years ago
by
Elias Pipping
Committed by
Elias Pipping
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[Cleanup] Helpers for MyDirectionalConvexFunctional
parent
ae306d94
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dune/tectonic/minimisation.hh
+2
-14
2 additions, 14 deletions
dune/tectonic/minimisation.hh
dune/tectonic/myblockproblem.hh
+3
-15
3 additions, 15 deletions
dune/tectonic/myblockproblem.hh
dune/tectonic/mydirectionalconvexfunction.hh
+23
-0
23 additions, 0 deletions
dune/tectonic/mydirectionalconvexfunction.hh
with
28 additions
and
29 deletions
dune/tectonic/minimisation.hh
+
2
−
14
View file @
d96d93a8
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
#include
<dune/fufem/arithmetic.hh>
#include
<dune/fufem/arithmetic.hh>
#include
<dune/fufem/interval.hh>
#include
<dune/fufem/interval.hh>
#include
<dune/solvers/computeenergy.hh>
#include
<dune/tnnmg/problem-classes/bisection.hh>
#include
<dune/tnnmg/problem-classes/bisection.hh>
#include
"mydirectionalconvexfunction.hh"
#include
"mydirectionalconvexfunction.hh"
...
@@ -21,20 +20,9 @@ void descentMinimisation(Functional const &J,
...
@@ -21,20 +20,9 @@ void descentMinimisation(Functional const &J,
using
SmallVector
=
typename
Functional
::
SmallVector
;
using
SmallVector
=
typename
Functional
::
SmallVector
;
using
LocalNonlinearityType
=
typename
Functional
::
NonlinearityType
;
using
LocalNonlinearityType
=
typename
Functional
::
NonlinearityType
;
// {{{ Construct a restriction of J to the line x + t * v
/* We have
1/2 <A(x+tv),x+tv>-<b,x+tv> = 1/2 <Av,v> t^2 - <b-Ax,v> t + <1/2 Ax-b,x>
since A is symmetric.
*/
SmallVector
tmp
=
J
.
b
;
Arithmetic
::
addProduct
(
tmp
,
-
1.0
,
J
.
A
,
x
);
double
const
JRestb
=
tmp
*
v
;
MyDirectionalConvexFunction
<
LocalNonlinearityType
>
const
JRest
(
MyDirectionalConvexFunction
<
LocalNonlinearityType
>
const
JRest
(
2.0
*
computeEnergy
(
J
.
A
,
v
),
JRestb
,
*
J
.
phi
,
x
,
v
);
computeDirectionalA
(
J
.
A
,
v
),
computeDirectionalb
(
J
.
A
,
J
.
b
,
x
,
v
),
*
J
.
phi
,
x
,
v
);
// }}}
// }}}
int
count
;
int
count
;
...
...
This diff is collapsed.
Click to expand it.
dune/tectonic/myblockproblem.hh
+
3
−
15
View file @
d96d93a8
...
@@ -105,22 +105,10 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem {
...
@@ -105,22 +105,10 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem {
Arithmetic
::
addProduct
(
tmp
,
-
1.0
,
problem
.
A
,
u
);
Arithmetic
::
addProduct
(
tmp
,
-
1.0
,
problem
.
A
,
u
);
double
const
localb
=
tmp
*
v
;
double
const
localb
=
tmp
*
v
;
problem
.
A
.
mv
(
v
,
tmp
);
double
const
localA
=
tmp
*
v
;
/*
1/2 <A(u + hv),u + hv> - <b, u + hv>
= 1/2 <Av,v> h^2 - <b - Au, v> h + const.
localA = <Av,v>
localb = <b - Au, v>
*/
MyDirectionalConvexFunction
<
MyDirectionalConvexFunction
<
Dune
::
GlobalNonlinearity
<
MatrixType
,
VectorType
>>
const
psi
(
localA
,
Dune
::
GlobalNonlinearity
<
MatrixType
,
VectorType
>>
const
localb
,
psi
(
computeDirectionalA
(
problem
.
A
,
v
),
problem
.
phi
,
computeDirectionalb
(
problem
.
A
,
problem
.
f
,
u
,
v
),
problem
.
phi
,
u
,
v
);
u
,
v
);
Interval
<
double
>
D
;
Interval
<
double
>
D
;
psi
.
subDiff
(
0
,
D
);
psi
.
subDiff
(
0
,
D
);
...
...
This diff is collapsed.
Click to expand it.
dune/tectonic/mydirectionalconvexfunction.hh
+
23
−
0
View file @
d96d93a8
...
@@ -9,6 +9,29 @@
...
@@ -9,6 +9,29 @@
#include
<dune/fufem/interval.hh>
#include
<dune/fufem/interval.hh>
/*
1/2 <A(u + hv),u + hv> - <b, u + hv>
= 1/2 <Av,v> h^2 - <b - Au, v> h + const.
localA = <Av,v>
localb = <b - Au, v>
*/
template
<
class
MatrixType
,
class
VectorType
>
double
computeDirectionalA
(
MatrixType
const
&
A
,
VectorType
const
&
v
)
{
VectorType
tmp
(
v
.
size
());
A
.
mv
(
v
,
tmp
);
return
tmp
*
v
;
}
template
<
class
MatrixType
,
class
VectorType
>
double
computeDirectionalb
(
MatrixType
const
&
A
,
VectorType
const
&
b
,
VectorType
const
&
u
,
VectorType
const
&
v
)
{
VectorType
tmp
=
b
;
Arithmetic
::
addProduct
(
tmp
,
-
1.0
,
A
,
u
);
return
tmp
*
v
;
}
template
<
class
NonlinearityType
>
class
MyDirectionalConvexFunction
{
template
<
class
NonlinearityType
>
class
MyDirectionalConvexFunction
{
public:
public:
using
VectorType
=
typename
NonlinearityType
::
VectorType
;
using
VectorType
=
typename
NonlinearityType
::
VectorType
;
...
...
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