Logo  0.95.0-final
Finite Element Embedded Library and Language in C++
Feel++ Feel++ on Github Feel++ community
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
orthogonalpolynomialset.hpp
Go to the documentation of this file.
1 /* -*- mode: c++; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; show-trailing-whitespace: t -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2 
3  This file is part of the Feel library
4 
5  Author(s): Christophe Prud'homme <christophe.prudhomme@feelpp.org>
6  Date: 2009-04-30
7 
8  Copyright (C) 2009 Université Joseph Fourier (Grenoble I)
9 
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Lesser General Public
12  License as published by the Free Software Foundation; either
13  version 3.0 of the License, or (at your option) any later version.
14 
15  This library is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public
21  License along with this library; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 */
29 #ifndef __OrthogonalPolynomialSet_H
30 #define __OrthogonalPolynomialSet_H 1
31 
32 namespace Feel
33 {
41 template<uint16_type Dim,
42  uint16_type Order,
43  template<uint16_type> class PolySetType = Scalar,
44  typename T = double,
45  template<uint16_type,uint16_type,uint16_type> class Convex = Simplex>
47 {};
48 
49 
50 template<uint16_type Dim,
51  uint16_type Order,
52  template<uint16_type> class PolySetType,
53  typename T>
54 class OrthogonalPolynomialSet<Dim, Order, PolySetType, T, Simplex>
55  :
56 public PolynomialSet<Dubiner<Dim, Order, Normalized<false>, T, StorageUBlas>, PolySetType >
57 {
58  typedef PolynomialSet<Dubiner<Dim, Order, Normalized<false>, T, StorageUBlas>, PolySetType > super;
59 public:
60 
61  static const uint16_type nDim = Dim;
62  static const uint16_type nOrder = Order;
63  static const bool isTransformationEquivalent = true;
64 
66  typedef self_type component_basis_type;
67 
68  typedef typename super::polyset_type polyset_type;
69  static const bool is_tensor2 = polyset_type::is_tensor2;
70  static const bool is_vectorial = polyset_type::is_vectorial;
71  static const bool is_scalar = polyset_type::is_scalar;
72  static const bool is_continuous = false;
73  static const bool is_modal = true;
74  static const uint16_type nComponents = polyset_type::nComponents;
75  static const uint16_type nComponents1 = polyset_type::nComponents1;
76  static const uint16_type nComponents2 = polyset_type::nComponents2;
77  typedef typename super::component_type component_type;
78 
79  typedef T value_type;
81  typedef Simplex<Dim, Order, Dim> convex_type;
82  typedef Reference<convex_type, nDim, nOrder, nDim, value_type> reference_convex_type;
83 
84  typedef typename super::polynomial_type polynomial_type;
85 
87  static const uint16_type nDofPerVertex = convex_type::nbPtsPerVertex;
89  static const uint16_type nDofPerEdge = convex_type::nbPtsPerEdge;
91  static const uint16_type nDofPerFace = convex_type::nbPtsPerFace;
92 
94  static const uint16_type nDofPerVolume = convex_type::nbPtsPerVolume;
95 
96  static const uint16_type nLocalDof = convex_type::numPoints;
97 
98  static const uint16_type nDof = nLocalDof;
99  static const uint16_type nNodes = nDof;
100  static const uint16_type nDofGrad = super::nDim*nDof;
101  static const uint16_type nDofHess = super::nDim*super::nDim*nDof;
102 
104  :
105  super( basis_type() )
106 
107  {
108  ublas::matrix<value_type> m( ublas::identity_matrix<value_type>( nComponents*convex_type::polyDims( nOrder ) ) );
109  this->setCoefficient( polyset_type::toType( m ), true );
110  }
111 
112  OrthogonalPolynomialSet<Dim, Order, Scalar,T, Simplex > toScalar() const
113  {
114  return OrthogonalPolynomialSet<Dim, Order, Scalar,T, Simplex >();
115  }
116 
117  std::string familyName() const
118  {
119  return "dubiner";
120  }
121 };
122 template<uint16_type Dim,
123  uint16_type Order,
124  template<uint16_type> class PolySetType,
125  typename T>
126 const uint16_type OrthogonalPolynomialSet<Dim, Order,PolySetType,T, Simplex>::nLocalDof;
127 
128 template<uint16_type Dim,
129  uint16_type Order,
130  template<uint16_type> class PolySetType,
131  typename T>
132 class OrthogonalPolynomialSet<Dim, Order, PolySetType, T, Hypercube>
133  :
134 public PolynomialSet<Legendre<Dim, Order, Normalized<false>, T>, PolySetType >
135 {
136  typedef PolynomialSet<Legendre<Dim, Order, Normalized<false>, T>, PolySetType > super;
137 public:
138 
139  static const uint16_type nDim = Dim;
140  static const uint16_type nOrder = Order;
141  static const bool isTransformationEquivalent = true;
142 
143  typedef OrthogonalPolynomialSet<Dim, Order, PolySetType, T, Hypercube> self_type;
144  typedef self_type component_basis_type;
145 
146  typedef typename super::polyset_type polyset_type;
147  static const bool is_tensor2 = polyset_type::is_tensor2;
148  static const bool is_vectorial = polyset_type::is_vectorial;
149  static const bool is_scalar = polyset_type::is_scalar;
150  static const bool is_continuous = false;
151  static const bool is_modal = true;
152  static const uint16_type nComponents = polyset_type::nComponents;
153  static const uint16_type nComponents1 = polyset_type::nComponents1;
154  static const uint16_type nComponents2 = polyset_type::nComponents2;
155  typedef typename super::component_type component_type;
156 
157  typedef T value_type;
158  typedef Legendre<Dim, Order, Normalized<false>, T> basis_type;
159  typedef Hypercube<Dim, Order, Dim> convex_type;
160  typedef Reference<convex_type, nDim, nOrder, nDim, value_type> reference_convex_type;
161 
162  typedef typename super::polynomial_type polynomial_type;
163 
165  static const uint16_type nDofPerVertex = convex_type::nbPtsPerVertex;
167  static const uint16_type nDofPerEdge = convex_type::nbPtsPerEdge;
169  static const uint16_type nDofPerFace = convex_type::nbPtsPerFace;
170 
172  static const uint16_type nDofPerVolume = convex_type::nbPtsPerVolume;
173 
174  static const uint16_type nLocalDof = convex_type::numPoints;
175 
176  static const uint16_type nDof = nLocalDof;
177  static const uint16_type nNodes = nDof;
178  static const uint16_type nDofGrad = super::nDim*nDof;
179  static const uint16_type nDofHess = super::nDim*super::nDim*nDof;
180 
181  OrthogonalPolynomialSet()
182  :
183  super( basis_type() )
184 
185  {
186  ublas::matrix<value_type> m( ublas::identity_matrix<value_type>( nComponents*convex_type::polyDims( nOrder ) ) );
187  this->setCoefficient( polyset_type::toType( m ), true );
188  }
189 
190  OrthogonalPolynomialSet<Dim, Order, Scalar,T, Hypercube > toScalar() const
191  {
192  return OrthogonalPolynomialSet<Dim, Order, Scalar,T, Hypercube >();
193  }
194 
195  std::string familyName() const
196  {
197  return "legendre";
198  }
199 };
200 
201 template<uint16_type Dim,
202  uint16_type Order,
203  template<uint16_type> class PolySetType,
204  typename T>
205 const uint16_type OrthogonalPolynomialSet<Dim, Order,PolySetType,T, Hypercube>::nLocalDof;
206 }
207 #endif /* __OrthogonalPolynomialSet_H */

Generated on Fri Oct 25 2013 14:24:22 for Feel++ by doxygen 1.8.4