Rheolef
7.1
an efficient C++ finite element environment
solver_option.h
Go to the documentation of this file.
1
#ifndef _RHEOLEF_SOLVER_OPTION_H
2
#define _RHEOLEF_SOLVER_OPTION_H
3
//
4
// This file is part of Rheolef.
5
//
6
// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
7
//
8
// Rheolef is free software; you can redistribute it and/or modify
9
// it under the terms of the GNU General Public License as published by
10
// the Free Software Foundation; either version 2 of the License, or
11
// (at your option) any later version.
12
//
13
// Rheolef is distributed in the hope that it will be useful,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
// GNU General Public License for more details.
17
//
18
// You should have received a copy of the GNU General Public License
19
// along with Rheolef; if not, write to the Free Software
20
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
//
22
// =========================================================================
23
// AUTHOR: Pierre.Saramito@imag.fr
24
// DATE: 4 march 2011
25
26
namespace
rheolef
{
147
}
// namespace rheolef
148
149
#include "rheolef/diststream.h"
150
#include "rheolef/csr.h"
151
152
namespace
rheolef
{
153
154
// [verbatim_solver_option]
155
class
solver_option
{
156
public
:
157
typedef
std::size_t
size_type
;
158
static
const
long
int
decide
= -1;
159
mutable
long
int
iterative
;
160
Float
tol
;
161
size_type
max_iter
;
162
bool
absolute_stopping
;
163
mutable
Float
residue
;
164
mutable
size_type
n_iter
;
165
odiststream
*
p_err
;
166
mutable
std::string
label
;
167
size_type
krylov_dimension
;
168
size_type
n_refinement
;
169
bool
compute_determinant
;
170
std::string
preferred_library
;
171
size_type
verbose_level
;
172
bool
do_check
;
173
bool
force_seq
;
174
size_type
level_of_fill
;
175
size_type
amalgamation
;
176
size_type
ooc
;
177
178
// allocator and default values:
179
180
solver_option
()
181
:
iterative
(
decide
),
182
#if defined(_RHEOLEF_HAVE_FLOAT128)
183
tol
(1e6*
std
::numeric_limits<
Float
>::
epsilon
()),
184
#else
185
tol
(1e3*
std
::numeric_limits<
Float
>::
epsilon
()),
186
#endif
187
max_iter
(100000),
188
absolute_stopping
(true),
189
residue
(0),
190
n_iter
(0),
191
p_err
(&
derr
),
192
label
(),
193
krylov_dimension
(6),
194
n_refinement
(2),
195
compute_determinant
(false),
196
preferred_library
(),
197
verbose_level
(0),
198
do_check
(false),
199
force_seq
(false),
200
level_of_fill
(1),
201
amalgamation
(10),
202
ooc
(20000)
203
{
204
}
205
solver_option
(
const
solver_option
&);
206
solver_option
&
operator=
(
const
solver_option
&);
207
template
<
class
T,
class
M>
208
static
std::string
default_preferred_library
(
const
csr<T,M>
&
a
);
209
template
<
class
T,
class
M>
210
static
std::string
used_library
(
const
csr<T,M>
&
a
,
const
solver_option
& sopt =
solver_option
());
211
// [verbatim_solver_option]
212
protected
:
213
static
std::string
_default_preferred_library
(
size_t
dis_ext_nnz,
bool
is_sym,
bool
is_dp);
214
static
std::string
_used_library
(std::string init_preferred_library,
size_t
dis_ext_nnz,
bool
is_sym,
bool
is_dp);
215
// [verbatim_solver_option_cont]
216
};
217
// [verbatim_solver_option_cont]
218
219
// for backward compatibility:
220
using
solver_option_type
=
solver_option
;
221
222
// ---------------------------------------------------------------
223
// inlined
224
// ---------------------------------------------------------------
225
inline
226
solver_option::solver_option
(
const
solver_option
& x)
227
: iterative (x.iterative),
228
tol (x.tol),
229
max_iter (x.max_iter),
230
absolute_stopping (x.absolute_stopping),
231
residue
(x.
residue
),
232
n_iter (x.n_iter),
233
p_err (x.p_err),
234
label (x.label),
235
krylov_dimension (x.krylov_dimension),
236
n_refinement (x.n_refinement),
237
compute_determinant(x.compute_determinant),
238
preferred_library(x.preferred_library),
239
verbose_level (x.verbose_level),
240
do_check (x.do_check),
241
force_seq (x.force_seq),
242
level_of_fill (x.level_of_fill),
243
amalgamation (x.amalgamation),
244
ooc (x.ooc)
245
{
246
}
247
inline
248
solver_option
&
249
solver_option::operator=
(
const
solver_option
& x)
250
{
251
iterative
= x.
iterative
;
252
tol
= x.
tol
;
253
max_iter
= x.
max_iter
;
254
absolute_stopping
= x.
absolute_stopping
;
255
residue
= x.
residue
;
256
n_iter
= x.
n_iter
;
257
p_err
= x.
p_err
;
258
label
= x.
label
;
259
krylov_dimension
= x.
krylov_dimension
;
260
n_refinement
= x.
n_refinement
;
261
compute_determinant
= x.
compute_determinant
;
262
preferred_library
= x.
preferred_library
;
263
verbose_level
= x.
verbose_level
;
264
do_check
= x.
do_check
;
265
force_seq
= x.
force_seq
;
266
level_of_fill
= x.
level_of_fill
;
267
amalgamation
= x.
amalgamation
;
268
ooc
= x.
ooc
;
269
return
*
this
;
270
}
271
template
<
class
T,
class
M>
272
inline
273
std::string
274
solver_option::default_preferred_library
(
const
csr<T,M>
&
a
)
275
{
276
return
_default_preferred_library
(
a
.dis_ext_nnz(),
a
.is_symmetric(),
a
.is_definite_positive());
277
}
278
template
<
class
T,
class
M>
279
inline
280
std::string
281
solver_option::used_library
(
const
csr<T,M>
&
a
,
const
solver_option
& sopt)
282
{
283
return
_used_library
(sopt.
preferred_library
,
a
.dis_ext_nnz(),
a
.is_symmetric(),
a
.is_definite_positive());
284
}
285
286
}
// namespace rheolef
287
#endif // _RHEOLEF_SOLVER_OPTION_H
rheolef::solver_option::n_iter
size_type n_iter
Definition:
solver_option.h:164
rheolef::solver_option::ooc
size_type ooc
Definition:
solver_option.h:176
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::amalgamation
size_type amalgamation
Definition:
solver_option.h:175
rheolef::solver_option::preferred_library
std::string preferred_library
Definition:
solver_option.h:170
rheolef::solver_option::max_iter
size_type max_iter
Definition:
solver_option.h:161
residue
field residue(Float p, const field &uh)
Definition:
p_laplacian_post.cc:35
rheolef::solver_option::residue
Float residue
Definition:
solver_option.h:163
rheolef::solver_option::absolute_stopping
bool absolute_stopping
Definition:
solver_option.h:162
rheolef::solver_option::operator=
solver_option & operator=(const solver_option &)
Definition:
solver_option.h:249
rheolef::solver_option::label
std::string label
Definition:
solver_option.h:166
rheolef::solver_option::krylov_dimension
size_type krylov_dimension
Definition:
solver_option.h:167
rheolef::solver_option::verbose_level
size_type verbose_level
Definition:
solver_option.h:171
a
Definition:
diffusion_isotropic.h:25
rheolef::solver_option::size_type
std::size_t size_type
Definition:
solver_option.h:157
rheolef::solver_option::do_check
bool do_check
Definition:
solver_option.h:172
rheolef::csr
see the csr page for the full documentation
Definition:
asr.h:31
rheolef::solver_option::level_of_fill
size_type level_of_fill
Definition:
solver_option.h:174
rheolef::solver_option::tol
Float tol
Definition:
solver_option.h:160
rheolef
This file is part of Rheolef.
Definition:
compiler_eigen.h:37
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::n_refinement
size_type n_refinement
Definition:
solver_option.h:168
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::derr
odiststream derr(cerr)
see the diststream page for the full documentation
Definition:
diststream.h:436
rheolef::odiststream
odiststream: see the diststream page for the full documentation
Definition:
diststream.h:126
Float
see the Float page for the full documentation
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::compute_determinant
bool compute_determinant
Definition:
solver_option.h:169
rheolef::solver_option::solver_option
solver_option()
Definition:
solver_option.h:180
rheolef::solver_option::iterative
long int iterative
Definition:
solver_option.h:159
epsilon
Float epsilon
Definition:
transmission_error.cc:25
rheolef::solver_option::force_seq
bool force_seq
Definition:
solver_option.h:173
rheolef::std
Definition:
vec_expr_v2.h:391
rheolef::solver_option::decide
static const long int decide
Definition:
solver_option.h:158
rheolef::solver_option::p_err
odiststream * p_err
Definition:
solver_option.h:165
rheolef::solver_option
see the solver_option page for the full documentation
Definition:
solver_option.h:155