Skip to content

Commit

Permalink
removed future as requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
CreRecombinase committed Aug 25, 2018
1 parent 405ece8 commit 4403cd3
Show file tree
Hide file tree
Showing 17 changed files with 184 additions and 459 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Author: Nicholas Knoblauch
Maintainer: Nicholas Knoblauch <[email protected]>
Description: Read and write R objects using blosc+HDF5. Also contains a C++ interface for using with other packages. The C++ interface can handle the reading/writing/converting between column-major matrices (as in R/fortran) and row-major matrices (as in HDF5)
License: What license is it under?
Imports: Rcpp (>= 0.12.12), RcppEigen (>= 0.3.3.3.0),BH,dplyr,progress,tidyr,purrr,magrittr,future
Imports: Rcpp (>= 0.12.12), RcppEigen (>= 0.3.3.3.0),BH,dplyr,progress,tidyr,purrr,magrittr
LinkingTo: Rcpp, RcppEigen,BH,RcppProgress,testthat
SystemRequirements: C++11, HDF5 (>= 1.8.13), c-blosc, zstd
SystemRequirements: C++11, HDF5 (>= 1.8.13), blosc, zstd
Suggests: testthat,
knitr,
rmarkdown
Expand Down
4 changes: 0 additions & 4 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ create_dataset_h5 <- function(filename, datapath, data, options) {
.Call(`_EigenH5_create_dataset_h5`, filename, datapath, data, options)
}

split_ldd <- function(region_ids) {
.Call(`_EigenH5_split_ldd`, region_ids)
}

create_file_h5 <- function(filename) {
invisible(.Call(`_EigenH5_create_file_h5`, filename))
}
Expand Down
29 changes: 0 additions & 29 deletions R/future.R

This file was deleted.

4 changes: 4 additions & 0 deletions inst/include/EigenH5.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class FileManager{



inline stdx::filesystem::path root_path(const std::string & input){
return(stdx::filesystem::path("/") / stdx::filesystem::path(input));
}


template <typename T>
struct cpp2r{
Expand Down
120 changes: 60 additions & 60 deletions inst/include/highfive/H5DataSpace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,92 +37,92 @@ class DataSpace : public Object {
// simple dataspace are handle directly from their dimensions
};

/// create a dataspace of N-dimensions
/// Each dimension is configured this way
/// size(dim1) = vec[0]
/// size(dim2) = vec[1]
/// etc...
explicit DataSpace(const std::vector<size_t> &dims);
/// create a dataspace of N-dimensions
/// Each dimension is configured this way
/// size(dim1) = vec[0]
/// size(dim2) = vec[1]
/// etc...
explicit DataSpace(const std::vector<size_t> &dims);

/// create a dataspace of N-dimensions , with max dimensions
explicit DataSpace(const std::vector<size_t> &dims,const std::vector<size_t> &max_dims);

///
/// \brief DataSpace create a dataspace of a single dimension and of size
/// dim1
/// \param dim1
///
explicit DataSpace(size_t dim1);
///
/// \brief DataSpace create a dataspace of a single dimension and of size
/// dim1
/// \param dim1
///
explicit DataSpace(size_t dim1);

///
/// \brief DataSpace create a scalar dataspace or a null dataset
///
explicit DataSpace(DataspaceType dtype);
///
/// \brief DataSpace create a scalar dataspace or a null dataset
///
explicit DataSpace(DataspaceType dtype);

/// Create a new DataSpace
/// with a different id avaiable for modifications
DataSpace clone() const;
/// Create a new DataSpace
/// with a different id avaiable for modifications
DataSpace clone() const;


///
/// \brief getNumberDimensions
/// \return the number of dimensions in the current dataspace
///
size_t getNumberDimensions() const;
///
/// \brief getNumberDimensions
/// \return the number of dimensions in the current dataspace
///
size_t getNumberDimensions() const;

/// \brief getDimensions
/// \return return a vector of N-element, each element is the size of the
/// associated dataset dimension
std::vector<size_t> getDimensions() const;
/// \brief getDimensions
/// \return return a vector of N-element, each element is the size of the
/// associated dataset dimension
std::vector<size_t> getDimensions() const;

std::vector<size_t> getMaxDimensions() const ;
std::vector<size_t> getMaxDimensions() const;

/// Create a dataspace matching a single element of a basic type
/// supported type are integrals (int,long), floating points (float,double)
/// and std::string
template <typename ScalarValue>
static DataSpace From(const ScalarValue& scalar_value);
/// Create a dataspace matching a single element of a basic type
/// supported type are integrals (int,long), floating points (float,double)
/// and std::string
template <typename ScalarValue>
static DataSpace From(const ScalarValue& scalar_value);




template<typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime, int Options>
static DataSpace From(const Eigen::Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options> &mat);
template<typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime, int Options>
static DataSpace From(const Eigen::Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options> &mat);

template<typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime, int Options>
static DataSpace
From(const Eigen::Map<const Eigen::Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options> > &mat);
template<typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime, int Options>
static DataSpace
From(const Eigen::Map<const Eigen::Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options> > &mat);

template<typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime, int Options>
static DataSpace
From(const Eigen::Map<Eigen::Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options> > &mat);
template<typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime, int Options>
static DataSpace
From(const Eigen::Map<Eigen::Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options> > &mat);


/// Create a dataspace matching the container dimensions and size
/// Supported Containers are:
/// - vector of fundamental types
/// - vector of std::string
/// - boost::multi_array
template <typename Value>
static DataSpace From(const std::vector<Value>& vec);
/// Create a dataspace matching the container dimensions and size
/// Supported Containers are:
/// - vector of fundamental types
/// - vector of std::string
/// - boost::multi_array
template <typename Value>
static DataSpace From(const std::vector<Value>& vec);

#ifdef H5_USE_BOOST
template <typename Value, std::size_t Dims>
static DataSpace From(const boost::multi_array<Value, Dims>& container);
template <typename Value, std::size_t Dims>
static DataSpace From(const boost::multi_array<Value, Dims>& container);

template <typename Value>
static DataSpace From(const boost::numeric::ublas::matrix<Value,boost::numeric::ublas::row_major>& mat);
template <typename Value>
static DataSpace From(const boost::numeric::ublas::matrix<Value,boost::numeric::ublas::row_major>& mat);

template <typename Value>
static DataSpace From(const boost::numeric::ublas::matrix<Value,boost::numeric::ublas::column_major>& mat);
template <typename Value>
static DataSpace From(const boost::numeric::ublas::matrix<Value,boost::numeric::ublas::column_major>& mat);
#endif

protected:
explicit DataSpace();
protected:
explicit DataSpace();

friend class Attribute;
friend class File;
friend class DataSet;
friend class Attribute;
friend class File;
friend class DataSet;
};
}

