Skip to content

Commit

Permalink
Discouraged support for custom datasets inside the particlesPath
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Feb 15, 2024
1 parent 27be452 commit c31cd52
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/CustomHierarchy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,18 @@ void CustomHierarchy::read(
{
switch (mpp.determineType(currentPath))
{
// Group is a bit of an internal misnomer here, it just means that
// it matches neither meshes nor particles path

case internal::ContainedType::Particle:
std::cerr << "[Warning] Dataset found at '"
<< (concatWithSep(currentPath, "/") + "/" + path)
<< "' inside the particles path. A particle species is "
"always a group, never a dataset. Will parse as a "
"custom dataset. Storing custom datasets inside the "
"particles path is discouraged."
<< std::endl;
[[fallthrough]];
// Group is a bit of an internal misnomer here, it just means that
// it matches neither meshes nor particles path
case internal::ContainedType::Group: {
auto &rc = data.embeddedDatasets()[path];
Parameter<Operation::OPEN_DATASET> dOpen;
Expand Down Expand Up @@ -513,14 +523,6 @@ void CustomHierarchy::read(
meshesMap.forget(path);
}
break;
case internal::ContainedType::Particle:
std::cerr
<< "[Warning] Dataset found at '"
<< (concatWithSep(currentPath, "/") + "/" + path)
<< " that matches one of the given particle paths. A particle "
"species is always a group, never a dataset. Will skip."
<< std::endl;
break;
}
}

Expand Down
6 changes: 6 additions & 0 deletions test/CoreTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,12 @@ TEST_CASE("custom_hierarchies_no_rw", "[core]")
.asContainerOf<ParticleSpecies>()["e"]["position"]["x"];
e_pos_x.resetDataset({Datatype::INT, {10}});
e_pos_x.storeChunk(data, {0}, {10});

auto gnihihi = write.iterations[0]["custom_particles"]["particles"]
.asContainerOf<RecordComponent>();
auto dataset = gnihihi["custom_dataset"];
dataset.resetDataset({Datatype::INT, {10}});
dataset.storeChunk(std::unique_ptr<int[]>(new int[10]{}), {0}, {10});
write.close();
}

Expand Down

0 comments on commit c31cd52

Please sign in to comment.