Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Chaofan Chen
ogs
Commits
9226e878
Commit
9226e878
authored
3 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
[MaL/LA/PETSc] LinearSolverOptionsParser templ. spezialisation.
parent
95606d68
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
MathLib/LinAlg/PETSc/LinearSolverOptionsParser.h
+68
-0
68 additions, 0 deletions
MathLib/LinAlg/PETSc/LinearSolverOptionsParser.h
with
68 additions
and
0 deletions
MathLib/LinAlg/PETSc/LinearSolverOptionsParser.h
0 → 100644
+
68
−
0
View file @
9226e878
/**
* \file
* \copyright
* Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#pragma once
#include
"BaseLib/ConfigTree.h"
#include
"MathLib/LinAlg/LinearSolverOptions.h"
#include
"MathLib/LinAlg/LinearSolverOptionsParser.h"
#include
"MathLib/LinAlg/PETSc/PETScLinearSolver.h"
namespace
MathLib
{
template
<
>
struct
LinearSolverOptionsParser
<
PETScLinearSolver
>
final
{
/// The method parses the linear solver options for PETSc.
/// @param solver_prefix the prefix for the linear solver to distinguish
/// different linear solvers for instance in the staggered schema
/// @param config the part of the property tree (usually created from the
/// linear solver section in the project file)
/// @return the first item of the returned tuple is the solver prefix as
/// string, the second item are all the options passed as string to PETSc
/// options database
std
::
tuple
<
std
::
string
,
std
::
string
>
parseNameAndOptions
(
std
::
string
solver_prefix
,
BaseLib
::
ConfigTree
const
*
const
config
)
const
{
// Insert options into petsc database. Default options are given in the
// string below.
std
::
string
petsc_options
=
"-ksp_type cg -pc_type bjacobi -ksp_rtol 1e-16 -ksp_max_it 10000"
;
if
(
config
)
{
ignoreOtherLinearSolvers
(
*
config
,
"petsc"
);
//! \ogs_file_param{prj__linear_solvers__linear_solver__petsc}
if
(
auto
const
subtree
=
config
->
getConfigSubtreeOptional
(
"petsc"
))
{
if
(
auto
const
parameters
=
//! \ogs_file_param{prj__linear_solvers__linear_solver__petsc__parameters}
subtree
->
getConfigParameterOptional
<
std
::
string
>
(
"parameters"
))
{
petsc_options
=
*
parameters
;
}
if
(
auto
const
pre
=
//! \ogs_file_param{prj__linear_solvers__linear_solver__petsc__prefix}
subtree
->
getConfigParameterOptional
<
std
::
string
>
(
"prefix"
))
{
if
(
!
pre
->
empty
())
solver_prefix
=
*
pre
+
"_"
;
}
}
}
return
{
solver_prefix
,
petsc_options
};
}
};
}
// namespace MathLib
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