Expand Down
53 changes: 44 additions & 9 deletions inst/include/highfive/bits/H5Converter_misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,6 @@ namespace HighFive {

};








#ifdef H5_USE_BOOST
// apply conversion to boost multi array
template <typename T, std::size_t Dims>
Expand Down Expand Up @@ -587,6 +580,49 @@ namespace HighFive {
DataSpace &_space;
};

template <>
struct data_converter<std::vector<char*>, void> {
inline data_converter(std::vector<char*>& vec, DataSpace& space)
: _space(space) {
(void)vec;
}

// create a C vector adapted to HDF5
// fill last element with NULL to identify end
inline char** transform_read(std::vector<char*>& vec) {
(void)vec;
_c_vec.resize(_space.getDimensions()[0], NULL);
return (&_c_vec[0]);
}

// static inline char* char_converter(const std::string& str) {
// return const_cast<char*>(str.c_str());
// }

inline char** transform_write(std::vector<char*>& vec) {
// _c_vec.resize(vec.size() + 1, NULL);
// std::transform(vec.begin(), vec.end(), _c_vec.begin(), &char_converter);
return (vec.data());
}

inline void process_result(std::vector<char*>& vec) {
(void)vec;
vec.resize(_c_vec.size());
for (size_t i = 0; i < vec.size(); ++i) {
vec[i] = _c_vec[i];
}

if (_c_vec.empty() == false && _c_vec[0] != NULL) {
AtomicType<char*> str_type;
(void)H5Dvlen_reclaim(str_type.getId(), _space.getId(), H5P_DEFAULT,
&(_c_vec[0]));
}
}

std::vector<char*> _c_vec;
DataSpace& _space;
};

