ViennaGrid - The Vienna Grid Library  2.1.0
viennagrid/forwards.hpp
Go to the documentation of this file.
00001 #ifndef VIENNAGRID_FORWARDS_H
00002 #define VIENNAGRID_FORWARDS_H
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 
00025 #include <iostream>
00026 #include <vector>
00027 #include <map>
00028 #include <cstddef>     //for std::size_t
00029 #include <cstdlib>     //for EXIT_SUCCESS and EXIT_FAILURE
00030 
00031 #define VIENNAGRID_MAJOR_VERSION   2
00032 #define VIENNAGRID_MINOR_VERSION   1
00033 #define VIENNAGRID_BUGFIX_LEVEL    0
00034 
00035 
00036 #include "viennagrid/storage/static_array.hpp"
00037 #include "viennagrid/storage/forwards.hpp"
00038 
00039 //Debug levels:
00040 //VIENNAGRID_DEBUG_ALL          Output every little piece of debug information
00041 //VIENNAGRID_DEBUG_IO           Debug IO operations
00042 //VIENNAGRID_DEBUG_STATUS       Print status messages to std::cout (very little debug info)
00043 
00044 #ifdef VIENNAGRID_DEBUG_ALL
00045   #define VIENNAGRID_DEBUG_IO
00046   #define VIENNAGRID_DEBUG_STATUS
00047 #endif
00048 
00054 namespace viennagrid
00055 {
00057   namespace detail
00058   {
00060     namespace result_of {}
00061   }
00062 
00064   namespace config
00065   {
00067     namespace result_of {}
00068   }
00069 
00071   namespace io
00072   {
00074     namespace detail {}
00075   }
00076 
00083   template<typename iterator_type, typename distance_type>
00084   iterator_type advance(iterator_type const & in, distance_type distance)
00085   {
00086       iterator_type out(in);
00087       std::advance(out, static_cast<long>(distance));
00088       return out;
00089   }
00090 
00091 
00093   typedef std::size_t       dim_type;
00094 
00095   /********* Tags ***********************/
00096 
00098   template <int d>
00099   struct cartesian_cs;    //Cartesian coordinate system
00100 
00102   struct polar_cs;        //Polar coordinate system (r, phi)
00104   struct spherical_cs;    //Spherical coordinate system (r, theta, phi)
00106   struct cylindrical_cs;  //Cylindrical coordinate system (rho, theta, z)
00107 
00108   //Dimension Tag: (for tag dispatching)
00110   template <int d>
00111   struct dimension_tag
00112   {
00113       static const int value = d;
00114   };
00115 
00116   //Tags for the handling of elements at different topological levels (see topology::subcell_desc)
00118   struct full_handling_tag {};
00120   struct no_handling_tag {};
00121 
00123   struct no_orientation_handling_tag {};
00124 
00125 //   Lazy storage reserved for future use
00127   struct no_orientation_lazy_handling_tag {};
00129   struct full_lazy_handling_tag {};
00130 
00131 
00133   struct coboundary_collection_tag {};
00135   struct neighbor_collection_tag {};
00137   struct boundary_information_collection_tag {};
00139   struct interface_information_collection_tag {};
00140 
00141 
00142   /********* Forward definitions of main classes *******************/
00143 
00144   // Simplex family:
00146   template <int dim>
00147   struct simplex_tag;
00148 
00150   typedef simplex_tag<0>    vertex_tag;
00152   typedef simplex_tag<1>    line_tag;
00154   typedef simplex_tag<1>    edge_tag;
00156   typedef simplex_tag<2>    triangle_tag;
00158   typedef simplex_tag<3>    tetrahedron_tag;
00159 
00160   // Hypercube family:
00162   template <int dim>
00163   struct hypercube_tag;
00164 
00165   //typedef hypercube_tag<1>    line_tag;
00167   typedef hypercube_tag<2>  quadrilateral_tag;
00169   typedef hypercube_tag<3>  hexahedron_tag;
00170 
00171   //see viennagrid/topology/polygon.hpp
00172   struct polygon_tag;
00173 
00174   //see viennagrid/topology/plc.hpp
00175   struct plc_tag;
00176 
00177 
00179   struct static_layout_tag {};
00181   struct dynamic_layout_tag {};
00182 
00183 
00184 
00185   //forward declarations:
00186 
00192   template <typename CoordType, typename CoordinateSystem>
00193   class spatial_point;
00194 
00200   template<typename ElementTag, typename WrappedConfigType>
00201   class element;
00202 
00203 
00204 
00210   template <typename ElementTag, typename BoundaryElementTag = ElementTag>
00211   struct boundary_elements
00212   {
00213     //the default case is simultaneously a pathetic case:
00214     //cell-handling within the cell
00215 
00217     static const int num = 1;     //1 cell
00218 
00220     typedef ElementTag            tag;
00221   };
00222 
00223 
00224   namespace detail
00225   {
00232     template <typename ElementTag, typename BoundaryElementTag, typename BoundaryElementType>
00233     struct boundary_element_generator {};
00234 
00235     template<typename ElementTag, typename BoundaryElementType>
00236     struct boundary_element_generator<ElementTag, vertex_tag, BoundaryElementType>
00237     {
00238       template<typename element_type, typename inserter_type>
00239       static void create_boundary_elements(element_type &, inserter_type &) {}
00240     };
00241 
00242   }
00243 
00244 
00245 
00246 
00247 
00248   namespace detail
00249   {
00250     template <typename MeshConfigT, typename ElementTypeListT, typename ContainerConfigT>
00251     class decorated_mesh_view_config;
00252   }
00253 
00254   // see mesh.hpp
00255   template <typename WrappedConfigT>
00256   class mesh;
00257 
00258   // see segmentation.hpp
00259   template<typename WrappedConfigT>
00260   class segmentation;
00261 
00262   // see segmentation.hpp
00263   template<typename SegmentationT>
00264   class segment_handle;
00265 
00266   namespace detail
00267   {
00268     template<typename container_type_, typename change_counter_type>
00269     struct coboundary_container_wrapper;
00270 
00271     template<typename container_type_, typename change_counter_type>
00272     struct neighbor_container_wrapper;
00273 
00274     template<typename container_type_, typename change_counter_type>
00275     struct boundary_information_wrapper;
00276 
00277 
00278     template<typename ConfigType>
00279     typename viennagrid::mesh<ConfigType>::inserter_type &
00280     inserter(viennagrid::mesh<ConfigType> & mesh_obj);
00281 
00282     template<typename ConfigType>
00283     typename viennagrid::mesh<ConfigType>::inserter_type const &
00284     inserter(viennagrid::mesh<ConfigType> const & mesh_obj);
00285 
00286     template<typename SegmentationType>
00287     typename viennagrid::segment_handle<SegmentationType>::view_type::inserter_type & inserter(segment_handle<SegmentationType> & segment);
00288 
00289     template<typename SegmentationType>
00290     typename viennagrid::segment_handle<SegmentationType>::view_type::inserter_type const & inserter(segment_handle<SegmentationType> const & segment);
00291   }
00292 
00293 
00294 
00295 
00296 
00298   namespace result_of
00299   {
00300     template<typename WrappedConfigT>
00301     struct mesh;
00302 
00307     template<typename SomethingT>
00308     struct element_collection {};
00309 
00314     template<typename SomethingT>
00315     struct container_collection_typemap {};
00316 
00317     template<typename SomethingT>
00318     struct topologic_cell_dimension;
00319 
00320     template<typename SomethingT, int TopologicDimensionV>
00321     struct elements_of_topologic_dim;
00322 
00323     template<typename SomethingT>
00324     struct cells;
00325 
00326     template<typename SomethingT>
00327     struct cell;
00328 
00329     template<typename SomethingT>
00330     struct cell_tag;
00331 
00332 
00337     template<typename SomethingT>
00338     struct point {};
00339 
00344     template<typename SomethingT>
00345     struct coord
00346     {
00347       typedef typename coord< typename point<SomethingT>::type >::type type;
00348     };
00349 
00354     template<typename SomethingT>
00355     struct geometric_dimension
00356     {
00357       static const int value = geometric_dimension< typename point<SomethingT>::type >::value;
00358     };
00359 
00360 
00365     template<typename ElementT>
00366     struct id
00367     {
00368       typedef typename ElementT::id_type type;
00369     };
00370 
00371 
00372     template<typename SomethingT, typename ElementTypeOrTagT>
00373     struct element;
00374 
00376     template<typename element_tag, typename WrappedConfigType>
00377     struct element< viennagrid::element<element_tag, WrappedConfigType>, viennagrid::element<element_tag, WrappedConfigType> >
00378     {
00379       typedef viennagrid::element<element_tag, WrappedConfigType> type;
00380     };
00381 
00382     template<typename element_tag, typename WrappedConfigType>
00383     struct element< viennagrid::element<element_tag, WrappedConfigType>, element_tag >
00384     {
00385       typedef viennagrid::element<element_tag, WrappedConfigType> type;
00386     };
00387 
00388     template<typename SomethingT>
00389     struct element<SomethingT, viennagrid::null_type>
00390     {
00391       typedef viennagrid::null_type type;
00392     };
00399     template<typename SomethingT>
00400     struct vertex
00401     {
00402       typedef typename element<SomethingT, vertex_tag>::type type;
00403     };
00404 
00409     template<typename SomethingT>
00410     struct line
00411     {
00412       typedef typename element<SomethingT, line_tag>::type type;
00413     };
00414 
00419     template<typename SomethingT>
00420     struct edge
00421     {
00422       typedef typename element<SomethingT, edge_tag>::type type;
00423     };
00424 
00429     template<typename SomethingT>
00430     struct triangle
00431     {
00432       typedef typename element<SomethingT, triangle_tag>::type type;
00433     };
00434 
00439     template<typename SomethingT>
00440     struct quadrilateral
00441     {
00442       typedef typename element<SomethingT, quadrilateral_tag>::type type;
00443     };
00444 
00449     template<typename SomethingT>
00450     struct polygon
00451     {
00452       typedef typename element<SomethingT, polygon_tag>::type type;
00453     };
00454 
00459     template<typename SomethingT>
00460     struct plc
00461     {
00462       typedef typename element<SomethingT, plc_tag>::type type;
00463     };
00464 
00469     template<typename SomethingT>
00470     struct tetrahedron
00471     {
00472       typedef typename element<SomethingT, tetrahedron_tag>::type type;
00473     };
00474 
00479     template<typename SomethingT>
00480     struct hexahedron
00481     {
00482       typedef typename element<SomethingT, hexahedron_tag>::type type;
00483     };
00484 
00485 
00486     template<typename SomethingT, typename ElementTypeOrTagT>
00487     struct handle;
00488 
00493     template<typename SomethingT>
00494     struct cell_handle
00495     {
00496       typedef typename cell_tag<SomethingT>::type cell_tag;
00497       typedef typename handle<SomethingT, cell_tag>::type type;
00498     };
00499 
00504     template<typename SomethingT>
00505     struct vertex_handle
00506     {
00507       typedef typename handle<SomethingT, vertex_tag>::type type;
00508     };
00509 
00514     template<typename SomethingT>
00515     struct line_handle
00516     {
00517       typedef typename handle<SomethingT, line_tag>::type type;
00518     };
00519 
00524     template<typename SomethingT>
00525     struct edge_handle
00526     {
00527       typedef typename handle<SomethingT, edge_tag>::type type;
00528     };
00529 
00534     template<typename SomethingT>
00535     struct triangle_handle
00536     {
00537       typedef typename handle<SomethingT, triangle_tag>::type type;
00538     };
00539 
00544     template<typename SomethingT>
00545     struct quadrilateral_handle
00546     {
00547       typedef typename handle<SomethingT, quadrilateral_tag>::type type;
00548     };
00549 
00554     template<typename SomethingT>
00555     struct polygon_handle
00556     {
00557       typedef typename handle<SomethingT, polygon_tag>::type type;
00558     };
00559 
00564     template<typename SomethingT>
00565     struct plc_handle
00566     {
00567       typedef typename handle<SomethingT, plc_tag>::type type;
00568     };
00569 
00574     template<typename SomethingT>
00575     struct tetrahedron_handle
00576     {
00577       typedef typename handle<SomethingT, tetrahedron_tag>::type type;
00578     };
00579 
00584     template<typename SomethingT>
00585     struct hexahedron_handle
00586     {
00587       typedef typename handle<SomethingT, hexahedron_tag>::type type;
00588     };
00589 
00590 
00591 
00592     template<typename SomethingT, typename ElementTypeOrTagT>
00593     struct const_handle;
00594 
00599     template<typename SomethingT>
00600     struct const_cell_handle
00601     {
00602       typedef typename cell_tag<SomethingT>::type cell_tag;
00603       typedef typename const_handle<SomethingT, cell_tag>::type type;
00604     };
00605 
00610     template<typename SomethingT>
00611     struct const_vertex_handle
00612     {
00613       typedef typename const_handle<SomethingT, vertex_tag>::type type;
00614     };
00615 
00620     template<typename SomethingT>
00621     struct const_line_handle
00622     {
00623       typedef typename const_handle<SomethingT, line_tag>::type type;
00624     };
00625 
00630     template<typename SomethingT>
00631     struct const_edge_handle
00632     {
00633       typedef typename const_handle<SomethingT, edge_tag>::type type;
00634     };
00635 
00640     template<typename SomethingT>
00641     struct const_triangle_handle
00642     {
00643       typedef typename const_handle<SomethingT, triangle_tag>::type type;
00644     };
00645 
00650     template<typename SomethingT>
00651     struct const_quadrilateral_handle
00652     {
00653       typedef typename const_handle<SomethingT, quadrilateral_tag>::type type;
00654     };
00655 
00660     template<typename SomethingT>
00661     struct const_polygon_handle
00662     {
00663       typedef typename const_handle<SomethingT, polygon_tag>::type type;
00664     };
00665 
00670     template<typename SomethingT>
00671     struct const_plc_handle
00672     {
00673       typedef typename const_handle<SomethingT, plc_tag>::type type;
00674     };
00675 
00680     template<typename SomethingT>
00681     struct const_tetrahedron_handle
00682     {
00683       typedef typename const_handle<SomethingT, tetrahedron_tag>::type type;
00684     };
00685 
00690     template<typename SomethingT>
00691     struct const_hexahedron_handle
00692     {
00693       typedef typename const_handle<SomethingT, hexahedron_tag>::type type;
00694     };
00695 
00696 
00697 
00698 
00699 
00700 
00701 
00706     template<typename SomethingT>
00707     struct cell_id
00708     {
00709       typedef typename id< typename cell<SomethingT>::type >::type type;
00710     };
00711 
00716     template<typename SomethingT>
00717     struct vertex_id
00718     {
00719       typedef typename id< typename vertex<SomethingT>::type >::type type;
00720     };
00721 
00726     template<typename SomethingT>
00727     struct line_id
00728     {
00729       typedef typename id< typename line<SomethingT>::type >::type type;
00730     };
00731 
00736     template<typename SomethingT>
00737     struct edge_id
00738     {
00739       typedef typename id< typename edge<SomethingT>::type >::type type;
00740     };
00741 
00746     template<typename SomethingT>
00747     struct triangle_id
00748     {
00749       typedef typename id< typename triangle<SomethingT>::type >::type type;
00750     };
00751 
00756     template<typename SomethingT>
00757     struct quadrilateral_id
00758     {
00759       typedef typename id< typename quadrilateral<SomethingT>::type >::type type;
00760     };
00761 
00766     template<typename SomethingT>
00767     struct polygon_id
00768     {
00769       typedef typename id< typename polygon<SomethingT>::type >::type type;
00770     };
00771 
00776     template<typename SomethingT>
00777     struct plc_id
00778     {
00779       typedef typename id< typename plc<SomethingT>::type >::type type;
00780     };
00781 
00786     template<typename SomethingT>
00787     struct tetrahedron_id
00788     {
00789       typedef typename id< typename tetrahedron<SomethingT>::type >::type type;
00790     };
00791 
00796     template<typename SomethingT>
00797     struct hexahedron_id
00798     {
00799       typedef typename id< typename hexahedron<SomethingT>::type >::type type;
00800     };
00801 
00802 
00803 
00804 
00805 
00806 
00807 
00808 
00809 
00810     template <typename SomethingT,
00811               typename ElementTypeOrTagT>
00812     struct element_range;
00813 
00814 
00819     template<typename SomethingT>
00820     struct cell_range
00821     {
00822       typedef typename cell_tag<SomethingT>::type cell_tag;
00823       typedef typename element_range<SomethingT, cell_tag>::type type;
00824     };
00825 
00830     template<typename SomethingT>
00831     struct vertex_range
00832     {
00833       typedef typename element_range<SomethingT, vertex_tag>::type type;
00834     };
00835 
00840     template<typename SomethingT>
00841     struct line_range
00842     {
00843       typedef typename element_range<SomethingT, line_tag>::type type;
00844     };
00845 
00850     template<typename SomethingT>
00851     struct edge_range
00852     {
00853       typedef typename element_range<SomethingT, edge_tag>::type type;
00854     };
00855 
00860     template<typename SomethingT>
00861     struct triangle_range
00862     {
00863       typedef typename element_range<SomethingT, triangle_tag>::type type;
00864     };
00865 
00870     template<typename SomethingT>
00871     struct quadrilateral_range
00872     {
00873       typedef typename element_range<SomethingT, quadrilateral_tag>::type type;
00874     };
00875 
00880     template<typename SomethingT>
00881     struct polygon_range
00882     {
00883       typedef typename element_range<SomethingT, polygon_tag>::type type;
00884     };
00885 
00890     template<typename SomethingT>
00891     struct plc_range
00892     {
00893       typedef typename element_range<SomethingT, plc_tag>::type type;
00894     };
00895 
00900     template<typename SomethingT>
00901     struct tetrahedron_range
00902     {
00903       typedef typename element_range<SomethingT, tetrahedron_tag>::type type;
00904     };
00905 
00910     template<typename SomethingT>
00911     struct hexahedron_range
00912     {
00913       typedef typename element_range<SomethingT, hexahedron_tag>::type type;
00914     };
00915 
00916 
00917 
00918 
00919 
00920 
00921     template <typename SomethingT,
00922               typename ElementTypeOrTagT>
00923     struct const_element_range;
00924 
00925 
00930     template<typename SomethingT>
00931     struct const_cell_range
00932     {
00933       typedef typename cell_tag<SomethingT>::type cell_tag;
00934       typedef typename const_element_range<SomethingT, cell_tag>::type type;
00935     };
00936 
00941     template<typename SomethingT>
00942     struct const_vertex_range
00943     {
00944       typedef typename const_element_range<SomethingT, vertex_tag>::type type;
00945     };
00946 
00951     template<typename SomethingT>
00952     struct const_line_range
00953     {
00954       typedef typename const_element_range<SomethingT, line_tag>::type type;
00955     };
00956 
00961     template<typename SomethingT>
00962     struct const_edge_range
00963     {
00964       typedef typename const_element_range<SomethingT, edge_tag>::type type;
00965     };
00966 
00971     template<typename SomethingT>
00972     struct const_triangle_range
00973     {
00974       typedef typename const_element_range<SomethingT, triangle_tag>::type type;
00975     };
00976 
00981     template<typename SomethingT>
00982     struct const_quadrilateral_range
00983     {
00984       typedef typename const_element_range<SomethingT, quadrilateral_tag>::type type;
00985     };
00986 
00991     template<typename SomethingT>
00992     struct const_polygon_range
00993     {
00994       typedef typename const_element_range<SomethingT, polygon_tag>::type type;
00995     };
00996 
01001     template<typename SomethingT>
01002     struct const_plc_range
01003     {
01004       typedef typename const_element_range<SomethingT, plc_tag>::type type;
01005     };
01006 
01011     template<typename SomethingT>
01012     struct const_tetrahedron_range
01013     {
01014       typedef typename const_element_range<SomethingT, tetrahedron_tag>::type type;
01015     };
01016 
01021     template<typename SomethingT>
01022     struct const_hexahedron_range
01023     {
01024       typedef typename const_element_range<SomethingT, hexahedron_tag>::type type;
01025     };
01026 
01027 
01028 
01029 
01034     template <typename ContainerT>
01035     struct iterator
01036     {
01037       typedef typename ContainerT::iterator type;
01038     };
01039 
01044     template <typename ContainerT>
01045     struct const_iterator
01046     {
01047       typedef typename ContainerT::const_iterator type;
01048     };
01049 
01051     template <typename ContainerT>
01052     struct iterator<const ContainerT>
01053     {
01054       typedef typename const_iterator<ContainerT>::type type;
01055     };
01064     template<typename ElementTypeOrTagT>
01065     struct element_tag
01066     {
01067       typedef ElementTypeOrTagT type;
01068     };
01069 
01071     template<typename ElementTagT, typename WrappedConfigT>
01072     struct element_tag< viennagrid::element<ElementTagT, WrappedConfigT> >
01073     {
01074       typedef ElementTagT type;
01075     };
01076 
01077     template<typename ElementTagT, typename WrappedConfigT>
01078     struct element_tag< const viennagrid::element<ElementTagT, WrappedConfigT> >
01079     {
01080       typedef ElementTagT type;
01081     };
01089     template<typename SomethingT>
01090     struct facet_tag
01091     {
01092       typedef typename element_tag<SomethingT>::type::facet_tag type;
01093     };
01094 
01096     template<typename SomethingT>
01097     struct facet_tag< const SomethingT>
01098     {
01099       typedef typename facet_tag<SomethingT>::type  type;
01100     };
01101 
01102     template<typename WrappedMeshConfigT>
01103     struct facet_tag< viennagrid::mesh<WrappedMeshConfigT> >
01104     {
01105       typedef typename facet_tag< typename cell_tag< viennagrid::mesh<WrappedMeshConfigT> >::type >::type type;
01106     };
01107 
01108     template<typename WrappedSegmentationConfigT>
01109     struct facet_tag< viennagrid::segmentation<WrappedSegmentationConfigT> >
01110     {
01111       typedef typename facet_tag< typename cell_tag< viennagrid::segmentation<WrappedSegmentationConfigT> >::type >::type type;
01112     };
01113 
01114     template<typename SegmentationT>
01115     struct facet_tag< viennagrid::segment_handle<SegmentationT> >
01116     {
01117       typedef typename facet_tag< typename cell_tag< viennagrid::segment_handle<SegmentationT> >::type >::type type;
01118     };
01128     template<typename SomethingT>
01129     struct facet
01130     {
01131       typedef typename element<SomethingT, typename facet_tag<SomethingT>::type >::type type;
01132     };
01133 
01135     template<typename SomethingT>
01136     struct facet< const SomethingT>
01137     {
01138       typedef typename facet<SomethingT>::type    type;
01139     };
01140 
01141     template<typename WrappedMeshConfigT>
01142     struct facet< viennagrid::mesh<WrappedMeshConfigT> >
01143     {
01144       typedef typename facet< typename cell< viennagrid::mesh<WrappedMeshConfigT> >::type >::type type;
01145     };
01146 
01147     template<typename WrappedSegmentationConfigT>
01148     struct facet< viennagrid::segmentation<WrappedSegmentationConfigT> >
01149     {
01150       typedef typename facet< typename cell< viennagrid::segmentation<WrappedSegmentationConfigT> >::type >::type type;
01151     };
01152 
01153     template<typename SegmentationT>
01154     struct facet< viennagrid::segment_handle<SegmentationT> >
01155     {
01156       typedef typename facet< typename cell< viennagrid::segment_handle<SegmentationT> >::type >::type type;
01157     };
01165     template<typename SomethingT>
01166     struct facet_handle
01167     {
01168       typedef typename handle< SomethingT, typename facet_tag<SomethingT>::type >::type type;
01169     };
01170 
01175     template<typename SomethingT>
01176     struct const_facet_handle
01177     {
01178       typedef typename const_handle< SomethingT, typename facet_tag<SomethingT>::type >::type type;
01179     };
01180 
01185     template<typename SomethingT>
01186     struct facet_id
01187     {
01188       typedef typename id< typename facet<SomethingT>::type >::type type;
01189     };
01190 
01191 
01196     template<typename SomethingT>
01197     struct facet_range
01198     {
01199       typedef typename element_range<SomethingT, typename facet_tag<SomethingT>::type >::type type;
01200     };
01201 
01206     template<typename SomethingT>
01207     struct const_facet_range
01208     {
01209       typedef typename const_element_range<SomethingT, typename facet_tag<SomethingT>::type >::type type;
01210     };
01211 
01212 
01217     template<typename SegmentationT>
01218     struct segment_handle;
01219   }
01220 
01221 
01229   template<typename ElementTypeOrTagT, typename SomethingT>
01230   typename result_of::element_range<SomethingT, ElementTypeOrTagT>::type elements(SomethingT & something);
01231 
01232 
01240   template<typename ElementTypeOrTagT, typename WrappedConfigType>
01241   typename result_of::element_range<viennagrid::mesh<WrappedConfigType>, ElementTypeOrTagT>::type
01242   elements(viennagrid::mesh<WrappedConfigType> & mesh_obj);
01243 
01244 
01252   template<typename ElementTypeOrTagT, typename SegmentationT>
01253   typename result_of::element_range< viennagrid::segment_handle<SegmentationT>, ElementTypeOrTagT>::type
01254   elements( viennagrid::segment_handle<SegmentationT> & segment)
01255   { return elements<ElementTypeOrTagT>( segment.view() ); }
01256 
01264   template<typename ElementTypeOrTagT, typename WrappedConfigT>
01265   typename result_of::element_range<segmentation<WrappedConfigT>, ElementTypeOrTagT>::type
01266   elements( viennagrid::segmentation<WrappedConfigT> & segm)
01267   { return elements<ElementTypeOrTagT>( segm.all_elements() ); }
01268 
01269 
01278   template<typename sub_element_type_or_tag, typename element_tag, typename WrappedConfigType>
01279   typename result_of::element_range<viennagrid::element<element_tag, WrappedConfigType>, sub_element_type_or_tag>::type
01280   elements( viennagrid::element<element_tag, WrappedConfigType> & element);
01281 
01290   template<typename sub_element_type_or_tag, typename element_tag, typename WrappedConfigType>
01291   typename result_of::const_element_range<viennagrid::element<element_tag, WrappedConfigType>, sub_element_type_or_tag>::type
01292   elements( const viennagrid::element<element_tag, WrappedConfigType> & element);
01293 
01294 
01301   template<typename SomethingT>
01302   typename result_of::cell_range<SomethingT>::type cells(SomethingT & something)
01303   { return elements<typename result_of::cell_tag<SomethingT>::type>(something); }
01304 
01311   template<typename ElementT>
01312   typename result_of::facet_range<ElementT>::type facets(ElementT & element)
01313   { return elements< typename result_of::facet_tag<ElementT>::type >(element); }
01314 
01321   template<typename SomethingT>
01322   typename result_of::element_range<SomethingT, vertex_tag>::type vertices(SomethingT & something)
01323   { return elements<vertex_tag>(something); }
01324 
01331   template<typename SomethingT>
01332   typename result_of::element_range<SomethingT, line_tag>::type lines(SomethingT & something)
01333   { return elements<line_tag>(something); }
01334 
01341   template<typename SomethingT>
01342   typename result_of::element_range<SomethingT, edge_tag>::type edges(SomethingT & something)
01343   { return elements<edge_tag>(something); }
01344 
01351   template<typename SomethingT>
01352   typename result_of::element_range<SomethingT, triangle_tag>::type triangles(SomethingT & something)
01353   { return elements<triangle_tag>(something); }
01354 
01361   template<typename SomethingT>
01362   typename result_of::element_range<SomethingT, quadrilateral_tag>::type quadrilaterals(SomethingT & something)
01363   { return elements<quadrilateral_tag>(something); }
01364 
01371   template<typename SomethingT>
01372   typename result_of::element_range<SomethingT, polygon_tag>::type polygons(SomethingT & something)
01373   { return elements<polygon_tag>(something); }
01374 
01381   template<typename SomethingT>
01382   typename result_of::element_range<SomethingT, plc_tag>::type plcs(SomethingT & something)
01383   { return elements<plc_tag>(something); }
01384 
01391   template<typename SomethingT>
01392   typename result_of::element_range<SomethingT, tetrahedron_tag>::type tetrahedra(SomethingT & something)
01393   { return elements<tetrahedron_tag>(something); }
01394 
01401   template<typename SomethingT>
01402   typename result_of::element_range<SomethingT, hexahedron_tag>::type hexahedra(SomethingT & something)
01403   { return elements<hexahedron_tag>(something); }
01404 
01405 
01406 
01414   template<typename ElementTypeOrTagT, typename SomethingT>
01415   typename result_of::const_element_range<SomethingT, ElementTypeOrTagT>::type elements(SomethingT const & something);
01416 
01424   template<typename ElementTypeOrTagT, typename WrappedConfigType>
01425   typename result_of::const_element_range<viennagrid::mesh<WrappedConfigType>, ElementTypeOrTagT>::type
01426   elements(viennagrid::mesh<WrappedConfigType> const & mesh_obj);
01427 
01428 
01436   template<typename ElementTypeOrTagT, typename SegmentationT>
01437   typename result_of::const_element_range< viennagrid::segment_handle<SegmentationT>, ElementTypeOrTagT>::type
01438   elements( viennagrid::segment_handle<SegmentationT> const & segment)
01439   { return elements<ElementTypeOrTagT>( segment.view() ); }
01440 
01441 
01449   template<typename ElementTypeOrTagT, typename WrappedConfigT>
01450   typename result_of::const_element_range<viennagrid::segmentation<WrappedConfigT>, ElementTypeOrTagT>::type
01451   elements(viennagrid::segmentation<WrappedConfigT> const & segm)
01452   { return elements<ElementTypeOrTagT>( segm.all_elements() ); }
01453 
01454 
01461   template<typename SomethingT>
01462   typename result_of::const_cell_range<SomethingT>::type cells( SomethingT const & something)
01463   { return elements<typename result_of::cell_tag<SomethingT>::type>(something); }
01464 
01471   template<typename ElementT>
01472   typename result_of::const_facet_range<ElementT>::type facets(const ElementT & element)
01473   { return elements< typename result_of::facet_tag<ElementT>::type >(element); }
01474 
01481   template<typename SomethingT>
01482   typename result_of::const_element_range<SomethingT, vertex_tag>::type vertices(SomethingT const & something)
01483   { return elements<vertex_tag>(something); }
01484 
01491   template<typename SomethingT>
01492   typename result_of::const_element_range<SomethingT, line_tag>::type lines(SomethingT const & something)
01493   { return elements<line_tag>(something); }
01494 
01501   template<typename SomethingT>
01502   typename result_of::const_element_range<SomethingT, edge_tag>::type edges(SomethingT const & something)
01503   { return elements<edge_tag>(something); }
01504 
01511   template<typename SomethingT>
01512   typename result_of::const_element_range<SomethingT, triangle_tag>::type triangles(SomethingT const & something)
01513   { return elements<triangle_tag>(something); }
01514 
01521   template<typename SomethingT>
01522   typename result_of::const_element_range<SomethingT, quadrilateral_tag>::type quadrilaterals(SomethingT const & something)
01523   { return elements<quadrilateral_tag>(something); }
01524 
01531   template<typename SomethingT>
01532   typename result_of::const_element_range<SomethingT, polygon_tag>::type polygons(SomethingT const & something)
01533   { return elements<polygon_tag>(something); }
01534 
01541   template<typename SomethingT>
01542   typename result_of::const_element_range<SomethingT, plc_tag>::type plcs(SomethingT const & something)
01543   { return elements<plc_tag>(something); }
01544 
01551   template<typename SomethingT>
01552   typename result_of::const_element_range<SomethingT, tetrahedron_tag>::type tetrahedra(SomethingT const & something)
01553   { return elements<tetrahedron_tag>(something); }
01554 
01561   template<typename SomethingT>
01562   typename result_of::const_element_range<SomethingT, hexahedron_tag>::type hexahedra(SomethingT const & something)
01563   { return elements<hexahedron_tag>(something); }
01564 
01565 
01566 
01567 
01578   template<typename ElementTypeOrTagT, typename MeshOrSegmentHandleTypeT, typename VertexHandleIteratorT>
01579   typename result_of::handle<MeshOrSegmentHandleTypeT, ElementTypeOrTagT>::type make_element(
01580         MeshOrSegmentHandleTypeT & mesh_segment,
01581         VertexHandleIteratorT array_start,
01582         VertexHandleIteratorT const & array_end );
01583 
01584 
01596   template<typename ElementTypeOrTagT, typename MeshOrSegmentHandleTypeT, typename VertexHandleIteratorT, typename IDT>
01597   typename result_of::handle<MeshOrSegmentHandleTypeT, ElementTypeOrTagT>::type make_element_with_id(
01598         MeshOrSegmentHandleTypeT & mesh_segment,
01599         VertexHandleIteratorT array_start,
01600         VertexHandleIteratorT const & array_end,
01601         IDT id );
01602 
01609   template<typename MeshOrSegmentHandleTypeT>
01610   typename result_of::vertex_handle<MeshOrSegmentHandleTypeT>::type make_vertex(MeshOrSegmentHandleTypeT & mesh_segment);
01611 
01619   template<typename MeshOrSegmentHandleTypeT>
01620   typename result_of::vertex_handle<MeshOrSegmentHandleTypeT>::type make_vertex(
01621         MeshOrSegmentHandleTypeT & mesh_segment,
01622         typename result_of::point<MeshOrSegmentHandleTypeT>::type const & point);
01623 
01632 #ifndef _MSC_VER
01633   template<typename MeshOrSegmentHandleTypeT>
01634   typename result_of::vertex_handle<MeshOrSegmentHandleTypeT>::type make_vertex_with_id(
01635         MeshOrSegmentHandleTypeT & mesh_segment,
01636         typename viennagrid::result_of::element<MeshOrSegmentHandleTypeT, vertex_tag>::type::id_type id,
01637         typename result_of::point<MeshOrSegmentHandleTypeT>::type const & point);
01638 #endif
01639 
01648   template<typename MeshOrSegmentHandleTypeT>
01649   typename result_of::vertex_handle<MeshOrSegmentHandleTypeT>::type make_unique_vertex(
01650         MeshOrSegmentHandleTypeT & mesh_segment,
01651         typename result_of::point<MeshOrSegmentHandleTypeT>::type const & point,
01652         typename result_of::coord<MeshOrSegmentHandleTypeT>::type tolerance);
01653 
01661   template<typename MeshOrSegmentHandleTypeT>
01662   typename result_of::vertex_handle<MeshOrSegmentHandleTypeT>::type make_unique_vertex(
01663         MeshOrSegmentHandleTypeT & mesh_segment,
01664         typename result_of::point<MeshOrSegmentHandleTypeT>::type const & p);
01665 
01675   template<typename MeshOrSegmentHandleTypeT, typename VertexHandleT>
01676   typename result_of::line_handle<MeshOrSegmentHandleTypeT>::type make_line(
01677         MeshOrSegmentHandleTypeT & mesh_segment,
01678         VertexHandleT v0, VertexHandleT v1);
01679 
01689   template<typename MeshOrSegmentHandleTypeT, typename VertexHandleT>
01690   typename result_of::edge_handle<MeshOrSegmentHandleTypeT>::type make_edge(
01691         MeshOrSegmentHandleTypeT & mesh_segment,
01692         VertexHandleT v0, VertexHandleT v1);
01693 
01704   template<typename MeshOrSegmentHandleTypeT, typename VertexHandleT>
01705   typename result_of::triangle_handle<MeshOrSegmentHandleTypeT>::type make_triangle(
01706         MeshOrSegmentHandleTypeT & mesh_segment,
01707         VertexHandleT v0, VertexHandleT v1, VertexHandleT v2);
01708 
01720   template<typename MeshOrSegmentHandleTypeT, typename VertexHandleT>
01721   typename result_of::quadrilateral_handle<MeshOrSegmentHandleTypeT>::type make_quadrilateral(
01722         MeshOrSegmentHandleTypeT & mesh_segment,
01723         VertexHandleT v0, VertexHandleT v1, VertexHandleT v2, VertexHandleT v3);
01724 
01740   template<typename MeshOrSegmentHandleTypeT, typename LineHandleIteratorT, typename VertexHandleIteratorT, typename PointIteratorT>
01741   typename result_of::plc_handle<MeshOrSegmentHandleTypeT>::type make_plc(
01742         MeshOrSegmentHandleTypeT & mesh_segment,
01743         LineHandleIteratorT    lines_begin,           LineHandleIteratorT     lines_end,
01744         VertexHandleIteratorT  loose_vertices_begin,  VertexHandleIteratorT   loose_vertices_end,
01745         PointIteratorT         hole_points_begin,     PointIteratorT          hole_points_end);
01746 
01758   template<typename MeshOrSegmentHandleTypeT, typename VertexHandleT>
01759   typename result_of::tetrahedron_handle<MeshOrSegmentHandleTypeT>::type make_tetrahedron(
01760         MeshOrSegmentHandleTypeT & mesh_segment,
01761         VertexHandleT v0, VertexHandleT v1, VertexHandleT v2, VertexHandleT v3);
01762 
01778   template<typename MeshOrSegmentHandleTypeT, typename VertexHandleT>
01779   typename result_of::hexahedron_handle<MeshOrSegmentHandleTypeT>::type make_hexahedron(
01780         MeshOrSegmentHandleTypeT & mesh_segment,
01781         VertexHandleT v0, VertexHandleT v1, VertexHandleT v2, VertexHandleT v3,
01782         VertexHandleT v4, VertexHandleT v5, VertexHandleT v6, VertexHandleT v7);
01783 
01793   template<typename ElementT, typename MeshOrSegmentHandleT>
01794   typename viennagrid::result_of::handle<
01795       MeshOrSegmentHandleT,
01796       typename viennagrid::result_of::element_tag<ElementT>::type
01797     >::type copy_element( ElementT const & element, MeshOrSegmentHandleT & mesh_segment,
01798                           typename viennagrid::result_of::coord<MeshOrSegmentHandleT>::type tolerance );
01799 
01808   template<typename ElementT, typename MeshOrSegmentHandleT>
01809   typename viennagrid::result_of::handle<
01810       MeshOrSegmentHandleT,
01811       typename viennagrid::result_of::element_tag<ElementT>::type
01812     >::type copy_element( ElementT const & element, MeshOrSegmentHandleT & mesh_segment );
01813 
01814 
01815 
01825   template<typename ElementIteratorT, typename OutputMeshOrSegmentHandleT>
01826   void copy_elements(ElementIteratorT const & begin, ElementIteratorT const & end,
01827                      OutputMeshOrSegmentHandleT & output_mesh,
01828                      typename viennagrid::result_of::coord<OutputMeshOrSegmentHandleT>::type tolerance );
01829 
01838   template<typename ElementIteratorT, typename OutputMeshOrSegmentHandleT>
01839   void copy_elements(ElementIteratorT const & begin, ElementIteratorT const & end,
01840                      OutputMeshOrSegmentHandleT & output_mesh );
01841 
01853   template<typename InputMeshOrSegmentHandleT, typename ElementHandleIteratorT, typename OutputMeshOrSegmentHandleT>
01854   void copy_element_by_handles(InputMeshOrSegmentHandleT const & input_mesh,
01855                             ElementHandleIteratorT const & begin, ElementHandleIteratorT const & end,
01856                             OutputMeshOrSegmentHandleT & output_mesh,
01857                             typename viennagrid::result_of::coord<OutputMeshOrSegmentHandleT>::type tolerance );
01858 
01869   template<typename InputMeshOrSegmentHandleT, typename ElementHandleIteratorT, typename OutputMeshOrSegmentHandleT>
01870   void copy_element_by_handles(InputMeshOrSegmentHandleT const & input_mesh,
01871                             ElementHandleIteratorT const & begin, ElementHandleIteratorT const & end,
01872                             OutputMeshOrSegmentHandleT & output_mesh );
01873 
01874 
01883   template<typename WrappedMeshConfigT, typename ElementTagT, typename WrappedConfigT>
01884   viennagrid::element<ElementTagT, WrappedConfigT> & dereference_handle( viennagrid::mesh<WrappedMeshConfigT> &, viennagrid::element<ElementTagT, WrappedConfigT> & element)
01885   { return element; }
01886 
01895   template<typename WrappedMeshConfigT, typename ElementTagT, typename WrappedConfigT>
01896   viennagrid::element<ElementTagT, WrappedConfigT> & dereference_handle( viennagrid::segment_handle<WrappedMeshConfigT> &, viennagrid::element<ElementTagT, WrappedConfigT> & element)
01897   { return element; }
01898 
01907   template<typename HostElementTagT, typename WrappedHostElementConfigT, typename ElementTagT, typename WrappedConfigT>
01908   viennagrid::element<ElementTagT, WrappedConfigT> & dereference_handle( viennagrid::element<HostElementTagT, WrappedHostElementConfigT> &, viennagrid::element<ElementTagT, WrappedConfigT> & element)
01909   { return element; }
01910 
01919   template<typename WrappedMeshConfigT, typename ElementTagT, typename WrappedConfigT>
01920   viennagrid::element<ElementTagT, WrappedConfigT> const & dereference_handle( viennagrid::mesh<WrappedMeshConfigT> const &, viennagrid::element<ElementTagT, WrappedConfigT> const & element)
01921   { return element; }
01922 
01924   template<typename WrappedMeshConfigT, typename ElementTagT, typename WrappedConfigT>
01925   viennagrid::element<ElementTagT, WrappedConfigT> const & dereference_handle( viennagrid::mesh<WrappedMeshConfigT> &, viennagrid::element<ElementTagT, WrappedConfigT> const & element)
01926   { return element; }
01927 
01929   template<typename WrappedMeshConfigT, typename ElementTagT, typename WrappedConfigT>
01930   viennagrid::element<ElementTagT, WrappedConfigT> const & dereference_handle( viennagrid::mesh<WrappedMeshConfigT> const &, viennagrid::element<ElementTagT, WrappedConfigT> & element)
01931   { return element; }
01932 
01933 
01935   template<typename SegmentationT, typename ElementTagT, typename WrappedConfigT>
01936   viennagrid::element<ElementTagT, WrappedConfigT> const & dereference_handle( viennagrid::segment_handle<SegmentationT> const &, viennagrid::element<ElementTagT, WrappedConfigT> const & element)
01937   { return element; }
01938 
01940   template<typename SegmentationT, typename ElementTagT, typename WrappedConfigT>
01941   viennagrid::element<ElementTagT, WrappedConfigT> const & dereference_handle( viennagrid::segment_handle<SegmentationT> &, viennagrid::element<ElementTagT, WrappedConfigT> const & element)
01942   { return element; }
01943 
01945   template<typename SegmentationT, typename ElementTagT, typename WrappedConfigT>
01946   viennagrid::element<ElementTagT, WrappedConfigT> const & dereference_handle( viennagrid::segment_handle<SegmentationT> const &, viennagrid::element<ElementTagT, WrappedConfigT> & element)
01947   { return element; }
01948 
01949 
01951   template<typename HostElementTagT, typename WrappedHostElementConfigT, typename ElementTagT, typename WrappedConfigT>
01952   viennagrid::element<ElementTagT, WrappedConfigT> const & dereference_handle( viennagrid::element<HostElementTagT, WrappedHostElementConfigT> const &, viennagrid::element<ElementTagT, WrappedConfigT> const & element)
01953   { return element; }
01954 
01956   template<typename HostElementTagT, typename WrappedHostElementConfigT, typename ElementTagT, typename WrappedConfigT>
01957   viennagrid::element<ElementTagT, WrappedConfigT> const & dereference_handle( viennagrid::element<HostElementTagT, WrappedHostElementConfigT> &, viennagrid::element<ElementTagT, WrappedConfigT> const & element)
01958   { return element; }
01959 
01961   template<typename HostElementTagT, typename WrappedHostElementConfigT, typename ElementTagT, typename WrappedConfigT>
01962   viennagrid::element<ElementTagT, WrappedConfigT> const & dereference_handle( viennagrid::element<HostElementTagT, WrappedHostElementConfigT> const &, viennagrid::element<ElementTagT, WrappedConfigT> & element)
01963   { return element; }
01964 
01972   template<typename MeshOrSegmentHandleT, typename HandleT>
01973   HandleT handle( MeshOrSegmentHandleT &, HandleT handle) { return handle; }
01974 
01982   template<typename MeshOrSegmentHandleT, typename HandleT>
01983   const HandleT handle( MeshOrSegmentHandleT const &, HandleT handle) { return handle; }
01984 
01985   template<typename MeshT, typename MeshViewT, typename HandleT>
01986   void mark_referencing_elements( MeshT & mesh_obj, MeshViewT & element_view, HandleT host_element );
01987 
01988 
01989 
01990 
01995   template<typename MeshT>
01996   struct mesh_proxy
01997   {
01998     mesh_proxy( MeshT & mesh_obj ) : mesh_obj_(&mesh_obj){}
01999     MeshT * mesh_obj_;
02000   };
02001 
02008   template<typename WrappedConfigT>
02009   mesh_proxy< viennagrid::mesh<WrappedConfigT> > make_view(viennagrid::mesh<WrappedConfigT> & mesh_obj)
02010   {
02011     return mesh_proxy< viennagrid::mesh<WrappedConfigT> >( mesh_obj );
02012   }
02013 
02015   template<typename SegmentationT>
02016   mesh_proxy< typename SegmentationT::view_type > make_view(segment_handle<SegmentationT> & segment);
02017 
02018 
02019   // norm tags for: algorithm/norm.hpp
02021   struct one_norm_tag {};
02023   struct two_norm_tag {};
02025   struct inf_norm_tag {};
02026 
02028   struct seg_cell_normal_tag {};
02029 
02031   struct seg_cell_normal_data {
02032     typedef viennagrid::spatial_point<double, cartesian_cs<3> >         point_type;
02033     typedef std::map<std::size_t, point_type>    type;
02034   };
02035 
02036 
02037   namespace detail
02038   {
02040     template <typename ElementTagT>
02041     struct element_refinement;
02042   }
02043 }
02044 
02045 #endif