diff --git a/fem/space/combinedspace.cc b/fem/space/combinedspace.cc index 920b9fe66cf5c5e27035495bc8ccd8d29dd9c9fe..ec9f95e6a4135af8ef1cc9b9c8a547e852a99da0 100644 --- a/fem/space/combinedspace.cc +++ b/fem/space/combinedspace.cc @@ -43,9 +43,9 @@ namespace Dune { } //- CombinedBaseFunctionSet - template <class BaseFunctionSetImp, int N, DofStoragePolicy policy> + template <class DiscreteFunctionSpaceImp, int N, DofStoragePolicy policy> template <int diffOrd> - void CombinedBaseFunctionSet<BaseFunctionSetImp, N, policy>:: + void CombinedBaseFunctionSet<DiscreteFunctionSpaceImp, N, policy>:: evaluate(int baseFunct, const FieldVector<deriType, diffOrd> &diffVariable, const DomainType & x, RangeType & phi) const @@ -55,9 +55,9 @@ namespace Dune { expand(baseFunct, containedResult_, phi); } - template <class BaseFunctionSetImp, int N, DofStoragePolicy policy> + template <class DiscreteFunctionSpaceImp, int N, DofStoragePolicy policy> template <int diffOrd, class QuadratureType> - void CombinedBaseFunctionSet<BaseFunctionSetImp, N, policy>:: + void CombinedBaseFunctionSet<DiscreteFunctionSpaceImp, N, policy>:: evaluate(int baseFunct, const FieldVector<deriType, diffOrd> &diffVariable, QuadratureType & quad, @@ -68,24 +68,24 @@ namespace Dune { expand(baseFunct, containedResult_, phi); } - template <class BaseFunctionSetImp, int N, DofStoragePolicy policy> - inline int CombinedBaseFunctionSet<BaseFunctionSetImp, N, policy>:: + template <class DiscreteFunctionSpaceImp, int N, DofStoragePolicy policy> + inline int CombinedBaseFunctionSet<DiscreteFunctionSpaceImp, N, policy>:: containedDof(int combinedBaseNumber) const { //return global%N; return combinedBaseNumber/N; } - template <class BaseFunctionSetImp, int N, DofStoragePolicy policy> - inline int CombinedBaseFunctionSet<BaseFunctionSetImp, N, policy>:: + template <class DiscreteFunctionSpaceImp, int N, DofStoragePolicy policy> + inline int CombinedBaseFunctionSet<DiscreteFunctionSpaceImp, N, policy>:: component(int combinedBaseNumber) const { //return global%N; return combinedBaseNumber%N; } - template <class BaseFunctionSetImp, int N, DofStoragePolicy policy> - void CombinedBaseFunctionSet<BaseFunctionSetImp, N, policy>:: + template <class DiscreteFunctionSpaceImp, int N, DofStoragePolicy policy> + void CombinedBaseFunctionSet<DiscreteFunctionSpaceImp, N, policy>:: expand(int baseFunct, const ContainedRangeType& arg, RangeType& dest) const { dest = 0.0; @@ -93,8 +93,8 @@ namespace Dune { dest[component(baseFunct)] = arg[0]; } - template <class BaseFunctionSetImp, int N, DofStoragePolicy policy> - void CombinedBaseFunctionSet<BaseFunctionSetImp, N, policy>:: + template <class DiscreteFunctionSpaceImp, int N, DofStoragePolicy policy> + void CombinedBaseFunctionSet<DiscreteFunctionSpaceImp, N, policy>:: evaluateContained(int baseFunct, const DomainType& x, ContainedRangeType& phi) const @@ -104,8 +104,8 @@ namespace Dune { baseFunctionSet_.eval(baseFunct, x, phi); } - template <class BaseFunctionSetImp, int N, DofStoragePolicy policy> - void CombinedBaseFunctionSet<BaseFunctionSetImp, N, policy>:: + template <class DiscreteFunctionSpaceImp, int N, DofStoragePolicy policy> + void CombinedBaseFunctionSet<DiscreteFunctionSpaceImp, N, policy>:: jacobianContained(int baseFunct, const DomainType& x, ContainedJacobianRangeType& phi) const diff --git a/fem/space/combinedspace.hh b/fem/space/combinedspace.hh index b7b5478e4e0048a4e4bfc00ae6a41fd6f116376b..84e67ad1aa6051d0d62794c6aef6c82239491ed2 100644 --- a/fem/space/combinedspace.hh +++ b/fem/space/combinedspace.hh @@ -58,13 +58,14 @@ namespace Dune { struct CombinedSpaceTraits { private: typedef DiscreteFunctionSpaceImp ContainedDiscreteFunctionSpaceType; - // typedef ContainedDiscreteFunctionSpaceType::MapperType ContainedMapperType; + typedef typename ContainedDiscreteFunctionSpaceType::Traits - ContainedTraits; - typedef typename ContainedTraits::FunctionSpaceType + ContainedSpaceTraits; + typedef typename ContainedSpaceTraits::FunctionSpaceType ContainedFunctionSpaceType; - typedef typename ContainedTraits::BaseFunctionSetType + typedef typename ContainedSpaceTraits::BaseFunctionSetType ContainedBaseFunctionSetType; + typedef typename ContainedSpaceTraits::MapperType ContainedMapperType; enum { ContainedDimRange = ContainedFunctionSpaceType::DimRange, ContainedDimDomain = ContainedFunctionSpaceType::DimDomain }; @@ -80,21 +81,27 @@ namespace Dune { typedef CombinedSpace< DiscreteFunctionSpaceImp, N, policy> DiscreteFunctionSpaceType; - typedef FunctionSpace<DomainFieldType, RangeFieldType, ContainedDimDomain, - ContainedDimRange*N> FunctionSpaceType; + typedef FunctionSpace< + DomainFieldType, RangeFieldType, + ContainedDimDomain, ContainedDimRange*N> FunctionSpaceType; typedef CombinedBaseFunctionSet< - ContainedBaseFunctionSetType, N, policy> BaseFunctionSetType; + DiscreteFunctionSpaceImp, N, policy> BaseFunctionSetType; typedef CombinedMapper<DiscreteFunctionSpaceImp, N, policy> MapperType; typedef typename FunctionSpaceType::RangeType RangeType; typedef typename FunctionSpaceType::DomainType DomainType; - typedef typename FunctionSpaceType::RangeFieldType RangeFieldType; - typedef typename FunctionSpaceType::DomainFieldType DomainFieldType; + typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType; - typedef typename ContainedTraits::GridType GridType; - typedef typename ContainedTraits::IteratorType IteratorType; + typedef typename ContainedSpaceTraits::GridType GridType; + typedef typename ContainedSpaceTraits::IteratorType IteratorType; + enum { DimRange = FunctionSpaceType::DimRange, + DimDomain = FunctionSpaceType::DimDomain }; + public: + //- Friends friend class DiscreteFunctionSpaceType; + friend class BaseFunctionSetType; + friend class MapperType; }; //! Class to combine N scalar spaces @@ -197,54 +204,25 @@ namespace Dune { static const int spaceId_; }; // end class CombinedSpace - //! Traits class for CombinedBaseFunctionSet - template <class BaseFunctionSetImp, int N, DofStoragePolicy policy> - struct CombinedBaseFunctionSetTraits { - private: - typedef typename BaseFunctionSetImp::DiscreteFunctionSpaceType - ContainedFunctionSpaceType; - public: - typedef CombinedBaseFunctionSet<BaseFunctionSetImp, N, policy> - BaseFunctionSetType; - - typedef CombinedSpace<ContainedFunctionSpaceType, N, policy> - DiscreteFunctionSpaceType; - - typedef typename DiscreteFunctionSpaceType::RangeType RangeType; - typedef typename DiscreteFunctionSpaceType::DomainType DomainType; - typedef typename DiscreteFunctionSpaceType::JacobianRangeType - JacobianRangeType; - typedef typename DiscreteFunctionSpaceType::HessianRangeType - HessianRangeType; - typedef typename DiscreteFunctionSpaceType::ContainedRangeType - ContainedRangeType; - typedef typename DiscreteFunctionSpaceType::ContainedJacobianRangeType - ContainedJacobianRangeType; - - enum { DimDomain = DiscreteFunctionSpaceType::DimDomain }; - enum { DimRange = DiscreteFunctionSpaceType::DimRange }; - }; - //! Wrapper class for base function sets. This class is used within //! CombinedSpace - template <class BaseFunctionSetImp, int N, DofStoragePolicy policy> + template <class DiscreteFunctionSpaceImp, int N, DofStoragePolicy policy> class CombinedBaseFunctionSet : public BaseFunctionSetDefault< - CombinedBaseFunctionSetTraits<BaseFunctionSetImp, N, policy> + CombinedSpaceTraits<DiscreteFunctionSpaceImp, N, policy> > { - private: - //- Private typedefs - typedef BaseFunctionSetImp ContainedBaseFunctionSetType; - typedef ContainedBaseFunctionSetType::RangeType ContainedRangeType; - public: //- Typedefs and enums enum { numComponents = N }; - typedef CombinedBaseFunctionSet<BaseFunctionSetImp, N, policy> ThisType; + typedef CombinedBaseFunctionSet< + DiscreteFunctionSpaceImp, N, policy> ThisType; + typedef CombinedSpaceTraits< + DiscreteFunctionSpaceImp, N, policy> Traits; - typedef CombinedBaseFunctionSetTraits<BaseFunctionSetImp, N, policy> Traits; - typedef typename Traits::DiscreteFunctionSpaceType DiscreteFunctionSpaceType; + typedef typename Traits::DiscreteFunctionSpaceType + DiscreteFunctionSpaceType; + typedef typename Traits::ContainedBaseFunctionSetType ContainedBaseFunctionSetType; typedef typename Traits::RangeType RangeType; typedef typename Traits::DomainType DomainType; typedef typename Traits::ContainedRangeType ContainedRangeType;