From ba416ac909f66da76bca87c2c0e86e2f6a807ec6 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Thu, 24 Aug 2023 12:10:45 +0100 Subject: [PATCH] fvMeshStitcher: Standardise mesh change hooks --- src/finiteVolume/fvMesh/fvMesh.C | 12 ++++++++++ .../fvMeshStitcher/fvMeshStitcher.C | 20 +++++++++------- .../fvMeshStitcher/fvMeshStitcher.H | 23 +++++++++++-------- 3 files changed, 37 insertions(+), 18 deletions(-) diff --git a/src/finiteVolume/fvMesh/fvMesh.C b/src/finiteVolume/fvMesh/fvMesh.C index 6091c97d0d..a0f04b45e9 100644 --- a/src/finiteVolume/fvMesh/fvMesh.C +++ b/src/finiteVolume/fvMesh/fvMesh.C @@ -1329,6 +1329,11 @@ void Foam::fvMesh::topoChange(const polyTopoChangeMap& map) const_cast(time()).functionObjects().topoChange(map); + if (stitcher_.valid()) + { + stitcher_->topoChange(map); + } + if (topoChanger_.valid()) { topoChanger_->topoChange(map); @@ -1365,6 +1370,7 @@ void Foam::fvMesh::mapMesh(const polyMeshMap& map) const_cast(time()).functionObjects().mapMesh(map); + stitcher_->mapMesh(map); topoChanger_->mapMesh(map); distributor_->mapMesh(map); mover_->mapMesh(map); @@ -1390,6 +1396,7 @@ void Foam::fvMesh::distribute(const polyDistributionMap& map) const_cast(time()).functionObjects().distribute(map); + stitcher_->distribute(map); topoChanger_->distribute(map); distributor_->distribute(map); mover_->distribute(map); @@ -1714,6 +1721,11 @@ bool Foam::fvMesh::writeObject ok = ok && V0Ptr_->write(write); } + if (stitcher_.valid()) + { + stitcher_->write(write); + } + if (topoChanger_.valid()) { topoChanger_->write(write); diff --git a/src/finiteVolume/fvMesh/fvMeshStitchers/fvMeshStitcher/fvMeshStitcher.C b/src/finiteVolume/fvMesh/fvMeshStitchers/fvMeshStitcher/fvMeshStitcher.C index 36b1086f85..a5ccd17aa2 100644 --- a/src/finiteVolume/fvMesh/fvMeshStitchers/fvMeshStitcher/fvMeshStitcher.C +++ b/src/finiteVolume/fvMesh/fvMeshStitchers/fvMeshStitcher/fvMeshStitcher.C @@ -1185,14 +1185,6 @@ bool Foam::fvMeshStitcher::stitches() const } -void Foam::fvMeshStitcher::updateMesh(const polyTopoChangeMap&) -{} - - -void Foam::fvMeshStitcher::movePoints() -{} - - bool Foam::fvMeshStitcher::disconnect ( const bool changing, @@ -1596,4 +1588,16 @@ void Foam::fvMeshStitcher::reconnect(const bool geometric) const } +void Foam::fvMeshStitcher::topoChange(const polyTopoChangeMap&) +{} + + +void Foam::fvMeshStitcher::mapMesh(const polyMeshMap&) +{} + + +void Foam::fvMeshStitcher::distribute(const polyDistributionMap&) +{} + + // ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvMeshStitchers/fvMeshStitcher/fvMeshStitcher.H b/src/finiteVolume/fvMesh/fvMeshStitchers/fvMeshStitcher/fvMeshStitcher.H index 01bd250f5b..318ba70f5e 100644 --- a/src/finiteVolume/fvMesh/fvMeshStitchers/fvMeshStitcher/fvMeshStitcher.H +++ b/src/finiteVolume/fvMesh/fvMeshStitchers/fvMeshStitcher/fvMeshStitcher.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -375,21 +375,15 @@ public: //- Does this stitcher do anything? bool stitches() const; - //- Update local data for topology changes - virtual void updateMesh(const polyTopoChangeMap&); - - //- Update local data for mesh motion - virtual void movePoints(); - //- Disconnect the mesh by removing faces from the nonConformalCyclics - virtual bool disconnect + bool disconnect ( const bool changing, const bool geometric ); //- Connect the mesh by adding faces into the nonConformalCyclics - virtual bool connect + bool connect ( const bool changing, const bool geometric, @@ -400,7 +394,16 @@ public: // in whether or not the connection is "geometric". void reconnect(const bool geometric) const; - //- Write the mover state + //- Update corresponding to the given map + virtual void topoChange(const polyTopoChangeMap&); + + //- Update from another mesh using the given map + virtual void mapMesh(const polyMeshMap&); + + //- Update corresponding to the given distribution map + virtual void distribute(const polyDistributionMap&); + + //- Write the stitcher state virtual bool write(const bool write = true) const { return true;