• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List

face_data.hh

00001 // Copyright (C) 2008, 2009, 2010 EPITA Research and Development
00002 // Laboratory (LRDE)
00003 //
00004 // This file is part of Olena.
00005 //
00006 // Olena is free software: you can redistribute it and/or modify it under
00007 // the terms of the GNU General Public License as published by the Free
00008 // Software Foundation, version 2 of the License.
00009 //
00010 // Olena is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Olena.  If not, see <http://www.gnu.org/licenses/>.
00017 //
00018 // As a special exception, you may use this file as part of a free
00019 // software project without restriction.  Specifically, if other files
00020 // instantiate templates or use macros or inline functions from this
00021 // file, or you compile this file and link it with other files to produce
00022 // an executable, this file does not by itself cause the resulting
00023 // executable to be covered by the GNU General Public License.  This
00024 // exception does not however invalidate any other reasons why the
00025 // executable file might be covered by the GNU General Public License.
00026 
00027 #ifndef MLN_TOPO_FACE_DATA_HH
00028 # define MLN_TOPO_FACE_DATA_HH
00029 
00036 
00037 # include <vector>
00038 
00039 # include <mln/topo/algebraic_n_face.hh>
00040 
00041 
00042 namespace mln
00043 {
00044 
00045   namespace topo
00046   {
00047 
00048     // Forward declarations (external).
00049     template <unsigned D> class complex;
00050     namespace internal
00051     {
00052       template <unsigned N, unsigned D> struct lower_dim_faces_set_mixin;
00053       template <unsigned N, unsigned D> struct higher_dim_faces_set_mixin;
00054       
00055       template <unsigned N, unsigned D>
00056       struct lower_dim_adj_faces_if_dim_matches_;
00057       template <unsigned N, unsigned D>
00058       struct higher_dim_adj_faces_if_dim_matches_;
00059     }
00060 
00061     // Forward declarations (internal).
00062     template <unsigned N, unsigned D> class n_face;
00063     namespace internal
00064     {
00065       template <unsigned N, unsigned D> class lower_dim_faces_data_mixin;
00066       template <unsigned N, unsigned D> class higher_dim_faces_data_mixin;
00067     }
00068 
00069 
00070     /*------------.
00071     | Face data.  |
00072     `------------*/
00073 
00075     template <unsigned N, unsigned D> class face_data;
00076 
00077 
00078     // Specialization for the faces of highest dimension (\p D).
00079     template <unsigned D>
00080     class face_data<D, D> : public internal::lower_dim_faces_data_mixin<D, D>
00081     {
00082     };
00083 
00084     // Specialization for the faces of intermediate dimension (greater
00085     // than 0, lower than \p D).
00086     template <unsigned N, unsigned D>
00087     class face_data : public internal::lower_dim_faces_data_mixin<N, D>,
00088                       public internal::higher_dim_faces_data_mixin<N, D>
00089     {
00090     };
00091 
00092     // Specialization for the faces of lowest dimension (0).
00093     template <unsigned D>
00094     class face_data<0u, D> : public internal::higher_dim_faces_data_mixin<0u, D>
00095     {
00096     };
00097 
00098     // Specialization for the case of a 0-complex.
00099     template <>
00100     class face_data<0u, 0u>
00101     {
00102     };
00103 
00104 
00105     namespace internal
00106     {
00107 
00110       template <unsigned N, unsigned D>
00111       class lower_dim_faces_data_mixin
00112       {
00113         typedef std::vector< algebraic_n_face<N - 1, D> > lower_dim_faces_type;
00114 
00115       public:
00116         void connect_lower_dim_face(const algebraic_n_face<N - 1, D>& f);
00117 
00118       private:
00119         friend struct mln::topo::internal::lower_dim_faces_set_mixin<N, D>;
00120         friend struct mln::topo::internal::lower_dim_adj_faces_if_dim_matches_<N, D>;
00121         friend lower_dim_faces_type
00122         mln::topo::n_face<N, D>::lower_dim_adj_faces() const;
00123 
00124         // FIXME: Rename as lower_dim_adj_faces_ (as well as related members).
00125         lower_dim_faces_type lower_dim_faces_;
00126       };
00127 
00128       template <unsigned N, unsigned D>
00129       class higher_dim_faces_data_mixin
00130       {
00131         typedef std::vector< algebraic_n_face<N + 1, D> > higher_dim_faces_type;
00132 
00133       public:
00134         void connect_higher_dim_face(const algebraic_n_face<N + 1, D>& f);
00135 
00136       private:
00137         friend struct mln::topo::internal::higher_dim_faces_set_mixin<N, D>;
00138         friend struct mln::topo::internal::higher_dim_adj_faces_if_dim_matches_<N, D>;
00139         friend higher_dim_faces_type
00140         mln::topo::n_face<N, D>::higher_dim_adj_faces() const;
00141 
00142         // FIXME: Rename as higher_dim_adj_faces_ (as well as related members).
00143         higher_dim_faces_type higher_dim_faces_;
00144       };
00146 
00147     } // end of namespace mln::topo::internal
00148 
00149 
00150 
00151 # ifndef MLN_INCLUDE_ONLY
00152 
00153     namespace internal
00154     {
00155       template <unsigned N, unsigned D>
00156       inline
00157       void
00158       lower_dim_faces_data_mixin<N, D>::connect_lower_dim_face(const algebraic_n_face<N - 1, D>& f)
00159       {
00160         lower_dim_faces_.push_back(f);
00161       }
00162 
00163       template <unsigned N, unsigned D>
00164       inline
00165       void
00166       higher_dim_faces_data_mixin<N, D>::connect_higher_dim_face(const algebraic_n_face<N + 1, D>& f)
00167       {
00168         higher_dim_faces_.push_back(f);
00169       }
00170 
00171     } // end of namespace mln::topo::internal
00172 
00173 # endif // ! MLN_INCLUDE_ONLY
00174 
00175   } // end of namespace mln::topo
00176 
00177 } // end of namespace mln
00178 
00179 #endif // ! MLN_TOPO_FACE_DATA_HH

Generated on Tue Oct 4 2011 15:23:46 for Milena (Olena) by  doxygen 1.7.1