diff --git a/src/finiteVolume/fvMesh/fvMesh.C b/src/finiteVolume/fvMesh/fvMesh.C index 82bc22628e..7909e8ca30 100644 --- a/src/finiteVolume/fvMesh/fvMesh.C +++ b/src/finiteVolume/fvMesh/fvMesh.C @@ -260,24 +260,9 @@ Foam::fvMesh::fvMesh(const IOobject& io, const bool changers) fvSolution(static_cast(*this)), data(static_cast(*this)), boundary_(*this, boundaryMesh()), - topoChanger_ - ( - changers - ? fvMeshTopoChanger::New(*this) - : autoPtr(nullptr) - ), - distributor_ - ( - changers - ? fvMeshDistributor::New(*this) - : autoPtr(nullptr) - ), - mover_ - ( - changers - ? fvMeshMover::New(*this) - : autoPtr(nullptr) - ), + topoChanger_(nullptr), + distributor_(nullptr), + mover_(nullptr), lduPtr_(nullptr), curTimeIndex_(time().timeIndex()), VPtr_(nullptr), @@ -294,6 +279,14 @@ Foam::fvMesh::fvMesh(const IOobject& io, const bool changers) Pout<< FUNCTION_NAME << "Constructing fvMesh from IOobject" << endl; } + // Construct changers + if (changers) + { + topoChanger_.set(fvMeshTopoChanger::New(*this).ptr()); + distributor_.set(fvMeshDistributor::New(*this).ptr()); + mover_.set(fvMeshMover::New(*this).ptr()); + } + // Check the existence of the cell volumes and read if present // and set the storage of V00 if (fileHandler().isFile(time().timePath()/"V0")) @@ -365,6 +358,9 @@ Foam::fvMesh::fvMesh fvSolution(static_cast(*this)), data(static_cast(*this)), boundary_(*this, boundaryMesh()), + topoChanger_(nullptr), + distributor_(nullptr), + mover_(nullptr), lduPtr_(nullptr), curTimeIndex_(time().timeIndex()), VPtr_(nullptr), @@ -407,6 +403,9 @@ Foam::fvMesh::fvMesh fvSolution(static_cast(*this)), data(static_cast(*this)), boundary_(*this, boundaryMesh()), + topoChanger_(nullptr), + distributor_(nullptr), + mover_(nullptr), lduPtr_(nullptr), curTimeIndex_(time().timeIndex()), VPtr_(nullptr), @@ -440,6 +439,9 @@ Foam::fvMesh::fvMesh fvSolution(static_cast(*this)), data(static_cast(*this)), boundary_(*this), + topoChanger_(nullptr), + distributor_(nullptr), + mover_(nullptr), lduPtr_(nullptr), curTimeIndex_(time().timeIndex()), VPtr_(nullptr),