1 #ifndef NIHU_CORNER_ANGLE_HPP_INCLUDED
2 #define NIHU_CORNER_ANGLE_HPP_INCLUDED
7 #include "boost/math/constants/constants.hpp"
13 template <
class Elem,
class NSet,
unsigned dimension = Elem::domain_t::dimension>
16 template <
class Elem,
class Nset>
22 static double eval(elem_t
const&,
unsigned nset_corner_idx)
25 return 0.5 * (1 + nset_t::position_dof(nset_corner_idx));
29 template <
class Elem,
class Nset>
37 static unsigned const num_domain_corners = domain_t::num_corners;
40 static double eval(Elem
const& elem,
unsigned nset_corner_idx)
42 auto position_dof = nset_t::position_dof(nset_corner_idx);
46 int domain_corner_idx = nset_t::node_to_domain_corner(nset_corner_idx);
48 auto cp = domain_t::get_corner((domain_corner_idx + num_domain_corners-1) % num_domain_corners);
49 auto c0 = domain_t::get_corner(domain_corner_idx);
50 auto cn = domain_t::get_corner((domain_corner_idx + 1)%num_domain_corners);
55 auto dx = elem.get_dx(nset_t::corner_at(nset_corner_idx));
57 auto dx_p = (dx * dcp).normalized();
58 auto dx_n = (dx * dcn).normalized();
61 double angle = std::acos(dx_p.dot(dx_n));
63 return angle / (2.0 * boost::math::double_constants::pi);