diff --git a/src/RecordComponent.cpp b/src/RecordComponent.cpp index 1a1ee8444a..eb41dddd19 100644 --- a/src/RecordComponent.cpp +++ b/src/RecordComponent.cpp @@ -986,9 +986,10 @@ DynamicMemoryView RecordComponent::storeChunk(Offset offset, Extent extent) return storeChunk(std::move(offset), std::move(extent), [](size_t size) { #if (defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 11000) || \ (defined(__apple_build_version__) && __clang_major__ < 14) - return std::shared_ptr{new T[size], [](auto *ptr) { delete[] ptr; }}; + return UniquePtrWithLambda{ + new T[size], [](auto *ptr) { delete[] ptr; }}; #else - return std::shared_ptr< T[] >{ new T[ size ] }; + return std::unique_ptr{new T[size]}; #endif }); } @@ -1045,7 +1046,7 @@ void RecordComponent::verifyChunk(Offset const &o, Extent const &e) const OPENPMD_INSTANTIATE_FULLMATRIX(OPENPMD_ARRAY(type)) \ OPENPMD_INSTANTIATE_FULLMATRIX(type const[]) -OPENPMD_FOREACH_NONVECTOR_DATATYPE(OPENPMD_INSTANTIATE) +OPENPMD_FOREACH_DATASET_DATATYPE(OPENPMD_INSTANTIATE) #undef OPENPMD_INSTANTIATE #undef OPENPMD_INSTANTIATE_FULLMATRIX #undef OPENPMD_INSTANTIATE_WITH_AND_WITHOUT_EXTENT diff --git a/src/binding/python/RecordComponent.cpp b/src/binding/python/RecordComponent.cpp index 3841f51270..232df5861d 100644 --- a/src/binding/python/RecordComponent.cpp +++ b/src/binding/python/RecordComponent.cpp @@ -584,18 +584,11 @@ struct GetCurrentView static constexpr char const *errorMsg = "DynamicMemoryView"; }; - -template <> -pybind11::object -GetCurrentView::call(PythonDynamicMemoryView const &) -{ - throw std::runtime_error("[DynamicMemoryView] Only PODs allowed."); -} } // namespace pybind11::object PythonDynamicMemoryView::currentView() const { - return switchNonVectorType(m_datatype, *this); + return switchDatasetType(m_datatype, *this); } namespace @@ -628,14 +621,6 @@ struct StoreChunkSpan static constexpr char const *errorMsg = "RecordComponent.store_chunk()"; }; - -template <> -PythonDynamicMemoryView StoreChunkSpan::call( - RecordComponent &, Offset const &, Extent const &) -{ - throw std::runtime_error( - "[RecordComponent.store_chunk()] Only PODs allowed."); -} } // namespace inline PythonDynamicMemoryView store_chunk_span( @@ -656,7 +641,7 @@ inline PythonDynamicMemoryView store_chunk_span( std::begin(shape), [&maskIt](std::uint64_t) { return !*(maskIt++); }); - return switchNonVectorType( + return switchDatasetType( r.getDatatype(), r, offset, extent); } @@ -726,7 +711,7 @@ void load_chunk( } } - switchNonVectorType( + switchDatasetType( r.getDatatype(), r, buffer, buffer_info, offset, extent); } @@ -910,9 +895,6 @@ void init_RecordComponent(py::module &m) // std::endl; typestring: encoding + type + number of bytes switch (dtype) { - case DT::BOOL: - return rc.makeConstant(*static_cast(buf.ptr)); - break; case DT::CHAR: return rc.makeConstant(*static_cast(buf.ptr)); break; @@ -971,6 +953,11 @@ void init_RecordComponent(py::module &m) return rc.makeConstant( *static_cast *>(buf.ptr)); break; + case DT::BOOL: + throw std::runtime_error( + "make_constant: " + "Boolean type not supported!"); + break; default: throw std::runtime_error( "make_constant: " @@ -998,10 +985,6 @@ void init_RecordComponent(py::module &m) "make_constant", &RecordComponent::makeConstant, py::arg("value")) - .def( - "make_constant", - &RecordComponent::makeConstant, - py::arg("value")) .def( "make_empty", [](RecordComponent &rc, Datatype dt, uint8_t dimensionality) { diff --git a/test/SerialIOTest.cpp b/test/SerialIOTest.cpp index b2306bc3e8..7fd13822f3 100644 --- a/test/SerialIOTest.cpp +++ b/test/SerialIOTest.cpp @@ -3021,7 +3021,7 @@ TEST_CASE("git_hdf5_legacy_picongpu", "[serial][hdf5]") auto radiationMask = o.iterations[200] .particles["e"]["radiationMask"][RecordComponent::SCALAR]; - switchNonVectorType( + switchDatasetType( radiationMask.getDatatype(), radiationMask); auto particlePatches = o.iterations[200].particles["e"].particlePatches;