diff --git a/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.C b/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.C index fb4026f61..264a8620d 100644 --- a/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.C +++ b/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.C @@ -34,16 +34,19 @@ namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void fvBoundaryMesh::addPatches(const polyBoundaryMesh& basicBdry) +void fvBoundaryMesh::addFvPatches() { - setSize(basicBdry.size()); + const polyBoundaryMesh& bMesh = mesh_.boundaryMesh(); + + setSize(bMesh.size()); - // Set boundary patches + // Set boundary patches, using the patches added to the polyMesh + // Bug fix. HJ, 1/Mar/2018 fvPatchList& Patches = *this; forAll(Patches, patchI) { - Patches.set(patchI, fvPatch::New(basicBdry[patchI], *this)); + Patches.set(patchI, fvPatch::New(bMesh[patchI], *this)); } } @@ -55,21 +58,10 @@ fvBoundaryMesh::fvBoundaryMesh const fvMesh& m ) : - fvPatchList(0), - mesh_(m) -{} - - -fvBoundaryMesh::fvBoundaryMesh -( - const fvMesh& m, - const polyBoundaryMesh& basicBdry -) -: - fvPatchList(basicBdry.size()), + fvPatchList(m.boundaryMesh().size()), mesh_(m) { - addPatches(basicBdry); + addFvPatches(); } @@ -109,10 +101,10 @@ lduInterfacePtrsList fvBoundaryMesh::interfaces() const } -void fvBoundaryMesh::readUpdate(const polyBoundaryMesh& basicBdry) +void fvBoundaryMesh::readUpdate() { clear(); - addPatches(basicBdry); + addFvPatches(); } diff --git a/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.H b/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.H index 4fbf36543..e9e5d55f4 100644 --- a/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.H +++ b/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.H @@ -47,7 +47,7 @@ class fvMesh; class polyBoundaryMesh; /*---------------------------------------------------------------------------*\ - Class fvBoundaryMesh Declaration + Class fvBoundaryMesh Declaration \*---------------------------------------------------------------------------*/ class fvBoundaryMesh @@ -70,14 +70,14 @@ private: //- Disallow assignment void operator=(const fvBoundaryMesh&); - //- Add fvPatches corresponding to the given polyBoundaryMesh - void addPatches(const polyBoundaryMesh&); + //- Add fvPatches corresponding to the polyBoundaryMesh + void addFvPatches(); protected: //- Update boundary based on new polyBoundaryMesh - void readUpdate(const polyBoundaryMesh&); + void readUpdate(); public: @@ -87,18 +87,8 @@ public: // Constructors - //- Construct with zero size - fvBoundaryMesh - ( - const fvMesh& - ); - //- Construct from polyBoundaryMesh - fvBoundaryMesh - ( - const fvMesh&, - const polyBoundaryMesh& - ); + fvBoundaryMesh(const fvMesh&); // Destructor - default diff --git a/src/finiteVolume/fvMesh/fvMesh.C b/src/finiteVolume/fvMesh/fvMesh.C index 948e58d03..f5b87e4b1 100644 --- a/src/finiteVolume/fvMesh/fvMesh.C +++ b/src/finiteVolume/fvMesh/fvMesh.C @@ -124,7 +124,7 @@ Foam::fvMesh::fvMesh(const IOobject& io) : polyMesh(io), surfaceInterpolation(*this), - boundary_(*this, boundaryMesh()), + boundary_(*this), lduPtr_(NULL), curTimeIndex_(time().timeIndex()), VPtr_(NULL), @@ -245,6 +245,34 @@ Foam::fvMesh::fvMesh } +Foam::fvMesh::fvMesh +( + const IOobject& io, + Istream& is, + const bool syncPar +) +: + polyMesh(io, is, syncPar), + surfaceInterpolation(*this), + boundary_(*this), + lduPtr_(NULL), + curTimeIndex_(time().timeIndex()), + VPtr_(NULL), + V0Ptr_(NULL), + V00Ptr_(NULL), + SfPtr_(NULL), + magSfPtr_(NULL), + CPtr_(NULL), + CfPtr_(NULL), + phiPtr_(NULL) +{ + if (debug) + { + Info<< "Constructing fvMesh from Istream" << endl; + } +} + + Foam::fvMesh::fvMesh ( const IOobject& io, @@ -347,9 +375,9 @@ void Foam::fvMesh::addFvPatches << abort(FatalError); } - // first add polyPatches + // First add polyPatches addPatches(p, validBoundary); - boundary_.addPatches(boundaryMesh()); + boundary_.addFvPatches(); } @@ -390,7 +418,7 @@ Foam::polyMesh::readUpdateState Foam::fvMesh::readUpdate() Info << "Boundary and topological update" << endl; } - boundary_.readUpdate(boundaryMesh()); + boundary_.readUpdate(); clearOut(); diff --git a/src/finiteVolume/fvMesh/fvMesh.H b/src/finiteVolume/fvMesh/fvMesh.H index 5edf00dda..22f973efc 100644 --- a/src/finiteVolume/fvMesh/fvMesh.H +++ b/src/finiteVolume/fvMesh/fvMesh.H @@ -178,6 +178,14 @@ public: //- Construct from IOobject explicit fvMesh(const IOobject& io); + //- Construct from Istream + fvMesh + ( + const IOobject& io, + Istream& is, + const bool syncPar = true + ); + //- Construct from components without boundary. // Boundary is added using addFvPatches() member function fvMesh @@ -226,6 +234,8 @@ public: // Helpers //- Add boundary patches. Constructor helper + // Note: adding polyPatches to polyMesh patches and + // fvPatches to fvMesh void addFvPatches ( const List&,