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

face_data.hh

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

Generated on Thu Sep 8 2011 18:31:49 for Milena (Olena) by  doxygen 1.7.1