Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-solvers
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
agnumpde
dune-solvers
Commits
b4807eba
Commit
b4807eba
authored
11 years ago
by
Oliver Sander
Committed by
sander
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Replace hard-coded 'double' by 'field_type'
[[Imported from SVN: r12436]]
parent
ac49582a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/solvers/solvers/tcgsolver.cc
+12
-12
12 additions, 12 deletions
dune/solvers/solvers/tcgsolver.cc
dune/solvers/solvers/tcgsolver.hh
+1
-1
1 addition, 1 deletion
dune/solvers/solvers/tcgsolver.hh
with
13 additions
and
13 deletions
dune/solvers/solvers/tcgsolver.cc
+
12
−
12
View file @
b4807eba
...
...
@@ -53,10 +53,10 @@ void TruncatedCGSolver<MatrixType, VectorType>::solve()
std
::
cout
<<
std
::
endl
;
}
doubl
e
error
=
std
::
numeric_limits
<
doubl
e
>::
max
();
field_typ
e
error
=
std
::
numeric_limits
<
field_typ
e
>::
max
();
doubl
e
normOfOldCorrection
=
0
;
doubl
e
totalConvRate
=
1
;
field_typ
e
normOfOldCorrection
=
0
;
field_typ
e
totalConvRate
=
1
;
this
->
maxTotalConvRate_
=
0
;
int
convRateCounter
=
0
;
...
...
@@ -67,7 +67,7 @@ void TruncatedCGSolver<MatrixType, VectorType>::solve()
VectorType
q
(
*
x_
);
// a temporary vector
// some local variables
doubl
e
rho
,
rholast
,
beta
;
field_typ
e
rho
,
rholast
,
beta
;
// determine initial search direction
p
=
0
;
// clear correction
...
...
@@ -82,9 +82,9 @@ void TruncatedCGSolver<MatrixType, VectorType>::solve()
rholast
=
p
*
b
;
// orthogonalization
doubl
e
solutionNormSquared
=
0
;
doubl
e
solutionTimesCorrection
=
0
;
doubl
e
correctionNormSquared
=
rholast
;
field_typ
e
solutionNormSquared
=
0
;
field_typ
e
solutionTimesCorrection
=
0
;
field_typ
e
correctionNormSquared
=
rholast
;
// Loop until desired tolerance or maximum number of iterations is reached
for
(
i
=
0
;
i
<
this
->
maxIterations_
&&
(
error
>
this
->
tolerance_
||
std
::
isnan
(
error
));
i
++
)
{
...
...
@@ -147,7 +147,7 @@ void TruncatedCGSolver<MatrixType, VectorType>::solve()
// minimize in given search direction p
matrix_
->
mv
(
p
,
q
);
// q=Ap
doubl
e
alpha
=
rholast
/
(
p
*
q
);
// scalar product
field_typ
e
alpha
=
rholast
/
(
p
*
q
);
// scalar product
// ////////////////////////////////////////////////////////////////////////
// Compute the new iterate. If it is outside of the admissible set
...
...
@@ -159,7 +159,7 @@ void TruncatedCGSolver<MatrixType, VectorType>::solve()
tentativeNewIterate
.
axpy
(
alpha
,
p
);
// update solution
// Compute length of this tentative new iterate
doubl
e
tentativeLengthSquared
=
solutionNormSquared
field_typ
e
tentativeLengthSquared
=
solutionNormSquared
+
2
*
alpha
*
solutionTimesCorrection
+
alpha
*
alpha
*
correctionNormSquared
;
...
...
@@ -221,17 +221,17 @@ void TruncatedCGSolver<MatrixType, VectorType>::solve()
// //////////////////////////////////////////////////
// Compute error
// //////////////////////////////////////////////////
doubl
e
oldNorm
=
errorNorm_
->
operator
()(
oldSolution
);
field_typ
e
oldNorm
=
errorNorm_
->
operator
()(
oldSolution
);
oldSolution
-=
*
x_
;
doubl
e
normOfCorrection
=
errorNorm_
->
operator
()(
oldSolution
);
field_typ
e
normOfCorrection
=
errorNorm_
->
operator
()(
oldSolution
);
if
(
this
->
useRelativeError_
)
error
=
normOfCorrection
/
oldNorm
;
else
error
=
normOfCorrection
;
doubl
e
convRate
=
normOfCorrection
/
normOfOldCorrection
;
field_typ
e
convRate
=
normOfCorrection
/
normOfOldCorrection
;
normOfOldCorrection
=
normOfCorrection
;
...
...
This diff is collapsed.
Click to expand it.
dune/solvers/solvers/tcgsolver.hh
+
1
−
1
View file @
b4807eba
...
...
@@ -86,7 +86,7 @@ public:
void
setProblem
(
const
MatrixType
&
matrix
,
VectorType
*
x
,
VectorType
*
rhs
,
doubl
e
trustRegionRadius
)
field_typ
e
trustRegionRadius
)
{
matrix_
=
&
matrix
;
x_
=
x
;
...
...
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