Skip to content

Commit

Permalink
Create valid openPMD file from myPath CoreTest
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Jun 26, 2023
1 parent 8e7d616 commit a7fbb54
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions test/CoreTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ TEST_CASE("myPath", "[core]")
REQUIRE(
pathOf(scalarMesh) ==
vec_t{"iterations", "1234", "meshes", "e_chargeDensity"});
auto scalarMeshComponent = scalarMesh[RecordComponent::SCALAR];
auto scalarMeshComponent = scalarMesh[RecordComponent::SCALAR].resetDataset(
{Datatype::FLOAT, {10}});
REQUIRE(
pathOf(scalarMeshComponent) ==
vec_t{
Expand All @@ -203,7 +204,8 @@ TEST_CASE("myPath", "[core]")

auto vectorMesh = iteration.meshes["E"];
REQUIRE(pathOf(vectorMesh) == vec_t{"iterations", "1234", "meshes", "E"});
auto vectorMeshComponent = vectorMesh["x"];
auto vectorMeshComponent =
vectorMesh["x"].resetDataset({Datatype::FLOAT, {10}});
REQUIRE(
pathOf(vectorMeshComponent) ==
vec_t{"iterations", "1234", "meshes", "E", "x"});
Expand All @@ -220,7 +222,8 @@ TEST_CASE("myPath", "[core]")
pathOf(speciesPosition) ==
vec_t{"iterations", "1234", "particles", "e", "position"});

auto speciesPositionX = speciesPosition["x"];
auto speciesPositionX =
speciesPosition["x"].resetDataset({Datatype::FLOAT, {10}});
REQUIRE(
pathOf(speciesPositionX) ==
vec_t{"iterations", "1234", "particles", "e", "position", "x"});
Expand All @@ -231,7 +234,9 @@ TEST_CASE("myPath", "[core]")
pathOf(speciesWeighting) ==
vec_t{"iterations", "1234", "particles", "e", "weighting"});

auto speciesWeightingX = speciesWeighting[RecordComponent::SCALAR];
auto speciesWeightingX =
speciesWeighting[RecordComponent::SCALAR].resetDataset(
{Datatype::FLOAT, {10}});
REQUIRE(
pathOf(speciesWeightingX) ==
vec_t{
Expand All @@ -258,7 +263,7 @@ TEST_CASE("myPath", "[core]")
"particlePatches",
"extent"});

auto patchExtentX = patchExtent["x"];
auto patchExtentX = patchExtent["x"].resetDataset({Datatype::INT, {10}});
REQUIRE(
pathOf(patchExtentX) ==
vec_t{
Expand All @@ -282,7 +287,8 @@ TEST_CASE("myPath", "[core]")
"numParticles"});

auto patchNumParticlesComponent =
patchNumParticles[RecordComponent::SCALAR];
patchNumParticles[RecordComponent::SCALAR].resetDataset(
{Datatype::INT, {10}});
REQUIRE(
pathOf(patchNumParticlesComponent) ==
vec_t{
Expand All @@ -293,6 +299,10 @@ TEST_CASE("myPath", "[core]")
"particlePatches",
"numParticles",
RecordComponent::SCALAR});

speciesE.particlePatches["offset"]["x"].resetDataset({Datatype::INT, {10}});
speciesE.particlePatches["numParticlesOffset"][RecordComponent::SCALAR]
.resetDataset({Datatype::INT, {10}});
#endif
}

Expand Down

0 comments on commit a7fbb54

Please sign in to comment.