Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ find_package( Eigen3 REQUIRED NO_MODULE HINTS
$ENV{Eigen3_PATH} $ENV{EIGEN3_PATH} $ENV{Eigen_PATH} $ENV{EIGEN_PATH} )
find_package( gsl-lite REQUIRED HINTS $ENV{gsl_lite_DIR} )
find_package( udunits 2.2.0 REQUIRED )
find_package( EXPAT REQUIRED )
find_package( Boost 1.64.0 REQUIRED )

# Optional
Expand Down
1 change: 1 addition & 0 deletions src/engines/ioda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ target_link_libraries(ioda_engines PUBLIC gsl::gsl-lite)
target_link_libraries(ioda_engines PUBLIC Eigen3::Eigen)
target_link_libraries(ioda_engines PUBLIC udunits::udunits)
target_link_libraries(ioda_engines PUBLIC eckit)
target_link_libraries(ioda_engines PUBLIC EXPAT::EXPAT)

if(BUILD_PYTHON_BINDINGS)
target_link_libraries(ioda_engines PRIVATE Python3::Python pybind11::headers)
Expand Down
8 changes: 4 additions & 4 deletions src/engines/ioda/include/ioda/Attributes/Attribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Attribute_Base {
auto d = m.serialize(data);
auto spn = gsl::make_span<const char>(reinterpret_cast<const char*>(d->DataPointers.data()),
d->DataPointers.size() * Marshaller::bytesPerElement_);
write(spn, TypeWrapper::GetType(getTypeProvider()));
write(spn, TypeWrapper::GetType(gsl::not_null<const ::ioda::detail::Type_Provider*>(getTypeProvider())));
return Attribute_Implementation{backend_};
} catch (...) {
std::throw_with_nested(Exception(ioda_Here()));
Expand Down Expand Up @@ -259,7 +259,7 @@ class Attribute_Base {
auto p = m.prep_deserialize(numObjects);
read(gsl::make_span<char>(reinterpret_cast<char*>(p->DataPointers.data()),
p->DataPointers.size() * Marshaller::bytesPerElement_),
TypeWrapper::GetType(getTypeProvider()));
TypeWrapper::GetType(gsl::not_null<const ::ioda::detail::Type_Provider*>(getTypeProvider())));
m.deserialize(p, data);

return Attribute_Implementation{backend_};
Expand Down Expand Up @@ -445,15 +445,15 @@ class Attribute_Base {
/// \throws ioda::Exception if an error occurred.
template <class DataType>
bool isA() const {
Type templateType = Types::GetType_Wrapper<DataType>::GetType(getTypeProvider());
Type templateType = Types::GetType_Wrapper<DataType>::GetType(gsl::not_null<const ::ioda::detail::Type_Provider*>(getTypeProvider()));

return isA(templateType);
}
/// Hand-off to the backend to check equivalence
virtual bool isA(Type lhs) const;

/// Python compatability function
inline bool isA(BasicTypes dataType) { return isA(Type(dataType, getTypeProvider())); }
inline bool isA(BasicTypes dataType) { return isA(Type(dataType, gsl::not_null<::ioda::detail::Type_Provider*>(getTypeProvider()))); }
/// \internal pybind11
inline bool _py_isA2(BasicTypes dataType) { return isA(dataType); }

Expand Down
4 changes: 2 additions & 2 deletions src/engines/ioda/include/ioda/Attributes/Has_Attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ class IODA_DL Has_Attributes_Base {
/// Python compatability function
inline Attribute _create_py(const std::string& attrname, BasicTypes dataType,
const std::vector<Dimensions_t>& dimensions = {1}) {
return create(attrname, ::ioda::Type(dataType, getTypeProvider()), dimensions);
return create(attrname, ::ioda::Type(dataType, gsl::not_null<::ioda::detail::Type_Provider*>(getTypeProvider())), dimensions);
}

/// \brief Create an Attribute without setting its data.
Expand All @@ -345,7 +345,7 @@ class IODA_DL Has_Attributes_Base {
Attribute create(const std::string& attrname,
const std::vector<Dimensions_t>& dimensions = {1}) {
try {
Type in_memory_dataType = TypeWrapper::GetType(getTypeProvider());
Type in_memory_dataType = TypeWrapper::GetType(gsl::not_null<const ::ioda::detail::Type_Provider*>(getTypeProvider()));
auto att = create(attrname, in_memory_dataType, dimensions);
return att;
} catch (...) {
Expand Down
4 changes: 2 additions & 2 deletions src/engines/ioda/include/ioda/Variables/Has_Variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ class IODA_DL Has_Variables_Base {
try {
VariableCreationParameters params2 = params;
FillValuePolicies::applyFillValuePolicy<DataType>(getFillValuePolicy(), params2.fillValue_);
Type in_memory_dataType = Types::GetType<DataType>(getTypeProvider());
Type in_memory_dataType = Types::GetType<DataType>(gsl::not_null<const ::ioda::detail::Type_Provider*>(getTypeProvider()));
auto var = create(name, in_memory_dataType, dimensions,
max_dimensions, params2);
return var;
Expand Down Expand Up @@ -343,7 +343,7 @@ class IODA_DL Has_Variables_Base {
const VariableCreationParameters& params
= VariableCreationParameters::defaulted<DataType>()) {
try {
Type in_memory_dataType = Types::GetType<DataType>(getTypeProvider());
Type in_memory_dataType = Types::GetType<DataType>(gsl::not_null<const ::ioda::detail::Type_Provider*>(getTypeProvider()));

NewVariables_t newvars{NewVariable(name, in_memory_dataType, dimension_scales, params)};
createWithScales(newvars);
Expand Down
14 changes: 7 additions & 7 deletions src/engines/ioda/include/ioda/Variables/Variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ class Variable_Base {
/// \throws ioda::Exception if an error occurred.
template <class DataType>
bool isA() const {
Type templateType = Types::GetType_Wrapper<DataType>::GetType(getTypeProvider());
Type templateType = Types::GetType_Wrapper<DataType>::GetType(gsl::not_null<const ::ioda::detail::Type_Provider*>(getTypeProvider()));

return isA(templateType);
}
/// Hand-off to the backend to check equivalence
virtual bool isA(Type lhs) const;

/// Python compatability function
inline bool isA(BasicTypes dataType) const { return isA(Type(dataType, getTypeProvider())); }
inline bool isA(BasicTypes dataType) const { return isA(Type(dataType, gsl::not_null<::ioda::detail::Type_Provider*>(getTypeProvider()))); }
/// \internal pybind11
inline bool _py_isA2(BasicTypes dataType) { return isA(dataType); }
/// Convenience function to query type
Expand Down Expand Up @@ -293,7 +293,7 @@ class Variable_Base {
return write(gsl::make_span<const char>(
reinterpret_cast<const char*>(d->DataPointers.data()),
d->DataPointers.size() * Marshaller::bytesPerElement_),
TypeWrapper::GetType(getTypeProvider()), mem_selection, file_selection);
TypeWrapper::GetType(gsl::not_null<const ::ioda::detail::Type_Provider*>(getTypeProvider())), mem_selection, file_selection);
} catch (...) {
std::throw_with_nested(Exception(ioda_Here()));
}
Expand All @@ -309,7 +309,7 @@ class Variable_Base {
return parallelWrite(gsl::make_span<const char>(
reinterpret_cast<const char*>(d->DataPointers.data()),
d->DataPointers.size() * Marshaller::bytesPerElement_),
TypeWrapper::GetType(getTypeProvider()), mem_selection, file_selection);
TypeWrapper::GetType(gsl::not_null<const ::ioda::detail::Type_Provider*>(getTypeProvider())), mem_selection, file_selection);
} catch (...) {
std::throw_with_nested(Exception(ioda_Here()));
}
Expand Down Expand Up @@ -339,7 +339,7 @@ class Variable_Base {
return write(gsl::make_span<const char>(
reinterpret_cast<const char*>(d->DataPointers.data()),
d->DataPointers.size() * Marshaller::bytesPerElement_),
TypeWrapper::GetType(getTypeProvider()), mem_selection, file_selection);
TypeWrapper::GetType(gsl::not_null<const ::ioda::detail::Type_Provider*>(getTypeProvider())), mem_selection, file_selection);
} catch (...) {
std::throw_with_nested(Exception(ioda_Here()));
}
Expand All @@ -355,7 +355,7 @@ class Variable_Base {
return parallelWrite(gsl::make_span<const char>(
reinterpret_cast<const char*>(d->DataPointers.data()),
d->DataPointers.size() * Marshaller::bytesPerElement_),
TypeWrapper::GetType(getTypeProvider()), mem_selection, file_selection);
TypeWrapper::GetType(gsl::not_null<const ::ioda::detail::Type_Provider*>(getTypeProvider())), mem_selection, file_selection);
} catch (...) {
std::throw_with_nested(Exception(ioda_Here()));
}
Expand Down Expand Up @@ -531,7 +531,7 @@ class Variable_Base {
// reading in a string, then mutable data type is char*,
// which works because address pointers have the same size.
p->DataPointers.size() * Marshaller::bytesPerElement_),
TypeWrapper::GetType(getTypeProvider()), mem_selection, file_selection);
TypeWrapper::GetType(gsl::not_null<const ::ioda::detail::Type_Provider*>(getTypeProvider())), mem_selection, file_selection);
m.deserialize(p, data, &atts);

return Variable_Implementation{backend_};
Expand Down
7 changes: 4 additions & 3 deletions src/engines/ioda/src/ioda/C/ioda_variable_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ bool ioda_variable_c_write_char(ioda_variable_t p,int64_t n,const char * vptr) {
throw std::exception();
}
std::string s(str,n);
auto v = var->write< std::string >(s);
std::vector<std::string> vs = {s};
auto v = var->write< std::string >(vs);
return true;
} catch (std::exception& e) {
std::cerr << "ioda_variable_c_write_char failed\n";
Expand All @@ -323,7 +324,7 @@ bool ioda_variable_c_write_str(ioda_variable_t p,cxx_vector_string_t vstr_p) {
std::cerr << "ioda_variable_c_write_str vecstring pointer is null\n";
fatal_error();
}
ioda::Variable v = var->write< std::vector< std::string > >(*vstr);
ioda::Variable v = var->write< std::string >(*vstr);
return true;
} catch (std::exception& e) {
std::cerr << "ioda_variable_c_write_str_full failed ";
Expand Down Expand Up @@ -411,7 +412,7 @@ bool ioda_variable_c_read_str(void *p,int64_t n,cxx_vector_string_t *vstr) {
vs_p = reinterpret_cast<void*>(new std::vector<std::string>());
}
VOID_TO_CXX(std::vector<std::string>,vs_p,vs);
auto vr = var->read< std::vector<std::string> >(*vs);
auto vr = var->read< std::string >(*vs);
// make sure that vstr points to correct char *
*vstr = reinterpret_cast<void*>(vs);
return true;
Expand Down
15 changes: 11 additions & 4 deletions src/engines/ioda/src/ioda/Engines/HH/HH-groups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,17 @@ std::map<ObjectType, std::vector<std::string>> HH_Group::listObjects(ObjectType

herr_t search_res
= (recurse)
? H5Lvisit(backend_(), idxclass, H5_ITER_NATIVE, iterate_find_by_link,
reinterpret_cast<void*>(&iter_data))
: H5Literate(backend_(), idxclass, H5_ITER_NATIVE, 0, iterate_find_by_link,
reinterpret_cast<void*>(&iter_data)); // NOLINT: 0 is not a nullptr here.
#if H5_VERSION_GE(1, 12, 0)
? H5Lvisit2(backend_(), idxclass, H5_ITER_NATIVE, iterate_find_by_link,
reinterpret_cast<void*>(&iter_data))
: H5Literate2(backend_(), idxclass, H5_ITER_NATIVE, 0, iterate_find_by_link,
reinterpret_cast<void*>(&iter_data)); // NOLINT: 0 is not a nullptr here.
#else
? H5Lvisit1(backend_(), idxclass, H5_ITER_NATIVE, iterate_find_by_link,
reinterpret_cast<void*>(&iter_data))
: H5Literate1(backend_(), idxclass, H5_ITER_NATIVE, 0, iterate_find_by_link,
reinterpret_cast<void*>(&iter_data)); // NOLINT: 0 is not a nullptr here.
#endif

if (search_res < 0) throw Exception("H5Lvisit / H5Literate failed.", ioda_Here())
.add("recurse", recurse);
Expand Down
4 changes: 2 additions & 2 deletions src/engines/ioda/src/ioda/Engines/HH/HH/HH-variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class IODA_HIDDEN HH_Variable : public ioda::detail::Variable_Backend,
/// \returns <0 if an error occurred.
template <class DataType>
bool isA() const {
auto ttype = Types::GetType<DataType>(getTypeProvider());
auto ttype = Types::GetType<DataType>(gsl::not_null<const ::ioda::detail::Type_Provider*>(getTypeProvider()));
return isA(ttype);
}

Expand All @@ -86,7 +86,7 @@ class IODA_HIDDEN HH_Variable : public ioda::detail::Variable_Backend,
/// \returns <0 if an error occurred.
template <class DataType>
bool isExactlyA() const {
auto ttype = Types::GetType<DataType>(getTypeProvider());
auto ttype = Types::GetType<DataType>(gsl::not_null<const ::ioda::detail::Type_Provider*>(getTypeProvider()));
HH_hid_t otype = internalType();
auto ret = H5Tequal(ttype(), otype());
if (ret < 0) throw Exception("Cannot check type equality. General failure.", ioda_Here());
Expand Down
2 changes: 1 addition & 1 deletion src/engines/ioda/src/ioda/Has_Variables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Variable Has_Variables_Base::_create_py(const std::string& name, BasicTypes data
const VariableCreationParameters& params
) {
try {
Type typ = Type(dataType, getTypeProvider());
Type typ = Type(dataType, gsl::not_null<::ioda::detail::Type_Provider*>(getTypeProvider()));
if (dimension_scales.size()) {
std::vector<Dimensions_t> c_d, m_d, chunking_hints;

Expand Down
2 changes: 1 addition & 1 deletion src/engines/ioda/src/ioda/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ Type::Type(std::shared_ptr<detail::Type_Backend> b, std::type_index t)
: Type_Base(b, b->provider_), as_type_index_(t) {}

Type::Type(BasicTypes typ, gsl::not_null<::ioda::detail::Type_Provider*> t)
: Type_Base(nullptr, t.get()), as_type_index_(typeid(void)) {
: Type_Base(nullptr, static_cast<::ioda::detail::Type_Provider*>(t)), as_type_index_(typeid(void)) {
static const std::map<BasicTypes, std::type_index> workable_types
= {{BasicTypes::float_, typeid(float)}, // NOLINT: cpplint doesn't understand this!
{BasicTypes::double_, typeid(double)}, // NOLINT
Expand Down
4 changes: 2 additions & 2 deletions src/ioPool/ReaderPoolUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1958,7 +1958,7 @@ void readerLoadSourceVarReplaceFill(const ReaderPoolBase & ioPool,
[&](auto typeDiscriminator) {
typedef decltype(typeDiscriminator) T;
const Type srcType =
Types::GetType_Wrapper<T>::GetType(srcVar.getTypeProvider());
Types::GetType_Wrapper<T>::GetType(gsl::not_null<const ::ioda::detail::Type_Provider*>(srcVar.getTypeProvider()));
srcVar.read(srcBuffer, srcType, srcSelect, srcSelect);
const ioda::Dimensions_t numElements = srcVar.getDimensions().numElements;
replaceFillWithMissing<T>(ioPool, srcVar, numElements, srcBuffer);
Expand Down Expand Up @@ -2016,7 +2016,7 @@ void readerSaveDestVar(const std::string & varName, const std::vector<char> & de
[&](auto typeDiscriminator) {
typedef decltype(typeDiscriminator) T;
const Type destType =
Types::GetType_Wrapper<T>::GetType(destVar.getTypeProvider());
Types::GetType_Wrapper<T>::GetType(gsl::not_null<const ::ioda::detail::Type_Provider*>(destVar.getTypeProvider()));
destVar.write(destBuffer, destType, destSelect, destSelect);
},
VarUtils::ThrowIfVariableIsOfUnsupportedType(varName));
Expand Down