Flow123d
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: