MineLink
 All Data Structures Functions Variables Pages
reblock.h
1 #ifndef __REBLOCK_H__
2 #define __REBLOCK_H__
3 
4 #include <vector>
5 #include <string>
6 #include <cstring>
7 #include <map>
8 #include <algorithm>
9 #include "../../data_structures/bm/blockmodel.h"
10 #include "../../data_structures/bm/blocksel.h"
11 
12 using std::vector;
13 using std::string;
14 using std::map;
15 
16 namespace delphos{
17 
29 class Reblocker : public BlockModelEntity {
30 private:
31  map<string,SelectionFunctor *> * _new_columns;
32 
33 public:
40 
44  virtual ~Reblocker();
45 
46  #ifndef DOXYGEN
47 
50  virtual BlockModel * Reblock() = 0;
51  #endif
52 
65  void AddAggregatedColumn(const string & column, delphos::SelectionFunctor * f);
66 
76  void AddSummationColumn(const string & column, const string & newcolumn);
77 
87  void AddMajorizationColumn(const string & column, const string & newcolumn);
88 
89 
99  void AddAvgColumn(const string & sumcolumn, const string & newcolumn);
100 
111  void AddAvgColumn(const string & sumcolumn,const string & weightcolumn, const string & newcolumn);
112 
122  void AddMaxColumn(const string & column, const string & newcolumn);
132  void AddMinColumn(const string & column, const string & newcolumn);
137  vector<string> AggregatedColumnNames() const;
138 
145  const delphos::SelectionFunctor * const AggregatedColumnFunctor(const string & column_name) const;
146 
150  const unsigned int NumOfAggregatedColumns() const;
151 
152 protected:
159  void CalculateCoordinates(BlockModel * bm, map<string,BlockSelection*> * groups) const;
160 
169  void CalculateCoordinates(BlockModel * bm, map<string,BlockSelection*> * groups,const string& reblocked_id_col) const;
170 
177  void CalculateColumns(BlockModel * bm, map<string,BlockSelection*> * groups) const;
178 
183  void CopyColumns(const Reblocker& other);
184 };
185 
193 class RegularReblocker : public Reblocker {
194 private:
195  const double _dx, _dy, _dz;
196  const double _minx,_miny,_minz;
197  char * temp;
198  const vector<string> _list;
199  string _reblocked_id_col;
200 
201  void init();
202  map<string,BlockSelection*> * Groups() const;
203 
204 protected:
205 
215  string ID(const BlockIndexType & index) const;
216 public:
234  RegularReblocker(delphos::BlockModel & bm, const double & dx, const double & dy, const double & dz, const std::vector<std::string> & column_list);
235 
254  RegularReblocker(delphos::BlockModel & bm, const double & dx, const double & dy, const double & dz, const std::vector<std::string> & column_list,const string& reblocked_id_col);
255 
256 
270  RegularReblocker(delphos::BlockModel & bm, const double & dx, const double & dy, const double & dz);
271 
286  RegularReblocker(delphos::BlockModel & bm, const double & dx, const double & dy, const double & dz,const string& reblocked_id_col);
287 
291  virtual ~RegularReblocker();
292 
297  virtual delphos::BlockModel * Reblock();
298 
304 
305 };
306 }
307 #endif
308 
virtual ~RegularReblocker()
Destructor.
Definition: reblock.cpp:242
virtual ~Reblocker()
Destructor.
Definition: reblock.cpp:196
Abstract class that defines the basis for classes that abstracts functions to perform selections...
Definition: blocksel.h:350
const delphos::SelectionFunctor *const AggregatedColumnFunctor(const string &column_name) const
Retrieves the function to be used for creating a certain attribute in the aggregated block model...
Definition: reblock.cpp:67
vector< string > AggregatedColumnNames() const
Returns the names of the columns to be created in the new block model.
Definition: reblock.cpp:13
const unsigned int NumOfAggregatedColumns() const
Reports the number of columns to be created in the new block model.
Definition: reblock.cpp:71
virtual delphos::BlockModel * Reblock()
Performs the reblocking process and constructs a new block model with specified new columns...
Definition: reblock.cpp:248
void AddSummationColumn(const string &column, const string &newcolumn)
Adds a column to be created in the resulting block model.
Definition: reblock.cpp:27
Abstracts a container of blocks as a table with arbitrary number of attributes that can be accessed b...
Definition: blockmodel.h:62
Reblocker(delphos::BlockModel &bm)
Creates a new reblocker associated to a given block model.
Definition: reblock.cpp:5
delphos::BlockModel * ReblockToRegularBlockModel()
Performs the reblocking process and constructs a new regular block model with specified new columns...
Definition: reblock.cpp:298
void AddMajorizationColumn(const string &column, const string &newcolumn)
Adds a column to be created in the resulting block model.
Definition: reblock.cpp:34
RegularReblocker(delphos::BlockModel &bm, const double &dx, const double &dy, const double &dz, const std::vector< std::string > &column_list)
Creates a new regular reblocker, that reblocks in blocks of sizes dx, dy, dz and filters by the given...
Definition: reblock.cpp:219
void AddMaxColumn(const string &column, const string &newcolumn)
Adds a column to be created in the resulting block model.
Definition: reblock.cpp:55
An implementation of a reblocker based on regular dimensions and attribute filters.
Definition: reblock.h:193
A base class for object associated to a given block model.
Definition: blockmodel.h:1356
void AddAggregatedColumn(const string &column, delphos::SelectionFunctor *f)
Adds a column to be created in the resulting block model.
Definition: reblock.cpp:21
void AddMinColumn(const string &column, const string &newcolumn)
Adds a column to be created in the resulting block model.
Definition: reblock.cpp:61
void AddAvgColumn(const string &sumcolumn, const string &newcolumn)
Adds a column to be created in the resulting block model.
Definition: reblock.cpp:42
Abstract class to define methods for the reblocking utility.
Definition: reblock.h:29