Go to the documentation of this file.00001 #ifndef VIENNAFEM_QUADRATURE_QUAD_HPP
00002 #define VIENNAFEM_QUADRATURE_QUAD_HPP
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "viennafem/forwards.h"
00018
00019 #include "viennafem/quadrature/line.hpp"
00020
00021 #include "viennafem/quadrature/triangle.hpp"
00022 #include "viennafem/quadrature/quadrilateral.hpp"
00023
00024
00025 #include "viennafem/quadrature/tetrahedron.hpp"
00026 #include "viennafem/quadrature/hexahedron.hpp"
00027
00032 namespace viennafem
00033 {
00034 namespace detail
00035 {
00036
00037 template <typename ReferenceCellType, typename BasisTag>
00038 inline viennamath::numerical_quadrature make_quadrature_rule_impl(BasisTag)
00039 {
00040 std::cerr << "Quadrature rule not available!" << std::endl;
00041 throw "Quadrature rule not available!";
00042 return viennamath::numerical_quadrature(NULL);
00043 }
00044
00045
00046
00047
00048 template <>
00049 inline viennamath::numerical_quadrature make_quadrature_rule_impl<viennafem::unit_interval>(lagrange_tag<1>)
00050 {
00051
00052 return viennamath::numerical_quadrature(new rt_gauss_quad_element <viennafem::unit_interval, 3>());
00053 }
00054
00055 template <>
00056 inline viennamath::numerical_quadrature make_quadrature_rule_impl<viennafem::unit_interval>(lagrange_tag<2>)
00057 {
00058
00059 return viennamath::numerical_quadrature(new rt_gauss_quad_element <viennafem::unit_interval, 5>());
00060 }
00061
00062 template <>
00063 inline viennamath::numerical_quadrature make_quadrature_rule_impl<viennafem::unit_interval>(lagrange_tag<3>)
00064 {
00065
00066 return viennamath::numerical_quadrature(new rt_gauss_quad_element <viennafem::unit_interval, 5>());
00067 }
00068
00069
00070
00071
00072 template <>
00073 inline viennamath::numerical_quadrature make_quadrature_rule_impl<viennafem::unit_square>(lagrange_tag<1>)
00074 {
00075
00076 return viennamath::numerical_quadrature(new rt_gauss_quad_element <viennafem::unit_square, 3>());
00077 }
00078
00079 template <>
00080 inline viennamath::numerical_quadrature make_quadrature_rule_impl<viennafem::unit_square>(lagrange_tag<2>)
00081 {
00082
00083 return viennamath::numerical_quadrature(new rt_gauss_quad_element <viennafem::unit_square, 5>());
00084 }
00085
00086
00087
00088
00089 template <>
00090 inline viennamath::numerical_quadrature make_quadrature_rule_impl<viennafem::unit_triangle>(lagrange_tag<1>)
00091 {
00092
00093 return viennamath::numerical_quadrature(new rt_strang_quad_element <viennafem::unit_triangle, 2>());
00094 }
00095
00096 template <>
00097 inline viennamath::numerical_quadrature make_quadrature_rule_impl<viennafem::unit_triangle>(lagrange_tag<2>)
00098 {
00099
00100 return viennamath::numerical_quadrature(new rt_strang_quad_element <viennafem::unit_triangle, 4>());
00101 }
00102
00103
00104
00105
00106
00107 template <>
00108 inline viennamath::numerical_quadrature make_quadrature_rule_impl<viennafem::unit_cube>(lagrange_tag<1>)
00109 {
00110
00111 return viennamath::numerical_quadrature(new rt_gauss_quad_element <viennafem::unit_cube, 3>());
00112 }
00113
00114 template <>
00115 inline viennamath::numerical_quadrature make_quadrature_rule_impl<viennafem::unit_cube>(lagrange_tag<2>)
00116 {
00117
00118 return viennamath::numerical_quadrature(new rt_gauss_quad_element <viennafem::unit_cube, 5>());
00119 }
00120
00121
00122
00123
00124
00125 template <>
00126 inline viennamath::numerical_quadrature make_quadrature_rule_impl<viennafem::unit_tetrahedron>(lagrange_tag<1>)
00127 {
00128
00129 return viennamath::numerical_quadrature(new rt_keast_quad_element <viennafem::unit_tetrahedron, 2>());
00130 }
00131
00132 template <>
00133 inline viennamath::numerical_quadrature make_quadrature_rule_impl<viennafem::unit_tetrahedron>(lagrange_tag<2>)
00134 {
00135
00136 return viennamath::numerical_quadrature(new rt_keast_quad_element <viennafem::unit_tetrahedron, 4>());
00137 }
00138
00139 }
00140
00141
00142
00143
00144
00145
00147 template <typename PDESystemType, typename DomainType>
00148 viennamath::numerical_quadrature make_quadrature_rule(PDESystemType const & pde_system, DomainType const & domain)
00149 {
00150 typedef typename DomainType::config_type Config;
00151 typedef typename Config::cell_tag CellTag;
00152
00153
00154 switch (pde_system.option(0).trial_space_id())
00155 {
00156 case space_to_id< lagrange_tag<1> >::value:
00157 return detail::make_quadrature_rule_impl<typename reference_cell_for_basis<CellTag, viennafem::lagrange_tag<1> >::type>(lagrange_tag<1>());
00158 case space_to_id< lagrange_tag<2> >::value:
00159 return detail::make_quadrature_rule_impl<typename reference_cell_for_basis<CellTag, viennafem::lagrange_tag<2> >::type>(lagrange_tag<2>());
00160 case space_to_id< lagrange_tag<3> >::value:
00161 return detail::make_quadrature_rule_impl<typename reference_cell_for_basis<CellTag, viennafem::lagrange_tag<3> >::type>(lagrange_tag<3>());
00162 }
00163
00164 std::cerr << "make_quadrature_rule(): Cannot derive quadrature rule!" << std::endl;
00165 throw "Cannot derive quadrature rule!";
00166
00167 return viennamath::numerical_quadrature(NULL);
00168 }
00169
00170
00171 }
00172
00173
00174 #endif