Merge branch 'master' of bitbucket.org:glavaux/cosmotool
This commit is contained in:
commit
a869335472
3 changed files with 105 additions and 344 deletions
|
@ -202,6 +202,29 @@ namespace CosmoTool {
|
|||
}
|
||||
};
|
||||
|
||||
class hdf5_StringType
|
||||
{
|
||||
public:
|
||||
H5::StrType type;
|
||||
|
||||
hdf5_StringType()
|
||||
: type(0, H5T_VARIABLE)
|
||||
{
|
||||
}
|
||||
|
||||
static const hdf5_StringType *ctype()
|
||||
{
|
||||
static hdf5_StringType singleton;
|
||||
return &singleton;
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct get_hdf5_data_type<std::string> {
|
||||
static H5::DataType type() {
|
||||
return hdf5_StringType::ctype()->type;
|
||||
}
|
||||
};
|
||||
|
||||
class hdf5_BoolType
|
||||
{
|
||||
public:
|
||||
|
@ -286,7 +309,7 @@ namespace CosmoTool {
|
|||
|
||||
template<typename ArrayType>
|
||||
void hdf5_check_array(ArrayType& data, std::vector<hsize_t>& dims) {
|
||||
for (long i = 0; i < data.num_dimensions(); i++) {
|
||||
for (size_t i = 0; i < data.num_dimensions(); i++) {
|
||||
if (data.shape()[i] != dims[i]) {
|
||||
throw InvalidDimensions();
|
||||
}
|
||||
|
@ -295,7 +318,7 @@ namespace CosmoTool {
|
|||
|
||||
template<typename ArrayType>
|
||||
void hdf5_weak_check_array(ArrayType& data, std::vector<hsize_t>& dims) {
|
||||
for (long i = 0; i < data.num_dimensions(); i++) {
|
||||
for (size_t i = 0; i < data.num_dimensions(); i++) {
|
||||
if (data.index_bases()[i] < 0) {
|
||||
// Negative indexes are not supported right now.
|
||||
throw InvalidDimensions();
|
||||
|
@ -326,7 +349,7 @@ namespace CosmoTool {
|
|||
H5::DataSpace dataspace = dataset.getSpace();
|
||||
std::vector<hsize_t> dimensions(data.num_dimensions());
|
||||
|
||||
if (dataspace.getSimpleExtentNdims() != data.num_dimensions())
|
||||
if ((size_t)dataspace.getSimpleExtentNdims() != (size_t)data.num_dimensions())
|
||||
{
|
||||
throw InvalidDimensions();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue