Go to the documentation of this file.00001 #ifndef VIENNAFEM_TRANSFORM_QUADRILATERAL_HPP
00002 #define VIENNAFEM_TRANSFORM_QUADRILATERAL_HPP
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include <iostream>
00018 #include <utility>
00019 #include "viennagrid/topology/triangle.hpp"
00020 #include "viennagrid/algorithm/spanned_volume.hpp"
00021 #include "viennagrid/domain.hpp"
00022 #include "viennafem/forwards.h"
00023 #include "viennamath/manipulation/simplify.hpp"
00024
00029 namespace viennafem
00030 {
00031
00032 template <>
00033 struct dt_dx_handler<viennafem::unit_square>
00034 {
00035 public:
00036
00037 template <typename CellType>
00038 static void apply(CellType const & cell)
00039 {
00040 typedef typename CellType::config_type Config;
00041 typedef typename viennagrid::result_of::point<Config>::type PointType;
00042
00043 PointType const & p0 = viennagrid::ncells<0>(cell)[0].point();
00044 PointType const & p1 = viennagrid::ncells<0>(cell)[1].point();
00045 PointType const & p2 = viennagrid::ncells<0>(cell)[2].point();
00046 PointType const & p3 = viennagrid::ncells<0>(cell)[3].point();
00047
00048
00049 numeric_type x1_x0 = p1[0] - p0[0];
00050 numeric_type x2_x0 = p2[0] - p0[0];
00051 numeric_type y1_y0 = p1[1] - p0[1];
00052 numeric_type y2_y0 = p2[1] - p0[1];
00053 numeric_type coeff_x = p0[0] - p1[0] - p2[0] + p3[0];
00054 numeric_type coeff_y = p0[1] - p1[1] - p2[1] + p3[1];
00055
00056 viennamath::variable xi(0);
00057 viennamath::variable eta(1);
00058
00059 viennamath::expr det_J = (x1_x0 + eta * coeff_x) * (y2_y0 + xi * coeff_y) - (y1_y0 + eta * coeff_y) * (x2_x0 + xi * coeff_x);
00060 viennamath::inplace_simplify(det_J);
00061
00062 viennadata::access<det_dF_dt_key, viennamath::expr>()(cell) = det_J;
00063
00064
00065 typedef viennamath::expr ValueType;
00066
00067 viennadata::access<dt_dx_key<0, 0>, ValueType>()(cell) = ( y2_y0 + xi * coeff_y) / det_J;
00068 viennadata::access<dt_dx_key<0, 1>, ValueType>()(cell) = (-x2_x0 - xi * coeff_x) / det_J;
00069 viennadata::access<dt_dx_key<1, 0>, ValueType>()(cell) = (-y1_y0 - eta * coeff_y) / det_J;
00070 viennadata::access<dt_dx_key<1, 1>, ValueType>()(cell) = ( x1_x0 + eta * coeff_x) / det_J;
00071
00072 }
00073
00074 };
00075
00076
00077 }
00078
00079 #endif