dune-localfunctions
2.1.1
|
00001 // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 00002 // vi: set et ts=8 sw=2 sts=2: 00003 00004 #ifndef DUNE_LOCALFUNCTIONS_META_POWER_HH 00005 #define DUNE_LOCALFUNCTIONS_META_POWER_HH 00006 00007 #include <cstddef> 00008 00009 #include <dune/common/geometrytype.hh> 00010 #include <dune/common/shared_ptr.hh> 00011 00012 #include <dune/localfunctions/meta/power/basis.hh> 00013 #include <dune/localfunctions/meta/power/coefficients.hh> 00014 #include <dune/localfunctions/meta/power/interpolation.hh> 00015 00016 namespace Dune { 00017 00020 00026 template<class Backend, std::size_t dimR> 00027 class PowerFiniteElement { 00028 public: 00030 struct Traits { 00032 typedef PowerBasis<typename Backend::Traits::Basis, dimR> Basis; 00034 typedef PowerCoefficients Coefficients; 00036 typedef PowerInterpolation<typename Backend::Traits::Interpolation, 00037 typename Basis::Traits> Interpolation; 00038 }; 00039 private: 00040 shared_ptr<const Backend> backend; 00041 typename Traits::Basis basis_; 00042 typename Traits::Coefficients coefficients_; 00043 typename Traits::Interpolation interpolation_; 00044 00045 public: 00047 00051 PowerFiniteElement(const Backend &backend_) : 00052 backend(new Backend(backend_)), 00053 basis_(backend->basis()), 00054 coefficients_(backend->coefficients(), dimR), 00055 interpolation_(backend->interpolation()) 00056 { } 00057 00059 00063 PowerFiniteElement(const shared_ptr<const Backend> &backendSPtr) : 00064 backend(backendSPtr), 00065 basis_(backend->basis()), 00066 coefficients_(backend->coefficients(), dimR), 00067 interpolation_(backend->interpolation()) 00068 { } 00069 00071 00075 const typename Traits::Basis& basis() const { return basis_; } 00077 00081 const typename Traits::Coefficients& coefficients() const 00082 { return coefficients_; } 00084 00088 const typename Traits::Interpolation& interpolation() const 00089 { return interpolation_; } 00091 GeometryType type() const { return backend->type(); } 00092 }; 00093 00096 00103 template<class BackendFiniteElement, std::size_t dimR> 00104 class PowerFiniteElementFactory 00105 { 00106 public: 00108 typedef PowerFiniteElement<BackendFiniteElement, dimR> FiniteElement; 00109 00111 00115 const FiniteElement make(const BackendFiniteElement &backend) const 00116 { return FiniteElement(backend); } 00118 00122 const FiniteElement 00123 make(const shared_ptr<const BackendFiniteElement> &backendSPtr) const 00124 { return FiniteElement(backendSPtr); } 00125 00126 }; 00127 00128 } // namespace Dune 00129 00130 #endif // DUNE_LOCALFUNCTIONS_META_POWER_HH