rasdaman API
alignedtiling.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 /
33 #ifndef _R_ALIGNEDTILING_HH_
34 #define _R_ALIGNEDTILING_HH_
35 
36 class r_Aligned_Tiling;
37 
38 #include "rasodmg/tiling.hh"
39 #include "raslib/minterval.hh"
40 
41 //@ManMemo: Module: {\bf rasodmg}
42 
43 /*@Doc:
44 
45  The {\tt r_Aligned_Tiling} class is used to express the options
46  for aligned tiling of {\tt r_Marray} objects.
47 
48  The following options may be set:
49 
50  \begin{itemize}
51  \item {\bf Tile configuration}
52 
53  describes which format tiles should have. The tile configuration
54  is expressed using a multidimensional interval {\tt r_Minterval}.
55  This interval should have null lower limits and
56  must have the same dimensionality as that of the
57  objects to which it is to be applied. Its lengths along each
58  direction are interpreted relative to the others.
59 
60  For example, if tile configuration is {\tt[ 0:9, 0:9, 0:19]}, tiles
61  will be three dimensional arrays with two sides of equal length and
62  double that length along the third direction.
63 
64  If a fixed tile is required, tile configuration and
65  tile size should be set in such a way that the size of a tile
66  with the given configuration is equal to the specified tile size.
67  For example, if the tile configuration is {\tt [ 0:29, 0:39, 0:59]}
68  and cell size is 2, then the tile size should be set to
69  144000. This will also result in more efficient computation of
70  the tiling since the given tile configuration is used unchanged if
71 
72  {\tt 90% * tile_size < size of tile_config < tile_size}
73 
74  (i.e., no computation is necessary). This applies equally to tile
75  configurations with non-fixed limits.
76 
77  Tiles with non-fixed limits are used to express preferential
78  directions for tiling. For example, {\tt [ 0:9 , 0:* ]} expresses that
79  tiles should be done along the first direction, i.e., they
80  should have domains :
81 
82  \begin{verbatim}
83  [ 0 : 9 , 0 : marray.domain[1].high() ]
84  [ 10 : 19 , 0 : marray.domain[1].high() ]
85  ...
86  \end{verbatim}
87 
88  assuming this results in a tile with the given tile size. If not,
89  the limits in the first direction are changed. The higher dimensions
90  are given preference in that tiles will be preferably
91  extended along a higher dimension than a lower one if two or
92  more limits are open.
93 
94  The default configuration corresponds to an interval with equal
95  lengths along all directions.
96 
97  \item {\bf Tile size }
98 
99  describes the size for tiles of the object in characters.
100  Tiling is done so that tiles are as big as possible but wit a
101  smaller size than this one.
102  The default tile size is the size specified for the RasDaMan client.
103 
104  Notice: the tiling options are invalid if the rasdaman client is running
105  with the option notiling. In that case, no tiling is done,
106  independently of the storage layout chosen.
107 */
116 {
117 public:
120  r_Aligned_Tiling(const char* encoded) throw (r_Error);
121 
124 
126  //r_Aligned_Tiling(r_Dimension dim) throw (r_Error);
127 
130 
131  virtual r_Tiling* clone() const;
132 
133  virtual ~r_Aligned_Tiling();
134 
136  const r_Minterval& get_tile_config() const;
137 
138  std::vector<r_Minterval>* compute_tiles(const r_Minterval& obj_domain, r_Bytes cell_size) const throw (r_Error);
139 
140  char* get_string_representation() const;
146  void print_status(std::ostream& s = cout) const;
148 
149  virtual r_Tiling_Scheme get_tiling_scheme() const;
150 
151  static const char* description;
152 
154  r_Minterval compute_tile_domain(const r_Minterval& dom, r_Bytes cell_size) const;
174 protected:
175 
178 
181 
183  r_Minterval get_opt_size(const r_Minterval& tile_domain, r_Bytes cell_size) const;
184 };
185 
186 //@ManMemo: Module: {\bf rasodmg}
187 
188 /*@Doc:
189 
190  The {\tt r_Default_Tiling} class is used to express the default tiling
191  of {\tt r_Marray} objects. According to this algorithm, tiles are divided
192  into equal sized multidimensional blocks qith equal lengths along
193  all directions of the spatial domain.
194 
195  The following parameter may be set:
196 
197  \item {\bf Tile size }
198 
199  describes the size for tiles of the object in characters.
200  Tiling is done so that tiles have a smaller size than this one.
201  The default tile size is the size specified for the RasDaMan client.
202  In bytes.
203 */
204 
205 
206 //@ManMemo: Module: {\bf rasodmg }
211 //extern std::ostream& operator<<(std::ostream& s, const r_Aligned_Tiling& at);
212 
213 #endif
214 
215 
216 
217 
r_Minterval tile_config
tile configuration
Definition: alignedtiling.hh:177
Definition: alignedtiling.hh:115
r_Aligned_Tiling(const char *encoded)
read everything from encoded string (e.g. "[0:9,0:9];100" or "2;100")
Definition: error.hh:88
Definition: tiling.hh:67
unsigned int r_Dimension
Definition: mddtypes.hh:118
static const char * description
Definition: alignedtiling.hh:151
const r_Minterval & get_tile_config() const
returns the current value for the tile configuration option
virtual ~r_Aligned_Tiling()
virtual r_Tiling * clone() const
Clones this object.
r_Minterval get_opt_size(const r_Minterval &tile_domain, r_Bytes cell_size) const
char * get_string_representation() const
r_Bytes get_min_opt_tile_size() const
static r_Bytes clientTileSize
Definition: rminit.hh:132
void print_status(std::ostream &s=cout) const
writes the state of the object to the specified stream
r_Tiling_Scheme
Definition: mddtypes.hh:393
unsigned int r_Bytes
Definition: mddtypes.hh:56
r_Minterval compute_tile_domain(const r_Minterval &dom, r_Bytes cell_size) const
determines the individual tiles domains
std::vector< r_Minterval > * compute_tiles(const r_Minterval &obj_domain, r_Bytes cell_size) const
returns true if the cellTypeSize is smaller or equal to the tile size and the dimension fits the obj_...
virtual r_Tiling_Scheme get_tiling_scheme() const
Definition: tiling.hh:153
Definition: minterval.hh:249