Skip to content

Commit 7070156

Browse files
committed
Discouraged support for custom datasets inside the particlesPath
1 parent edd8b0b commit 7070156

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

src/CustomHierarchy.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,18 @@ void CustomHierarchy::read(
474474
{
475475
switch (mpp.determineType(currentPath))
476476
{
477-
// Group is a bit of an internal misnomer here, it just means that
478-
// it matches neither meshes nor particles path
477+
478+
case internal::ContainedType::Particle:
479+
std::cerr << "[Warning] Dataset found at '"
480+
<< (concatWithSep(currentPath, "/") + "/" + path)
481+
<< "' inside the particles path. A particle species is "
482+
"always a group, never a dataset. Will parse as a "
483+
"custom dataset. Storing custom datasets inside the "
484+
"particles path is discouraged."
485+
<< std::endl;
486+
[[fallthrough]];
487+
// Group is a bit of an internal misnomer here, it just means that
488+
// it matches neither meshes nor particles path
479489
case internal::ContainedType::Group: {
480490
auto &rc = data.embeddedDatasets()[path];
481491
Parameter<Operation::OPEN_DATASET> dOpen;
@@ -513,14 +523,6 @@ void CustomHierarchy::read(
513523
meshesMap.forget(path);
514524
}
515525
break;
516-
case internal::ContainedType::Particle:
517-
std::cerr
518-
<< "[Warning] Dataset found at '"
519-
<< (concatWithSep(currentPath, "/") + "/" + path)
520-
<< " that matches one of the given particle paths. A particle "
521-
"species is always a group, never a dataset. Will skip."
522-
<< std::endl;
523-
break;
524526
}
525527
}
526528

test/CoreTest.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,12 @@ TEST_CASE("custom_hierarchies_no_rw", "[core]")
403403
.asContainerOf<ParticleSpecies>()["e"]["position"]["x"];
404404
e_pos_x.resetDataset({Datatype::INT, {10}});
405405
e_pos_x.storeChunk(data, {0}, {10});
406+
407+
auto gnihihi = write.iterations[0]["custom_particles"]["particles"]
408+
.asContainerOf<RecordComponent>();
409+
auto dataset = gnihihi["custom_dataset"];
410+
dataset.resetDataset({Datatype::INT, {10}});
411+
dataset.storeChunk(std::unique_ptr<int[]>(new int[10]{}), {0}, {10});
406412
write.close();
407413
}
408414

0 commit comments

Comments
 (0)