ViennaGrid - The Vienna Grid Library  2.1.0
viennagrid/topology/quadrilateral.hpp
Go to the documentation of this file.
00001 #ifndef VIENNAGRID_TOPOLOGY_QUADRILATERAL_HPP
00002 #define VIENNAGRID_TOPOLOGY_QUADRILATERAL_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/vertex.hpp"
00018 #include "viennagrid/topology/line.hpp"
00019 
00024 namespace viennagrid
00025 {
00027   template <>
00028   struct hypercube_tag<2>
00029   {
00030     typedef simplex_tag<1> facet_tag;
00031 
00032     static const int dim = 2;
00033     static std::string name() { return "quadrilateral"; }
00034   };
00035 
00037   template <>
00038   struct boundary_elements<hypercube_tag<2>, simplex_tag<1> >
00039   {
00040     typedef static_layout_tag     layout_tag;
00041     static const int num = 4;
00042   };
00043 
00045   template <>
00046   struct boundary_elements<hypercube_tag<2>, simplex_tag<0> >
00047   {
00048     typedef static_layout_tag     layout_tag;
00049     static const int num = 4;
00050   };
00051 
00052   namespace detail
00053   {
00054       //fill edges:
00055       //
00056       // Reference orientation: (v... vertices, e...edges)
00057       //        e3
00058       // v2 --------- v3
00059       //    |       |
00060       // e1 |       | e2
00061       //    |       |
00062       // v0 --------- v1
00063       //        e0
00064 
00065     template<typename BoundaryElementType>
00066     struct boundary_element_generator<hypercube_tag<2>, simplex_tag<1>, BoundaryElementType>
00067     {
00068       template<typename element_type, typename inserter_type>
00069       static void create_boundary_elements(element_type & element, inserter_type & inserter)
00070       {
00071         BoundaryElementType boundary_element( inserter.get_physical_container_collection() );
00072         std::size_t index = 0;
00073 
00074         boundary_element.container(dimension_tag<0>()).set_handle( element.container( dimension_tag<0>() ).handle_at(0), 0 );
00075         boundary_element.container(dimension_tag<0>()).set_handle( element.container( dimension_tag<0>() ).handle_at(1), 1 );
00076         element.set_boundary_element( boundary_element, inserter.template insert<true, true>(boundary_element), index++ );
00077 
00078         boundary_element.container(dimension_tag<0>()).set_handle( element.container( dimension_tag<0>() ).handle_at(0), 0 );
00079         boundary_element.container(dimension_tag<0>()).set_handle( element.container( dimension_tag<0>() ).handle_at(2), 1 );
00080         element.set_boundary_element( boundary_element, inserter.template insert<true, true>(boundary_element), index++ );
00081 
00082         boundary_element.container(dimension_tag<0>()).set_handle( element.container( dimension_tag<0>() ).handle_at(1), 0 );
00083         boundary_element.container(dimension_tag<0>()).set_handle( element.container( dimension_tag<0>() ).handle_at(3), 1 );
00084         element.set_boundary_element( boundary_element, inserter.template insert<true, true>(boundary_element), index++ );
00085 
00086         boundary_element.container(dimension_tag<0>()).set_handle( element.container( dimension_tag<0>() ).handle_at(2), 0 );
00087         boundary_element.container(dimension_tag<0>()).set_handle( element.container( dimension_tag<0>() ).handle_at(3), 1 );
00088         element.set_boundary_element( boundary_element, inserter.template insert<true, true>(boundary_element), index++ );
00089       }
00090     };
00091 
00092   }
00093 
00094 }
00095 
00096 #endif
00097