summaryrefslogtreecommitdiffstats
path: root/storagemgr
diff options
context:
space:
mode:
authorAndrei Aiordachioaie <a.aiordachioaie@jacobs-university.de>2009-08-25 13:33:09 +0200
committerPeter Baumann <baumann@rasdaman.org>2009-08-27 09:38:08 +0200
commitfd66ca862d4499378719e2a635c9f97df28b763d (patch)
treee11e40b69e30b4d553cd0bcdedb435849c22e0d0 /storagemgr
parentbb3139b97d956a8455649af82c0f3b705d2a8e55 (diff)
downloadrasdaman-upstream-fd66ca862d4499378719e2a635c9f97df28b763d.tar.gz
rasdaman-upstream-fd66ca862d4499378719e2a635c9f97df28b763d.tar.xz
rasdaman-upstream-fd66ca862d4499378719e2a635c9f97df28b763d.zip
Tiling & Indexing options added to rasql grammar
Diffstat (limited to 'storagemgr')
-rw-r--r--storagemgr/Makefile.am3
-rw-r--r--storagemgr/sstoragelayout.cc215
-rw-r--r--storagemgr/sstoragelayout.hh39
-rwxr-xr-xstoragemgr/stgmddconfig.cc92
-rwxr-xr-xstoragemgr/stgmddconfig.hh57
5 files changed, 378 insertions, 28 deletions
diff --git a/storagemgr/Makefile.am b/storagemgr/Makefile.am
index f019320..53d93c0 100644
--- a/storagemgr/Makefile.am
+++ b/storagemgr/Makefile.am
@@ -29,7 +29,8 @@
##################################################################
lib_LIBRARIES = libstoragemgr.a
-libstoragemgr_a_SOURCES = sstoragelayout.cc sstoragelayout.hh
+libstoragemgr_a_SOURCES = sstoragelayout.cc sstoragelayout.hh \
+ stgmddconfig.cc stgmddconfig.hh
CLEANFILES= core client.bm client.dbg client.log ir.out
diff --git a/storagemgr/sstoragelayout.cc b/storagemgr/sstoragelayout.cc
index fc7a793..0dcef0c 100644
--- a/storagemgr/sstoragelayout.cc
+++ b/storagemgr/sstoragelayout.cc
@@ -1,29 +1,21 @@
-/*
-* This file is part of rasdaman community.
-*
-* Rasdaman community is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* Rasdaman community is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
-*
-* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
-rasdaman GmbH.
-*
-* For more information please see <http://www.rasdaman.org>
-* or contact Peter Baumann via <baumann@rasdaman.com>.
-*/
/****************************************************************************
*
*
+ * SOURCE: sstoragelayout.cc
+ *
+ * MODULE: indexmgr
+ * CLASS: StorageLayout
*
+ * CHANGE HISTORY (append further entries):
+ * when who what
+ * -----------------------------------------------------------------------
+ * 10-Sep-97 furtado creation of preliminary version.
+ * 09-Oct-97 sivan set, get functions
+ * 13-Oct-97 furtado extended functionality, class hierarchy
+ * 4-Nov-98 furtado added RegDirIx< >.
+ * 13-Nov-00 hoefner startet to do something with this class
+ * 07-Jan-09 Shams add tiling set to the getLayout method
+ * 07-Jan-09 Shams add some methods for supporting tiling
* COMMENTS:
* none
*
@@ -32,6 +24,9 @@ rasdaman GmbH.
#include "sstoragelayout.hh"
#include <stdlib.h>
#include "raslib/rmdebug.hh"
+#include "rasodmg/alignedtiling.hh"
+#include "rasodmg/dirtiling.hh"
+#include "rasodmg/stattiling.hh"
const r_Bytes StorageLayout::DBSPageSize = 4096;
@@ -55,18 +50,21 @@ StorageLayout::StorageLayout(r_Index_Type ixType)
: myLayout(new DBStorageLayout())
{
setIndexType(ixType);
+ extraFeatures = new StgMddConfig();
RMDBGONCE(4, RMDebug::module_storagemgr, "StorageLayout", "StorageLayout(" << ixType << ")")
}
StorageLayout::StorageLayout()
: myLayout(new DBStorageLayout())
{
+ extraFeatures = new StgMddConfig();
RMDBGONCE(4, RMDebug::module_storagemgr, "StorageLayout", "StorageLayout()")
}
StorageLayout::StorageLayout(const DBStorageLayoutId& id)
: myLayout(id)
{
+ extraFeatures = new StgMddConfig();
RMDBGONCE(4, RMDebug::module_storagemgr, "StorageLayout", "StorageLayout(" << id.getOId() << ")")
}
@@ -84,6 +82,7 @@ StorageLayout::getDBStorageLayout() const
return myLayout;
}
+
r_Index_Type
StorageLayout::getIndexType() const
{
@@ -152,6 +151,45 @@ StorageLayout::getDataFormat(const r_Point& where) const
return myLayout->getDataFormat();
}
+void
+StorageLayout::setBBoxes(const vector<r_Minterval>& input) {
+ extraFeatures->setBBoxes(input);
+}
+
+void
+StorageLayout::setSubTiling()
+{extraFeatures->setSubTiling();}
+
+void
+StorageLayout::resetSubTiling()
+{extraFeatures->resetSubTiling();}
+
+void
+StorageLayout::setInterestThreshold(double i){
+ extraFeatures->setInterestThreshold(i);
+}
+
+void
+StorageLayout::setBorderThreshold(unsigned int b){
+ extraFeatures->setBorderThreshold(b);
+}
+
+void
+StorageLayout::setCellSize(int i){
+ extraFeatures->setCellSize(i);
+}
+
+
+void
+StorageLayout::setDirDecomp(vector<r_Dir_Decompose>* dir){
+ vector<r_Dir_Decompose> dec;
+ for(int i = 0 ; i < dir->size() ; ++i){
+ dec.push_back(dir->at(i));
+ }
+ extraFeatures->setDirDecompose(dec);
+}
+
+
std::vector< r_Minterval >
StorageLayout::getLayout(const r_Minterval& tileDomain)
{
@@ -169,11 +207,36 @@ StorageLayout::getLayout(const r_Minterval& tileDomain)
retval.push_back(tileDomain);
}
break;
- case r_InterestTiling:
- case r_StatisticalTiling:
- case r_AlignedTiling:
- case r_DirectionalTiling:
- case r_SizeTiling:
+ case r_InterestTiling:
+ retval = calcInterestLayout(tileDomain);
+ RMInit::logOut << "Interest Tiling chosen Everything is OK" << endl;
+ RMDBGMIDDLE(0, RMDebug::module_storagemgr, "StorageLayout", "getLayout(" << tileDomain << ") Interest Tiling");
+ break;
+ case r_StatisticalTiling:
+ retval = calcStatisticLayout(tileDomain);
+ RMInit::logOut << "Statistical Tiling chosen" << endl;
+ break;
+ case r_AlignedTiling:
+ if (myLayout->getTileConfiguration().dimension() == tileDomain.dimension())
+ retval = calcAlignedLayout(tileDomain);
+ else {
+ RMInit::logOut << "Aligned Tiling chosen without Tiling Domain!\nPlease specify a Tiling Domain.\nNow using no tiling." << endl;
+ RMDBGMIDDLE(0, RMDebug::module_storagemgr, "StorageLayout", "getLayout(" << tileDomain << ") Aligned Tiling without Tiling Domain");
+ retval.push_back(tileDomain);
+ }
+ break;
+
+ case r_DirectionalTiling:
+// if (myLayout->getTileConfiguration().dimension() == tileDomain.dimension())
+ retval = calcDirectionalLayout(tileDomain);
+// else {
+ RMInit::logOut << "Directional Tiling chosen. Everything is OK." << endl;
+// RMDBGMIDDLE(0, RMDebug::module_storagemgr, "StorageLayout", "getLayout(" << tileDomain << ") Directional Tiling without Tiling Domain");
+// retval.push_back(tileDomain);
+ // }
+ break;
+
+ case r_SizeTiling:
RMInit::logOut << "Tiling Scheme " << myLayout->getTilingScheme() << " " << (int)myLayout->getTilingScheme() << " not supported" << endl;
RMDBGMIDDLE(0, RMDebug::module_storagemgr, "StorageLayout", "getLayout(" << tileDomain << ") of " << myLayout->getOId() << " Tiling Scheme " << myLayout->getTilingScheme() << " " << (int)myLayout->getTilingScheme() << " not supported");
retval.push_back(tileDomain);
@@ -255,6 +318,104 @@ RMDBGIF(5, RMDebug::module_storagemgr, "StorageLayout", \
RMDBGMIDDLE(1, RMDebug::module_storagemgr, "StorageLayout", *i); \
);
RMDBGEXIT(4, RMDebug::module_storagemgr, "StorageLayout", "calcRegLayout(" << tileDomain << ") " << myLayout->getOId());
+ RMInit::logOut << "CalcReg Tiling: tile number: " << retval.size() << endl;
return retval;
}
+std::vector< r_Minterval >
+StorageLayout::calcInterestLayout(const r_Minterval& tileDomain) {
+ RMInit::logOut << "Entering CalcInterest Tiling" << endl;
+ r_Interest_Tiling* tiling = new r_Interest_Tiling
+ (tileDomain.dimension(), extraFeatures->getBBoxes(), myLayout->getTileSize(), r_Interest_Tiling::SUB_TILING);
+ std::vector<r_Minterval> ret;
+ std::vector<r_Minterval>* ret1 = tiling->compute_tiles
+ (tileDomain, extraFeatures->getCellSize());
+ RMInit::logOut << "CalcInterest Tiling: tile number: " << ret1->size() << endl;
+ for (int i = 0; i < ret1->size(); i++) {
+ ret.push_back(ret1->at(i));
+ }
+ RMInit::logOut << "CalcInterest Tiling: tile number2: " << ret.size() << endl;
+ return ret;
+}
+
+std::vector< r_Minterval >
+StorageLayout::calcAlignedLayout(const r_Minterval& tileDomain) {
+ RMInit::logOut << "Entering CalcAligned Tiling" << endl;
+ r_Aligned_Tiling* tiling = new r_Aligned_Tiling
+ (myLayout->getTileConfiguration(),myLayout->getTileSize());
+ std::vector<r_Minterval> ret;
+ std::vector<r_Minterval>* ret1 = tiling->compute_tiles
+ (tileDomain, extraFeatures->getCellSize());
+ RMInit::logOut << "CalcAligned Tiling: tile number: " << ret1->size() << endl;
+ for (int i = 0; i < ret1->size(); i++) {
+ ret.push_back(ret1->at(i));
+ }
+ RMInit::logOut << "CalcAligned Tiling: tile number2: " << ret.size() << endl;
+ return ret;
+}
+
+std::vector< r_Minterval >
+StorageLayout::calcDirectionalLayout(const r_Minterval& tileDomain){
+ RMInit::logOut << "Entering CalcDir Tiling" << endl;
+ r_Dir_Tiling* dirTile ;
+ if(!extraFeatures->getSubTiling())
+ dirTile = new r_Dir_Tiling(tileDomain.dimension(),
+ extraFeatures->getDirDecompose(),myLayout->getTileSize(),
+ r_Dir_Tiling::WITHOUT_SUBTILING);
+ else
+ dirTile = new r_Dir_Tiling(tileDomain.dimension(),
+ extraFeatures->getDirDecompose(),myLayout->getTileSize(),
+ r_Dir_Tiling::WITH_SUBTILING);
+
+ std::vector<r_Minterval> ret;
+ std::vector<r_Minterval>* ret1 = dirTile->compute_tiles
+ (tileDomain, extraFeatures->getCellSize());
+ RMInit::logOut << "CalcDir Tiling: tile number: " << ret1->size() << endl;
+ for (int i = 0; i < ret1->size(); i++) {
+ ret.push_back(ret1->at(i));
+ }
+ RMInit::logOut << "End of dirTiling Method Tile numbers = "<< ret.size();
+ return ret;
+}
+
+std::vector< r_Minterval >
+StorageLayout::calcStatisticLayout(const r_Minterval& tileDomain){
+ RMInit::logOut << "Entering CalcStatistic Tiling" << endl;
+ std::vector<r_Minterval> ret;
+ RMInit::logOut << "ret is created" << endl;
+ RMInit::logOut << "bboxes are " << extraFeatures->getBBoxes().size() << endl;
+ vector<r_Minterval> temp = extraFeatures->getBBoxes();
+ RMInit::logOut << "bboxes are ok " << temp.size() << endl;
+ RMInit::logOut << "Statistic areas are "<< endl;
+ std::vector<r_Access> accesses;
+ RMInit::logOut << "Beginning of For"<< endl;
+ for(int i = 0 ; i < temp.size() ; ++i){
+ r_Minterval area = temp.at(i);
+ r_Access ac(area);
+ RMInit::logOut << ac;
+ accesses.push_back(ac);
+ }
+ RMInit::logOut << "\nStatistic End of for"<<endl;
+ unsigned int borderT;
+ double interestT;
+ if(extraFeatures->getBorderThreshold() < 0)
+ borderT = r_Stat_Tiling::DEF_BORDER_THR;
+ else
+ borderT = extraFeatures->getBorderThreshold();
+ if(extraFeatures->getInterestThreshold() < 0)
+ interestT = r_Stat_Tiling::DEF_INTERESTING_THR;
+ else
+ interestT = extraFeatures->getInterestThreshold();
+ RMInit::logOut << "Object is : " <<tileDomain.dimension() <<" "<< accesses.size() << " "<<myLayout->getTileSize()<<" "<< borderT<< " "<< interestT <<endl;
+ r_Stat_Tiling* stat = new r_Stat_Tiling(tileDomain.dimension(),accesses,
+ myLayout->getTileSize(), borderT,
+ interestT);
+ RMInit::logOut << "Object created" << endl;
+ std::vector<r_Minterval>* ret1 = stat->compute_tiles(tileDomain,extraFeatures->getCellSize());
+ RMInit::logOut << "End of CalcStatistic Tiling tile numbers = "<< ret.size() << endl;
+ for (int i = 0; i < ret1->size(); i++) {
+ ret.push_back(ret1->at(i));
+ }
+
+ return ret;
+}
diff --git a/storagemgr/sstoragelayout.hh b/storagemgr/sstoragelayout.hh
index 4ac9e79..b3e2a25 100644
--- a/storagemgr/sstoragelayout.hh
+++ b/storagemgr/sstoragelayout.hh
@@ -5,6 +5,10 @@
#include "raslib/minterval.hh"
#include "relstorageif/dbstoragelayout.hh"
+#include "rasodmg/interesttiling.hh"
+#include "rasodmg/stattiling.hh"
+#include "rasodmg/dirdecompose.hh"
+#include "storagemgr/stgmddconfig.hh"
/*
@@ -32,7 +36,16 @@ rasdaman GmbH.
/****************************************************************************
*
*
+ * INCLUDE: storagelayout.hh
*
+ * MODULE: storagemgr
+ * CLASS: StorageLayout
+ *
+ * CHANGE HISTORY (append further entries):
+ * when who what
+ * -----------------------------------------------------------------------
+ * 13-Nov-00 hoefner creation of preliminary version
+ * 07-Jan-09 Shams add tiling attributes
* COMMENTS:
*
****************************************************************************/
@@ -215,6 +228,16 @@ class StorageLayout
return the object which actually stores the option values.
*/
+ // Functions added by Andrei Aiordachioaie, to match function definitions. (17-08-2009)
+ void setBBoxes(const vector<r_Minterval>& input);
+ void setSubTiling();
+ void resetSubTiling();
+ void setInterestThreshold(double i);
+ void setBorderThreshold(unsigned int b);
+ void setCellSize(int size);
+ void setDirDecomp(vector<r_Dir_Decompose>*);
+
+
protected:
std::vector< r_Minterval > calcRegLayout(const r_Minterval& layout) const;
/*@Doc:
@@ -224,11 +247,27 @@ class StorageLayout
//@Man: Actual Parameters:
//@{
+ StgMddConfig* extraFeatures;
+ /*@Doc: actual features */
+
DBStorageLayoutId myLayout;
//@Man: Persistent Representation of a StorageLayout object.
//@{
///All parameters are stored there.
//@}
+ std::vector< r_Minterval >
+ calcInterestLayout(const r_Minterval& tileDomain);
+
+ //@Man: Actual Parameters:
+ //@{
+ std::vector< r_Minterval >
+ calcAlignedLayout(const r_Minterval&);
+
+ std::vector< r_Minterval >
+ calcDirectionalLayout(const r_Minterval&);
+
+ std::vector< r_Minterval >
+ calcStatisticLayout(const r_Minterval&);
//@}
diff --git a/storagemgr/stgmddconfig.cc b/storagemgr/stgmddconfig.cc
new file mode 100755
index 0000000..c008479
--- /dev/null
+++ b/storagemgr/stgmddconfig.cc
@@ -0,0 +1,92 @@
+#include "storagemgr/stgmddconfig.hh"
+
+using namespace std;
+
+/****************************************************************************
+ *
+ *
+ * INCLUDE: stgmddconfig.hh
+ *
+ * MODULE: qlparser
+ * CLASS: StgMddConfig
+ *
+ * CHANGE HISTORY (append further entries):
+ * when who what
+ * -----------------------------------------------------------------------
+ * 17-Aug-09 aaiordachi create class (for adding rasql tiling options)
+ * COMMENTS:
+ *
+ ****************************************************************************/
+
+StgMddConfig::StgMddConfig()
+{}
+StgMddConfig::~StgMddConfig()
+{}
+
+// Setter functions
+void StgMddConfig::setBBoxes(const vector<r_Minterval>& input)
+{
+ bboxes = input;
+}
+
+void StgMddConfig::setSubTiling()
+{
+ subTiling = true;
+}
+
+void StgMddConfig::resetSubTiling()
+{
+ subTiling = false;
+}
+
+void StgMddConfig::setInterestThreshold(double i)
+{
+ interestThreshold = i;
+}
+
+void StgMddConfig::setBorderThreshold(unsigned int b)
+{
+ borderThreshold = b;
+}
+
+void StgMddConfig::setCellSize(int size)
+{
+ cellSize = size;
+}
+
+void StgMddConfig::setDirDecompose(const vector<r_Dir_Decompose>& input)
+{
+ dirDecomp = input;
+}
+
+// Getter functions
+vector<r_Minterval>& StgMddConfig::getBBoxes()
+{
+ return bboxes;
+}
+
+bool StgMddConfig::getSubTiling()
+{
+ return subTiling;
+}
+
+double StgMddConfig::getInterestThreshold()
+{
+ return interestThreshold;
+}
+
+unsigned int StgMddConfig::getBorderThreshold()
+{
+ return borderThreshold;
+}
+
+int StgMddConfig::getCellSize()
+{
+ return cellSize;
+}
+
+vector<r_Dir_Decompose>& StgMddConfig::getDirDecompose()
+{
+ return dirDecomp;
+}
+
diff --git a/storagemgr/stgmddconfig.hh b/storagemgr/stgmddconfig.hh
new file mode 100755
index 0000000..4588715
--- /dev/null
+++ b/storagemgr/stgmddconfig.hh
@@ -0,0 +1,57 @@
+#ifndef _STORAGE_MDD_CONFIG_HH_
+#define _STORAGE_MDD_CONFIG_HH_
+
+#include <vector>
+#include "rasodmg/dirdecompose.hh"
+#include "raslib/minterval.hh"
+
+/****************************************************************************
+ *
+ *
+ * INCLUDE: stgmddconfig.hh
+ *
+ * MODULE: qlparser
+ * CLASS: StgMddConfig
+ *
+ * CHANGE HISTORY (append further entries):
+ * when who what
+ * -----------------------------------------------------------------------
+ * 17-Aug-09 aaiordachi create class (for adding rasql tiling options)
+ * COMMENTS:
+ *
+ ****************************************************************************/
+
+class StgMddConfig
+ {
+ private:
+ std::vector<r_Minterval> bboxes;
+ double interestThreshold;
+ unsigned int borderThreshold;
+ bool subTiling;
+ int cellSize;
+ std::vector<r_Dir_Decompose> dirDecomp;
+
+ public:
+
+ StgMddConfig();
+ ~StgMddConfig();
+
+ // Setter functions
+ void setBBoxes(const std::vector<r_Minterval>& input);
+ void setSubTiling();
+ void resetSubTiling();
+ void setInterestThreshold(double i);
+ void setBorderThreshold(unsigned int b);
+ void setCellSize(int size);
+ void setDirDecompose(const std::vector<r_Dir_Decompose>& input);
+
+ // Getter functions
+ std::vector<r_Minterval>& getBBoxes();
+ bool getSubTiling();
+ double getInterestThreshold();
+ unsigned int getBorderThreshold();
+ int getCellSize();
+ std::vector<r_Dir_Decompose>& getDirDecompose();
+
+ };
+#endif