rasdaman API
stattiling.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_STATTILING_HH_
34 #define _R_STATTILING_HH_
35 
36 // Include statements
37 
38 class r_Access;
39 class r_Stat_Tiling;
40 
41 //@ManMemo: Module: {\bf rasodmg}
42 
43 /*@Doc:
44 
45  This class represents an access pattern to a certain object.
46  {\tt r_Stat_Tiling} receives a list of this objects so that
47  an appropriate tiling can be defined.
48 */
49 
53 class r_Access
54 {
55 public:
56 
58  r_Access(const r_Minterval& pattern, r_ULong accesses = 1);
64  const r_Minterval& get_pattern() const;
66 
68  void set_pattern(const r_Minterval& pattern);
69 
71  r_ULong get_times() const;
72 
74  void set_times(r_ULong accesses);
75 
78  bool is_near(const r_Access& other, r_ULong border_threshold) const throw (r_Error);
79 
81  void merge_with(const r_Access& other);
82 
84  void print_status(std::ostream& os) const;
85 
87  bool operator==(const r_Access& other) const;
88 
90  bool operator!=(const r_Access& other) const;
91 
92 private:
93 
95  r_Access();
96 
98  r_Minterval interval;
99 
101  r_ULong times;
102 };
103 
104 //@ManMemo: Module: {\bf rasodmg}
108 extern std::ostream& operator<<(std::ostream& os, const r_Access& access);
109 
110 
111 //@ManMemo: Module: {\bf rasodmg}
112 
113 /*@Doc:
114  This class implements the "statistic tiling" algorithm.
115 
116  Three parameters are passed in the constructor of the class,
117  the border threshold for considering two access patterns to be the
118  same, the interesting threshold which specifies the percentage of
119  accesses that must take place so that an areas is considered of interest
120  when performing tiling and also the tilesize.
121 
122  A call to {\tt update_stat_information} should be made prior to performing
123  tiling so that the static information about the accesses to the object
124  can be updated and the tiling operation prepared.
125 */
126 
131 {
132  // ******************* PUBLIC SECTION *******************
133 
134 public: // constants
135 
137  const static r_Area DEF_BORDER_THR;
138 
141 
144  r_Stat_Tiling(const char* encoded) throw (r_Error);
145 
148  const std::vector<r_Access>& stat_info,
150  r_Area border_threshold = DEF_BORDER_THR,
151  r_Double interesting_threshold = DEF_INTERESTING_THR) throw (r_Error);
164  virtual ~r_Stat_Tiling();
165 
167  virtual const std::vector<r_Minterval>& get_interesting_areas() const;
168 
184  virtual void print_status(std::ostream& os) const;
185 
186  virtual std::vector<r_Minterval>* compute_tiles(const r_Minterval& obj_domain, r_Bytes cell_size) const throw (r_Error);
187 
188  virtual r_Tiling* clone() const;
189 
190  virtual r_Tiling_Scheme get_tiling_scheme() const;
191 
192  static const char* description;
193 
194 protected: // methods
195 
198  void filter(std::vector<r_Access>& patterns) const throw (r_Error);
199 
201  r_Access merge(const std::vector<r_Access>& patterns) const;
202 
205 
208 
211 
213  std::vector<r_Access> stat_info;
214 };
215 
216 #endif
unsigned int r_ULong
Definition: odmgtypes.hh:114
virtual void print_status(std::ostream &os) const
virtual r_Tiling_Scheme get_tiling_scheme() const
bool operator==(const r_Access &other) const
Operator equal.
Definition: stattiling.hh:130
Definition: error.hh:88
virtual const std::vector< r_Minterval > & get_interesting_areas() const
Gets the statistical information.
static const char * description
Definition: stattiling.hh:192
std::vector< r_Access > stat_info
Statistical data.
Definition: stattiling.hh:213
Definition: stattiling.hh:53
r_Area get_border_threshold() const
Gets the threshold at which to intervals are considered the same.
void filter(std::vector< r_Access > &patterns) const
Filters and access pattern table (list) throws exception if dimensions of access patterns are not the...
Definition: tiling.hh:67
unsigned int r_Dimension
Definition: mddtypes.hh:118
r_ULong get_times() const
Gets the number of times the pattern was accessed.
std::ostream & operator<<(std::ostream &os, const r_Access &access)
double r_Double
Definition: odmgtypes.hh:138
r_Stat_Tiling(const char *encoded)
read everything from an encoded string e.g. "2;[0:9,0:9],3;[100:109,0:9],2;2;0.3;100" ...
const r_Minterval & get_pattern() const
Gets the current interval (access pattern)
r_Access merge(const std::vector< r_Access > &patterns) const
Merges a list of access patterns.
std::vector< r_Minterval > iareas
Current interest areas.
Definition: stattiling.hh:210
void set_times(r_ULong accesses)
Sets the number of times the pattern was accessed.
r_Double interesting_thr
The "interesting area" threshold.
Definition: stattiling.hh:204
static r_Bytes clientTileSize
Definition: rminit.hh:132
uint64_t r_Area
Definition: mddtypes.hh:85
static const r_Area DEF_BORDER_THR
Default threshold for two borders being considered the same.
Definition: stattiling.hh:137
bool is_near(const r_Access &other, r_ULong border_threshold) const
Checks if a certain access pattern is "close enough" of other throws exception if the domains do not ...
static const r_Double DEF_INTERESTING_THR
Default threshold for considering an area interesting when tiling.
Definition: stattiling.hh:140
r_Tiling_Scheme
Definition: mddtypes.hh:393
void print_status(std::ostream &os) const
Print object status.
unsigned int r_Bytes
Definition: mddtypes.hh:56
r_Double get_interesting_threshold() const
Gets the threshold at which an area is considered to be interesting.
virtual 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_...
void merge_with(const r_Access &other)
Merge this access pattern with another.
void set_pattern(const r_Minterval &pattern)
Sets the current interval (access pattern)
Definition: tiling.hh:153
r_Area border_thr
The "same border" threshold.
Definition: stattiling.hh:207
bool operator!=(const r_Access &other) const
Operator different.
Definition: minterval.hh:249
virtual r_Tiling * clone() const
Clones this object.