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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ repos:
# clang-format v13
# to run manually, use .github/workflows/clang-format/clang-format.sh
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v21.1.8
rev: v22.1.0
hooks:
- id: clang-format
# By default, the clang-format hook configures:
Expand All @@ -88,7 +88,7 @@ repos:
# Sorts Python imports according to PEP8
# https://www.python.org/dev/peps/pep-0008/#imports
- repo: https://github.com/pycqa/isort
rev: 7.0.0
rev: 8.0.1
hooks:
- id: isort
name: isort (python)
Expand Down
21 changes: 12 additions & 9 deletions include/openPMD/backend/Attribute.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,10 @@ namespace detail
{
U res{};
res.reserve(pv->size());
if constexpr (std::is_convertible_v<
typename T::value_type,
typename U::value_type>)
if constexpr (
std::is_convertible_v<
typename T::value_type,
typename U::value_type>)
{
std::copy(pv->begin(), pv->end(), std::back_inserter(res));
return {res};
Expand Down Expand Up @@ -194,9 +195,10 @@ namespace detail
{
U res{};
res.reserve(pv->size());
if constexpr (std::is_convertible_v<
typename T::value_type,
typename U::value_type>)
if constexpr (
std::is_convertible_v<
typename T::value_type,
typename U::value_type>)
{
std::copy(pv->begin(), pv->end(), std::back_inserter(res));
return {res};
Expand Down Expand Up @@ -234,9 +236,10 @@ namespace detail
else if constexpr (auxiliary::IsVector_v<T> && auxiliary::IsArray_v<U>)
{
U res{};
if constexpr (std::is_convertible_v<
typename T::value_type,
typename U::value_type>)
if constexpr (
std::is_convertible_v<
typename T::value_type,
typename U::value_type>)
{
if (res.size() != pv->size())
{
Expand Down
7 changes: 4 additions & 3 deletions src/IO/ADIOS/ADIOS2File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@ void WriteDataset::call(ADIOS2File &ba, detail::BufferedPut &bp)

engine.Put(var, ptr);
}
else if constexpr (std::is_same_v<
ptr_type,
auxiliary::WriteBuffer::CopyableUniquePtr>)
else if constexpr (
std::is_same_v<
ptr_type,
auxiliary::WriteBuffer::CopyableUniquePtr>)
{
BufferedUniquePtrPut bput;
bput.name = std::move(bp.name);
Expand Down
6 changes: 4 additions & 2 deletions src/IO/JSON/JSONIOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ JSONIOHandler::JSONIOHandler(
openPMD::json::TracingJSON jsonCfg,
JSONIOHandlerImpl::FileFormat format,
std::string originalExtension)
: AbstractIOHandler{std::move(initialize_from), std::move(path), at, std::move(jsonCfg)}
: AbstractIOHandler{
std::move(initialize_from), std::move(path), at, std::move(jsonCfg)}
, m_impl{this, format, std::move(originalExtension)}
{}

Expand All @@ -45,7 +46,8 @@ JSONIOHandler::JSONIOHandler(
openPMD::json::TracingJSON jsonCfg,
JSONIOHandlerImpl::FileFormat format,
std::string originalExtension)
: AbstractIOHandler{std::move(initialize_from), std::move(path), at, std::move(jsonCfg)}
: AbstractIOHandler{
std::move(initialize_from), std::move(path), at, std::move(jsonCfg)}
, m_impl{
JSONIOHandlerImpl{this, comm, format, std::move(originalExtension)}}
{}
Expand Down
14 changes: 8 additions & 6 deletions src/Iteration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,10 @@ void Iteration::read_impl(std::string const &groupPath)
setDt(Attribute(Attribute::from_any, *aRead.m_resource)
.get<long double>());
// conversion cast if a backend reports an integer type
else if (auto val = Attribute(Attribute::from_any, *aRead.m_resource)
.getOptional<double>();
val.has_value())
else if (
auto val = Attribute(Attribute::from_any, *aRead.m_resource)
.getOptional<double>();
val.has_value())
setDt(val.value());
else
throw error::ReadError(
Expand All @@ -539,9 +540,10 @@ void Iteration::read_impl(std::string const &groupPath)
setTime(Attribute(Attribute::from_any, *aRead.m_resource)
.get<long double>());
// conversion cast if a backend reports an integer type
else if (auto val = Attribute(Attribute::from_any, *aRead.m_resource)
.getOptional<double>();
val.has_value())
else if (
auto val = Attribute(Attribute::from_any, *aRead.m_resource)
.getOptional<double>();
val.has_value())
setTime(val.value());
else
throw error::ReadError(
Expand Down
5 changes: 3 additions & 2 deletions src/Series.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2581,8 +2581,9 @@ std::string Series::iterationFilename(IterationIndex_t i)
{
return series.m_overrideFilebasedFilename.value();
}
else if (auto iteration = series.m_iterationFilenames.find(i); //
iteration != series.m_iterationFilenames.end())
else if (
auto iteration = series.m_iterationFilenames.find(i); //
iteration != series.m_iterationFilenames.end())
{
return iteration->second;
}
Expand Down
7 changes: 4 additions & 3 deletions src/backend/BaseRecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,9 +801,10 @@ inline void BaseRecord<T_elem>::readBase()
"timeOffset",
Attribute(Attribute::from_any, *aRead.m_resource).get<double>());
// conversion cast if a backend reports an integer type
else if (auto val = Attribute(Attribute::from_any, *aRead.m_resource)
.getOptional<double>();
val.has_value())
else if (
auto val = Attribute(Attribute::from_any, *aRead.m_resource)
.getOptional<double>();
val.has_value())
this->setAttribute("timeOffset", val.value());
else
throw std::runtime_error(
Expand Down
10 changes: 6 additions & 4 deletions src/binding/python/Attributable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,15 +422,17 @@ bool setAttributeFromObject_char(
#endif
// this must come after tryCast<vector<char>>,
// because tryCast<vector<string>> implicitly covers chars as well
else if (auto list_of_string = tryCast<ListString>(obj);
list_of_string.has_value())
else if (
auto list_of_string = tryCast<ListString>(obj);
list_of_string.has_value())
{
return attr.setAttribute<ListString>(key, std::move(*list_of_string));
}
// Again: `char` vs. `signed char`, resp. `char` vs. `unsigned char`
// depending on `char`'s signedness.
else if (auto list_of_int = tryCast<std::vector<int>>(obj);
list_of_int.has_value())
else if (
auto list_of_int = tryCast<std::vector<int>>(obj);
list_of_int.has_value())
{
std::vector<explicit_char_type> casted;
casted.reserve(list_of_int->size());
Expand Down
Loading