From 9ba18d8345b1ecbba249506ad1a70a73071b5a16 Mon Sep 17 00:00:00 2001 From: David Bold Date: Fri, 5 Jul 2024 11:38:16 +0200 Subject: [PATCH] Fix: preserve regionID --- src/field/field3d.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/field/field3d.cxx b/src/field/field3d.cxx index 4ed9641f44..7eda5d0266 100644 --- a/src/field/field3d.cxx +++ b/src/field/field3d.cxx @@ -64,7 +64,8 @@ Field3D::Field3D(Mesh* localmesh, CELL_LOC location_in, DirectionTypes direction /// Doesn't copy any data, just create a new reference to the same data (copy on change /// later) Field3D::Field3D(const Field3D& f) - : Field(f), data(f.data), yup_fields(f.yup_fields), ydown_fields(f.ydown_fields) { + : Field(f), data(f.data), yup_fields(f.yup_fields), ydown_fields(f.ydown_fields), + regionID(f.regionID) { TRACE("Field3D(Field3D&)"); @@ -252,6 +253,7 @@ Field3D& Field3D::operator=(const Field3D& rhs) { // Copy parallel slices or delete existing ones. yup_fields = rhs.yup_fields; ydown_fields = rhs.ydown_fields; + regionID = rhs.regionID; // Copy the data and data sizes nx = rhs.nx; @@ -274,6 +276,7 @@ Field3D& Field3D::operator=(Field3D&& rhs) { nx = rhs.nx; ny = rhs.ny; nz = rhs.nz; + regionID = rhs.regionID; data = std::move(rhs.data); @@ -292,6 +295,7 @@ Field3D& Field3D::operator=(const Field2D& rhs) { // Delete existing parallel slices. We don't copy parallel slices, so any // that currently exist will be incorrect. clearParallelSlices(); + resetRegion(); setLocation(rhs.getLocation()); @@ -319,6 +323,7 @@ void Field3D::operator=(const FieldPerp& rhs) { // Delete existing parallel slices. We don't copy parallel slices, so any // that currently exist will be incorrect. clearParallelSlices(); + resetRegion(); /// Make sure there's a unique array to copy data into allocate(); @@ -333,6 +338,7 @@ Field3D& Field3D::operator=(const BoutReal val) { // Delete existing parallel slices. We don't copy parallel slices, so any // that currently exist will be incorrect. clearParallelSlices(); + resetRegion(); allocate();