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
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
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
Patrick Jaap
dune-solvers
Commits
dac89531
Commit
dac89531
authored
8 years ago
by
Max Kahnt
Browse files
Options
Downloads
Patches
Plain Diff
Add doc and factory for new BlockGS local solver GS.
parent
be43d374
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/iterationsteps/blockgssteps.cc
+2
-0
2 additions, 0 deletions
dune/solvers/iterationsteps/blockgssteps.cc
dune/solvers/iterationsteps/blockgssteps.hh
+27
-14
27 additions, 14 deletions
dune/solvers/iterationsteps/blockgssteps.hh
with
29 additions
and
14 deletions
dune/solvers/iterationsteps/blockgssteps.cc
+
2
−
0
View file @
dac89531
...
...
@@ -33,6 +33,8 @@ namespace Solvers {
t
=
BlockGSType
::
LDLt
;
else
if
(
s
==
"cg"
)
t
=
BlockGSType
::
CG
;
else
if
(
s
==
"gs"
)
t
=
BlockGSType
::
GS
;
else
lhs
.
setstate
(
std
::
ios_base
::
failbit
);
return
lhs
;
...
...
This diff is collapsed.
Click to expand it.
dune/solvers/iterationsteps/blockgssteps.hh
+
27
−
14
View file @
dac89531
...
...
@@ -121,25 +121,29 @@ VBlock cg(const MBlock& m, VBlock r, size_t maxIter = defaultCgMaxIter,
return
x
;
}
static
constexpr
double
defaultGsTol
=
9e-11
;
static
constexpr
double
defaultGsTol
=
0.0
;
//! \brief Solves a block problem using the conjugate gradient method.
/**
* \brief Solves a block problem using a single Gauss--Seidel iteration.
* \param tol Lines with diagonal entries below this value are skipped and
* their respective solutions are set to 0.
*/
template
<
class
MBlock
,
class
VBlock
>
VBlock
gs
(
const
MBlock
&
m
,
const
VBlock
&
b
,
double
tol
=
defaultGsTol
)
{
VBlock
x
(
0
);
for
(
size_t
i
=
0
;
i
<
m
.
N
();
++
i
)
{
const
auto
&
mi
=
m
[
i
];
const
auto
&
mii
=
mi
[
i
];
if
(
std
::
abs
(
mii
)
>
tol
)
{
x
[
i
]
=
b
[
i
];
const
auto
&
end
=
mi
.
end
();
for
(
auto
it
=
mi
.
begin
();
it
!=
end
;
++
it
)
{
auto
j
=
it
.
index
();
if
(
j
!=
i
)
x
[
i
]
-=
(
*
it
)
*
x
[
j
];
}
x
[
i
]
/=
mii
;
if
(
std
::
abs
(
mii
)
<=
tol
)
continue
;
x
[
i
]
=
b
[
i
];
const
auto
&
end
=
mi
.
end
();
for
(
auto
it
=
mi
.
begin
();
it
!=
end
;
++
it
)
{
auto
j
=
it
.
index
();
if
(
j
!=
i
)
x
[
i
]
-=
(
*
it
)
*
x
[
j
];
}
x
[
i
]
/=
mii
;
}
return
x
;
}
...
...
@@ -267,8 +271,12 @@ auto cg(size_t maxIter = LinearSolvers::defaultCgMaxIter,
};
}
//! \brief is @LinearSolvers::direct with ignore nodes.
//! \param r Regularization parameter. Set to 0.0 to switch off regularization.
/**
* \brief is @LinearSolvers::gs with ignore nodes.
* \param tol Tolerance value for skipping potentially zero diagonal entries
* after regularization.
* \param r Regularization parameter. Set to 0.0 to switch off regularization.
*/
template
<
typename
dummy
=
void
>
auto
gs
(
double
tol
=
LinearSolvers
::
defaultGsTol
,
double
r
=
LocalSolverRegularizer
::
defaultDiagRegularizeParameter
)
{
...
...
@@ -318,7 +326,7 @@ private:
* @brief The Type enum provides representatives for (new) block Gauss-Seidel
* steps that can be constructed via the @BlockGSStepFactory.
*/
enum
class
BlockGSType
{
Direct
,
LDLt
,
CG
};
enum
class
BlockGSType
{
Direct
,
LDLt
,
CG
,
GS
};
/**
* @brief Provides support to parse the @BlockGSType enum.
...
...
@@ -375,6 +383,11 @@ struct BlockGSStepFactory {
config
.
get
(
"tol"
,
BlockGS
::
LocalSolvers
::
LinearSolvers
::
defaultCgTol
);
return
createPtr
(
BlockGS
::
LocalSolvers
::
cg
(
maxIter
,
tol
,
reg
),
dir
);
}
case
BlockGSType
::
GS
:
{
auto
tol
=
config
.
get
(
"tol"
,
BlockGS
::
LocalSolvers
::
LinearSolvers
::
defaultGsTol
);
return
createPtr
(
BlockGS
::
LocalSolvers
::
gs
(
tol
,
reg
),
dir
);
}
default
:
DUNE_THROW
(
Dune
::
NotImplemented
,
"Factory cannot create this BlockGSType."
);
...
...
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