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
im.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: 2006-12-30
7 
8  Copyright (C) 2006-2011 Université Joseph Fourier
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 __im_H
30 #define __im_H 1
31 #include <iostream>
32 
33 #include <feel/feelcore/feel.hpp>
34 
35 #include <feel/feelalg/glas.hpp>
36 
37 #include <feel/feelpoly/gauss.hpp>
41 
42 namespace Feel
43 {
44 namespace ublas = boost::numeric::ublas;
45 
50 template<uint16_type N>
52 {
53  static const uint16_type jacobi_degree = N;
54  static const uint16_type integration_degree = 2*jacobi_degree-1;
55 };
60 template<uint16_type N>
62 {
63  static const uint16_type integration_degree = N;
64  static const uint16_type jacobi_degree = ( integration_degree+1 )/2+1;
65 };
66 
67 
84 template<int Dim,
85  uint16_type Order,
86  typename T = double,
87  template<uint16_type, uint16_type, uint16_type> class Entity = Simplex,
88  template<class Convex, uint16_type O, typename T2> class QPS = Gauss,
89  template<uint16_type N> class DegreePolicy = IntegrationDegree>
90 class IMGeneral
91  :
92 public QPS<Entity<Dim,1,Dim>, DegreePolicy<Order>::integration_degree, T>
93 {
94  typedef QPS<Entity<Dim,1,Dim>, DegreePolicy<Order>::integration_degree, T> super;
95 public:
96  static const bool is_exact = false;
97  typedef DegreePolicy<Order> degree_policy_type;
98  static const uint16_type nDim = Dim;
99  static const uint16_type nNodes = degree_policy_type::jacobi_degree;
100  static const uint16_type nOrder = degree_policy_type::integration_degree;
101 
102  //typedef typename super::convex_type convex_type;
103  typedef Entity<Dim,nOrder,Dim> convex_type;
104  typedef typename super::value_type value_type;
105  typedef typename super::node_type node_type;
106  typedef typename super::weights_type weights_type;
107  typedef typename super::nodes_type nodes_type;
108 
109  typedef boost::tuple<nodes_type, weights_type> quadrature_data_type;
110  typedef typename super::face_quadrature_type face_quadrature_type;
112 
113  IMGeneral()
114  :
115  super()
116  {
117 
118  }
119 
120  ~IMGeneral() {}
121  quadrature_data_type data() const
122  {
123  return boost::make_tuple( this->points(), this->weights() );
124  }
125 
126 };
127 
128 template<int DIM,
129  int IMORDER,
130  typename T = double,
131  template<uint16_type, uint16_type, uint16_type> class Entity = Simplex>
132 struct IM
133  :
134  public mpl::if_<mpl::and_<mpl::or_<mpl::and_<mpl::less_equal<mpl::int_<IMORDER>,mpl::int_<20> >,
135  mpl::equal_to<mpl::int_<DIM>,mpl::int_<2> > >,
136  mpl::and_<mpl::less_equal<mpl::int_<IMORDER>,mpl::int_<20> >,
137  mpl::equal_to<mpl::int_<DIM>,mpl::int_<3> > > >,
138  mpl::bool_<Entity<DIM,1,DIM>::is_simplex> >,
139  mpl::identity<IMSimplex<DIM, IMORDER, T> >,
140  mpl::identity<IMGeneral<DIM, IMORDER, T, Entity> > >::type::type
141 {
142  template<int DIM1,
143  typename T1,
144  template<uint16_type, uint16_type, uint16_type> class Entity1>
145  struct apply
146  {
147  typedef typename mpl::if_<mpl::and_<mpl::or_<mpl::and_<mpl::less_equal<mpl::int_<IMORDER>,mpl::int_<20> >,
148  mpl::equal_to<mpl::int_<DIM1>,mpl::int_<2> > >,
149  mpl::and_<mpl::less_equal<mpl::int_<IMORDER>,mpl::int_<20> >,
150  mpl::equal_to<mpl::int_<DIM1>,mpl::int_<3> > > >,
151  mpl::bool_<Entity1<DIM1,1,DIM1>::is_simplex> >,
152  mpl::identity<IMSimplex<DIM1, IMORDER, T1> >,
153  mpl::identity<IMGeneral<DIM1, IMORDER, T1, Entity1> > >::type::type type;
154  };
155 };
156 
157 template<int IMORDER>
158 struct _Q
159 {
160  template<int DIM,
161  typename T,
162  template<uint16_type, uint16_type, uint16_type> class Entity>
163  struct apply
164  {
165  typedef typename mpl::if_<mpl::and_<mpl::or_<mpl::and_<mpl::less_equal<mpl::int_<IMORDER>,mpl::int_<20> >,
166  mpl::equal_to<mpl::int_<DIM>,mpl::int_<2> > >,
167  mpl::and_<mpl::less_equal<mpl::int_<IMORDER>,mpl::int_<20> >,
168  mpl::equal_to<mpl::int_<DIM>,mpl::int_<3> > > >,
169  mpl::bool_<Entity<DIM,1,DIM>::is_simplex> >,
170  mpl::identity<IMSimplex<DIM, IMORDER, T> >,
171  mpl::identity<IMGeneral<DIM, IMORDER, T, Entity> > >::type::type type;
172  };
173 
174  template<typename ContextType>
175  struct applyContext
176  {
177  static const int DIM = ContextType::PDim;
178  typedef typename ContextType::value_type T;
179  typedef typename mpl::if_<mpl::and_<mpl::or_<mpl::and_<mpl::less_equal<mpl::int_<IMORDER>,mpl::int_<20> >,
180  mpl::equal_to<mpl::int_<DIM>,mpl::int_<2> > >,
181  mpl::and_<mpl::less_equal<mpl::int_<IMORDER>,mpl::int_<20> >,
182  mpl::equal_to<mpl::int_<DIM>,mpl::int_<3> > > >,
183  mpl::bool_<ContextType::element_type::is_simplex> >,
184  mpl::identity<IMSimplex<DIM, IMORDER, T> >,
185  typename mpl::if_<mpl::bool_<ContextType::element_type::is_simplex>,
186  mpl::identity<IMGeneral<DIM, IMORDER, T, Simplex> >,
187  mpl::identity<IMGeneral<DIM, IMORDER, T, Hypercube> > >::type>::type::type type;
188  };
189 };
190 
191 
192 #if 0
193 template<int Dim,
194  uint16_type Order,
195  typename T,
196  template<uint16_type,uint16_type,uint16_type> class Entity,
197  template<class Convex, uint16_type O, typename T2> class QPS,
198  template<uint16_type N> class DegreePolicy>
199 std::ostream&
200 operator<<( std::ostream& os,
201  Feel::IM<Dim, Order, T, Entity,QPS, DegreePolicy> const& qps )
202 {
203  os << "quadrature point set:\n"
204  << "number of points: " << qps.nPoints() << "\n"
205  << "points : " << qps.points() << "\n"
206  << "weights : " << qps.weights() << "\n";
207 
208  for ( size_type f = 0; f < qps.nFaces(); ++f )
209  {
210  os << " o Face " << f << "\n";
211  os << " number of points: " << qps.nPointsOnFace( f ) << "\n"
212  << " points : " << qps.fpoints( f ) << "\n"
213  << " weights : " << qps.weights( f ) << "\n";
214  }
215 
216  return os;
217 }
218 
219 template<int Dim, int IMORDER, typename T> struct ImBestSimplex
220  :
221  public mpl::if_<mpl::less_equal<mpl::int_<IMORDER>,mpl::int_<6> >,
222  mpl::identity<IMSimplex<Dim, IMORDER, T> >,
223  mpl::identity<IM<Dim, IMORDER, T, Simplex> > >::type::type
224 {};
225 #endif
226 } // Feel
227 
228 
229 #endif /* __im_H */

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