Skip to content

Commit 5bb1876

Browse files
committed
Fix some of the bugs found by this check
1 parent c854fd7 commit 5bb1876

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

examples/7_extended_write_serial.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ int main()
8383
{{io::UnitDimension::M, 1}});
8484
electrons["displacement"]["x"].setUnitSI(1e-6);
8585
electrons.erase("displacement");
86-
electrons["weighting"][io::RecordComponent::SCALAR].makeConstant(
87-
1.e-5);
86+
electrons["weighting"][io::RecordComponent::SCALAR]
87+
.resetDataset({io::Datatype::FLOAT, {1}})
88+
.makeConstant(1.e-5);
8889
}
8990

9091
io::Mesh mesh = cur_it.meshes["lowRez_2D_field"];

examples/7_extended_write_serial.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@
9090
electrons["displacement"].unit_dimension = {Unit_Dimension.M: 1}
9191
electrons["displacement"]["x"].unit_SI = 1.e-6
9292
del electrons["displacement"]
93-
electrons["weighting"][SCALAR].make_constant(1.e-5)
93+
electrons["weighting"][SCALAR] \
94+
.reset_dataset(Dataset(np.dtype("float32"), extent=[1])) \
95+
.make_constant(1.e-5)
9496

9597
mesh = cur_it.meshes["lowRez_2D_field"]
9698
mesh.axis_labels = ["x", "y"]

examples/9_particle_write_serial.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@
4444
# don't like it anymore? remove it with:
4545
# del electrons["displacement"]
4646

47-
electrons["weighting"][SCALAR].make_constant(1.e-5)
47+
electrons["weighting"][SCALAR] \
48+
.reset_dataset(Dataset(np.dtype("float32"), extent=[1])) \
49+
.make_constant(1.e-5)
4850

4951
particlePos_x = np.random.rand(234).astype(np.float32)
5052
particlePos_y = np.random.rand(234).astype(np.float32)

0 commit comments

Comments
 (0)