ViennaGrid - The Vienna Grid Library
2.1.0
|
00001 #ifndef VIENNAGRID_TOPOLOGY_PLC_HPP 00002 #define VIENNAGRID_TOPOLOGY_PLC_HPP 00003 00004 /* ======================================================================= 00005 Copyright (c) 2011-2014, Institute for Microelectronics, 00006 Institute for Analysis and Scientific Computing, 00007 TU Wien. 00008 00009 ----------------- 00010 ViennaGrid - The Vienna Grid Library 00011 ----------------- 00012 00013 License: MIT (X11), see file LICENSE in the base directory 00014 ======================================================================= */ 00015 00016 #include "viennagrid/forwards.hpp" 00017 #include "viennagrid/topology/simplex.hpp" 00018 #include "viennagrid/topology/polygon.hpp" 00019 00025 namespace viennagrid 00026 { 00027 00029 struct plc_tag 00030 { 00031 typedef line_tag facet_tag; 00032 00033 static const int dim = 2; 00034 static std::string name() { return "PLC"; } 00035 }; 00036 00037 //Line: 00039 template <> 00040 struct boundary_elements<plc_tag, vertex_tag> 00041 { 00042 typedef dynamic_layout_tag layout_tag; 00043 static const int num = -1; 00044 }; 00045 00047 template <> 00048 struct boundary_elements<plc_tag, line_tag> 00049 { 00050 typedef dynamic_layout_tag layout_tag; 00051 static const int num = -1; 00052 }; 00053 00054 00055 00056 namespace detail 00057 { 00058 template<typename BoundaryElementType> 00059 struct boundary_element_generator<plc_tag, line_tag, BoundaryElementType> 00060 { 00061 template<typename element_type, typename inserter_type> 00062 static void create_boundary_elements(element_type &, inserter_type &) 00063 { 00064 } 00065 }; 00066 00067 template<typename BoundaryElementType> 00068 struct boundary_element_generator<plc_tag, simplex_tag<0>, BoundaryElementType> 00069 { 00070 template<typename element_type, typename inserter_type> 00071 static void create_boundary_elements(element_type & plc, inserter_type &) 00072 { 00073 typedef typename viennagrid::result_of::element<element_type, line_tag>::type LineType; 00074 typedef typename viennagrid::result_of::element_range<element_type, line_tag>::type LineRange; 00075 typedef typename viennagrid::result_of::iterator<LineRange>::type LineIterator; 00076 00077 LineRange lines = elements<line_tag>(plc); 00078 for (LineIterator lit = lines.begin(); lit != lines.end(); ++lit) 00079 { 00080 typedef typename viennagrid::result_of::element_range<LineType, vertex_tag>::type VertexOnLineRange; 00081 typedef typename viennagrid::result_of::iterator<VertexOnLineRange>::type VertexOnLineHandleIterator; 00082 00083 VertexOnLineRange vertices = elements<vertex_tag>(*lit); 00084 for (VertexOnLineHandleIterator vlhit = vertices.begin(); vlhit != vertices.end(); ++vlhit) 00085 plc.container( vertex_tag() ).insert_unique_handle( vlhit.handle() ); 00086 } 00087 00088 } 00089 }; 00090 } //topology 00091 00092 00094 template<typename PLCT> 00095 typename PLCT::appendix_type & hole_points( PLCT & plc ) 00096 { 00097 return plc.appendix(); 00098 } 00099 00101 template<typename PLCT> 00102 typename PLCT::appendix_type const & hole_points( PLCT const & plc ) 00103 { 00104 return plc.appendix(); 00105 } 00106 00107 } 00108 00109 #endif 00110