solver_option.h
Go to the documentation of this file.
#ifndef _RHEOLEF_SOLVER_OPTION_H
#define _RHEOLEF_SOLVER_OPTION_H
//
// This file is part of Rheolef.
//
// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
//
// Rheolef is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Rheolef is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Rheolef; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// =========================================================================
// AUTHOR: Pierre.Saramito@imag.fr
// DATE: 4 march 2011
namespace rheolef {
} // namespace rheolef
#include "rheolef/diststream.h"
#include "rheolef/csr.h"
namespace rheolef {
// [verbatim_solver_option]
class solver_option {
public:
typedef std::size_t size_type;
static const long int decide = -1;
mutable long int iterative;
Float tol;
size_type max_iter;
bool absolute_stopping;
mutable Float residue;
mutable size_type n_iter;
odiststream* p_err;
mutable std::string label;
size_type krylov_dimension;
size_type n_refinement;
bool compute_determinant;
std::string preferred_library;
size_type verbose_level;
bool do_check;
bool force_seq;
size_type level_of_fill;
size_type amalgamation;
size_type ooc;
// allocator and default values:
solver_option()
: iterative (decide),
#if defined(_RHEOLEF_HAVE_FLOAT128)
tol (1e6*std::numeric_limits<Float>::epsilon()),
#else
tol (1e3*std::numeric_limits<Float>::epsilon()),
#endif
max_iter (100000),
absolute_stopping (true),
residue (0),
n_iter (0),
p_err (&derr),
label (),
krylov_dimension (6),
n_refinement (2),
compute_determinant(false),
preferred_library(),
verbose_level (0),
do_check (false),
force_seq (false),
level_of_fill (1),
amalgamation (10),
ooc (20000)
{
}
solver_option (const solver_option&);
solver_option& operator= (const solver_option&);
template <class T, class M>
static std::string default_preferred_library (const csr<T,M>& a);
template <class T, class M>
static std::string used_library (const csr<T,M>& a, const solver_option& sopt = solver_option());
// [verbatim_solver_option]
protected:
static std::string _default_preferred_library (size_t dis_ext_nnz, bool is_sym, bool is_dp);
static std::string _used_library (std::string init_preferred_library, size_t dis_ext_nnz, bool is_sym, bool is_dp);
// [verbatim_solver_option_cont]
};
// [verbatim_solver_option_cont]
// for backward compatibility:
using solver_option_type = solver_option;
// ---------------------------------------------------------------
// inlined
// ---------------------------------------------------------------
inline
solver_option::solver_option (const solver_option& x)
: iterative (x.iterative),
tol (x.tol),
max_iter (x.max_iter),
absolute_stopping (x.absolute_stopping),
residue (x.residue),
n_iter (x.n_iter),
p_err (x.p_err),
label (x.label),
krylov_dimension (x.krylov_dimension),
n_refinement (x.n_refinement),
compute_determinant(x.compute_determinant),
preferred_library(x.preferred_library),
verbose_level (x.verbose_level),
do_check (x.do_check),
force_seq (x.force_seq),
level_of_fill (x.level_of_fill),
amalgamation (x.amalgamation),
ooc (x.ooc)
{
}
inline
solver_option&
solver_option::operator= (const solver_option& x)
{
iterative = x.iterative;
tol = x.tol;
max_iter = x.max_iter;
absolute_stopping = x.absolute_stopping;
residue = x.residue;
n_iter = x.n_iter;
p_err = x.p_err;
label = x.label;
krylov_dimension = x.krylov_dimension;
n_refinement = x.n_refinement;
compute_determinant= x.compute_determinant;
preferred_library= x.preferred_library;
verbose_level = x.verbose_level;
do_check = x.do_check;
force_seq = x.force_seq;
level_of_fill = x.level_of_fill;
amalgamation = x.amalgamation;
ooc = x.ooc;
return *this;
}
template <class T, class M>
inline
std::string
solver_option::default_preferred_library (const csr<T,M>& a)
{
return _default_preferred_library (a.dis_ext_nnz(), a.is_symmetric(), a.is_definite_positive());
}
template <class T, class M>
inline
std::string
solver_option::used_library (const csr<T,M>& a, const solver_option& sopt)
{
return _used_library (sopt.preferred_library, a.dis_ext_nnz(), a.is_symmetric(), a.is_definite_positive());
}
} // namespace rheolef
#endif // _RHEOLEF_SOLVER_OPTION_H
Float
see the Float page for the full documentation
rheolef::csr< T, M >
rheolef::odiststream
odiststream: see the diststream page for the full documentation
Definition: diststream.h:126
rheolef::solver_option
see the solver_option page for the full documentation
Definition: solver_option.h:155
rheolef::solver_option::level_of_fill
size_type level_of_fill
Definition: solver_option.h:174
rheolef::solver_option::force_seq
bool force_seq
Definition: solver_option.h:173
rheolef::solver_option::max_iter
size_type max_iter
Definition: solver_option.h:161
rheolef::solver_option::n_refinement
size_type n_refinement
Definition: solver_option.h:168
rheolef::solver_option::label
std::string label
Definition: solver_option.h:166
rheolef::solver_option::decide
static const long int decide
Definition: solver_option.h:158
rheolef::solver_option::default_preferred_library
static std::string default_preferred_library(const csr< T, M > &a)
Definition: solver_option.h:274
rheolef::solver_option::solver_option
solver_option()
Definition: solver_option.h:180
rheolef::solver_option::absolute_stopping
bool absolute_stopping
Definition: solver_option.h:162
rheolef::solver_option::amalgamation
size_type amalgamation
Definition: solver_option.h:175
rheolef::solver_option::ooc
size_type ooc
Definition: solver_option.h:176
rheolef::solver_option::krylov_dimension
size_type krylov_dimension
Definition: solver_option.h:167
rheolef::solver_option::p_err
odiststream * p_err
Definition: solver_option.h:165
rheolef::solver_option::n_iter
size_type n_iter
Definition: solver_option.h:164
rheolef::solver_option::size_type
std::size_t size_type
Definition: solver_option.h:157
rheolef::solver_option::compute_determinant
bool compute_determinant
Definition: solver_option.h:169
rheolef::solver_option::used_library
static std::string used_library(const csr< T, M > &a, const solver_option &sopt=solver_option())
Definition: solver_option.h:281
rheolef::solver_option::tol
Float tol
Definition: solver_option.h:160
rheolef::solver_option::do_check
bool do_check
Definition: solver_option.h:172
rheolef::solver_option::operator=
solver_option & operator=(const solver_option &)
Definition: solver_option.h:249
rheolef::solver_option::residue
Float residue
Definition: solver_option.h:163
rheolef::solver_option::preferred_library
std::string preferred_library
Definition: solver_option.h:170
rheolef::solver_option::_default_preferred_library
static std::string _default_preferred_library(size_t dis_ext_nnz, bool is_sym, bool is_dp)
Definition: solver_option.cc:41
rheolef::solver_option::verbose_level
size_type verbose_level
Definition: solver_option.h:171
rheolef::solver_option::_used_library
static std::string _used_library(std::string init_preferred_library, size_t dis_ext_nnz, bool is_sym, bool is_dp)
Definition: solver_option.cc:157
rheolef::solver_option::iterative
long int iterative
Definition: solver_option.h:159
rheolef::std
Definition: vec_expr_v2.h:402
rheolef::derr
odiststream derr(cerr)
see the diststream page for the full documentation
Definition: diststream.h:436
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
residue
field residue(Float p, const field &uh)
Definition: p_laplacian_post.cc:35
a
Definition: diffusion_isotropic.h:25
epsilon
Float epsilon
Definition: transmission_error.cc:25