Skip to content
Merged
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
7 changes: 4 additions & 3 deletions src/RecordComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -986,9 +986,10 @@ DynamicMemoryView<T> RecordComponent::storeChunk(Offset offset, Extent extent)
return storeChunk<T>(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<T>{new T[size], [](auto *ptr) { delete[] ptr; }};
return UniquePtrWithLambda<T>{
new T[size], [](auto *ptr) { delete[] ptr; }};
#else
return std::shared_ptr< T[] >{ new T[ size ] };
return std::unique_ptr<T[]>{new T[size]};
#endif
});
}
Expand Down Expand Up @@ -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
Expand Down
33 changes: 8 additions & 25 deletions src/binding/python/RecordComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,18 +584,11 @@ struct GetCurrentView

static constexpr char const *errorMsg = "DynamicMemoryView";
};

template <>
pybind11::object
GetCurrentView::call<std::string>(PythonDynamicMemoryView const &)
{
throw std::runtime_error("[DynamicMemoryView] Only PODs allowed.");
}
} // namespace

pybind11::object PythonDynamicMemoryView::currentView() const
{
return switchNonVectorType<GetCurrentView>(m_datatype, *this);
return switchDatasetType<GetCurrentView>(m_datatype, *this);
}

namespace
Expand Down Expand Up @@ -628,14 +621,6 @@ struct StoreChunkSpan

static constexpr char const *errorMsg = "RecordComponent.store_chunk()";
};

template <>
PythonDynamicMemoryView StoreChunkSpan::call<std::string>(
RecordComponent &, Offset const &, Extent const &)
{
throw std::runtime_error(
"[RecordComponent.store_chunk()] Only PODs allowed.");
}
} // namespace

inline PythonDynamicMemoryView store_chunk_span(
Expand All @@ -656,7 +641,7 @@ inline PythonDynamicMemoryView store_chunk_span(
std::begin(shape),
[&maskIt](std::uint64_t) { return !*(maskIt++); });

return switchNonVectorType<StoreChunkSpan>(
return switchDatasetType<StoreChunkSpan>(
r.getDatatype(), r, offset, extent);
}

Expand Down Expand Up @@ -726,7 +711,7 @@ void load_chunk(
}
}

switchNonVectorType<LoadChunkIntoPythonBuffer>(
switchDatasetType<LoadChunkIntoPythonBuffer>(
r.getDatatype(), r, buffer, buffer_info, offset, extent);
}

Expand Down Expand Up @@ -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<bool *>(buf.ptr));
break;
case DT::CHAR:
return rc.makeConstant(*static_cast<char *>(buf.ptr));
break;
Expand Down Expand Up @@ -971,6 +953,11 @@ void init_RecordComponent(py::module &m)
return rc.makeConstant(
*static_cast<std::complex<long double> *>(buf.ptr));
break;
case DT::BOOL:
throw std::runtime_error(
"make_constant: "
"Boolean type not supported!");
break;
default:
throw std::runtime_error(
"make_constant: "
Expand Down Expand Up @@ -998,10 +985,6 @@ void init_RecordComponent(py::module &m)
"make_constant",
&RecordComponent::makeConstant<double>,
py::arg("value"))
.def(
"make_constant",
&RecordComponent::makeConstant<bool>,
py::arg("value"))
.def(
"make_empty",
[](RecordComponent &rc, Datatype dt, uint8_t dimensionality) {
Expand Down
2 changes: 1 addition & 1 deletion test/SerialIOTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3021,7 +3021,7 @@ TEST_CASE("git_hdf5_legacy_picongpu", "[serial][hdf5]")
auto radiationMask =
o.iterations[200]
.particles["e"]["radiationMask"][RecordComponent::SCALAR];
switchNonVectorType<LoadDataset>(
switchDatasetType<LoadDataset>(
radiationMask.getDatatype(), radiationMask);

auto particlePatches = o.iterations[200].particles["e"].particlePatches;
Expand Down
Loading