Flow123d  jenkins-Flow123d-windows32-release-multijob-28
solve.h
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2007 Technical University of Liberec. All rights reserved.
4  *
5  * Please make a following refer to Flow123d on your project site if you use the program for any purpose,
6  * especially for academic research:
7  * Flow123d, Research Centre: Advanced Remedial Technologies, Technical University of Liberec, Czech Republic
8  *
9  * This program is free software; you can redistribute it and/or modify it under the terms
10  * of the GNU General Public License version 3 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along with this program; if not,
17  * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 021110-1307, USA.
18  *
19  *
20  * $Id$
21  * $Revision$
22  * $LastChangedBy$
23  * $LastChangedDate$
24  *
25  * @file
26  * @brief Unified interface to various solvers
27  *
28  * aim: simplified interface to PETSC solvers, Mat, Vec
29  * - independent of Seq-MPI
30  * - application to parallel PETSC mapping
31  * - preallocation by abstract assembly
32  *
33  * @todo
34  * - samostatny objekt LS
35  * - samostatne objekty pro matici a vektor
36  * - objekty pro mapovani indexu a jejich automaticke pouziti pri asemblaci
37  * - podminene veci jako LS View a old_4_new
38  * - funkcni stavy LS
39  * - solve jako metoda
40  * - nastaveni parametru na volajici strane (zavisle na problemu)
41  */
42 
43 #include "input/input_type.hh"
44 #include "input/accessors.hh"
45 #include "la/linsys.hh"
46 
47 #ifndef SOLVE_H
48 #define SOLVE_H
49 
50 /*!************************************************
51  * ISOL specific parameters
52  **************************************/
53 // Specific parameters for ISOL solver
54 typedef struct ISOL_params {
55  char* method; //!< Iteration method
56  int restart; //!< num of iter. of restart of GMRES
57  char* stop_crit; //!< Stoping criterion
58  double be_tol; //!< Backward error tolerance
59  int stop_check; //!< Stop check
60  char* scaling; //!< Scaling method
61  char* precond; //!< Type od preconditioning
62  double sor_omega; //!< Relaxation parameter
63  /// @name ILU preconditioner parameters
64  ///@{
65  double ilu_droptol; //!< drop tolerance
66  int ilu_milu; //
67  int ilu_cpiv;
68  int ilu_dskip;
69  int ilu_lfil;
70  ///@}
71 } ISOL_params;
72 
73 
74 /*!************************************************************
75  * @name Solver Type
76  */
77 typedef enum {
79  SI2=1,
80  GI8=2,
81  MATLAB=4,
83  ISOL=7,
86 } SolverType;
87 
88 
89 /*!**************************************************************
90  * Solver structure - no matrix, but parameters ...
91  **************************************************************/
92 struct Solver {
93 public:
97 
98  int some_func();
99 
100 
101 
102  SolverType type; //!< type of the solver
103  char *name; //!< Name of the solver
104  char *executable; //!< full path to the external solver executable file
105  struct LinSys *LinSys; //!< System to solve
106  char external; //!< run an external progam as a solver
107  char manual_run; //!< Run solver manualy ?
108  char use_ctrl_file; //!< User provided control file ?
109  const char *ctrl_file; //!< Name of control file
110  string params; //!< Solver's comamnd line parameters
111  char keep_files; //!< Keep or remove solver files?
112  int use_last_sol; //!< Use last known solution? (should be in water module)
113 
114  //@{
115  //! solver parameters
116  int max_it; //!< Max. number of iterations
117  double r_tol; //!< Relative tolerance
118  double a_tol; //!< Absolute tolerance
119  ISOL_params *isol_params; //!< optional ISOL parameters
120  //@}
121 };
122 
123 // public functions
125 void solve_system( Solver*, LinSys *lin_system);
126 
127 #endif
128 //-----------------------------------------------------------------------------
129 // vim: set cindent:
int use_last_sol
Use last known solution? (should be in water module)
Definition: solve.h:112
char * stop_crit
Stoping criterion.
Definition: solve.h:57
char * name
Name of the solver.
Definition: solve.h:103
double sor_omega
Definition: solve.h:62
char external
run an external progam as a solver
Definition: solve.h:106
char keep_files
Keep or remove solver files?
Definition: solve.h:111
Definition: solve.h:81
Wrappers for linear systems based on MPIAIJ and MATIS format.
static Input::Type::AbstractRecord input_type
Definition: solve.h:94
static Input::Type::Record input_type_petsc
Definition: solve.h:95
Definition: solve.h:83
static Input::Type::Record input_type_bddc
Definition: solve.h:96
double ilu_droptol
drop tolerance
Definition: solve.h:65
void solver_init(Solver *, Input::AbstractRecord in_rec)
Initialize a solver structure.
Definition: solve.cc:99
int stop_check
Stop check.
Definition: solve.h:59
int ilu_milu
Definition: solve.h:66
double a_tol
Absolute tolerance.
Definition: solve.h:118
int ilu_dskip
Definition: solve.h:68
char manual_run
Run solver manualy ?
Definition: solve.h:107
char * scaling
Scaling method.
Definition: solve.h:60
Definition: solve.h:79
char use_ctrl_file
User provided control file ?
Definition: solve.h:108
Definition: solve.h:78
void solve_system(Solver *, LinSys *lin_system)
Solves a given linear system.
Definition: solve.cc:178
struct ISOL_params ISOL_params
Class for declaration of polymorphic Record.
Definition: type_record.hh:467
int ilu_cpiv
Definition: solve.h:67
int restart
num of iter. of restart of GMRES
Definition: solve.h:56
int some_func()
int max_it
solver parameters
Definition: solve.h:116
Accessor to the polymorphic input data of a type given by an AbstracRecord object.
Definition: accessors.hh:423
Definition: solve.h:80
SolverType type
type of the solver
Definition: solve.h:102
SolverType
Definition: solve.h:77
Definition: solve.h:92
double r_tol
Relative tolerance.
Definition: solve.h:117
double be_tol
Backward error tolerance.
Definition: solve.h:58
char * executable
full path to the external solver executable file
Definition: solve.h:104
Abstract linear system class.
int ilu_lfil
Definition: solve.h:69
Record type proxy class.
Definition: type_record.hh:161
char * precond
Type od preconditioning.
Definition: solve.h:61
string params
Solver's comamnd line parameters.
Definition: solve.h:110
ISOL_params * isol_params
optional ISOL parameters
Definition: solve.h:119
const char * ctrl_file
Name of control file.
Definition: solve.h:109
char * method
Iteration method.
Definition: solve.h:55
struct LinSys * LinSys
System to solve.
Definition: solve.h:105