00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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
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
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
00072
00073
00075 template <unsigned N, unsigned D> class face_data;
00076
00077
00078
00079 template <unsigned D>
00080 class face_data<D, D> : public internal::lower_dim_faces_data_mixin<D, D>
00081 {
00082 };
00083
00084
00085
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
00093 template <unsigned D>
00094 class face_data<0u, D> : public internal::higher_dim_faces_data_mixin<0u, D>
00095 {
00096 };
00097
00098
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
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
00143 higher_dim_faces_type higher_dim_faces_;
00144 };
00146
00147 }
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 }
00172
00173 # endif // ! MLN_INCLUDE_ONLY
00174
00175 }
00176
00177 }
00178
00179 #endif // ! MLN_TOPO_FACE_DATA_HH