STYLE: remove dead code, refactor constructors in extrudePatchMesh

This commit is contained in:
Mark Olesen
2020-02-21 11:13:22 +01:00
parent 585ee0fe89
commit 86fe2b7bc9
3 changed files with 52 additions and 110 deletions

View File

@ -142,14 +142,6 @@ void Foam::extrude2DMesh::addFrontBackPatches()
patches patches
).ptr(); ).ptr();
// newPatches[frontPatchi_] = polyPatch::New
// (
// "front",
// patchDict_,
// frontPatchi_,
// patches
// ).ptr();
Info<< "Adding patch " << newPatches[frontPatchi_]->name() Info<< "Adding patch " << newPatches[frontPatchi_]->name()
<< " at index " << frontPatchi_ << " at index " << frontPatchi_
<< " for front faces." << nl << endl; << " for front faces." << nl << endl;
@ -170,14 +162,6 @@ void Foam::extrude2DMesh::addFrontBackPatches()
patches patches
).ptr(); ).ptr();
// newPatches[frontPatchi_] = polyPatch::New
// (
// "back",
// patchDict_,
// backPatchi_,
// patches
// ).ptr();
Info<< "Adding patch " << newPatches[backPatchi_]->name() Info<< "Adding patch " << newPatches[backPatchi_]->name()
<< " at index " << backPatchi_ << " at index " << backPatchi_
<< " for back faces." << nl << endl; << " for back faces." << nl << endl;

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -33,25 +34,22 @@ License
#include "emptyPolyPatch.H" #include "emptyPolyPatch.H"
#include "wedgePolyPatch.H" #include "wedgePolyPatch.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(extrudePatchMesh, 0);
}
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(extrudePatchMesh, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
extrudePatchMesh::extrudePatchMesh Foam::extrudePatchMesh::extrudePatchMesh
( (
const word& regionName,
const fvMesh& mesh, const fvMesh& mesh,
const fvPatch& patch, const fvPatch& p,
const dictionary& dict, const dictionary& dict
const word regionName,
const List<polyPatch*>& regionPatches
) )
: :
fvMesh fvMesh
@ -68,37 +66,35 @@ extrudePatchMesh::extrudePatchMesh
Zero, Zero,
false false
), ),
extrudedPatch_(patch.patch()), extrudedPatch_(p.patch()),
dict_(dict) dict_(dict)
{}
Foam::extrudePatchMesh::extrudePatchMesh
(
const fvMesh& mesh,
const fvPatch& p,
const dictionary& dict,
const word& regionName,
const List<polyPatch*>& regionPatches
)
:
extrudePatchMesh(regionName, mesh, p, dict)
{ {
extrudeMesh(regionPatches); extrudeMesh(regionPatches);
} }
extrudePatchMesh::extrudePatchMesh Foam::extrudePatchMesh::extrudePatchMesh
( (
const fvMesh& mesh, const fvMesh& mesh,
const fvPatch& patch, const fvPatch& p,
const dictionary& dict, const dictionary& dict,
const word regionName const word& regionName
) )
: :
fvMesh extrudePatchMesh(regionName, mesh, p, dict)
(
IOobject
(
regionName,
mesh.facesInstance(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
true
),
Zero,
false
),
extrudedPatch_(patch.patch()),
dict_(dict)
{ {
List<polyPatch*> regionPatches(3); List<polyPatch*> regionPatches(3);
List<word> patchNames(regionPatches.size()); List<word> patchNames(regionPatches.size());
@ -125,7 +121,7 @@ extrudePatchMesh::extrudePatchMesh
forAll(regionPatches, patchi) forAll(regionPatches, patchi)
{ {
dictionary& patchDict = dicts[patchi]; dictionary& patchDict = dicts[patchi];
patchDict.set("nFaces", 0); patchDict.set("nFaces", 0);
patchDict.set("startFace", 0); patchDict.set("startFace", 0);
@ -136,14 +132,13 @@ extrudePatchMesh::extrudePatchMesh
patchi, patchi,
mesh.boundaryMesh() mesh.boundaryMesh()
).ptr(); ).ptr();
} }
extrudeMesh(regionPatches); extrudeMesh(regionPatches);
} }
void extrudePatchMesh::extrudeMesh(const List<polyPatch*>& regionPatches) void Foam::extrudePatchMesh::extrudeMesh(const List<polyPatch*>& regionPatches)
{ {
if (this->boundaryMesh().size() == 0) if (this->boundaryMesh().size() == 0)
{ {
@ -247,6 +242,7 @@ void extrudePatchMesh::extrudeMesh(const List<polyPatch*>& regionPatches)
firstDisp[regionI] = model_()(regionPt, n, 1) - regionPt; firstDisp[regionI] = model_()(regionPt, n, 1) - regionPt;
} }
const label nNewPatches = regionPatches.size();
// Extrude engine // Extrude engine
createShellMesh extruder createShellMesh extruder
@ -255,46 +251,6 @@ void extrudePatchMesh::extrudeMesh(const List<polyPatch*>& regionPatches)
pointLocalRegions, pointLocalRegions,
localRegionPoints localRegionPoints
); );
/*
List<polyPatch*> regionPatches(3);
List<word> patchNames(regionPatches.size());
List<word> patchTypes(regionPatches.size());
PtrList<dictionary> 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->clearOut();
this->removeFvBoundary(); this->removeFvBoundary();
this->addFvPatches(regionPatches, true); this->addFvPatches(regionPatches, true);
@ -315,7 +271,7 @@ void extrudePatchMesh::extrudeMesh(const List<polyPatch*>& regionPatches)
} }
} }
polyTopoChange meshMod(regionPatches.size()); polyTopoChange meshMod(nNewPatches);
extruder.setRefinement extruder.setRefinement
( (
@ -343,8 +299,4 @@ void extrudePatchMesh::extrudeMesh(const List<polyPatch*>& regionPatches)
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -94,10 +95,7 @@ class extrudePatchMesh
: :
public fvMesh public fvMesh
{ {
// Private Data
private:
// Private data
//- Enumeration of patch IDs //- Enumeration of patch IDs
enum patchID enum patchID
@ -114,11 +112,20 @@ private:
dictionary dict_; dictionary dict_;
// Private member functions // Private Member Functions
//- Extrude mesh using polyPatches //- Extrude mesh using polyPatches
void extrudeMesh(const List<polyPatch*>& regionPatches); void extrudeMesh(const List<polyPatch*>& 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: public:
@ -131,20 +138,20 @@ public:
//- Construct from mesh, patch and dictionary //- Construct from mesh, patch and dictionary
extrudePatchMesh extrudePatchMesh
( (
const fvMesh&, const fvMesh& mesh,
const fvPatch&, const fvPatch& p,
const dictionary&, const dictionary& dict,
const word const word& regionName
); );
//- Construct from mesh, patch, dictionary and new mesh //- Construct from mesh, patch, dictionary and new mesh
// polyPatch information // polyPatch information
extrudePatchMesh extrudePatchMesh
( (
const fvMesh&, const fvMesh& mesh,
const fvPatch&, const fvPatch& p,
const dictionary&, const dictionary& dict,
const word, const word& regionName,
const List<polyPatch*>& polyPatches const List<polyPatch*>& polyPatches
); );
@ -153,8 +160,7 @@ public:
virtual ~extrudePatchMesh() = default; virtual ~extrudePatchMesh() = default;
// Member functions // Member Functions
// Access functions // Access functions
@ -187,9 +193,9 @@ public:
{ {
return extrudedPatch_; return extrudedPatch_;
} }
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam