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
8525e5a6
Commit
8525e5a6
authored
13 years ago
by
Elias Pipping
Committed by
Elias Pipping
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Use more references
parent
e315f9ff
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/samplefunctional.hh
+18
-15
18 additions, 15 deletions
src/samplefunctional.hh
with
18 additions
and
15 deletions
src/samplefunctional.hh
+
18
−
15
View file @
8525e5a6
...
...
@@ -39,7 +39,8 @@ template <int dim> class SampleFunctional {
// negative_projection() divides by it
if
(
x
.
two_norm2
()
==
0.0
)
{
// If there is a direction of descent, this is it
SmallVector
const
d
=
smoothGradient
(
x
);
SmallVector
d
;
smoothGradient
(
x
,
d
);
Interval
<
double
>
D
;
phi
.
directionalSubDiff
(
x
,
d
,
D
);
...
...
@@ -56,8 +57,10 @@ template <int dim> class SampleFunctional {
return
;
}
SmallVector
const
pg
=
upperGradient
(
x
);
SmallVector
const
mg
=
lowerGradient
(
x
);
SmallVector
pg
;
upperGradient
(
x
,
pg
);
SmallVector
mg
;
lowerGradient
(
x
,
mg
);
double
const
pgx
=
pg
*
x
;
double
const
mgx
=
mg
*
x
;
if
(
pgx
>=
0
&&
mgx
>=
0
)
{
...
...
@@ -73,7 +76,9 @@ template <int dim> class SampleFunctional {
}
else
{
// Includes the case that pg points in direction x and mg
// points in direction -x. The projection will then be zero.
ret
=
negative_projection
(
smoothGradient
(
x
),
x
);
SmallVector
d
;
smoothGradient
(
x
,
d
);
ret
=
negative_projection
(
d
,
x
);
dverb
<<
"## Directional derivative (as per scalar product w/ "
"semigradient): "
<<
-
(
ret
*
ret
)
<<
" (coordinates of the restriction)"
<<
std
::
endl
;
...
...
@@ -87,25 +92,23 @@ template <int dim> class SampleFunctional {
private
:
// Gradient of the smooth part
SmallVector
smoothGradient
(
SmallVector
const
x
)
const
{
SmallVector
y
;
void
smoothGradient
(
SmallVector
const
&
x
,
SmallVector
&
y
)
const
{
A
.
mv
(
x
,
y
);
// y = Av
y
-=
b
;
// y = Av - b
return
y
;
}
SmallVector
upperGradient
(
SmallVector
const
x
)
const
{
SmallVector
y
;
void
upperGradient
(
SmallVector
const
&
x
,
SmallVector
&
y
)
const
{
phi
.
upperGradient
(
x
,
y
);
y
+=
smoothGradient
(
x
);
return
y
;
SmallVector
z
;
smoothGradient
(
x
,
z
);
y
+=
z
;
}
SmallVector
lowerGradient
(
SmallVector
const
x
)
const
{
SmallVector
y
;
void
lowerGradient
(
SmallVector
const
&
x
,
SmallVector
&
y
)
const
{
phi
.
lowerGradient
(
x
,
y
);
y
+=
smoothGradient
(
x
);
return
y
;
SmallVector
z
;
smoothGradient
(
x
,
z
);
y
+=
z
;
}
// No normalising is done!
...
...
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