From f179f568790321a7acfe778b3179f1145d8e8c59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Thu, 6 Oct 2022 15:14:36 +0200 Subject: [PATCH] Fix some of the bugs found by this check --- examples/7_extended_write_serial.cpp | 5 +++-- examples/7_extended_write_serial.py | 4 +++- examples/9_particle_write_serial.py | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/examples/7_extended_write_serial.cpp b/examples/7_extended_write_serial.cpp index 62d8752a6e..e0d8b3625a 100644 --- a/examples/7_extended_write_serial.cpp +++ b/examples/7_extended_write_serial.cpp @@ -83,8 +83,9 @@ int main() {{io::UnitDimension::M, 1}}); electrons["displacement"]["x"].setUnitSI(1e-6); electrons.erase("displacement"); - electrons["weighting"][io::RecordComponent::SCALAR].makeConstant( - 1.e-5); + electrons["weighting"][io::RecordComponent::SCALAR] + .resetDataset({io::Datatype::FLOAT, {1}}) + .makeConstant(1.e-5); } io::Mesh mesh = cur_it.meshes["lowRez_2D_field"]; diff --git a/examples/7_extended_write_serial.py b/examples/7_extended_write_serial.py index 8a8a077058..e8dda646ef 100755 --- a/examples/7_extended_write_serial.py +++ b/examples/7_extended_write_serial.py @@ -90,7 +90,9 @@ electrons["displacement"].unit_dimension = {Unit_Dimension.M: 1} electrons["displacement"]["x"].unit_SI = 1.e-6 del electrons["displacement"] - electrons["weighting"][SCALAR].make_constant(1.e-5) + electrons["weighting"][SCALAR] \ + .reset_dataset(Dataset(np.dtype("float32"), extent=[1])) \ + .make_constant(1.e-5) mesh = cur_it.meshes["lowRez_2D_field"] mesh.axis_labels = ["x", "y"] diff --git a/examples/9_particle_write_serial.py b/examples/9_particle_write_serial.py index 659ca846d1..d68df99e38 100755 --- a/examples/9_particle_write_serial.py +++ b/examples/9_particle_write_serial.py @@ -44,7 +44,9 @@ # don't like it anymore? remove it with: # del electrons["displacement"] - electrons["weighting"][SCALAR].make_constant(1.e-5) + electrons["weighting"][SCALAR] \ + .reset_dataset(Dataset(np.dtype("float32"), extent=[1])) \ + .make_constant(1.e-5) particlePos_x = np.random.rand(234).astype(np.float32) particlePos_y = np.random.rand(234).astype(np.float32)