diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/extrude2DMesh/extrude2DMesh.C b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/extrude2DMesh/extrude2DMesh.C index b9626e728b..23a0c18ab2 100644 --- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/extrude2DMesh/extrude2DMesh.C +++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/extrude2DMesh/extrude2DMesh.C @@ -142,14 +142,6 @@ void Foam::extrude2DMesh::addFrontBackPatches() patches ).ptr(); -// newPatches[frontPatchi_] = polyPatch::New -// ( -// "front", -// patchDict_, -// frontPatchi_, -// patches -// ).ptr(); - Info<< "Adding patch " << newPatches[frontPatchi_]->name() << " at index " << frontPatchi_ << " for front faces." << nl << endl; @@ -170,14 +162,6 @@ void Foam::extrude2DMesh::addFrontBackPatches() patches ).ptr(); -// newPatches[frontPatchi_] = polyPatch::New -// ( -// "back", -// patchDict_, -// backPatchi_, -// patches -// ).ptr(); - Info<< "Adding patch " << newPatches[backPatchi_]->name() << " at index " << backPatchi_ << " for back faces." << nl << endl; diff --git a/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.C b/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.C index d1a889ff73..7407eaef85 100644 --- a/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.C +++ b/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -33,25 +34,22 @@ License #include "emptyPolyPatch.H" #include "wedgePolyPatch.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { + defineTypeNameAndDebug(extrudePatchMesh, 0); +} -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(extrudePatchMesh, 0); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -extrudePatchMesh::extrudePatchMesh +Foam::extrudePatchMesh::extrudePatchMesh ( + const word& regionName, const fvMesh& mesh, - const fvPatch& patch, - const dictionary& dict, - const word regionName, - const List& regionPatches + const fvPatch& p, + const dictionary& dict ) : fvMesh @@ -68,37 +66,35 @@ extrudePatchMesh::extrudePatchMesh Zero, false ), - extrudedPatch_(patch.patch()), + extrudedPatch_(p.patch()), dict_(dict) +{} + + +Foam::extrudePatchMesh::extrudePatchMesh +( + const fvMesh& mesh, + const fvPatch& p, + const dictionary& dict, + const word& regionName, + const List& regionPatches +) +: + extrudePatchMesh(regionName, mesh, p, dict) { extrudeMesh(regionPatches); } -extrudePatchMesh::extrudePatchMesh +Foam::extrudePatchMesh::extrudePatchMesh ( const fvMesh& mesh, - const fvPatch& patch, + const fvPatch& p, const dictionary& dict, - const word regionName + const word& regionName ) : - fvMesh - ( - IOobject - ( - regionName, - mesh.facesInstance(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::NO_WRITE, - true - ), - Zero, - false - ), - extrudedPatch_(patch.patch()), - dict_(dict) + extrudePatchMesh(regionName, mesh, p, dict) { List regionPatches(3); List patchNames(regionPatches.size()); @@ -125,7 +121,7 @@ extrudePatchMesh::extrudePatchMesh forAll(regionPatches, patchi) { - dictionary& patchDict = dicts[patchi]; + dictionary& patchDict = dicts[patchi]; patchDict.set("nFaces", 0); patchDict.set("startFace", 0); @@ -136,14 +132,13 @@ extrudePatchMesh::extrudePatchMesh patchi, mesh.boundaryMesh() ).ptr(); - } extrudeMesh(regionPatches); } -void extrudePatchMesh::extrudeMesh(const List& regionPatches) +void Foam::extrudePatchMesh::extrudeMesh(const List& regionPatches) { if (this->boundaryMesh().size() == 0) { @@ -247,6 +242,7 @@ void extrudePatchMesh::extrudeMesh(const List& regionPatches) firstDisp[regionI] = model_()(regionPt, n, 1) - regionPt; } + const label nNewPatches = regionPatches.size(); // Extrude engine createShellMesh extruder @@ -255,46 +251,6 @@ void extrudePatchMesh::extrudeMesh(const List& regionPatches) pointLocalRegions, localRegionPoints ); -/* - List regionPatches(3); - List patchNames(regionPatches.size()); - List patchTypes(regionPatches.size()); - PtrList dicts(regionPatches.size()); - - forAll(dicts, patchi) - { - if (!dicts.set(patchi)) - { - dicts.set(patchi, new dictionary()); - } - } - - dicts[bottomPatchID] = dict_.subDict("bottomCoeffs"); - dicts[sidePatchID] = dict_.subDict("sideCoeffs"); - dicts[topPatchID] = dict_.subDict("topCoeffs"); - - forAll(dicts, patchi) - { - dicts[patchi].readEntry("name", patchNames[patchi]); - dicts[patchi].readEntry("type", patchTypes[patchi]); - } - - forAll(regionPatches, patchi) - { - dictionary& patchDict = dicts[patchi]; - patchDict.set("nFaces", 0); - patchDict.set("startFace", 0); - - regionPatches[patchi] = polyPatch::New - ( - patchNames[patchi], - patchDict, - patchi, - mesh.boundaryMesh() - ).ptr(); - - } -*/ this->clearOut(); this->removeFvBoundary(); this->addFvPatches(regionPatches, true); @@ -315,7 +271,7 @@ void extrudePatchMesh::extrudeMesh(const List& regionPatches) } } - polyTopoChange meshMod(regionPatches.size()); + polyTopoChange meshMod(nNewPatches); extruder.setRefinement ( @@ -343,8 +299,4 @@ void extrudePatchMesh::extrudeMesh(const List& regionPatches) } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.H b/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.H index ca394d7236..72040e91d2 100644 --- a/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.H +++ b/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -94,10 +95,7 @@ class extrudePatchMesh : public fvMesh { - -private: - - // Private data + // Private Data //- Enumeration of patch IDs enum patchID @@ -114,11 +112,20 @@ private: dictionary dict_; - // Private member functions + // Private Member Functions //- Extrude mesh using polyPatches void extrudeMesh(const List& regionPatches); + //- Construct from mesh, patch and dictionary without patches. + // Only used internally + extrudePatchMesh + ( + const word& regionName, + const fvMesh& mesh, + const fvPatch& p, + const dictionary& dict + ); public: @@ -131,20 +138,20 @@ public: //- Construct from mesh, patch and dictionary extrudePatchMesh ( - const fvMesh&, - const fvPatch&, - const dictionary&, - const word + const fvMesh& mesh, + const fvPatch& p, + const dictionary& dict, + const word& regionName ); //- Construct from mesh, patch, dictionary and new mesh // polyPatch information extrudePatchMesh ( - const fvMesh&, - const fvPatch&, - const dictionary&, - const word, + const fvMesh& mesh, + const fvPatch& p, + const dictionary& dict, + const word& regionName, const List& polyPatches ); @@ -153,8 +160,7 @@ public: virtual ~extrudePatchMesh() = default; - // Member functions - + // Member Functions // Access functions @@ -187,9 +193,9 @@ public: { return extrudedPatch_; } - }; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam