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
boundaryadaptedpolynomialset.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 Universite 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 __BoundaryAdaptedPolynomialSet_H
30 #define __BoundaryAdaptedPolynomialSet_H 1
31 
32 namespace Feel
33 {
35 namespace detail
36 {
44 template<uint16_type Dim,
45  uint16_type Order,
46  template<uint16_type> class PolySetType = Scalar,
47  typename T = double,
48  template<uint16_type,uint16_type,uint16_type> class Convex = Simplex>
49 class BoundaryAdaptedPolynomialSet
50 {};
51 
52 template<uint16_type Dim,
53  uint16_type Order,
54  template<uint16_type> class PolySetType,
55  typename T>
56 class BoundaryAdaptedPolynomialSet<Dim, Order, PolySetType, T, Simplex>
57  :
58 public PolynomialSet<BoundaryAdapted<Dim, Order, T>, PolySetType >
59 {
60  typedef PolynomialSet<BoundaryAdapted<Dim, Order, T>, PolySetType > super;
61 public:
62 
63  static const uint16_type nDim = Dim;
64  static const uint16_type nOrder = Order;
65 
66  typedef BoundaryAdaptedPolynomialSet<Dim, Order, PolySetType, T, Simplex> self_type;
67  typedef self_type component_basis_type;
68 
69  typedef typename super::polyset_type polyset_type;
70 
71  static const bool is_continuous = true;
72 
73  static const bool is_tensor2 = polyset_type::is_tensor2;
74  static const bool is_vectorial = polyset_type::is_vectorial;
75  static const bool is_scalar = polyset_type::is_scalar;
76  static const bool is_modal = true;
77  static const uint16_type nComponents = polyset_type::nComponents;
78  typedef typename super::component_type component_type;
79 
80  typedef T value_type;
81  typedef BoundaryAdapted<Dim, Order, T> basis_type;
82  typedef typename basis_type::points_type points_type;
83 
84  typedef Simplex<Dim, Order, Dim> convex_type;
85  template<int O>
86  struct convex
87  {
88  typedef Simplex<Dim, O, Dim> type;
89  };
90  typedef Reference<convex_type, nDim, nOrder, nDim, value_type> reference_convex_type;
91 
92  typedef typename super::polynomial_type polynomial_type;
93 
95  static const uint16_type nDofPerVertex = convex_type::nbPtsPerVertex;
97  static const uint16_type nDofPerEdge = convex_type::nbPtsPerEdge;
99  static const uint16_type nDofPerFace = convex_type::nbPtsPerFace;
101  static const uint16_type nDofPerVolume = convex_type::nbPtsPerVolume;
102 
103  static const uint16_type nLocalDof = convex_type::numPoints;
104 
105  static const uint16_type nDof = nLocalDof;
106  static const uint16_type nNodes = nDof;
107  static const uint16_type nDofGrad = super::nDim*nDof;
108  static const uint16_type nDofHess = super::nDim*super::nDim*nDof;
109 
110  BoundaryAdaptedPolynomialSet()
111  :
112  super( basis_type() )
113  {
114 
115  ublas::matrix<value_type> m( ublas::identity_matrix<value_type>( nComponents*convex_type::polyDims( nOrder ) ) );
116 
117  if ( is_tensor2 )
118  std::cout << "[boundaryadaptedpolynomialset] m = " << m << "\n";
119 
120  this->setCoefficient( polyset_type::toType( m ), true );
121  }
122 
123  BoundaryAdaptedPolynomialSet<Dim, Order, Scalar,T, Simplex > toScalar() const
124  {
125  return BoundaryAdaptedPolynomialSet<Dim, Order, Scalar,T, Simplex >();
126  }
127 
131  std::string familyName() const
132  {
133  return "dubinerba";
134  }
135 
136  points_type const& points() const
137  {
138  return this->basis().points();
139  }
140  points_type const& points( int f ) const
141  {
142  return this->basis().points( f );
143  }
144 };
145 
146 template<uint16_type Dim,
147  uint16_type Order,
148  template<uint16_type> class PolySetType,
149  typename T>
150 const uint16_type BoundaryAdaptedPolynomialSet<Dim, Order, PolySetType,T, Simplex >::nDofPerEdge;
151 
152 template<uint16_type Dim,
153  uint16_type Order,
154  template<uint16_type> class PolySetType,
155  typename T>
156 const uint16_type BoundaryAdaptedPolynomialSet<Dim, Order, PolySetType,T, Simplex >::nLocalDof;
157 
158 
159 template<uint16_type Dim,
160  uint16_type Order,
161  template<uint16_type> class PolySetType,
162  typename T>
163 class BoundaryAdaptedPolynomialSet<Dim, Order, PolySetType, T, Hypercube>
164  :
165 public PolynomialSet<TensorisedBoundaryAdapted<Dim, Order, T>, PolySetType >
166 {
167  typedef PolynomialSet<TensorisedBoundaryAdapted<Dim, Order, T>, PolySetType > super;
168 public:
169 
170  static const uint16_type nDim = Dim;
171  static const uint16_type nOrder = Order;
172 
173  typedef BoundaryAdaptedPolynomialSet<Dim, Order, PolySetType, T, Hypercube> self_type;
174  typedef self_type component_basis_type;
175 
176  typedef typename super::polyset_type polyset_type;
177  static const bool is_continuous = true;
178  static const bool is_tensor2 = polyset_type::is_tensor2;
179  static const bool is_vectorial = polyset_type::is_vectorial;
180  static const bool is_scalar = polyset_type::is_scalar;
181  static const bool is_modal = true;
182  static const uint16_type nComponents = polyset_type::nComponents;
183  typedef typename super::component_type component_type;
184 
185  typedef T value_type;
186  typedef TensorisedBoundaryAdapted<Dim, Order, T> basis_type;
187  typedef Hypercube<Dim, Order, Dim> convex_type;
188  template<int O>
189  struct convex
190  {
191  typedef Hypercube<Dim, O, Dim> type;
192  };
193  typedef Reference<convex_type, nDim, nOrder, nDim, value_type> reference_convex_type;
194 
195  typedef typename super::polynomial_type polynomial_type;
196 
197  typedef typename basis_type::points_type points_type;
198 
199 
201  static const uint16_type nDofPerVertex = convex_type::nbPtsPerVertex;
203  static const uint16_type nDofPerEdge = convex_type::nbPtsPerEdge;
205  static const uint16_type nDofPerFace = convex_type::nbPtsPerFace;
206 
207 
209  static const uint16_type nDofPerVolume = convex_type::nbPtsPerVolume;
210 
216  static const uint16_type nLocalDof = convex_type::numPoints;
218 
219  static const uint16_type nDof = nLocalDof;
220  static const uint16_type nNodes = nDof;
221  static const uint16_type nDofGrad = super::nDim*nDof;
222  static const uint16_type nDofHess = super::nDim*super::nDim*nDof;
223 
224  BoundaryAdaptedPolynomialSet()
225  :
226  super( basis_type() )
227 
228  {
229  ublas::matrix<value_type> m( ublas::identity_matrix<value_type>( nComponents*convex_type::polyDims( nOrder ) ) );
230 
231  if ( is_tensor2 )
232  std::cout << "[boundaryadaptedpolynomialset] m = " << m << "\n";
233 
234  this->setCoefficient( polyset_type::toType( m ), true );
235  }
236 
237  BoundaryAdaptedPolynomialSet<Dim, Order, Scalar,T, Hypercube > toScalar() const
238  {
239  return BoundaryAdaptedPolynomialSet<Dim, Order, Scalar,T, Hypercube >();
240  }
241 
245  std::string familyName() const
246  {
247  return "tensorizedba";
248  }
249 
250  points_type const& points() const
251  {
252  return this->basis().points();
253  }
254  points_type const& points( int f ) const
255  {
256  return this->basis().points( f );
257  }
258 };
259 } // detail
260 
262 
263 template<uint16_type Order,
264  template<uint16_type Dim> class PolySetType = Scalar>
265 class BoundaryAdaptedPolynomialSet
266 {
267 public:
268  template<uint16_type N,
269  typename T = double,
270  typename Convex = Simplex<N> >
271  struct apply
272  {
273  typedef typename mpl::if_<mpl::bool_<Convex::is_simplex>,
274  mpl::identity<Feel::detail::BoundaryAdaptedPolynomialSet<N,Order,PolySetType,T,Simplex> >,
275  mpl::identity<Feel::detail::
276 BoundaryAdaptedPolynomialSet<N,Order,PolySetType,T,Hypercube> > >::type::type result_type;
277  typedef result_type type;
278  };
279 
280  typedef BoundaryAdaptedPolynomialSet<Order,Scalar> component_basis_type;
281 };
282 
283 }
284 #endif /* __BoundaryAdaptedPolynomialSet_H */
boost::tuple< mpl::size_t< MESH_POINTS >, typename MeshTraits< MeshType >::point_const_iterator, typename MeshTraits< MeshType >::point_const_iterator > points(MeshType const &mesh)
Definition: filters.hpp:1296

Generated on Sun Dec 22 2013 13:10:55 for Feel++ by doxygen 1.8.5