// template<>
// struct data_converter<std::vector<char*>, void> {
// inline data_converter(std::vector<char*> &vec, DataSpace &space,const size_t dim=0)
Expand Down Expand Up @@ -619,8 +655,7 @@ namespace HighFive {
// }
// }

// std::vector<char> _c_vec;
// const size_t dim_;
// std::vector<char*> _c_vec;
// DataSpace &_space;
// };

Expand Down
36 changes: 18 additions & 18 deletions inst/include/highfive/bits/H5Dataspace_misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,26 +145,26 @@ inline DataSpace DataSpace::From(const std::vector<Value>& container) {
return DataSpace(details::get_dim_vector<Value>(container));
}

template<typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime, int Options>
inline DataSpace
DataSpace::From(const Eigen::Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options> &mat) {
auto retv = details::get_dim_vector<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options>(mat);
return (DataSpace(retv));
}
template<typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime, int Options>
inline DataSpace
DataSpace::From(const Eigen::Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options> &mat) {
auto retv = details::get_dim_vector<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options>(mat);
return (DataSpace(retv));
}

template<typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime, int Options>
inline DataSpace
DataSpace::From(const Eigen::Map<const Eigen::Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options> > &mat) {
auto retv = details::get_dim_vector<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options>(mat);
return (DataSpace(retv));
}
template<typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime, int Options>
inline DataSpace
DataSpace::From(const Eigen::Map<const Eigen::Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options> > &mat) {
auto retv = details::get_dim_vector<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options>(mat);
return (DataSpace(retv));
}

template<typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime, int Options>
inline DataSpace
DataSpace::From(const Eigen::Map<Eigen::Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options> > &mat) {
auto retv = details::get_dim_vector<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options>(mat);
return (DataSpace(retv));
}
template<typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime, int Options>
inline DataSpace
DataSpace::From(const Eigen::Map<Eigen::Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options> > &mat) {
auto retv = details::get_dim_vector<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options>(mat);
return (DataSpace(retv));
}



Expand Down
20 changes: 0 additions & 20 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,17 +472,6 @@ RcppExport SEXP _EigenH5_create_dataset_h5(SEXP filenameSEXP, SEXP datapathSEXP,
UNPROTECT(1);
return rcpp_result_gen;
}
// split_ldd
Rcpp::IntegerMatrix split_ldd(const std::vector<int>& region_ids);
RcppExport SEXP _EigenH5_split_ldd(SEXP region_idsSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< const std::vector<int>& >::type region_ids(region_idsSEXP);
rcpp_result_gen = Rcpp::wrap(split_ldd(region_ids));
return rcpp_result_gen;
END_RCPP
}
// create_file_h5
void create_file_h5(const std::string filename);
static SEXP _EigenH5_create_file_h5_try(SEXP filenameSEXP) {
Expand Down Expand Up @@ -1078,10 +1067,6 @@ RcppExport SEXP _EigenH5_RcppExport_registerCCallable() {
return R_NilValue;
}

RcppExport SEXP _EigenH5_exp_par_iter_path(SEXP);
RcppExport SEXP _EigenH5_exp_par_path(SEXP);
RcppExport SEXP _EigenH5_par_iter_path(SEXP);
RcppExport SEXP _EigenH5_par_path(SEXP);
RcppExport SEXP run_testthat_tests();

static const R_CallMethodDef CallEntries[] = {
Expand All @@ -1098,7 +1083,6 @@ static const R_CallMethodDef CallEntries[] = {
{"_EigenH5_write_attribute_h5", (DL_FUNC) &_EigenH5_write_attribute_h5, 3},
{"_EigenH5_read_attribute_h5", (DL_FUNC) &_EigenH5_read_attribute_h5, 2},
{"_EigenH5_create_dataset_h5", (DL_FUNC) &_EigenH5_create_dataset_h5, 4},
{"_EigenH5_split_ldd", (DL_FUNC) &_EigenH5_split_ldd, 1},
{"_EigenH5_create_file_h5", (DL_FUNC) &_EigenH5_create_file_h5, 1},
{"_EigenH5_dataset_chunks", (DL_FUNC) &_EigenH5_dataset_chunks, 2},
{"_EigenH5_extend_dataset", (DL_FUNC) &_EigenH5_extend_dataset, 3},
Expand All @@ -1115,10 +1099,6 @@ static const R_CallMethodDef CallEntries[] = {
{"_EigenH5_dim_h5", (DL_FUNC) &_EigenH5_dim_h5, 2},
{"_EigenH5_concat_mats", (DL_FUNC) &_EigenH5_concat_mats, 4},
{"_EigenH5_RcppExport_registerCCallable", (DL_FUNC) &_EigenH5_RcppExport_registerCCallable, 0},
{"_EigenH5_exp_par_iter_path", (DL_FUNC) &_EigenH5_exp_par_iter_path, 1},
{"_EigenH5_exp_par_path", (DL_FUNC) &_EigenH5_exp_par_path, 1},
{"_EigenH5_par_iter_path", (DL_FUNC) &_EigenH5_par_iter_path, 1},
{"_EigenH5_par_path", (DL_FUNC) &_EigenH5_par_path, 1},
{"run_testthat_tests", (DL_FUNC) &run_testthat_tests, 0},
{NULL, NULL, 0}
};
Expand Down
Loading

0 comments on commit 4403cd3

Please sign in to comment.