From af039f0eb72ee3fff7ba32bff7cae73aca9eb579 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 13 Apr 2010 16:06:57 +0200 Subject: [PATCH] ENH: add fvPatch::start() method to simplify some expressions --- .../fvMesh/fvPatches/fvPatch/fvPatch.C | 53 ++++++++----------- .../fvMesh/fvPatches/fvPatch/fvPatch.H | 10 +++- 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C index c546459875..0b42c7f6bb 100644 --- a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C +++ b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,21 +31,18 @@ License #include "volFields.H" #include "surfaceFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(fvPatch, 0); -defineRunTimeSelectionTable(fvPatch, polyPatch); -addToRunTimeSelectionTable(fvPatch, fvPatch, polyPatch); - + defineTypeNameAndDebug(fvPatch, 0); + defineRunTimeSelectionTable(fvPatch, polyPatch); + addToRunTimeSelectionTable(fvPatch, fvPatch, polyPatch); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -fvPatch::fvPatch(const polyPatch& p, const fvBoundaryMesh& bm) +Foam::fvPatch::fvPatch(const polyPatch& p, const fvBoundaryMesh& bm) : polyPatch_(p), boundaryMesh_(bm) @@ -54,19 +51,19 @@ fvPatch::fvPatch(const polyPatch& p, const fvBoundaryMesh& bm) // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -fvPatch::~fvPatch() +Foam::fvPatch::~fvPatch() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool fvPatch::constraintType(const word& pt) +bool Foam::fvPatch::constraintType(const word& pt) { return fvPatchField::patchConstructorTablePtr_->found(pt); } -wordList fvPatch::constraintTypes() +Foam::wordList Foam::fvPatch::constraintTypes() { wordList cTypes(polyPatchConstructorTablePtr_->size()); @@ -92,19 +89,19 @@ wordList fvPatch::constraintTypes() } -const unallocLabelList& fvPatch::faceCells() const +const Foam::unallocLabelList& Foam::fvPatch::faceCells() const { return polyPatch_.faceCells(); } -const vectorField& fvPatch::Cf() const +const Foam::vectorField& Foam::fvPatch::Cf() const { return boundaryMesh().mesh().Cf().boundaryField()[index()]; } -tmp fvPatch::Cn() const +Foam::tmp Foam::fvPatch::Cn() const { tmp tcc(new vectorField(size())); vectorField& cc = tcc(); @@ -123,64 +120,60 @@ tmp fvPatch::Cn() const } -tmp fvPatch::nf() const +Foam::tmp Foam::fvPatch::nf() const { return Sf()/magSf(); } -const vectorField& fvPatch::Sf() const +const Foam::vectorField& Foam::fvPatch::Sf() const { return boundaryMesh().mesh().Sf().boundaryField()[index()]; } -const scalarField& fvPatch::magSf() const +const Foam::scalarField& Foam::fvPatch::magSf() const { return boundaryMesh().mesh().magSf().boundaryField()[index()]; } -tmp fvPatch::delta() const +Foam::tmp Foam::fvPatch::delta() const { return Cf() - Cn(); } -void fvPatch::makeWeights(scalarField& w) const +void Foam::fvPatch::makeWeights(scalarField& w) const { w = 1.0; } -void fvPatch::makeDeltaCoeffs(scalarField& dc) const +void Foam::fvPatch::makeDeltaCoeffs(scalarField& dc) const { dc = 1.0/(nf() & delta()); } -void fvPatch::initMovePoints() +void Foam::fvPatch::initMovePoints() {} -void fvPatch::movePoints() +void Foam::fvPatch::movePoints() {} -const scalarField& fvPatch::deltaCoeffs() const +const Foam::scalarField& Foam::fvPatch::deltaCoeffs() const { return boundaryMesh().mesh().deltaCoeffs().boundaryField()[index()]; } -const scalarField& fvPatch::weights() const +const Foam::scalarField& Foam::fvPatch::weights() const { return boundaryMesh().mesh().weights().boundaryField()[index()]; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H index 1b57ab0601..fbadb7cdbe 100644 --- a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -151,6 +151,12 @@ public: return polyPatch_.name(); } + //- Return start label of this patch in the polyMesh face list + label start() const + { + return polyPatch_.start(); + } + //- Return size virtual label size() const { @@ -185,7 +191,7 @@ public: template const typename List::subList patchSlice(const List& l) const { - return typename List::subList(l, size(), polyPatch_.start()); + return typename List::subList(l, size(), start()); } //- Return faceCells