diff --git a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoam.C b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoam.C index d9c073c1ed..901759ee93 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoam.C +++ b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoam.C @@ -144,7 +144,11 @@ int Foam::vtkPVFoam::setTime(int nRequest, const double requestTimes[]) if (meshPtr_) { - if (meshPtr_->readUpdate(false) != polyMesh::UNCHANGED) + if + ( + meshPtr_->readUpdate(fvMesh::stitchType::nonGeometric) + != polyMesh::UNCHANGED + ) { meshChanged_ = true; } @@ -474,7 +478,8 @@ void Foam::vtkPVFoam::updateFoamMesh() dbPtr_(), IOobject::MUST_READ ), - false + false, + fvMesh::stitchType::nonGeometric ); meshChanged_ = true; diff --git a/src/finiteVolume/fvMesh/fvMesh.C b/src/finiteVolume/fvMesh/fvMesh.C index 1a000b46db..f69f6a81af 100644 --- a/src/finiteVolume/fvMesh/fvMesh.C +++ b/src/finiteVolume/fvMesh/fvMesh.C @@ -307,14 +307,14 @@ Foam::fvMesh::fvMesh ( const IOobject& io, const bool changers, - const bool stitcher + const stitchType stitch ) : polyMesh(io), surfaceInterpolation(*this), data(static_cast(*this)), boundary_(*this, boundaryMesh()), - stitcher_(nullptr), + stitcher_(fvMeshStitcher::New(*this, changers).ptr()), topoChanger_(nullptr), distributor_(nullptr), mover_(nullptr), @@ -345,10 +345,9 @@ Foam::fvMesh::fvMesh } // Stitch or Re-stitch if necessary - if (stitcher) + if (stitch != stitchType::none) { - stitcher_.set(fvMeshStitcher::New(*this, changers).ptr()); - stitcher_->connect(false, changers, true); + stitcher_->connect(false, stitch == stitchType::geometric, true); } // Construct changers @@ -710,7 +709,10 @@ void Foam::fvMesh::reset(const fvMesh& newMesh) } -Foam::polyMesh::readUpdateState Foam::fvMesh::readUpdate(const bool changers) +Foam::polyMesh::readUpdateState Foam::fvMesh::readUpdate +( + const stitchType stitch +) { if (debug) { @@ -719,9 +721,14 @@ Foam::polyMesh::readUpdateState Foam::fvMesh::readUpdate(const bool changers) polyMesh::readUpdateState state = polyMesh::readUpdate(); - if (stitcher_.valid() && state != polyMesh::UNCHANGED) + if + ( + stitcher_.valid() + && stitch != stitchType::none + && state != polyMesh::UNCHANGED + ) { - stitcher_->disconnect(false, changers); + stitcher_->disconnect(false, stitch == stitchType::geometric); } if (state == polyMesh::TOPO_PATCH_CHANGE) @@ -761,9 +768,14 @@ Foam::polyMesh::readUpdateState Foam::fvMesh::readUpdate(const bool changers) } } - if (stitcher_.valid() && state != polyMesh::UNCHANGED) + if + ( + stitcher_.valid() + && stitch != stitchType::none + && state != polyMesh::UNCHANGED + ) { - stitcher_->connect(false, changers, true); + stitcher_->connect(false, stitch == stitchType::geometric, true); } // If the mesh has been re-stitched with different geometry, then the diff --git a/src/finiteVolume/fvMesh/fvMesh.H b/src/finiteVolume/fvMesh/fvMesh.H index 95ba073b0c..34f1b04121 100644 --- a/src/finiteVolume/fvMesh/fvMesh.H +++ b/src/finiteVolume/fvMesh/fvMesh.H @@ -100,6 +100,26 @@ class fvMesh public surfaceInterpolation, public data { +public: + + // Public data types + + //- Extent to which to stitch on read and readUpdate. By default, a + // full geometric stitch is performed. A non-geometric stitch can be + // done as an optimisation in situations when finite volume geometry + // is not needed (e.g., decomposition). Stitching can also be + // prevented altogether if that is appropriate (e.g., if the mesh is + // loaded for mapping in an un-stitched state). + enum class stitchType + { + none, + nonGeometric, + geometric + }; + + +private: + // Private Data //- Boundary mesh @@ -274,12 +294,13 @@ public: // Constructors //- Construct from IOobject - // with the option to not instantiate the mesh changers or stitcher + // with the option to not instantiate the mesh changers and the option + // to prevent some or all of the stitching explicit fvMesh ( const IOobject& io, const bool changers = true, - const bool stitcher = true + const stitchType stitch = stitchType::geometric ); //- Construct from cellShapes with boundary. @@ -340,7 +361,10 @@ public: //- Update the mesh based on the mesh files saved in time // directories - readUpdateState readUpdate(const bool changers = true); + readUpdateState readUpdate + ( + const stitchType stitch = stitchType::geometric + ); // Access diff --git a/src/fvMeshTopoChangers/meshToMesh/fvMeshTopoChangersMeshToMesh.C b/src/fvMeshTopoChangers/meshToMesh/fvMeshTopoChangersMeshToMesh.C index a9c04d1629..8645792e44 100644 --- a/src/fvMeshTopoChangers/meshToMesh/fvMeshTopoChangersMeshToMesh.C +++ b/src/fvMeshTopoChangers/meshToMesh/fvMeshTopoChangersMeshToMesh.C @@ -151,7 +151,7 @@ bool Foam::fvMeshTopoChangers::meshToMesh::update() IOobject::MUST_READ ), false, - false + fvMesh::stitchType::none ); autoPtr mapper; diff --git a/src/parallel/parallel/domainDecomposition.C b/src/parallel/parallel/domainDecomposition.C index 69a04d2b28..66f21fb5dd 100644 --- a/src/parallel/parallel/domainDecomposition.C +++ b/src/parallel/parallel/domainDecomposition.C @@ -679,10 +679,12 @@ Foam::fvMesh::readUpdateState Foam::domainDecomposition::readUpdate() validateProcs(); // Do read-update on all meshes - fvMesh::readUpdateState stat = completeMesh_->readUpdate(false); + fvMesh::readUpdateState stat = + completeMesh_->readUpdate(fvMesh::stitchType::nonGeometric); forAll(runTimes_.procTimes(), proci) { - fvMesh::readUpdateState procStat = procMeshes_[proci].readUpdate(false); + fvMesh::readUpdateState procStat = + procMeshes_[proci].readUpdate(fvMesh::stitchType::nonGeometric); if (procStat > stat) { stat = procStat;