From 42fdc8a18e10571dadaa95d3debff45e2fd37235 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 5 May 2025 11:15:14 +0200 Subject: [PATCH] restrictprolong: cosmetics needs basically complete reindent to 4 spacing, so may as well drop indent for namespace while at it add a missing include --- .../discretization/common/restrictprolong.hh | 298 +++++++++--------- 1 file changed, 149 insertions(+), 149 deletions(-) diff --git a/opm/models/discretization/common/restrictprolong.hh b/opm/models/discretization/common/restrictprolong.hh index 441d04b28f..bbbfed2ab7 100644 --- a/opm/models/discretization/common/restrictprolong.hh +++ b/opm/models/discretization/common/restrictprolong.hh @@ -23,180 +23,180 @@ #ifndef EWOMS_COPYRESTRICTPROLONG_HH #define EWOMS_COPYRESTRICTPROLONG_HH +#include + #if HAVE_DUNE_FEM #include #endif -namespace Opm +namespace Opm { + +template +class CopyRestrictProlong; + +template +struct CopyRestrictProlongTraits { - template < class Grid, class Container > - class CopyRestrictProlong; + using DomainFieldType = typename Grid::ctype; + using RestProlImp = CopyRestrictProlong; +}; - template < class Grid, class Container > - struct CopyRestrictProlongTraits - { - using DomainFieldType = typename Grid::ctype; - using RestProlImp = CopyRestrictProlong< Grid, Container > ; - }; - - template< class Grid, class Container > - class CopyRestrictProlong +template +class CopyRestrictProlong #if HAVE_DUNE_FEM - : public Dune::Fem::RestrictProlongInterfaceDefault< CopyRestrictProlongTraits< Grid, Container > > + : public Dune::Fem::RestrictProlongInterfaceDefault> #endif +{ + using ThisType = CopyRestrictProlong; + + Container& container_; + +public: + using DomainFieldType = typename Grid::ctype; + + explicit CopyRestrictProlong(Container& container) + : container_(container) + {} + + /** \brief explicit set volume ratio of son and father + * + * \param[in] weight volume of son / volume of father + * + * \note If this ratio is set, it is assume to be constant. + */ + template + void setFatherChildWeight(const Field&) const + {} + + //! restrict data to father + template + void restrictLocal (const Entity& father, const Entity& son, bool initialize) const { - using ThisType = CopyRestrictProlong< Grid, Container >; - - Container& container_; - public: - using DomainFieldType = typename Grid::ctype; - - explicit CopyRestrictProlong( Container& container ) - : container_( container ) - {} - - /** \brief explicit set volume ratio of son and father - * - * \param[in] weight volume of son / volume of father - * - * \note If this ratio is set, it is assume to be constant. - */ - template - void setFatherChildWeight(const Field&) const - {} - - //! restrict data to father - template< class Entity > - void restrictLocal ( const Entity& father, const Entity& son, bool initialize ) const - { container_.resize(); - assert( container_.codimension() == 0 ); - if( initialize ) - { - // copy values from son to father (only once) - container_[ father ] = container_[ son ]; + assert(container_.codimension() == 0); + if (initialize) { + // copy values from son to father (only once) + container_[father] = container_[son]; } - } + } - //! restrict data to father - template< class Entity, class LocalGeometry > - void restrictLocal(const Entity& father, - const Entity& son, - const LocalGeometry&, - bool initialize) const - { restrictLocal(father, son, initialize); } + //! restrict data to father + template + void restrictLocal(const Entity& father, + const Entity& son, + const LocalGeometry&, + bool initialize) const + { restrictLocal(father, son, initialize); } - //! prolong data to children - template< class Entity > - void prolongLocal(const Entity& father, - const Entity& son, - bool) const - { - container_.resize(); - assert( container_.codimension() == 0 ); - // copy values from father to son all sons - container_[ son ] = container_[ father ]; - } - - //! prolong data to children - template< class Entity, class LocalGeometry > - void prolongLocal(const Entity& father, - const Entity& son, - const LocalGeometry&, - bool initialize) const - { prolongLocal(father, son, initialize); } - - /** \brief add discrete function to communicator - * \param[in] comm Communicator to add the discrete functions to - */ - template< class Communicator > - void addToList(Communicator&) - { - // TODO - } - - /** \brief add discrete function to load balancer - * \param[in] lb LoadBalancer to add the discrete functions to - */ - template< class LoadBalancer > - void addToLoadBalancer(LoadBalancer&) - { - // TODO - } - - }; - - - class EmptyRestrictProlong; - - struct EmptyRestrictProlongTraits + //! prolong data to children + template + void prolongLocal(const Entity& father, + const Entity& son, + bool) const { - using DomainFieldType = double ; - using RestProlImp = EmptyRestrictProlong ; - }; + container_.resize(); + assert(container_.codimension() == 0); + // copy values from father to son all sons + container_[son] = container_[father]; + } - class EmptyRestrictProlong + //! prolong data to children + template + void prolongLocal(const Entity& father, + const Entity& son, + const LocalGeometry&, + bool initialize) const + { prolongLocal(father, son, initialize); } + + /** \brief add discrete function to communicator + * \param[in] comm Communicator to add the discrete functions to + */ + template + void addToList(Communicator&) + { + // TODO + } + + /** \brief add discrete function to load balancer + * \param[in] lb LoadBalancer to add the discrete functions to + */ + template + void addToLoadBalancer(LoadBalancer&) + { + // TODO + } +}; + +class EmptyRestrictProlong; + +struct EmptyRestrictProlongTraits +{ + using DomainFieldType = double; + using RestProlImp = EmptyRestrictProlong; +}; + +class EmptyRestrictProlong #if HAVE_DUNE_FEM : public Dune::Fem::RestrictProlongInterfaceDefault< EmptyRestrictProlongTraits > #endif - { - using ThisType = EmptyRestrictProlong; +{ + using ThisType = EmptyRestrictProlong; - public: - /** \brief explicit set volume ratio of son and father - * - * \param[in] weight volume of son / volume of father - * - * \note If this ratio is set, it is assume to be constant. - */ - template - void setFatherChildWeight(const Field&) const - { } +public: + /** \brief explicit set volume ratio of son and father + * + * \param[in] weight volume of son / volume of father + * + * \note If this ratio is set, it is assume to be constant. + */ + template + void setFatherChildWeight(const Field&) const + {} - //! restrict data to father - template< class Entity > - void restrictLocal(const Entity&, - const Entity&, - bool) const - { } + //! restrict data to father + template + void restrictLocal(const Entity&, + const Entity&, + bool) const + {} - //! restrict data to father - template< class Entity, class LocalGeometry > - void restrictLocal(const Entity&, - const Entity&, - const LocalGeometry&, - bool) const - { } + //! restrict data to father + template + void restrictLocal(const Entity&, + const Entity&, + const LocalGeometry&, + bool) const + {} - //! prolong data to children - template< class Entity > - void prolongLocal(const Entity&, - const Entity&, - bool) const - { } + //! prolong data to children + template + void prolongLocal(const Entity&, + const Entity&, + bool) const + {} - //! prolong data to children - template< class Entity, class LocalGeometry > - void prolongLocal(const Entity&, - const Entity&, - const LocalGeometry&, - bool) const - { } + //! prolong data to children + template + void prolongLocal(const Entity&, + const Entity&, + const LocalGeometry&, + bool) const + {} - /** \brief add discrete function to communicator - * \param[in] comm Communicator to add the discrete functions to - */ - template< class Communicator > - void addToList(Communicator&) - { } + /** \brief add discrete function to communicator + * \param[in] comm Communicator to add the discrete functions to + */ + template + void addToList(Communicator&) + {} - /** \brief add discrete function to load balancer - * \param[in] lb LoadBalancer to add the discrete functions to - */ - template< class LoadBalancer > - void addToLoadBalancer(LoadBalancer&) - { } - }; + /** \brief add discrete function to load balancer + * \param[in] lb LoadBalancer to add the discrete functions to + */ + template + void addToLoadBalancer(LoadBalancer&) + {} +}; } // namespace Opm