You are here:
Concepts
>
Concepts Web
>
Class documentation
Class documentation of Concepts
Loading...
Searching...
No Matches
operator
PETScFabric.hh
Go to the documentation of this file.
1
6
#ifndef petscFabric_hh
7
#define petscFabric_hh
8
9
#include <list>
10
#include "
operator/PETSc.hh
"
11
#include "
operator/solverFabric.hh
"
12
13
namespace
concepts
{
14
15
// *********************************************************** PETScFabric **
16
30
class
PETScFabric
:
public
SolverFabric
<Real> {
31
public
:
37
PETScFabric
(
const
Real
maxeps
,
const
std::string
ksptype
,
38
const
std::string
pctype
= std::string(
"none"
))
39
: maxeps_(
maxeps
), ksptype_(
ksptype
), pctype_(
pctype
) {}
40
virtual
Operator<Real>
*
operator()
(
Operator<Real>
& matrix) {
41
if
(pctype_ ==
"none"
||
dynamic_cast<
concepts::PETScMat
*
>
(&matrix)) {
42
return
new
PETSc
(matrix, maxeps_, ksptype_, pctype_);
43
}
else
{
44
concepts::SparseMatrix<Real>
*
sparsemat
=
45
dynamic_cast<
concepts::SparseMatrix<Real>
*
>
(&matrix);
46
if
(
sparsemat
) {
47
petscmat_.push_front(
new
concepts::PETScMat
(*
sparsemat
));
48
}
else
{
49
sparsemat
=
new
concepts::SparseMatrix<Real>
(matrix);
50
petscmat_.push_front(
new
concepts::PETScMat
(*
sparsemat
));
51
delete
sparsemat
;
52
}
53
return
new
PETSc(*(petscmat_.front()), maxeps_, ksptype_, pctype_);
54
}
55
}
56
~PETScFabric() {
57
while
(!petscmat_.empty()) {
58
delete
petscmat_.front();
59
petscmat_.pop_front();
60
}
61
}
62
protected
:
63
virtual
std::ostream&
info
(std::ostream&
os
)
const
{
64
return
os
<<
concepts::typeOf
(*
this
)<<
"(maxeps = "
<< maxeps_ <<
", ksptype = "
65
<< ksptype_ <<
", pctype = "
<< pctype_ <<
")"
;
66
}
67
private
:
69
const
Real
maxeps_;
71
const
std::string ksptype_;
73
const
std::string pctype_;
75
std::list<concepts::PETScMat*> petscmat_;
76
};
77
78
}
// concepts
79
80
#endif
// petscFabric_hh
PETSc.hh
concepts::Operator
Definition
compositions.hh:42
concepts::PETScFabric
Definition
PETScFabric.hh:30
concepts::PETScFabric::info
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Definition
PETScFabric.hh:63
concepts::PETScFabric::PETScFabric
PETScFabric(const Real maxeps, const std::string ksptype, const std::string pctype=std::string("none"))
Definition
PETScFabric.hh:37
concepts::PETScMat
Definition
PETSc.hh:148
concepts::PETSc
Definition
PETSc.hh:74
concepts::SolverFabric
Definition
solverFabric.hh:22
concepts::SolverFabric< Real >::operator()
virtual Operator< Real > * operator()()=0
concepts::SparseMatrix
Definition
sparseMatrix.hh:65
concepts
Definition
pml_formula.h:16
concepts::typeOf
std::string typeOf(const T &t)
Definition
output.hh:43
concepts::Real
double Real
Definition
typedefs.hh:39
concepts::makeSet
Set< F > makeSet(uint n, const F &first,...)
Definition
set.hh:320
solverFabric.hh
Generated on Wed Sep 13 2023 21:06:23 for Concepts by
1.9.8