Skip to content
Snippets Groups Projects
Commit 2dd068b9 authored by Simon Praetorius's avatar Simon Praetorius
Browse files

make apply<forward> work with BlockPreconditioner and NonoverlappingBlockPreconditioner

parent 85fce383
No related branches found
No related tags found
1 merge request!302Make apply<forward> work with BlockPreconditioner and NonoverlappingBlockPreconditioner
...@@ -289,7 +289,7 @@ namespace Dune { ...@@ -289,7 +289,7 @@ namespace Dune {
\param c The communication object for syncing overlap and copy \param c The communication object for syncing overlap and copy
data points. (E.~g. OwnerOverlapCopyCommunication ) data points. (E.~g. OwnerOverlapCopyCommunication )
*/ */
NonoverlappingBlockPreconditioner (Preconditioner<X,Y>& p, const communication_type& c) NonoverlappingBlockPreconditioner (P& p, const communication_type& c)
: _preconditioner(stackobject_to_shared_ptr(p)), _communication(c) : _preconditioner(stackobject_to_shared_ptr(p)), _communication(c)
{ } { }
...@@ -300,7 +300,7 @@ namespace Dune { ...@@ -300,7 +300,7 @@ namespace Dune {
\param c The communication object for syncing overlap and copy \param c The communication object for syncing overlap and copy
data points. (E.~g. OwnerOverlapCopyCommunication ) data points. (E.~g. OwnerOverlapCopyCommunication )
*/ */
NonoverlappingBlockPreconditioner (const std::shared_ptr<Preconditioner<X,Y>>& p, const communication_type& c) NonoverlappingBlockPreconditioner (const std::shared_ptr<P>& p, const communication_type& c)
: _preconditioner(p), _communication(c) : _preconditioner(p), _communication(c)
{ } { }
...@@ -328,6 +328,13 @@ namespace Dune { ...@@ -328,6 +328,13 @@ namespace Dune {
_communication.addOwnerCopyToOwnerCopy(v,v); _communication.addOwnerCopyToOwnerCopy(v,v);
} }
template<bool forward>
void apply (X& v, const Y& d)
{
_preconditioner->template apply<forward>(v,d);
_communication.copyOwnerToAll(v,v);
}
/*! /*!
\brief Clean up. \brief Clean up.
...@@ -346,7 +353,7 @@ namespace Dune { ...@@ -346,7 +353,7 @@ namespace Dune {
private: private:
//! \brief a sequential preconditioner //! \brief a sequential preconditioner
std::shared_ptr<Preconditioner<X,Y>> _preconditioner; std::shared_ptr<P> _preconditioner;
//! \brief the communication object //! \brief the communication object
const communication_type& _communication; const communication_type& _communication;
......
...@@ -265,9 +265,9 @@ namespace Dune { ...@@ -265,9 +265,9 @@ namespace Dune {
* for approximately solving the local matrix block consisting of unknowns * for approximately solving the local matrix block consisting of unknowns
* owned by the process. Has to implement the Preconditioner interface. * owned by the process. Has to implement the Preconditioner interface.
*/ */
template<class X, class Y, class C, class T=Preconditioner<X,Y> > template<class X, class Y, class C, class P=Preconditioner<X,Y> >
class BlockPreconditioner : public Preconditioner<X,Y> { class BlockPreconditioner : public Preconditioner<X,Y> {
friend struct Amg::ConstructionTraits<BlockPreconditioner<X,Y,C,T> >; friend struct Amg::ConstructionTraits<BlockPreconditioner<X,Y,C,P> >;
public: public:
//! \brief The domain type of the preconditioner. //! \brief The domain type of the preconditioner.
//! //!
...@@ -294,7 +294,7 @@ namespace Dune { ...@@ -294,7 +294,7 @@ namespace Dune {
\param c The communication object for syncing overlap and copy \param c The communication object for syncing overlap and copy
data points. (E.~g. OwnerOverlapCopyCommunication ) data points. (E.~g. OwnerOverlapCopyCommunication )
*/ */
BlockPreconditioner (Preconditioner<X,Y>& p, const communication_type& c) BlockPreconditioner (P& p, const communication_type& c)
: _preconditioner(stackobject_to_shared_ptr(p)), _communication(c) : _preconditioner(stackobject_to_shared_ptr(p)), _communication(c)
{ } { }
...@@ -305,7 +305,7 @@ namespace Dune { ...@@ -305,7 +305,7 @@ namespace Dune {
\param c The communication object for syncing overlap and copy \param c The communication object for syncing overlap and copy
data points. (E.~g. OwnerOverlapCopyCommunication ) data points. (E.~g. OwnerOverlapCopyCommunication )
*/ */
BlockPreconditioner (const std::shared_ptr<Preconditioner<X,Y>>& p, const communication_type& c) BlockPreconditioner (const std::shared_ptr<P>& p, const communication_type& c)
: _preconditioner(p), _communication(c) : _preconditioner(p), _communication(c)
{ } { }
...@@ -356,7 +356,7 @@ namespace Dune { ...@@ -356,7 +356,7 @@ namespace Dune {
private: private:
//! \brief a sequential preconditioner //! \brief a sequential preconditioner
std::shared_ptr<Preconditioner<X,Y>> _preconditioner; std::shared_ptr<P> _preconditioner;
//! \brief the communication object //! \brief the communication object
const communication_type& _communication; const communication_type& _communication;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment