• Main Page
  • Namespaces
  • Data Structures
  • Files
  • File List

/export/development/ViennaFEM/viennafem/quadrature/line.hpp

Go to the documentation of this file.
00001 #ifndef VIENNAFEM_QUADRATURE_LINE_HPP
00002 #define VIENNAFEM_QUADRATURE_LINE_HPP
00003 
00004 /* =========================================================================
00005    Copyright (c) 2012, Institute for Microelectronics,
00006                        Institute for Analysis and Scientific Computing,
00007                        TU Wien.
00008                              -----------------
00009                ViennaFEM - The Vienna Finite Element Method Library
00010                              -----------------
00011 
00012    Author:     Karl Rupp                          rupp@iue.tuwien.ac.at
00013 
00014    License:    MIT (X11), see file LICENSE in the ViennaFEM base directory
00015 ============================================================================ */
00016 
00017 #include "viennafem/forwards.h"
00018 #include "viennafem/cell_quan.hpp"
00019 
00020 #include "viennamath/forwards.h"
00021 #include "viennamath/expression.hpp"
00022 #include "viennamath/manipulation/substitute.hpp"
00023 #include "viennamath/manipulation/diff.hpp"
00024 #include "viennamath/manipulation/eval.hpp"
00025 #include "viennamath/runtime/numerical_quadrature.hpp"
00026 
00027 #include "viennagrid/topology/triangle.hpp"
00028 #include "viennagrid/topology/tetrahedron.hpp"
00029 
00034 namespace viennafem
00035 {
00036   
00037   //
00038   //
00039   // Exact for polynomials up to order 1
00040   //
00041   //
00043   template <typename InterfaceType>
00044   class rt_gauss_quad_element <viennafem::unit_interval, 1, InterfaceType> : public viennamath::numerical_quadrature_interface<InterfaceType>
00045   {
00046       typedef typename InterfaceType::numeric_type         NumericT;
00047       typedef rt_gauss_quad_element <viennafem::unit_interval, 1, InterfaceType>  self_type;
00048       typedef viennamath::numerical_quadrature_interface<InterfaceType>    BaseType;
00049       
00050     public:
00051       
00052       BaseType * clone() const { return new self_type(); }
00053       
00054       NumericT eval(viennamath::rt_interval<InterfaceType> const & interv,
00055                     viennamath::rt_expr<InterfaceType> const & e,
00056                     viennamath::rt_variable<InterfaceType> const & var) const
00057       {
00058         return viennamath::eval(e, 0.5);  //Note: reference line is [0,1] here.
00059       }
00060       
00061   };
00062   
00063   //
00064   //
00065   // Exact for polynomials up to degree 2
00066   //
00067   //
00068 
00069   
00070 
00071   //  
00072   //
00073   // Exact for polynomials up to degree 3:
00074   //
00075   //
00077   template <typename InterfaceType>
00078   class rt_gauss_quad_element <viennafem::unit_interval, 3, InterfaceType> : public viennamath::numerical_quadrature_interface<InterfaceType>
00079   {
00080       typedef typename InterfaceType::numeric_type         NumericT;
00081       typedef rt_gauss_quad_element <viennafem::unit_interval, 3, InterfaceType>  self_type;
00082       typedef viennamath::numerical_quadrature_interface<InterfaceType>    BaseType;
00083     public:
00084       
00085       BaseType * clone() const { return new self_type(); }
00086       
00087       NumericT eval(viennamath::rt_interval<InterfaceType> const & interv,
00088                     viennamath::rt_expr<InterfaceType> const & e,
00089                     viennamath::rt_variable<InterfaceType> const & var) const
00090       {
00091         return 0.5 * (  viennamath::eval(e, 0.7886751345948125) 
00092                       + viennamath::eval(e, 0.2113248654051875));  //Note: reference line is [0,1] here.
00093       }
00094       
00095   };
00096   
00097   
00098   //  
00099   //
00100   // Exact for polynomials up to degree 5:
00101   //
00102   //
00104   template <typename InterfaceType>
00105   class rt_gauss_quad_element <viennafem::unit_interval, 5, InterfaceType> : public viennamath::numerical_quadrature_interface<InterfaceType>
00106   {
00107       typedef typename InterfaceType::numeric_type         NumericT;
00108       typedef rt_gauss_quad_element <viennafem::unit_interval, 5, InterfaceType>  self_type;
00109       typedef viennamath::numerical_quadrature_interface<InterfaceType>    BaseType;
00110     public:
00111       
00112       BaseType * clone() const { return new self_type(); }
00113       
00114       NumericT eval(viennamath::rt_interval<InterfaceType> const & interv,
00115                     viennamath::rt_expr<InterfaceType> const & e,
00116                     viennamath::rt_variable<InterfaceType> const & var) const
00117       {
00118         return (  5.0 * viennamath::eval(e, 0.11270166537925829786) 
00119                 + 8.0 * viennamath::eval(e, 0.5)
00120                 + 5.0 * viennamath::eval(e, 0.88729833462074170214)) / 18.0;  //Note: reference line is [0,1] here.
00121       }
00122       
00123   };
00124   
00125 
00126 }
00127 #endif

Generated on Wed Feb 29 2012 21:51:04 for ViennaFEM - The Vienna Finite Element Method Library by  doxygen 1.7.1