3 #ifndef DUNE_ISTL_SCALARPRODUCTS_HH 4 #define DUNE_ISTL_SCALARPRODUCTS_HH 12 #include <dune/common/exceptions.hh> 51 typedef typename FieldTraits<field_type>::real_type
real_type;
57 virtual field_type
dot (
const X& x,
const X& y) = 0;
62 virtual real_type
norm (
const X& x) = 0;
66 #if DUNE_ISTL_SUPPORT_OLD_CATEGORY_INTERFACE 68 DUNE_THROW(Dune::Exception,
"It is necessary to implement the category method in a derived classes, in the future this method will pure virtual.");
90 typedef typename FieldTraits<field_type>::real_type
real_type;
96 virtual field_type
dot (
const X& x,
const X& y)
104 virtual real_type
norm (
const X& x)
122 template<
class X,
class C>
131 typedef typename FieldTraits<field_type>::real_type
real_type;
147 virtual field_type
dot (
const X& x,
const X& y)
149 field_type result(0);
150 communication.dot(x,y,result);
157 virtual real_type
norm (
const X& x)
159 return communication.norm(x);
172 communication.copyOwnerToAll(x,x);
176 const communication_type& communication;
190 template<
class X,
class C>
201 typedef typename FieldTraits<field_type>::real_type
real_type;
220 virtual field_type
dot (
const X& x,
const X& y)
222 field_type result(0);
223 communication.dot(x,y,result);
230 virtual real_type
norm (
const X& x)
232 return communication.norm(x);
242 const communication_type& communication;
258 template<
class X,
class Comm>
265 std::make_shared<SeqScalarProduct<X>>();
268 std::make_shared<NonoverlappingSchwarzScalarProduct<X,Comm>>(comm);
271 std::make_shared<OverlappingSchwarzScalarProduct<X,Comm>>(comm);
273 DUNE_THROW(InvalidStateException,
"unknown solver category");
X::field_type field_type
Definition: scalarproducts.hh:89
X domain_type
export types
Definition: scalarproducts.hh:88
virtual field_type dot(const X &x, const X &y)
Dot product of two vectors. In the complex case, the first argument is conjugated. It is assumed that the vectors are consistent on the interior+border partition.
Definition: scalarproducts.hh:96
virtual SolverCategory::Category category() const
Category of the scalar product (see SolverCategory::Category)
Definition: scalarproducts.hh:163
Definition: allocator.hh:7
virtual SolverCategory::Category category() const =0
Category of the scalar product (see SolverCategory::Category)
virtual real_type norm(const X &x)
Norm of a right-hand side vector. The vector must be consistent on the interior+border partition...
Definition: scalarproducts.hh:230
FieldTraits< field_type >::real_type real_type
Definition: scalarproducts.hh:51
void make_consistent(X &x) const
make additive vector consistent
Definition: scalarproducts.hh:170
OverlappingSchwarzScalarProduct(const communication_type &com)
Constructor needs to know the grid.
Definition: scalarproducts.hh:212
C communication_type
The type of the communication object.
Definition: scalarproducts.hh:206
Category for overlapping solvers.
Definition: solvercategory.hh:27
This file implements a vector space as a tensor product of a given vector space. The number of compon...
virtual real_type norm(const X &x)
Norm of a right-hand side vector. The vector must be consistent on the interior+border partition...
Definition: scalarproducts.hh:157
virtual real_type norm(const X &x)
Norm of a right-hand side vector. The vector must be consistent on the interior+border partition...
Definition: scalarproducts.hh:104
Category for non-overlapping solvers.
Definition: solvercategory.hh:25
virtual field_type dot(const X &x, const X &y)=0
Dot product of two vectors. It is assumed that the vectors are consistent on the interior+border part...
Nonoverlapping Scalar Product with communication object.
Definition: scalarproducts.hh:123
FieldTraits< field_type >::real_type real_type
Definition: scalarproducts.hh:90
X domain_type
export types, they come from the derived class
Definition: scalarproducts.hh:49
X::field_type field_type
The field type used by the vector type domain_type.
Definition: scalarproducts.hh:200
FieldTraits< field_type >::real_type real_type
The real-type of the range.
Definition: scalarproducts.hh:131
X domain_type
The type of the vector to compute the scalar product on.
Definition: scalarproducts.hh:198
X domain_type
The type of the domain.
Definition: scalarproducts.hh:127
virtual field_type dot(const X &x, const X &y)
Dot product of two vectors. It is assumed that the vectors are consistent on the interior+border part...
Definition: scalarproducts.hh:147
Default implementation for the scalar case.
Definition: scalarproducts.hh:84
Category
Definition: solvercategory.hh:21
std::shared_ptr< ScalarProduct< X > > createScalarProduct(const Comm &comm, SolverCategory::Category category)
Choose the approriate scalar product for a solver category.
Definition: scalarproducts.hh:259
virtual field_type dot(const X &x, const X &y)
Dot product of two vectors. It is assumed that the vectors are consistent on the interior+border part...
Definition: scalarproducts.hh:220
Scalar product for overlapping schwarz methods.
Definition: scalarproducts.hh:191
NonoverlappingSchwarzScalarProduct(const communication_type &com)
Constructor.
Definition: scalarproducts.hh:139
Base class for scalar product and norm computation.
Definition: scalarproducts.hh:46
X::field_type field_type
Definition: scalarproducts.hh:50
virtual real_type norm(const X &x)=0
Norm of a right-hand side vector. The vector must be consistent on the interior+border partition...
virtual ~ScalarProduct()
every abstract base class has a virtual destructor
Definition: scalarproducts.hh:75
FieldTraits< field_type >::real_type real_type
Definition: scalarproducts.hh:201
Category for sequential solvers.
Definition: solvercategory.hh:23
virtual SolverCategory::Category category() const
Category of the scalar product (see SolverCategory::Category)
Definition: scalarproducts.hh:236
virtual SolverCategory::Category category() const
Category of the scalar product (see SolverCategory::Category)
Definition: scalarproducts.hh:110
X::field_type field_type
The type of the range.
Definition: scalarproducts.hh:129
C communication_type
The type of the communication object.
Definition: scalarproducts.hh:133