Commit b6c6145e authored by ghweber's avatar ghweber
Browse files

Repaced HDF_FQ files with most recent version such that VisIt will now compile...

Repaced HDF_FQ files with most recent version such that VisIt will now compile with a recent FastBit distribution.

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@12677 18c085ea-50e0-402c-830e-de6fd14e8384
parent a7c7c6e1
......@@ -60,6 +60,12 @@
#ifdef HAVE_LIBFASTBIT
#include "hdf5_fastquery.h"
#include "HistogramCache.h"
#include <fastbit-config.h>
#if FASTBIT_IBIS_INT_VERSION < 1020000
#error "The H5Part plugin requires FastBit 1.2.0 or newer."
#endif
#endif
class DBOptionsAttributes;
......
......@@ -10,14 +10,10 @@ using boost::int32_t;
#include <string>
#include <vector>
/**
Base class for the FlexIO API.
*/
#ifdef true
#undef true
#endif
#ifdef false
#undef false
#endif
......@@ -25,9 +21,13 @@ using boost::int32_t;
#define true 1
#define false 0
/**
The Base class for remapping HDF5 interface.
*/
struct BaseFileInterface {
//basic data types
enum DataType {H5_Float=0,H5_Double=1,H5_Int32=2,H5_Int64=3,H5_Byte=4,H5_Error=-1};
/// supported data types
enum DataType {H5_Float=0,H5_Double=1,H5_Int32=2,H5_Int64=3,H5_Byte=4,
H5_Error=-1};
enum DataClass {Real, Integer, String_DC, Enum};
//procedures
......@@ -42,17 +42,17 @@ struct BaseFileInterface {
//Return value:
//The total number of time steps in the HDF5 file
virtual int64_t getNumSteps() const=0;
//get the min valid time step (the earliest time for all samples)
//Return value:
//The smallest value of time associated with any time step.
virtual double getMinStep() const=0;
//get the max valid step (the latest time for all samples)
//Return value:
//The largest value of time associated with any time step
virtual double getMaxStep() const=0;
//calculate the size of any group of arrays based upon type and dimms
//dims: a vector containing the dimensions for a given dataset.
//DataType: The enumerated type of data for the dataset referenced by dims
......@@ -60,22 +60,22 @@ struct BaseFileInterface {
//The size (in bytes) of the specified dataset.
virtual int64_t getDatasetSize(const std::vector<int64_t> dims,
const DataType type) const=0;
//getVariableInfo retrieves information about a specific data set. The variablename MUST
//be an explicit full pathname to a data set in the HDF5 file.
//be an explicit full pathname to a data set in the HDF5 file.
//Example: variablename = /Time/Step#2/density
//Return value:
//getVariableInfo will return the variable descriptor group number order of the requested
//getVariableInfo will return the variable descriptor group number order of the requested
//dataset (if found -1 otherwise).
//Example: given the datasets ordering {X,Y,Z,density, Pressure}, a getVariableInfo(/Time/Step#2/density)
//will return 3 (where X would return 0, Y would return 1 and Z would return 4).
virtual int64_t getVariableInfo(const std::string& variablename,
int64_t time,
std::vector <int64_t> &dims,
std::vector <int64_t> &dims,
DataType *type)=0;
//Read all of the data associated with the variable specified by the variable name.
//Note that as with getVariableInfo(), variablename MUST
//Note that as with getVariableInfo(), variablename MUST
//be an explicit full pathname to a data set. Example: variablename = /Time/Step#2/density
virtual void getData(const std::string& variableName,
int64_t time, void *data) =0;
......@@ -92,20 +92,20 @@ struct BaseFileInterface {
//declareVariable() will create a new descriptor variable using information from the input variables
//as well as a new data sets (initialized) under every time step.
//Return value:
//declareVariable() will return the incremented total number of dataset variables currently
//declareVariable() will return the incremented total number of dataset variables currently
//in the HDF5 file
virtual int64_t declareVariable(const std::string& variableName,
const std::vector<int64_t> dims,
const DataType type,
const std::string& sData_center,
const std::string& sCoordsys,
const std::string& sCoordsys,
const std::string& sScheme,
const std::string& sSchema_type)=0;
//write variable data specified by variablename.
//Note that as with getVariableInfo(), variablename MUST
//Note that as with getVariableInfo(), variablename MUST
//be an explicit full pathname to a data set. Example: variablename = /Time/Step#2/density
//It will overwrite existing data if data already exists
//It will overwrite existing data if data already exists
//in that position.
virtual void insertVariableData(const std::string& variablename,
int64_t time,
......@@ -113,12 +113,15 @@ struct BaseFileInterface {
DataType type,
const void* min,
const void* max)=0;
//add a new step to the file (returns the new step number)
//The step is a monotonically increasing counter for the file
//This function also creates new "initialized" datasets under this new time step
//the timesteps will also all be updated so that the steps are in
//the timesteps will also all be updated so that the steps are in
//increasing chronological order.
virtual void insertStep(double timeValue)=0;
// virtual destructor.
virtual ~BaseFileInterface() {};
};
#endif
This diff is collapsed.
// $Id: fqindex.h,v 1.2 2009-05-06 21:51:12 kewu Exp $
// $Id: fqindex.h,v 1.5 2009-11-13 18:59:52 kewu Exp $
#ifndef _FASTQUERY_INDEX_H
#define _FASTQUERY_INDEX_H
......@@ -31,7 +31,7 @@ public:
/// read from a HDF5 file.
bool newIndex() const {return isNewIndex;}
/// Write the content of the index to
/// Write the content of the index to
void write(H5_Index& h5file) const;
......@@ -69,7 +69,7 @@ public:
/// read from a HDF5 file.
bool newIndex() const {return isNewIndex;}
/// Write the content of the index to
/// Write the content of the index to
void write(H5_Index& h5file) const;
......
......@@ -36,12 +36,12 @@ public:
hid_t getID() const {return classID;}
//return the number of subgroups in this group
hsize_t getGroupCount();
private:
//is the classID valid...i.e. is it tied to a file?
bool valid;
hid_t classID;
hid_t classID;
herr_t status;
};
};
#endif
......@@ -40,13 +40,14 @@ bool H5D::open(hid_t filename, const char *groupname){
}
// printf("%d\n",classID);
else if((status>=0)&&(classID>=0)){
valid = true;
valid = true;
return true;
}
else return false;
}
bool H5D::create(hid_t filename, const char *groupname,hid_t memtype,hid_t attribute_space){
bool H5D::create(hid_t filename, const char *groupname,hid_t memtype,
hid_t attribute_space){
//if currently valid, close and open a new
if(valid){
status = H5Dclose(classID);
......@@ -209,7 +210,7 @@ BaseFileInterface::DataType H5D::getDataType(){
hid_t data_type = H5Dget_type(classID);
hid_t specific_type = H5Tget_native_type(data_type,H5T_DIR_ASCEND);
BaseFileInterface::DataType answer;
if(H5Tequal(specific_type, H5T_NATIVE_INT32)){
answer = BaseFileInterface::DataType(2);
}
......
......@@ -43,12 +43,12 @@ public:
hid_t getDataSpace(){return H5Dget_space(classID);}
hsize_t getSize(){return H5Dget_storage_size(classID);}
void getSize(uint64_t *length);
private:
//is the classID valid...i.e. is it tied to a file?
bool valid;
hid_t classID;
hid_t classID;
herr_t status;
};
};
#endif
#include "hdf5_f.h"
#include "hdf5_f.h"
H5F::H5F(){
valid = false;
......@@ -35,8 +35,8 @@ bool H5F::open(const char *filename){
temp = H5Fis_hdf5(filename);
}H5E_END_TRY;
if(temp > 0){
classID = H5Fopen(filename,H5F_ACC_RDONLY,H5P_DEFAULT); // FIXME: open read or read/write as necessary
if(temp > 0){
classID = H5Fopen(filename,H5F_ACC_RDONLY,H5P_DEFAULT);
if(classID >=0) valid = true;
}
......@@ -51,7 +51,7 @@ bool H5F::testFileExist(const char *filename){
//make sure the file is a valid HDF5 file and that is exists...
std::ifstream filestr;
filestr.open(filename, std::ifstream::in);
if(filestr.is_open() && (H5Fis_hdf5(filename) > 0)){
if(filestr.is_open() && (H5Fis_hdf5(filename) > 0)){
answer = true;
}
else{
......
......@@ -19,17 +19,17 @@ public:
//constructor and destructor
H5F();
~H5F();
//base functions
//if the file exists, the file is opened and "true" is returned,
//otherwise it is created and "false" is returned.
//otherwise it is created and "false" is returned.
bool open(const char *);
//close the file
bool close();
//test first of a given file exists and return true or false
bool testFileExist(const char *);
hid_t getID(){return classID;}
hid_t getID(){return classID;}
// Return the name of the HDF5 file.
std::string getName() const {
......@@ -39,7 +39,7 @@ public:
buf[0] = 0;
return buf;
}
private:
//is the classID valid...i.e. is it tied to a file?
bool valid;
......@@ -47,4 +47,4 @@ private:
herr_t status;
};
#endif
#endif
......@@ -6,17 +6,20 @@
/// Constructor.
///@arg v Verbose level. Default to 0.
///@arg rcfile The name of runtime-control file. The default value is nil,
///in which case it will examine the following values to find a rc file.
///If none is fine, the run-time parameter list is empty.
/// in which case it will examine the following values to find a rc file.
/// If none is fine, the run-time parameter list is empty.
/// - Environment variable IBISRC.
/// - File named ibis.rc in the current working directory.
/// - File named .ibisrc in the current working directory.
/// - File named .ibisrc in the current user's home directory (only if
/// - File named .ibisrc in the current user's home directory (only if
/// the environmental variable HOME is defined).
///@arg loffile The name of the log file used for output error messages.
/// If it is nil or points to an empty string, the messages are sent to
/// the standard output.
HDF5_FQ::HDF5_FQ(const int v, const char* rcfile, const char* logfile)
: dataFile(0) {
ibis::init(v, rcfile, logfile);
ibis::util::setVerboseLevel(v);
ibis::init(rcfile, logfile);
// ibis::gParameters().add("fileManager.maxBytes", "3GB");
// ibis::util::setLogFileName("FastBit.Log");
}
......@@ -179,7 +182,7 @@ void HDF5_FQ::getVariableInformation(const char* variableName,
int64_t time,
std::vector <int64_t> &dims,
BaseFileInterface::DataType *type){
std::string temp = variableName;
getVariableInformation(temp, time, dims, type);
}
......@@ -244,7 +247,7 @@ int64_t HDF5_FQ::executeEqualitySelectionQuery
int64_t numHits = tstep->submitQuery(tok);
if (numHits > 0)
tstep->getHitLocations(tok,offset);
tstep->destroyQuery(tok);
return numHits;
}
......@@ -367,7 +370,7 @@ long HDF5_FQ::get1DHistogram(int64_t timestep,
std::vector<uint32_t> &counts) {
long err;
err = timeSlices[timestep]->getDistribution
(variableName, bounds, counts);
(variableName, bounds, counts);
return err;
}
......@@ -378,7 +381,7 @@ long HDF5_FQ::get1DHistogram(int64_t timestep,
std::vector<uint32_t> &counts) {
long err;
err = timeSlices[timestep]->getDistribution
(condition, variableName, bounds, counts);
(condition, variableName, bounds, counts);
return err;
}
......@@ -394,7 +397,7 @@ long HDF5_FQ::get1DHistogram(int64_t timestep,
bounds.resize(num_bins-1);
err = timeSlices[timestep]->getDistribution
(variableName, num_bins, &bounds[0], &counts[0]);
(variableName, num_bins, &bounds[0], &counts[0]);
return err;
}
......@@ -409,7 +412,7 @@ long HDF5_FQ::get1DHistogram(int64_t timestep,
bounds.resize(num_bins-1);
err = timeSlices[timestep]->getDistribution
(condition, variableName, num_bins, &bounds[0], &counts[0]);
(condition, variableName, num_bins, &bounds[0], &counts[0]);
return err;
}
......@@ -433,19 +436,19 @@ long HDF5_FQ::get1DHistogram(int64_t timestep,
//TODO:: transfer result from count to counts;
// Check this with John Wu
LOGGER(ibis::gVerbose > 0)
<<"get1DDistribution w/ strides returned " << err
<<"get1DDistribution w/ strides returned " << err
<< "count size is " << count.size();
for (unsigned int i=0; i<count.size(); i++)
counts.push_back((uint32_t)count[i]);
err = counts.size();
count.clear();
count.clear();
return err;
}
long HDF5_FQ::get2DHistogram(int64_t timestep,
const char *condition,
const char *condition,
const char *variableName1,
double begin1, double end1, uint32_t num_bins1,
const char *variableName2,
......@@ -454,8 +457,8 @@ long HDF5_FQ::get2DHistogram(int64_t timestep,
std::vector<double> &bounds2,
std::vector<uint32_t> &counts) {
long err;
double stride1;
double stride1;
stride1 = (end1 - begin1)/num_bins1;
// make sure that begin1 + stride1*num_bins1 > end1
stride1 = ibis::util::incrDouble(stride1);
......@@ -464,7 +467,7 @@ long HDF5_FQ::get2DHistogram(int64_t timestep,
stride2 = (end2 - begin2)/num_bins2;
stride2 = ibis::util::incrDouble(stride2);
err = timeSlices[timestep]->get2DDistribution(condition,
err = timeSlices[timestep]->get2DDistribution(condition,
variableName1,
begin1, end1, stride1,
variableName2,
......@@ -478,8 +481,8 @@ long HDF5_FQ::get2DHistogram(int64_t timestep,
while (counter<=end1) {
bounds1.push_back(counter);
counter = counter + stride1;
}
}
bounds2.clear();
counter = begin2;
while(counter<=end2) {
......@@ -490,28 +493,28 @@ long HDF5_FQ::get2DHistogram(int64_t timestep,
bounds1.clear();
for (unsigned int i=0; i<=num_bins1; i++)
bounds1.push_back(begin1 + i*stride1);
bounds2.clear();
for (unsigned int i=0; i<=num_bins2; i++)
bounds2.push_back(begin2 + i*stride2);
LOGGER(ibis::gVerbose > 0)
<< "HDF_FQ:: get2DHistogram created "
<< " bounds1 [size= " << bounds1.size() << "], "
<< " bounds1 [size= " << bounds1.size() << "], "
<< " bounds2 [size= " << bounds2.size() << "]";
return err;
}
long HDF5_FQ::get2DHistogram(int64_t timestep,
const char *condition,
const char *variableName1,
const char *variableName1,
const char *variableName2,
std::vector<double> &bounds1,
std::vector<double> &bounds2,
std::vector<uint32_t> &counts) {
long err;
long err;
err = timeSlices[timestep]->getJointDistribution(condition,
variableName1,
variableName1,
variableName2,
bounds1,
bounds2,
......@@ -520,7 +523,7 @@ long HDF5_FQ::get2DHistogram(int64_t timestep,
}
long HDF5_FQ::get2DHistogram(int64_t timestep,
const char *condition,
const char *condition,
const char *variableName1,
double begin1, double end1, double stride1,
const char *variableName2,
......@@ -534,14 +537,14 @@ long HDF5_FQ::get2DHistogram(int64_t timestep,
<< variableName1 << "[" << begin1 << "," << end1 << "," << stride1
<< "] " << variableName2 << "[" << begin2 << "," << end2 << ","
<< stride2 << "] ";
err = timeSlices[timestep]->get2DDistribution(condition,
err = timeSlices[timestep]->get2DDistribution(condition,
variableName1,
begin1, end1, stride1,
variableName2,
begin2, end2, stride2,
counts);
LOGGER(ibis::gVerbose > 0)
<< "HDF_FQ:: returned from 2DDistribution call with err=" << err;
return err;
......@@ -555,12 +558,12 @@ long HDF5_FQ::get2DAdaptiveHistogram(int64_t timestep,
std::vector<double> &bounds1,
std::vector<double> &bounds2,
std::vector<uint32_t> &counts) {
long err;
long err;
const char* option = "d";
LOGGER(ibis::gVerbose > 0)
<< "HDF_FQ:: starting get2DAdaptive call with following info" <<
variableName1 << ", #bins1 = " << num_bins1 << ", " <<
variableName2 << ", #bins2 = " << num_bins2 << "." <<
variableName2 << ", #bins2 = " << num_bins2 << "." <<
" Data/index option = " << option;
err = timeSlices[timestep]->get2DDistribution(variableName1, variableName2,
......@@ -570,17 +573,17 @@ long HDF5_FQ::get2DAdaptiveHistogram(int64_t timestep,
LOGGER(ibis::gVerbose > 0)
<< "HDF_FQ:: returned from First New 2DAdaptiveDistribution call "
"with err=" << err
"with err=" << err
<< ", bounds sizes = " << bounds1.size()<<"x"<<bounds2.size()
<< ", Counts size = " << counts.size();
return err;
}
long HDF5_FQ::get2DAdaptiveHistogram(int64_t timestep,
const char *condition,
const char *condition,
const char *variableName1,
const char *variableName2,
uint32_t num_bins1,
uint32_t num_bins1,
uint32_t num_bins2,
std::vector<double> &bounds1,
std::vector<double> &bounds2,
......@@ -590,7 +593,7 @@ long HDF5_FQ::get2DAdaptiveHistogram(int64_t timestep,
err = timeSlices[timestep]->get2DDistribution(condition,
variableName1, variableName2,
num_bins1, num_bins2,
bounds1,
bounds1,
bounds2,
counts);
LOGGER(ibis::gVerbose > 0)
......@@ -600,25 +603,25 @@ long HDF5_FQ::get2DAdaptiveHistogram(int64_t timestep,
}
long HDF5_FQ::get3DBins(int64_t timestep,
const char *condition,
const char *condition,
const char *variableName1,
double begin1, double end1, uint32_t num_bins1,
double begin1, double end1, uint32_t num_bins1,
const char *variableName2,
double begin2, double end2, uint32_t num_bins2,
double begin2, double end2, uint32_t num_bins2,
const char *variableName3,
double begin3, double end3, uint32_t num_bins3,
std::vector<double> &bounds1,
std::vector<double> &bounds2,
std::vector<double> &bounds3,
std::vector<uint32_t> &counts,
std::vector<ibis::bitvector*> &bitmaps) {
std::vector<ibis::bitvector*> &bitmaps) {
long err;
double stride1;
double stride1;
stride1 = (end1 - begin1)/num_bins1;
// make sure that begin1 + stride1*num_bins1 > end1
stride1 = ibis::util::incrDouble(stride1);
double stride2;
stride2 = (end2 - begin2)/num_bins2;
stride2 = ibis::util::incrDouble(stride2);
......@@ -626,8 +629,8 @@ long HDF5_FQ::get3DBins(int64_t timestep,
double stride3;
stride3 = (end3 - begin3)/num_bins3;
stride3 = ibis::util::incrDouble(stride3);
err = timeSlices[timestep]->get3DBins(condition,
err = timeSlices[timestep]->get3DBins(condition,
variableName1, begin1, end1, stride1,
variableName2, begin2, end2, stride2,
variableName3, begin3, end3, stride3,
......@@ -654,9 +657,9 @@ long HDF5_FQ::get3DBins(int64_t timestep,
// cnt() function on a bitvector gives the # elements
if (bitmaps[i]!=NULL)
counts[i] = bitmaps[i]->cnt();
else
counts[i] = 0;
}
else
counts[i] = 0;
}
return err;
}
......@@ -718,7 +721,7 @@ long HDF5_FQ::get3DBins(int64_t timestep,
if (tempBitmaps[i]!=NULL)
counts[i] = tempBitmaps[i]->cnt();
else
counts[i] = 0;
counts[i] = 0;
if (counts[i] > 0) {
bitmaps[i] = tempBitmaps[i];
......@@ -735,13 +738,13 @@ int HDF5_FQ::get_Bitmap_Data(int64_t timestep,
// << " entries in the bitmaps vector" << std::endl;
// create a composit bitvector
ibis::bitvector composit_bitvector;
ibis::bitvector composit_bitvector;
for (unsigned int i=0; i<bitmaps.size(); i++) {
if (bitmaps[i]!=NULL) {
if ((*bitmaps[i]).size()>0) {
composit_bitvector |= *bitmaps[i];
}
else {
else {
// do nothing, this bitvector does not exist
}
}
......@@ -751,12 +754,12 @@ int HDF5_FQ::get_Bitmap_Data(int64_t timestep,
std::vector<int64_t> dims;
BaseFileInterface::DataType dataType;
getVariableInformation(name, timestep, dims, &dataType);
int i;
array_t<float> *ftmp; float *fptr;
array_t<double> *dtmp; double *dptr;
array_t<int32_t> *itmp; int32_t *iptr;
array_t<int64_t> *litmp; int64_t *liptr;
ibis::array_t<float> *ftmp; float *fptr;
ibis::array_t<double> *dtmp; double *dptr;
ibis::array_t<int32_t> *itmp; int32_t *iptr;
ibis::array_t<int64_t> *litmp; int64_t *liptr;
switch(dataType) {
......@@ -765,7 +768,7 @@ int HDF5_FQ::get_Bitmap_Data(int64_t timestep,
i = 0;
ftmp = timeSlices[timestep]->selectFloats(name, composit_bitvector);
fptr = (float*) malloc(ftmp->size()*sizeof(float));
for (array_t<float>::const_iterator ii = ftmp->begin();
for (ibis::array_t<float>::const_iterator ii = ftmp->begin();
ii!= ftmp->end(); ii++, i++)
fptr[i] = *ii;