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
ee004807
Commit
ee004807
authored
4 years ago
by
podlesny
Browse files
Options
Downloads
Patches
Plain Diff
debug print
parent
a74d5c9f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/tectonic/spatial-solving/tnnmg/localbisectionsolver.hh
+47
-16
47 additions, 16 deletions
dune/tectonic/spatial-solving/tnnmg/localbisectionsolver.hh
with
47 additions
and
16 deletions
dune/tectonic/spatial-solving/tnnmg/localbisectionsolver.hh
+
47
−
16
View file @
ee004807
...
@@ -26,23 +26,25 @@ class LocalBisectionSolver
...
@@ -26,23 +26,25 @@ class LocalBisectionSolver
return
;
return
;
}
}
auto
old_x
=
x
;
auto
origin
=
x
;
auto
origin
=
x
;
auto
linearPart
=
f
.
linearPart
();
auto
linearPart
=
f
.
linearPart
();
/
*
std::cout << x << std::endl;
/
/
std::cout << x << std::endl;
std::cout << "eigenvalue: " <<
maxEigenvalue
<< std::endl;
//
std::cout << "eigenvalue: " <<
f.quadraticPart()[0][0]
<< std::endl;
std::cout << "ignore: " << ignore << std::endl;
//
std::cout << "ignore: " << ignore << std::endl;
std::cout << "orig linear part: " << linearPart << std::endl;
*/
//
std::cout << "orig linear part: " << linearPart << std::endl;
auto
lower
=
f
.
lowerObstacle
();
auto
lower
=
f
.
lowerObstacle
();
auto
upper
=
f
.
upperObstacle
();
auto
upper
=
f
.
upperObstacle
();
for
(
size_t
j
=
0
;
j
<
lower
.
size
();
++
j
)
{
for
(
size_t
j
=
0
;
j
<
lower
.
size
();
++
j
)
{
if
(
std
::
abs
(
upper
[
j
]
-
lower
[
j
])
<=
safety
)
{
if
(
std
::
abs
(
upper
[
j
]
-
lower
[
j
])
<=
safety
)
{
linearPart
[
j
]
=
0
;
//
linearPart[j] = 0;
}
}
}
}
std
::
cout
<<
"lower: "
<<
lower
<<
" upper: "
<<
upper
<<
std
::
endl
;
//std::cout << "lower: " << lower << " upper: " << upper << std::endl;
for
(
size_t
j
=
0
;
j
<
ignore
.
size
();
++
j
)
{
for
(
size_t
j
=
0
;
j
<
ignore
.
size
();
++
j
)
{
if
(
ignore
[
j
])
{
if
(
ignore
[
j
])
{
...
@@ -52,15 +54,27 @@ class LocalBisectionSolver
...
@@ -52,15 +54,27 @@ class LocalBisectionSolver
}
}
}
}
auto
linearPartNorm
=
linearPart
.
two_norm
();
if
(
linearPartNorm
>
0.0
)
linearPart
/=
linearPartNorm
;
else
{
linearPartNorm
=
0.0
;
linearPart
=
0.0
;
}
//using DirectionalRestriction = DirectionalRestriction<Matrix, Vector, Nonlinearity, LowerObstacle, UpperObstacle, Range>;
//DirectionalRestriction fv(f.quadraticPart(), f.linearPart(), f.phi(), f.lowerObstacle(), f.upperObstacle(), f.origin(), linearPart, linearPartNorm);
auto
fv
=
directionalRestriction
(
f
,
x
,
linearPart
);
auto
fv
=
directionalRestriction
(
f
,
x
,
linearPart
);
//std::cout << "origin: " << origin << std::endl;
//std::cout << "origin: " << origin << std::endl;
//std::cout << " linearPart: " << linearPart << std::endl;
//std::cout << " linearPart: " << linearPart << std::endl;
//std::cout << "maxEigenvalue " << maxEigenvalue << std::endl;
std
::
cout
<<
"maxEigenvalue "
<<
f
.
quadraticPart
()
<<
std
::
endl
;
//std::cout << "linearPartNorm " << linearPartNorm << std::endl;
print
(
linearPart
,
"linearPart:"
);
//print(origin, "origin:");
std
::
cout
<<
"linearPartNorm "
<<
linearPartNorm
<<
std
::
endl
;
//print(linearPart, "linearPart:");
print
(
origin
,
"origin:"
);
//print(lower, "lower:");
//print(lower, "lower:");
...
@@ -98,14 +112,30 @@ class LocalBisectionSolver
...
@@ -98,14 +112,30 @@ class LocalBisectionSolver
//std::cout << "domain: " << firstOrderFunctional.domain()[0] << " " << firstOrderFunctional.domain()[1] << std::endl;
//std::cout << "domain: " << firstOrderFunctional.domain()[0] << " " << firstOrderFunctional.domain()[1] << std::endl;
typename
Functional
::
Range
alpha
;
typename
Functional
::
Range
alpha
;
LineSearchSolver
lineSearch
;
lineSearch
(
alpha
,
fv
,
false
);
//std::cout << "alpha: " << alpha << std::endl;
if
(
fv
.
scaling
()
<=
0.0
)
{
alpha
=
0.0
;
}
/* else {
LineSearchSolver lineSearch;
lineSearch(alpha, fv, false);
}*/
const
auto
&
domain
=
fv
.
domain
();
if
(
std
::
abs
(
domain
[
0
]
-
domain
[
1
])
>
safety
)
{
int
bisectionsteps
=
0
;
const
Bisection
globalBisection
(
0.0
,
1.0
,
0.0
,
0.0
);
alpha
=
globalBisection
.
minimize
(
fv
,
0.0
,
0.0
,
bisectionsteps
);
}
else
{
alpha
=
domain
[
0
];
}
std
::
cout
<<
"alpha: "
<<
alpha
<<
std
::
endl
;
linearPart
*=
alpha
;
linearPart
*=
alpha
;
//
std::cout << linearPart << std::endl;
std
::
cout
<<
linearPart
<<
std
::
endl
;
#ifdef NEW_TNNMG_COMPUTE_ITERATES_DIRECTLY
#ifdef NEW_TNNMG_COMPUTE_ITERATES_DIRECTLY
if
(
std
::
abs
(
alpha
)
>
safety
)
{
if
(
std
::
abs
(
alpha
)
>
safety
)
{
...
@@ -115,13 +145,14 @@ class LocalBisectionSolver
...
@@ -115,13 +145,14 @@ class LocalBisectionSolver
x
=
origin
;
x
=
origin
;
}
}
#else
#else
std
::
cout
<<
"use old"
<<
std
::
endl
;
if
(
std
::
abs
(
alpha
)
>
safety
)
{
if
(
std
::
abs
(
alpha
)
>
safety
)
{
x
=
origin
;
x
=
origin
;
x
+=
linearPart
;
x
+=
linearPart
;
//
x -= f.origin();
x
-=
old_x
;
//
f.origin();
}
}
#endif
#endif
//
std::cout << x << std::endl << std::endl;
std
::
cout
<<
"new x: "
<<
x
<<
std
::
endl
<<
std
::
endl
;
}
}
};
};
...
...
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