00001 #ifndef NMWR_GB_REG2D_ELEMENT_TRAITS_H 00002 #define NMWR_GB_REG2D_ELEMENT_TRAITS_H 00003 00004 // $LICENSE 00005 00006 #include "Gral/Base/element-traits.h" 00007 #include "Gral/Grids/Cartesian2D/cartesian-grid2d.h" 00008 00018 template<class E> 00019 struct hasher_for_reg2d { 00020 int operator()(const E& e) const { return e.GlobalNumber();} 00021 }; 00022 00023 00026 template<> 00027 struct element_traits<RegGrid2D::Vertex> 00028 : public element_traits_vertex_base<RegGrid2D> 00029 { 00030 typedef hasher_for_reg2d<element_type> hasher_type; 00031 typedef consecutive_integer_tag<0> consecutive_tag; 00032 static RegGrid2D::Vertex handle2element(grid_type const& g, handle_type h) 00033 { return (g.vertex(h));} 00034 }; 00035 00036 00039 template<> 00040 struct element_traits<RegGrid2D::Edge> 00041 : public element_traits_edge_base<RegGrid2D> 00042 { 00043 typedef hasher_for_reg2d<element_type> hasher_type; 00044 typedef consecutive_integer_tag<0> consecutive_tag; 00045 static RegGrid2D::Edge handle2element(grid_type const& g, handle_type h) 00046 { return (g.edge(h));} 00047 00048 }; 00049 00050 00053 template<> 00054 struct element_traits<RegGrid2D::Cell> 00055 : public element_traits_cell_base<RegGrid2D> 00056 { 00057 typedef hasher_for_reg2d<element_type> hasher_type; 00058 typedef consecutive_integer_tag<0> consecutive_tag; 00059 static RegGrid2D::Cell handle2element(grid_type const& g, handle_type h) 00060 { return (g.cell(h));} 00061 }; 00062 00063 00064 #endif 00065