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
1ecef7c8
Commit
1ecef7c8
authored
3 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
[MaL/LA/Eigen] Rm. unnecessary constructor / setOption.
parent
0fbee00e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MathLib/LinAlg/Eigen/EigenLinearSolver.cpp
+0
-107
0 additions, 107 deletions
MathLib/LinAlg/Eigen/EigenLinearSolver.cpp
MathLib/LinAlg/Eigen/EigenLinearSolver.h
+0
-19
0 additions, 19 deletions
MathLib/LinAlg/Eigen/EigenLinearSolver.h
with
0 additions
and
126 deletions
MathLib/LinAlg/Eigen/EigenLinearSolver.cpp
+
0
−
107
View file @
1ecef7c8
...
...
@@ -23,11 +23,9 @@
#include
<unsupported/Eigen/src/IterativeSolvers/Scaling.h>
#endif
#include
"BaseLib/ConfigTree.h"
#include
"EigenMatrix.h"
#include
"EigenTools.h"
#include
"EigenVector.h"
#include
"MathLib/LinAlg/LinearSolverOptions.h"
namespace
MathLib
{
...
...
@@ -219,51 +217,6 @@ std::unique_ptr<EigenLinearSolverBase> createIterativeSolver(
}
// namespace details
EigenLinearSolver
::
EigenLinearSolver
(
const
std
::
string
&
/*solver_name*/
,
const
BaseLib
::
ConfigTree
*
const
option
)
{
using
Matrix
=
EigenMatrix
::
RawMatrixType
;
if
(
option
)
{
setOption
(
*
option
);
}
// TODO for my taste it is much too unobvious that the default solver type
// currently is SparseLU.
switch
(
option_
.
solver_type
)
{
case
EigenOption
::
SolverType
::
SparseLU
:
{
using
SolverType
=
Eigen
::
SparseLU
<
Matrix
,
Eigen
::
COLAMDOrdering
<
int
>>
;
solver_
=
std
::
make_unique
<
details
::
EigenDirectLinearSolver
<
SolverType
>>
();
return
;
}
case
EigenOption
::
SolverType
::
BiCGSTAB
:
case
EigenOption
::
SolverType
::
CG
:
case
EigenOption
::
SolverType
::
GMRES
:
solver_
=
details
::
createIterativeSolver
(
option_
.
solver_type
,
option_
.
precon_type
);
return
;
case
EigenOption
::
SolverType
::
PardisoLU
:
{
#ifdef USE_MKL
using
SolverType
=
Eigen
::
PardisoLU
<
EigenMatrix
::
RawMatrixType
>
;
solver_
.
reset
(
new
details
::
EigenDirectLinearSolver
<
SolverType
>
);
return
;
#else
OGS_FATAL
(
"The code is not compiled with Intel MKL. Linear solver type "
"PardisoLU is not available."
);
#endif
}
}
OGS_FATAL
(
"Invalid Eigen linear solver type. Aborting."
);
}
EigenLinearSolver
::
EigenLinearSolver
(
std
::
string
const
&
/*solver_name*/
,
EigenOption
const
&
option
)
:
option_
(
option
)
...
...
@@ -305,66 +258,6 @@ EigenLinearSolver::EigenLinearSolver(std::string const& /*solver_name*/,
EigenLinearSolver
::~
EigenLinearSolver
()
=
default
;
void
EigenLinearSolver
::
setOption
(
BaseLib
::
ConfigTree
const
&
option
)
{
ignoreOtherLinearSolvers
(
option
,
"eigen"
);
//! \ogs_file_param{prj__linear_solvers__linear_solver__eigen}
auto
const
ptSolver
=
option
.
getConfigSubtreeOptional
(
"eigen"
);
if
(
!
ptSolver
)
{
return
;
}
if
(
auto
solver_type
=
//! \ogs_file_param{prj__linear_solvers__linear_solver__eigen__solver_type}
ptSolver
->
getConfigParameterOptional
<
std
::
string
>
(
"solver_type"
))
{
option_
.
solver_type
=
MathLib
::
EigenOption
::
getSolverType
(
*
solver_type
);
}
if
(
auto
precon_type
=
//! \ogs_file_param{prj__linear_solvers__linear_solver__eigen__precon_type}
ptSolver
->
getConfigParameterOptional
<
std
::
string
>
(
"precon_type"
))
{
option_
.
precon_type
=
MathLib
::
EigenOption
::
getPreconType
(
*
precon_type
);
}
if
(
auto
error_tolerance
=
//! \ogs_file_param{prj__linear_solvers__linear_solver__eigen__error_tolerance}
ptSolver
->
getConfigParameterOptional
<
double
>
(
"error_tolerance"
))
{
option_
.
error_tolerance
=
*
error_tolerance
;
}
if
(
auto
max_iteration_step
=
//! \ogs_file_param{prj__linear_solvers__linear_solver__eigen__max_iteration_step}
ptSolver
->
getConfigParameterOptional
<
int
>
(
"max_iteration_step"
))
{
option_
.
max_iterations
=
*
max_iteration_step
;
}
if
(
auto
scaling
=
//! \ogs_file_param{prj__linear_solvers__linear_solver__eigen__scaling}
ptSolver
->
getConfigParameterOptional
<
bool
>
(
"scaling"
))
{
#ifdef USE_EIGEN_UNSUPPORTED
option_
.
scaling
=
*
scaling
;
#else
OGS_FATAL
(
"The code is not compiled with the Eigen unsupported modules. "
"scaling is not available."
);
#endif
}
if
(
auto
restart
=
//! \ogs_file_param{prj__linear_solvers__linear_solver__eigen__restart}
ptSolver
->
getConfigParameterOptional
<
int
>
(
"restart"
))
{
#ifdef USE_EIGEN_UNSUPPORTED
option_
.
restart
=
*
restart
;
#else
OGS_FATAL
(
"The code is not compiled with the Eigen unsupported modules. "
"GMRES/GMRES option restart is not available."
);
#endif
}
}
bool
EigenLinearSolver
::
solve
(
EigenMatrix
&
A
,
EigenVector
&
b
,
EigenVector
&
x
)
{
INFO
(
"------------------------------------------------------------------"
);
...
...
This diff is collapsed.
Click to expand it.
MathLib/LinAlg/Eigen/EigenLinearSolver.h
+
0
−
19
View file @
1ecef7c8
...
...
@@ -15,11 +15,6 @@
#include
"EigenOption.h"
namespace
BaseLib
{
class
ConfigTree
;
}
namespace
MathLib
{
class
EigenMatrix
;
...
...
@@ -34,15 +29,6 @@ public:
* Constructor
* @param solver_name A name used as a prefix for command line options
* if there are such options available.
* @param option A pointer to a linear solver option. In case you omit
* this argument, default settings follow those of
* LisOption struct.
*/
EigenLinearSolver
(
const
std
::
string
&
solver_name
,
BaseLib
::
ConfigTree
const
*
const
option
);
/**
* Constructor
* @param option Eigen linear solver options.
*/
explicit
EigenLinearSolver
(
std
::
string
const
&
solver_name
,
...
...
@@ -50,11 +36,6 @@ public:
~
EigenLinearSolver
();
/**
* parse linear solvers configuration
*/
void
setOption
(
const
BaseLib
::
ConfigTree
&
option
);
/**
* copy linear solvers options
*/
...
...
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