Go to the documentation of this file.00001
00002
00003
00004 #ifndef quadEdge_hh
00005 #define quadEdge_hh
00006
00007 #include "basics/typedefs.hh"
00008 #include "basics/vectorsMatrices.hh"
00009 #include "integration/quadrature.hh"
00010 #include "hp2D/quad.hh"
00011 #include "integration/karniadakis.hh"
00012
00013 namespace hp2Dedge {
00014
00015 using concepts::Real;
00016
00017
00018
00029 class KarniadakisDeriv2 : public concepts::ShapeFunction1D<Real> {
00030 public:
00038 KarniadakisDeriv2(const int P, const Real* xP, const int NxP,
00039 const bool cache = true);
00040
00042 KarniadakisDeriv2(const KarniadakisDeriv2& arg);
00043
00044 ~KarniadakisDeriv2();
00045 protected:
00046 virtual std::ostream& info(std::ostream& os) const;
00047 private:
00049 concepts::Karniadakis<1,1>* tmp_;
00050 };
00051
00052
00053
00060 class QuadEdgeFunctions {
00061 public:
00065 QuadEdgeFunctions(ushort p, const concepts::QuadratureRule *intX,
00066 const concepts::QuadratureRule *intY);
00071 QuadEdgeFunctions(ushort* p, const concepts::QuadratureRule *intX,
00072 const concepts::QuadratureRule *intY);
00074 virtual ~QuadEdgeFunctions();
00075
00078 inline const ushort* p() const { return p_; }
00079
00080
00081
00082
00083 inline const KarniadakisDeriv2* shpfctX_t() const {
00084 return shpfctX_t_.get(); }
00085
00086
00087
00088 inline const KarniadakisDeriv2* shpfctY_t() const {
00089 return shpfctY_t_.get(); }
00090
00091
00092
00093
00094 inline const concepts::Karniadakis<1,0>* shpfctX_n() const {
00095 return shpfctX_n_.get(); }
00096
00097
00098
00099
00100 inline const concepts::Karniadakis<1,0>* shpfctY_n() const {
00101 return shpfctY_n_.get(); }
00102
00103
00104
00105
00106 inline const concepts::Karniadakis<1,1>* shpfctDX_n() const {
00107 return shpfctDX_n_.get(); }
00108
00109
00110
00111 inline const concepts::Karniadakis<1,1>* shpfctDY_n() const {
00112 return shpfctDY_n_.get(); }
00113 protected:
00115 void computeShapefunctions_(const concepts::QuadratureRule *intX,
00116 const concepts::QuadratureRule *intY);
00117 private:
00119 ushort p_[2];
00121 std::auto_ptr<KarniadakisDeriv2> shpfctX_t_, shpfctY_t_;
00123 std::auto_ptr<concepts::Karniadakis<1,0> > shpfctX_n_, shpfctY_n_;
00125 std::auto_ptr<concepts::Karniadakis<1,1> > shpfctDX_t_, shpfctDY_t_,
00126 shpfctDX_n_, shpfctDY_n_;
00127 };
00128
00129
00130
00141 template<class F = Real>
00142 class Quad : public hp2D::BaseQuad<F>, public QuadEdgeFunctions {
00143 public:
00150 Quad(concepts::Quad2d& cell, ushort* p,
00151 concepts::TColumn<F>* T0, concepts::TColumn<F>* T1);
00152
00153 virtual const concepts::ElementGraphics<F>* graphics() const;
00157 void recomputeShapefunctions();
00158 void recomputeShapefunctions(const uint nq[2]);
00159 virtual ~Quad();
00160 protected:
00161 virtual std::ostream& info(std::ostream& os) const;
00162 private:
00164 static std::auto_ptr<concepts::ElementGraphics<F> > graphics_;
00165 };
00166
00167
00168
00174 template<class F = Real>
00175 class Edge : public concepts::Element<F> {
00176 public:
00181 Edge(const Quad<F>& elm, const ushort k);
00182
00183 virtual ~Edge();
00184
00185 inline concepts::Real2d vertex(uint i) const {
00186 conceptsAssert(i < 2, concepts::Assertion());
00187 return i ? chi(1.0) : chi(0.0);
00188 }
00189
00190 virtual const concepts::Edge& support() const {
00191 return *elm_.cell().connector().edge(k_); }
00192
00194 inline const ushort edge() const { return k_;}
00195
00197 inline const Quad<F>& elm() const { return elm_;}
00198
00200 inline const ushort direction() const { return l_;}
00201
00203 inline const Real sign() const { return k_%3==0 ? -1.0 : 1.0;}
00204
00205
00206
00207
00208 inline const KarniadakisDeriv2* shpfct() const {
00209 return shpfct_; }
00211 inline const concepts::QuadratureRule* integration() const {
00212 return int_; }
00213
00215 inline concepts::Real2d localCoords(const Real t) const {
00216 concepts::Real2d x;
00217 x[l_] = x_;
00218 x[(l_+1)%2] = t;
00219 return x;
00220 }
00221
00224 inline concepts::Real2d chi(const Real t) const {
00225 concepts::Real2d x = localCoords(t);
00226 return elm_.chi(x[0], x[1]);
00227 }
00228
00232 inline concepts::MapReal2d jacobian(const Real t) const {
00233 concepts::Real2d x = localCoords(t);
00234 return elm_.jacobian(x[0],x[1]);
00235 }
00236
00238 inline concepts::MapReal2d jacobianInverse(const Real t) const {
00239 return jacobian(t).inverse(); }
00240
00242 inline Real jacobianDeterminant(const Real t) const {
00243 return jacobian(t).determinant(); }
00244
00246 inline Real diffElement(const Real t) const {
00247
00248
00249 return elm_.cell().lineElement(t, k_) * 0.5;
00250 }
00251
00253 virtual const concepts::TMatrixBase<F>& T() const { return *T_;};
00254 protected:
00255 virtual std::ostream& info(std::ostream& os) const;
00256 private:
00258 const Quad<F>& elm_;
00260 const ushort k_;
00262 const ushort l_;
00266 concepts::Real x_;
00268 const KarniadakisDeriv2* shpfct_;
00270 const concepts::QuadratureRule *int_;
00272 const concepts::TMatrixBase<F>* T_;
00273 };
00274
00275 }
00276
00277 #endif // quadEdge_hh