Skip to content

Commit

Permalink
fix slice numbering when restarting
Browse files Browse the repository at this point in the history
  • Loading branch information
glesur committed Nov 10, 2023
1 parent 1afa4b8 commit 8ab50ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/output/slice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Slice::Slice(Input &input, DataBlock & data, int nSlice, SliceType type,
sliceLast = data.t - slicePeriod;
}
// Register the last output in dumps so that we restart from the right slice
data.dump->RegisterVariable(&sliceLast, std::string("vtk")+prefix+std::string("Last"));
data.dump->RegisterVariable(&sliceLast, std::string("slcLast-")+std::to_string(nSlice));
// Create the slice.
this->type = type;
this->direction = direction;
Expand All @@ -46,6 +46,9 @@ Slice::Slice(Input &input, DataBlock & data, int nSlice, SliceType type,

// Initialize the vtk routines
this->vtk = std::make_unique<Vtk>(input, sliceData.get(),prefix);
// Make sure the vtk file gets store in the parent's datablock dump
data.dump->RegisterVariable(&vtk->vtkFileNumber,
std::string("slcNumber-")+std::to_string(nSlice));

// Allocate array to compute the slice
this->Vc = IdefixArray4D<real>("Slice_Vc", NVAR,
Expand Down
1 change: 1 addition & 0 deletions src/output/vtk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class BaseVtk {

class Vtk : public BaseVtk {
friend class Dump;
friend class Slice;

public:
explicit Vtk(Input &, DataBlock *, std::string filebase = "data"); // init VTK object
Expand Down

0 comments on commit 8ab50ae

Please sign in to comment.