23 #ifndef LIB_SHAPE_HPP_INCLUDED
24 #define LIB_SHAPE_HPP_INCLUDED
26 #include "../core/shapeset.hpp"
30 #include "quad_1_gauss_shape_set.hpp"
31 #include "tria_1_gauss_shape_set.hpp"
50 namespace shape_set_traits
79 typedef shape_set_traits::shape_value_type<line_1_shape_set, 0>::type shape_t;
82 static shape_t eval(xi_t
const &xi)
101 typedef shape_set_traits::shape_value_type<line_1_shape_set, 1>::type shape_t;
104 static shape_t eval(xi_t
const &)
124 typedef shape_set_traits::shape_value_type<line_1_shape_set, 2>::type shape_t;
127 static shape_t eval(xi_t
const &)
129 return shape_t::Zero();
137 namespace shape_set_traits
167 typedef shape_set_traits::shape_value_type<tria_1_shape_set, 0>::type shape_t;
170 static shape_t eval(xi_t
const &xi)
187 typedef shape_set_traits::shape_value_type<tria_1_shape_set, 1>::type shape_t;
190 static shape_t eval(xi_t
const &)
208 typedef shape_set_traits::shape_value_type<tria_1_shape_set, 2>::type shape_t;
211 static shape_t eval(xi_t
const &)
213 return shape_t::Zero();
222 namespace shape_set_traits
255 typedef shape_set_traits::shape_value_type<quad_1_shape_set, 0>::type shape_t;
258 static shape_t eval(xi_t
const &xi)
261 (1.0 - xi[0])*(1.0 - xi[1]),
262 (1.0 + xi[0])*(1.0 - xi[1]),
263 (1.0 + xi[0])*(1.0 + xi[1]),
264 (1.0 - xi[0])*(1.0 + xi[1])
276 typedef shape_set_traits::shape_value_type<quad_1_shape_set, 1>::type shape_t;
279 static shape_t eval(xi_t
const &xi)
282 -(1.0 - xi[1]), -(1.0 - xi[0]),
283 +(1.0 - xi[1]), -(1.0 + xi[0]),
284 +(1.0 + xi[1]), +(1.0 + xi[0]),
285 -(1.0 + xi[1]), +(1.0 - xi[0])
297 typedef shape_set_traits::shape_value_type<quad_1_shape_set, 2>::type shape_t;
300 static shape_t eval(xi_t
const &)
315 namespace shape_set_traits
323 template <
unsigned Order>
346 typedef shape_set_traits::shape_value_type<brick_1_shape_set, 0>::type shape_t;
349 static shape_t eval(xi_t
const &xi)
352 (1.0 - xi[0])*(1.0 - xi[1])*(1.0 - xi[2]),
353 (1.0 + xi[0])*(1.0 - xi[1])*(1.0 - xi[2]),
354 (1.0 + xi[0])*(1.0 + xi[1])*(1.0 - xi[2]),
355 (1.0 - xi[0])*(1.0 + xi[1])*(1.0 - xi[2]),
356 (1.0 - xi[0])*(1.0 - xi[1])*(1.0 + xi[2]),
357 (1.0 + xi[0])*(1.0 - xi[1])*(1.0 + xi[2]),
358 (1.0 + xi[0])*(1.0 + xi[1])*(1.0 + xi[2]),
359 (1.0 - xi[0])*(1.0 + xi[1])*(1.0 + xi[2])
372 typedef shape_set_traits::shape_value_type<brick_1_shape_set, 1>::type shape_t;
375 static shape_t eval(xi_t
const &xi)
378 (-1.0)*(1.0 - xi[1])*(1.0 - xi[2]), (1.0 - xi[0])*(-1.0)*(1.0 - xi[2]), (1.0 - xi[0])*(1.0 - xi[1])*(-1.0),
379 (+1.0)*(1.0 - xi[1])*(1.0 - xi[2]), (1.0 + xi[0])*(-1.0)*(1.0 - xi[2]), (1.0 + xi[0])*(1.0 - xi[1])*(-1.0),
380 (+1.0)*(1.0 + xi[1])*(1.0 - xi[2]), (1.0 + xi[0])*(+1.0)*(1.0 - xi[2]), (1.0 + xi[0])*(1.0 + xi[1])*(-1.0),
381 (-1.0)*(1.0 + xi[1])*(1.0 - xi[2]), (1.0 - xi[0])*(+1.0)*(1.0 - xi[2]), (1.0 - xi[0])*(1.0 + xi[1])*(-1.0),
382 (-1.0)*(1.0 - xi[1])*(1.0 + xi[2]), (1.0 - xi[0])*(-1.0)*(1.0 + xi[2]), (1.0 - xi[0])*(1.0 - xi[1])*(+1.0),
383 (+1.0)*(1.0 - xi[1])*(1.0 + xi[2]), (1.0 + xi[0])*(-1.0)*(1.0 + xi[2]), (1.0 + xi[0])*(1.0 - xi[1])*(+1.0),
384 (+1.0)*(1.0 + xi[1])*(1.0 + xi[2]), (1.0 + xi[0])*(+1.0)*(1.0 + xi[2]), (1.0 + xi[0])*(1.0 + xi[1])*(+1.0),
385 (-1.0)*(1.0 + xi[1])*(1.0 + xi[2]), (1.0 - xi[0])*(+1.0)*(1.0 + xi[2]), (1.0 - xi[0])*(1.0 + xi[1])*(+1.0)
398 typedef shape_set_traits::shape_value_type<brick_1_shape_set, 2>::type shape_t;
401 static shape_t eval(xi_t
const &xi)
404 0.0, 1.0 - xi[2], 1.0 - xi[1], 0.0, 1.0 - xi[0], 0.0,
405 0.0, xi[2] - 1.0, xi[1] - 1.0, 0.0, xi[0] + 1.0, 0.0,
406 0.0, 1.0 - xi[2], -xi[1] - 1.0, 0.0, -xi[0] - 1.0, 0.0,
407 0.0, xi[2] - 1.0, xi[1] + 1.0, 0.0, xi[0] - 1.0, 0.0,
408 0.0, xi[2] + 1.0, xi[1] - 1.0, 0.0, xi[0] - 1.0, 0.0,
409 0.0, -xi[2] - 1.0, 1.0 - xi[1], 0.0, -xi[0] - 1.0, 0.0,
410 0.0, xi[2] + 1.0, xi[1] + 1.0, 0.0, xi[0] + 1.0, 0.0,
411 0.0, -xi[2] - 1.0, -xi[1] - 1.0, 0.0, 1.0 - xi[0], 0.0
420 namespace shape_set_traits
443 template <
unsigned Order>
473 typedef typename base_t::corners_t corners_t;
474 typedef typename base_t::corner_iterator_t corner_iterator_t;
498 typedef shape_set_traits::shape_value_type<line_2_shape_set, 0>::type shape_t;
501 static shape_t eval(xi_t
const &xi)
504 -xi[0]*(1.0 - xi[0]) / 2.0,
506 xi[0] * (1.0 + xi[0]) / 2.0
519 typedef shape_set_traits::shape_value_type<line_2_shape_set, 1>::type shape_t;
522 static shape_t eval(xi_t
const &xi)
539 typedef shape_set_traits::shape_value_type<line_2_shape_set, 2>::type shape_t;
542 static shape_t eval(xi_t
const &)
544 return shape_t(1.0, -2.0, 1.0);
552 namespace shape_set_traits
575 template <
unsigned Order>
602 typedef typename base_t::corners_t corners_t;
603 typedef typename base_t::corner_iterator_t corner_iterator_t;
627 typedef shape_set_traits::shape_value_type<tria_2_shape_set, 0>::type shape_t;
630 static shape_t eval(xi_t
const &_xi)
632 auto xi = _xi[0], eta = _xi[1];
634 (eta + xi - 1.0)*(2.0*eta + 2.0*xi - 1.0),
635 -4.0*xi*(eta + xi - 1),
639 -4.0*eta*(eta + xi - 1.0)
652 typedef shape_set_traits::shape_value_type<tria_2_shape_set, 1>::type shape_t;
655 static shape_t eval(xi_t
const &_xi)
657 auto xi = _xi[0], eta = _xi[1];
659 4.0*eta + 4 * xi - 3, 4.0*eta + 4 * xi - 3.0,
660 4.0 - 8 * xi - 4 * eta, -4.0*xi,
664 -4.0*eta, 4.0 - 4.0*xi - 8.0*eta
676 typedef shape_set_traits::shape_value_type<tria_2_shape_set, 2>::type shape_t;
679 static shape_t eval(xi_t
const &)
696 namespace shape_set_traits
719 template <
unsigned Order>
746 typedef typename base_t::corners_t corners_t;
747 typedef typename base_t::corner_iterator_t corner_iterator_t;
771 typedef shape_set_traits::shape_value_type<quad_2_shape_set, 0>::type shape_t;
774 static shape_t eval(xi_t
const &_xi)
776 auto xi = _xi[0], eta = _xi[1];
777 auto _1mxi = 1 - xi, _1pxi = 1 + xi;
778 auto _1meta = 1 - eta, _1peta = 1 + eta;
780 _1mxi*xi * _1meta*eta / 4.0,
781 _1mxi*_1pxi * _1meta*(-eta) / 2.0,
782 _1pxi*xi * _1meta*(-eta) / 4.0,
783 _1pxi*xi * _1meta*_1peta / 2.0,
784 _1pxi*xi * _1peta*eta / 4.0,
785 _1mxi*_1pxi * _1peta*eta / 2.0,
786 _1mxi*(-xi) * _1peta*eta / 4.0,
787 _1mxi*(-xi) * _1meta*_1peta / 2.0,
788 _1mxi*_1pxi * _1meta*_1peta
801 typedef shape_set_traits::shape_value_type<quad_2_shape_set, 1>::type shape_t;
804 static shape_t eval(xi_t
const &_xi)
806 auto xi = _xi[0], eta = _xi[1], xi2 = xi*xi, eta2 = eta*eta;
808 eta*(2.0*xi - 1.0)*(eta - 1.0) / 4.0, xi*(2.0*eta - 1.0)*(xi - 1.0) / 4.0,
809 -xi*eta*(eta - 1.0), -(xi2 - 1.0)*(2.0*eta - 1.0) / 2.0,
810 eta*(2.0*xi + 1.0)*(eta - 1.0) / 4.0, xi*(2.0*eta - 1.0)*(xi + 1.0) / 4.0,
811 -(2.0*xi + 1.0)*(eta2 - 1.0) / 2.0, -xi*eta*(xi + 1.0),
812 eta*(2.0*xi + 1.0)*(eta + 1.0) / 4.0, xi*(2.0*eta + 1.0)*(xi + 1.0) / 4.0,
813 -xi*eta*(eta + 1.0), -(xi2 - 1.0)*(2.0*eta + 1.0) / 2.0,
814 eta*(2.0*xi - 1.0)*(eta + 1.0) / 4.0, xi*(2.0*eta + 1.0)*(xi - 1.0) / 4.0,
815 -(2.0*xi - 1.0)*(eta2 - 1.0) / 2.0, -xi*eta*(xi - 1.0),
816 2.0*xi*(eta2 - 1.0), 2.0*eta*(xi2 - 1.0)
829 typedef shape_set_traits::shape_value_type<quad_2_shape_set, 2>::type shape_t;
832 static shape_t eval(xi_t
const &_xi)
834 auto xi = _xi[0], eta = _xi[1], xi2 = xi*xi, eta2 = eta*eta;
836 eta2 / 2.0 - eta / 2.0, eta*xi - xi / 2.0 - eta / 2.0 + 1.0 / 4.0, xi2 / 2.0 - xi / 2.0,
837 -eta2 + eta, xi - 2 * eta*xi, 1.0 - xi2,
838 eta2 / 2.0 - eta / 2.0, eta / 2.0 - xi / 2.0 + eta*xi - 1.0 / 4.0, xi2 / 2.0 + xi / 2.0,
839 1.0 - eta2, -eta - 2 * eta*xi, -xi2 - xi,
840 eta2 / 2.0 + eta / 2.0, eta / 2.0 + xi / 2.0 + eta*xi + 1.0 / 4.0, xi2 / 2.0 + xi / 2.0,
841 -eta2 - eta, -xi - 2 * eta*xi, 1.0 - xi2,
842 eta2 / 2.0 + eta / 2.0, xi / 2.0 - eta / 2.0 + eta*xi - 1.0 / 4.0, xi2 / 2.0 - xi / 2.0,
843 1.0 - eta2, eta - 2 * eta*xi, -xi2 + xi,
844 2 * eta2 - 2.0, 4 * eta*xi, 2 * xi2 - 2.0
853 namespace shape_set_traits
876 template <
unsigned Order>
900 typedef typename base_t::corners_t corners_t;
901 typedef typename base_t::corner_iterator_t corner_iterator_t;
925 typedef shape_set_traits::shape_value_type<quad_28_shape_set, 0>::type shape_t;
928 static shape_t eval(xi_t
const &_xi)
930 auto xi = _xi[0], eta = _xi[1], xi2 = xi*xi, eta2 = eta*eta;
932 -((xi - 1.0)*(eta - 1.0)*(xi + eta + 1.0)) / 4.0,
933 ((xi2 - 1.0)*(eta - 1.0)) / 2.0,
934 ((xi + 1.0)*(eta - 1.0)*(eta - xi + 1.0)) / 4.0,
935 -((eta2 - 1.0)*(xi + 1.0)) / 2.0,
936 ((xi + 1.0)*(eta + 1.0)*(xi + eta - 1.0)) / 4.0,
937 -((xi2 - 1.0)*(eta + 1.0)) / 2.0,
938 ((xi - 1.0)*(eta + 1.0)*(xi - eta + 1.0)) / 4.0,
939 ((eta2 - 1.0)*(xi - 1.0)) / 2.0
952 typedef shape_set_traits::shape_value_type<quad_28_shape_set, 1>::type shape_t;
955 static shape_t eval(xi_t
const &_xi)
957 auto x = _xi[0], y = _xi[1], x2 = x*x, y2 = y*y;
959 -((2.0*x + y)*(y - 1.0)) / 4.0, -((x + 2 * y)*(x - 1.0)) / 4.0,
960 x*(y - 1.0), (x2 - 1.0) / 2.0,
961 -((2.0*x - y)*(y - 1.0)) / 4.0, -((x - 2 * y)*(x + 1.0)) / 4.0,
962 (1.0 - y2) / 2.0, -y*(x + 1.0),
963 ((2.0*x + y)*(y + 1.0)) / 4.0, ((x + 2 * y)*(x + 1.0)) / 4.0,
964 -x*(y + 1.0), (1.0 - x2) / 2.0,
965 ((2.0*x - y)*(y + 1.0)) / 4.0, ((x - 2 * y)*(x - 1.0)) / 4.0,
966 (y2 - 1.0) / 2.0, y*(x - 1.0)
979 typedef shape_set_traits::shape_value_type<quad_28_shape_set, 2>::type shape_t;
982 static shape_t eval(xi_t
const &_xi)
984 auto xi(_xi[0]), eta(_xi[1]);
986 .5 - eta / 2.0, 1 / 4.0 - xi / 2.0 - eta / 2.0, .5 - xi / 2.0,
988 .5 - eta / 2.0, eta / 2.0 - xi / 2.0 - 1 / 4.0, xi / 2.0 + .5,
989 0.0, -eta, -xi - 1.0,
990 eta / 2.0 + .5, eta / 2.0 + xi / 2.0 + 1 / 4.0, xi / 2.0 + .5,
991 -eta - 1.0, -xi, 0.0,
992 eta / 2.0 + .5, xi / 2.0 - eta / 2.0 - 1 / 4.0, .5 - xi / 2.0,
1001 #endif // LIB_SHAPE_HPP_INCLUDED