Flow123d  jenkins-Flow123d-windows32-release-multijob-51
linsys_BDDC.hh
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: la_linsys.hh 1299 2011-08-23 21:42:50Z jakub.sistek $
21  * $Revision: 1299 $
22  * $LastChangedBy: jakub.sistek $
23  * $LastChangedDate: 2011-08-23 23:42:50 +0200 (Tue, 23 Aug 2011) $
24  *
25  * @file
26  * @brief Solver based on Multilevel BDDC - using corresponding class of OpenFTL package
27  * @author Jakub Sistek
28  *
29  *
30  */
31 
32 #ifndef LA_LINSYS_BDDC_HH_
33 #define LA_LINSYS_BDDC_HH_
34 
35 // derived from base linsys
36 #include "mesh/mesh.h"
37 #include "la/linsys.hh"
38 #include "input/input_type.hh"
39 #include "input/accessors.hh"
40 
41 #include <vector>
42 
43 namespace la {
44  class BddcmlWrapper;
45 };
46 
47 class LinSys_BDDC : public LinSys
48 {
49 
50 public:
52 
53  LinSys_BDDC( const unsigned numDofsSub,
54  const Distribution * rows_ds,
55  const int matrixTypeInt = 0,
56  const int numSubLoc = 1,
57  const bool swap_sign = false );
58 
59  void load_mesh( const int nDim, const int numNodes, const int numDofs,
60  const std::vector<int> & inet,
61  const std::vector<int> & nnet,
62  const std::vector<int> & nndf,
63  const std::vector<int> & isegn,
64  const std::vector<int> & isngn,
65  const std::vector<int> & isvgvn,
66  const std::vector<double> & xyz,
67  const std::vector<double> & element_permeability,
68  const int meshDim );
69 
70  void mat_set_values( int nrow, int *rows, int ncol, int *cols, double *vals );
71 
72  void rhs_set_values( int nrow, int *rows, double *vals );
73 
74  void diagonal_weights_set_value( int global_index, double value );
75 
76  PetscErrorCode mat_zero_entries() override;
77 
78  PetscErrorCode rhs_zero_entries() override;
79 
80  void finish_assembly( );
81 
82  void apply_constrains( double scalar = 1. );
83 
84  int solve();
85 
86  void set_from_input(const Input::Record in_rec);
87 
88  double get_solution_precision();
89 
90  ~LinSys_BDDC( );
91 
92 //private:
93 
94  //void gatherSolution_( );
95 
96 private:
97 
98  //! parameters expected from input file:
99  int max_nondecr_it_; //!< maximum number of iterations of linear solver with non-decreasing residual
100  int number_of_levels_; //!< number of levels in the multilevel method
101  bool use_adaptive_bddc_; //!< should adaptive BDDC be used?
102  int bddcml_verbosity_level_; //!< level of verbosity of BDDCML library
103  //!< ( 0 - only fatal errors reported,
104  //!< 1 - mild output,
105  //!< 2 - detailed output )//!< should adaptive BDDC be used?
106 
107  const bool swap_sign_; //!< swap sign of matrix and rhs entries, e.g. to make the matrix SPD
108 
109  std::vector<int> isngn_; //!< indices of subdomain nodes in global numbering
110  std::vector<double> locSolution_; //!< subdomain solution
111  Vec locSolVec_; //!< local solution PETSc vector - sequential
112  VecScatter VSpetscToSubScatter_; //!< scatter from solution_ to locSolVec_
113 
115  Bddcml_ * bddcml_; //!< BDDCML wrapper
116 };
117 
118 #endif /* LA_LINSYS_BDDC_HH_ */
int bddcml_verbosity_level_
Definition: linsys_BDDC.hh:102
void mat_set_values(int nrow, int *rows, int ncol, int *cols, double *vals)
Definition: linsys_BDDC.cc:163
VecScatter VSpetscToSubScatter_
scatter from solution_ to locSolVec_
Definition: linsys_BDDC.hh:112
std::vector< int > isngn_
indices of subdomain nodes in global numbering
Definition: linsys_BDDC.hh:109
PetscErrorCode rhs_zero_entries() override
Definition: linsys_BDDC.cc:224
Wrappers for linear systems based on MPIAIJ and MATIS format.
???
void load_mesh(const int nDim, const int numNodes, const int numDofs, const std::vector< int > &inet, const std::vector< int > &nnet, const std::vector< int > &nndf, const std::vector< int > &isegn, const std::vector< int > &isngn, const std::vector< int > &isvgvn, const std::vector< double > &xyz, const std::vector< double > &element_permeability, const int meshDim)
Definition: linsys_BDDC.cc:112
void rhs_set_values(int nrow, int *rows, double *vals)
Definition: linsys_BDDC.cc:188
bool use_adaptive_bddc_
should adaptive BDDC be used?
Definition: linsys_BDDC.hh:101
Vec locSolVec_
local solution PETSc vector - sequential
Definition: linsys_BDDC.hh:111
Accessor to the data with type Type::Record.
Definition: accessors.hh:308
int max_nondecr_it_
parameters expected from input file:
Definition: linsys_BDDC.hh:99
void diagonal_weights_set_value(int global_index, double value)
Definition: linsys_BDDC.cc:209
const bool swap_sign_
swap sign of matrix and rhs entries, e.g. to make the matrix SPD
Definition: linsys_BDDC.hh:107
double get_solution_precision()
Definition: linsys_BDDC.cc:361
int number_of_levels_
number of levels in the multilevel method
Definition: linsys_BDDC.hh:100
la::BddcmlWrapper Bddcml_
Definition: linsys_BDDC.hh:114
static Input::Type::Record input_type
Definition: linsys_BDDC.hh:51
Bddcml_ * bddcml_
BDDCML wrapper.
Definition: linsys_BDDC.hh:115
PetscErrorCode mat_zero_entries() override
Definition: linsys_BDDC.cc:216
Abstract linear system class.
void apply_constrains(double scalar=1.)
Definition: linsys_BDDC.cc:239
Record type proxy class.
Definition: type_record.hh:161
void finish_assembly()
Definition: linsys_BDDC.cc:232
std::vector< double > locSolution_
subdomain solution
Definition: linsys_BDDC.hh:110
LinSys_BDDC(const unsigned numDofsSub, const Distribution *rows_ds, const int matrixTypeInt=0, const int numSubLoc=1, const bool swap_sign=false)
Definition: linsys_BDDC.cc:61
Multilevel BDDC based linear system solver.
void set_from_input(const Input::Record in_rec)
Definition: linsys_BDDC.cc:280