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 #ifndef MLN_CORE_GRIDS_HH
00027 # define MLN_CORE_GRIDS_HH
00028
00032
00033 # include <mln/core/concept/regular_grid.hh>
00034 # include <mln/core/def/coord.hh>
00035 # include <mln/metal/bool.hh>
00036
00037
00038 namespace mln
00039 {
00040
00042 namespace grid
00043 {
00044
00045 struct tick : public Regular_Grid< tick >
00046 {
00047 typedef metal::true_ aligned;
00048 enum { dim = 1 };
00049 };
00050
00051 struct square : public Regular_Grid< square >
00052 {
00053 typedef metal::true_ aligned;
00054 enum { dim = 2 };
00055 };
00056
00057 struct hexa : public Regular_Grid< hexa >
00058 {
00059 typedef metal::false_ aligned;
00060 enum { dim = 2 };
00061 };
00062
00063 struct cube : public Regular_Grid< cube >
00064 {
00065 typedef metal::true_ aligned;
00066 enum { dim = 3 };
00067 };
00068
00069 }
00070
00071
00072
00073
00074 template <unsigned dim> struct regular_grid_from_dim_;
00075
00076 template <> struct regular_grid_from_dim_<1> { typedef grid::tick ret; };
00077 template <> struct regular_grid_from_dim_<2> { typedef grid::square ret; };
00078 template <> struct regular_grid_from_dim_<3> { typedef grid::cube ret; };
00079
00080 }
00081
00082
00083 # define mln_regular_grid_from_dim(N) typename mln::regular_grid_from_dim_< N >::ret
00084
00085
00086 #endif // ! MLN_CORE_GRIDS_HH