diff --git a/applications/solvers/finiteArea/liquidFilmFoam/liquidFilmFoam.C b/applications/solvers/finiteArea/liquidFilmFoam/liquidFilmFoam.C index 192e69872f..ba08a67a46 100644 --- a/applications/solvers/finiteArea/liquidFilmFoam/liquidFilmFoam.C +++ b/applications/solvers/finiteArea/liquidFilmFoam/liquidFilmFoam.C @@ -143,9 +143,9 @@ int main(int argc, char *argv[]) runTime.write(); } - Info<< "ExecutionTime = " - << scalar(runTime.elapsedCpuTime()) - << " s\n" << endl << endl; + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; } return 0; diff --git a/applications/solvers/finiteArea/sphereSurfactantFoam/surfactantFoam.C b/applications/solvers/finiteArea/sphereSurfactantFoam/surfactantFoam.C index e99f01b19a..408d85e8c1 100644 --- a/applications/solvers/finiteArea/sphereSurfactantFoam/surfactantFoam.C +++ b/applications/solvers/finiteArea/sphereSurfactantFoam/surfactantFoam.C @@ -74,9 +74,9 @@ int main(int argc, char *argv[]) Info<< "Total mass of surfactant: " << sum(Cs.internalField()*aMesh.S()) << endl; - Info<< "ExecutionTime = " - << scalar(runTime.elapsedCpuTime()) - << " s\n" << endl << endl; + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; } return 0; diff --git a/bin/tools/CleanFunctions b/bin/tools/CleanFunctions index 4e92ec6e15..431c52f383 100644 --- a/bin/tools/CleanFunctions +++ b/bin/tools/CleanFunctions @@ -3,7 +3,7 @@ # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation -# \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. +# \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. @@ -41,7 +41,8 @@ cleanTimeDirectories() done rm -rf \ ./[1-9]* ./-[1-9]* ./log ./log.* ./log-* ./logSummary.* \ - ./.fxLock ./*.xml ./ParaView* ./paraFoam* ./*.OpenFOAM ./*.blockMesh \ + ./.fxLock ./*.xml ./ParaView* ./paraFoam* \ + ./*.blockMesh ./*.foam ./*.OpenFOAM \ ./.setSet > /dev/null 2>&1 } @@ -149,8 +150,12 @@ cleanUcomponents() cleanFaMesh () { - rm -rf ./constant/faMesh/{faceLabels*,faBoundary*} \ - > /dev/null 2>&1 + ( + cd constant/faMesh 2>/dev/null && \ + rm -rf \ + faceLabels* faBoundary* \ + > /dev/null 2>&1 \ + ) } cleanApplication() diff --git a/src/finiteArea/Make/files b/src/finiteArea/Make/files index 9e8ffce869..ada1c980cd 100644 --- a/src/finiteArea/Make/files +++ b/src/finiteArea/Make/files @@ -6,7 +6,7 @@ faMesh/faBoundaryMesh/faBoundaryMesh.C faPatches = faMesh/faPatches $(faPatches)/faPatch/faPatch.C -$(faPatches)/faPatch/newFaPatch.C +$(faPatches)/faPatch/faPatchNew.C $(faPatches)/basic/coupled/coupledFaPatch.C $(faPatches)/constraint/empty/emptyFaPatch.C $(faPatches)/constraint/processor/processorFaPatch.C @@ -24,7 +24,6 @@ faPatchFields = fields/faPatchFields $(faPatchFields)/faPatchField/faPatchFields.C basicFaPatchFields = $(faPatchFields)/basic -$(basicFaPatchFields)/basicSymmetry/basicSymmetryFaPatchFields.C $(basicFaPatchFields)/basicSymmetry/basicSymmetryFaPatchScalarField.C $(basicFaPatchFields)/calculated/calculatedFaPatchFields.C $(basicFaPatchFields)/coupled/coupledFaPatchFields.C diff --git a/src/finiteArea/areaMesh/areaFaMesh.H b/src/finiteArea/areaMesh/areaFaMesh.H index 9899b376d1..2e506b1217 100644 --- a/src/finiteArea/areaMesh/areaFaMesh.H +++ b/src/finiteArea/areaMesh/areaFaMesh.H @@ -24,7 +24,7 @@ License along with OpenFOAM. If not, see . Class - areaMesh + Foam::areaMesh Description Mesh data needed to do the Finite Area discretisation. diff --git a/src/finiteArea/edgeMesh/edgeFaMesh.H b/src/finiteArea/edgeMesh/edgeFaMesh.H index f5c5dca635..6631f96c25 100644 --- a/src/finiteArea/edgeMesh/edgeFaMesh.H +++ b/src/finiteArea/edgeMesh/edgeFaMesh.H @@ -24,7 +24,7 @@ License along with OpenFOAM. If not, see . Class - edgeMesh + Foam::edgeMesh Description Mesh data needed to do the Finite Area discretisation. diff --git a/src/finiteArea/faMatrices/faMatrices.H b/src/finiteArea/faMatrices/faMatrices.H index 30d12db5db..42368b28ba 100644 --- a/src/finiteArea/faMatrices/faMatrices.H +++ b/src/finiteArea/faMatrices/faMatrices.H @@ -24,7 +24,7 @@ License along with OpenFOAM. If not, see . Class - faMatrix + Foam::faMatrix Description A special matrix type and solver, designed for finite area diff --git a/src/finiteArea/faMatrices/faMatrix/faMatrix.C b/src/finiteArea/faMatrices/faMatrix/faMatrix.C index 208a1b72ed..0e7040f453 100644 --- a/src/finiteArea/faMatrices/faMatrix/faMatrix.C +++ b/src/finiteArea/faMatrices/faMatrix/faMatrix.C @@ -23,27 +23,19 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Description - Finite-Area matrix - \*---------------------------------------------------------------------------*/ #include "areaFields.H" #include "edgeFields.H" #include "calculatedFaPatchFields.H" #include "zeroGradientFaPatchFields.H" -#include "coupledFaPatchFields.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ +#include "demandDrivenData.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template template -void faMatrix::addToInternalField +void Foam::faMatrix::addToInternalField ( const labelUList& addr, const Field& pf, @@ -52,11 +44,8 @@ void faMatrix::addToInternalField { if (addr.size() != pf.size()) { - FatalErrorIn - ( - "faMatrix::addToInternalField(const labelUList&, " - "const Field&, Field&)" - ) << "sizes of addressing and field are different" + FatalErrorInFunction + << "sizes of addressing and field are different" << abort(FatalError); } @@ -69,10 +58,10 @@ void faMatrix::addToInternalField template template -void faMatrix::addToInternalField +void Foam::faMatrix::addToInternalField ( const labelUList& addr, - const tmp >& tpf, + const tmp>& tpf, Field& intf ) const { @@ -83,7 +72,7 @@ void faMatrix::addToInternalField template template -void faMatrix::subtractFromInternalField +void Foam::faMatrix::subtractFromInternalField ( const labelUList& addr, const Field& pf, @@ -92,11 +81,8 @@ void faMatrix::subtractFromInternalField { if (addr.size() != pf.size()) { - FatalErrorIn - ( - "faMatrix::addToInternalField(const labelUList&, " - "const Field&, Field&)" - ) << "sizes of addressing and field are different" + FatalErrorInFunction + << "sizes of addressing and field are different" << abort(FatalError); } @@ -109,10 +95,10 @@ void faMatrix::subtractFromInternalField template template -void faMatrix::subtractFromInternalField +void Foam::faMatrix::subtractFromInternalField ( const labelUList& addr, - const tmp >& tpf, + const tmp>& tpf, Field& intf ) const { @@ -122,7 +108,7 @@ void faMatrix::subtractFromInternalField template -void faMatrix::addBoundaryDiag +void Foam::faMatrix::addBoundaryDiag ( scalarField& diag, const direction solveCmpt @@ -141,7 +127,7 @@ void faMatrix::addBoundaryDiag template -void faMatrix::addCmptAvBoundaryDiag(scalarField& diag) const +void Foam::faMatrix::addCmptAvBoundaryDiag(scalarField& diag) const { forAll(internalCoeffs_, patchI) { @@ -156,7 +142,7 @@ void faMatrix::addCmptAvBoundaryDiag(scalarField& diag) const template -void faMatrix::addBoundarySource +void Foam::faMatrix::addBoundarySource ( Field& source, const bool couples @@ -173,7 +159,7 @@ void faMatrix::addBoundarySource } else if (couples) { - tmp > tpnf = ptf.patchNeighbourField(); + tmp> tpnf = ptf.patchNeighbourField(); const Field& pnf = tpnf(); const labelUList& addr = lduAddr().patchAddr(patchI); @@ -190,7 +176,7 @@ void faMatrix::addBoundarySource // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // template -faMatrix::faMatrix +Foam::faMatrix::faMatrix ( const GeometricField& psi, const dimensionSet& ds @@ -202,18 +188,14 @@ faMatrix::faMatrix source_(psi.size(), pTraits::zero), internalCoeffs_(psi.mesh().boundary().size()), boundaryCoeffs_(psi.mesh().boundary().size()), - faceFluxCorrectionPtr_(NULL) + faceFluxCorrectionPtr_(nullptr) { - if (debug) - { - Info<< "faMatrix(const GeometricField&," - " const dimensionSet&) : " - "constructing faMatrix for field " << psi_.name() - << endl; - } + DebugInFunction + << "constructing faMatrix for field " << psi_.name() + << endl; // Initialise coupling coefficients - forAll (psi.mesh().boundary(), patchI) + forAll(psi.mesh().boundary(), patchI) { internalCoeffs_.set ( @@ -247,7 +229,7 @@ faMatrix::faMatrix template -faMatrix::faMatrix(const faMatrix& fam) +Foam::faMatrix::faMatrix(const faMatrix& fam) : refCount(), lduMatrix(fam), @@ -256,14 +238,11 @@ faMatrix::faMatrix(const faMatrix& fam) source_(fam.source_), internalCoeffs_(fam.internalCoeffs_), boundaryCoeffs_(fam.boundaryCoeffs_), - faceFluxCorrectionPtr_(NULL) + faceFluxCorrectionPtr_(nullptr) { - if (debug) - { - Info<< "faMatrix::faMatrix(const faMatrix&) : " - << "copying faMatrix for field " << psi_.name() - << endl; - } + DebugInFunction + << "copying faMatrix for field " << psi_.name() + << endl; if (fam.faceFluxCorrectionPtr_) { @@ -277,7 +256,7 @@ faMatrix::faMatrix(const faMatrix& fam) template -faMatrix::faMatrix +Foam::faMatrix::faMatrix ( const GeometricField& psi, Istream& is @@ -289,18 +268,14 @@ faMatrix::faMatrix source_(is), internalCoeffs_(psi.mesh().boundary().size()), boundaryCoeffs_(psi.mesh().boundary().size()), - faceFluxCorrectionPtr_(NULL) + faceFluxCorrectionPtr_(nullptr) { - if (debug) - { - Info<< "faMatrix(const GeometricField&," - " Istream&) : " - "constructing faMatrix for field " << psi_.name() - << endl; - } + DebugInFunction + << "constructing faMatrix for field " << psi_.name() + << endl; // Initialise coupling coefficients - forAll (psi.mesh().boundary(), patchI) + forAll(psi.mesh().boundary(), patchI) { internalCoeffs_.set ( @@ -327,28 +302,20 @@ faMatrix::faMatrix template -faMatrix::~faMatrix() +Foam::faMatrix::~faMatrix() { - if (debug) - { - Info<< "faMatrix::~faMatrix() : " - << "destroying faMatrix for field " << psi_.name() - << endl; - } + DebugInFunction + << "destroying faMatrix for field " << psi_.name() + << endl; - if (faceFluxCorrectionPtr_) - { - delete faceFluxCorrectionPtr_; - } + deleteDemandDrivenData(faceFluxCorrectionPtr_); } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -// Set solution in given faces and eliminate corresponding -// equations from the matrix template -void faMatrix::setValues +void Foam::faMatrix::setValues ( const labelUList& faceLabels, const UList& values @@ -357,9 +324,9 @@ void faMatrix::setValues const faMesh& mesh = psi_.mesh(); // Record face labels of eliminated equations - forAll (faceLabels, i) + for (const label i : faceLabels) { - this->eliminatedEqns().insert(faceLabels[i]); + this->eliminatedEqns().insert(i); } const labelListList& edges = mesh.patch().faceEdges(); @@ -441,9 +408,8 @@ void faMatrix::setValues } -// Set reference level for solution template -void faMatrix::setReference +void Foam::faMatrix::setReference ( const label facei, const Type& value @@ -461,7 +427,7 @@ void faMatrix::setReference template -void faMatrix::relax(const scalar alpha) +void Foam::faMatrix::relax(const scalar alpha) { if (alpha <= 0) { @@ -551,7 +517,7 @@ void faMatrix::relax(const scalar alpha) template -void faMatrix::relax() +void Foam::faMatrix::relax() { if (psi_.mesh().solutionDict().relaxEquation(psi_.name())) { @@ -559,18 +525,15 @@ void faMatrix::relax() } else { - if (debug) - { - InfoIn("void faMatrix::relax()") - << "Relaxation factor for field " << psi_.name() - << " not found. Relaxation will not be used." << endl; - } + DebugInFunction + << "Relaxation factor for field " << psi_.name() + << " not found. Relaxation will not be used." << endl; } } template -tmp faMatrix::D() const +Foam::tmp Foam::faMatrix::D() const { tmp tdiag(new scalarField(diag())); addCmptAvBoundaryDiag(tdiag.ref()); @@ -579,7 +542,7 @@ tmp faMatrix::D() const template -tmp faMatrix::A() const +Foam::tmp Foam::faMatrix::A() const { tmp tAphi ( @@ -605,9 +568,10 @@ tmp faMatrix::A() const template -tmp > faMatrix::H() const +Foam::tmp> +Foam::faMatrix::H() const { - tmp > tHphi + tmp> tHphi ( new GeometricField ( @@ -625,7 +589,7 @@ tmp > faMatrix::H() const GeometricField& Hphi = tHphi.ref(); // Loop over field components - for (direction cmpt=0; cmpt > faMatrix::H() const template -tmp > faMatrix:: -flux() const +Foam::tmp> +Foam::faMatrix::flux() const { if (!psi_.mesh().schemesDict().fluxRequired(psi_.name())) { - FatalErrorIn("faMatrix::flux()") + FatalErrorInFunction << "flux requested but " << psi_.name() << " not specified in the fluxRequired sub-dictionary of faSchemes" << abort(FatalError); } // construct GeometricField - tmp > tfieldFlux + tmp> tfieldFlux ( new GeometricField ( @@ -677,7 +641,7 @@ flux() const GeometricField& fieldFlux = tfieldFlux.ref(); - for (direction cmpt=0; cmpt::nComponents; cmpt++) + for (direction cmpt=0; cmpt::nComponents; ++cmpt) { fieldFlux.primitiveFieldRef().replace ( @@ -731,18 +695,18 @@ flux() const // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template -void faMatrix::operator=(const faMatrix& famv) +void Foam::faMatrix::operator=(const faMatrix& famv) { if (this == &famv) { - FatalErrorIn("faMatrix::operator=(const faMatrix&)") + FatalErrorInFunction << "attempted to assignment to self" << abort(FatalError); } if (&psi_ != &(famv.psi_)) { - FatalErrorIn("faMatrix::operator=(const faMatrix&)") + FatalErrorInFunction << "different fields" << abort(FatalError); } @@ -766,7 +730,7 @@ void faMatrix::operator=(const faMatrix& famv) template -void faMatrix::operator=(const tmp >& tfamv) +void Foam::faMatrix::operator=(const tmp>& tfamv) { operator=(tfamv()); tfamv.clear(); @@ -774,7 +738,7 @@ void faMatrix::operator=(const tmp >& tfamv) template -void faMatrix::negate() +void Foam::faMatrix::negate() { lduMatrix::negate(); source_.negate(); @@ -789,7 +753,7 @@ void faMatrix::negate() template -void faMatrix::operator+=(const faMatrix& famv) +void Foam::faMatrix::operator+=(const faMatrix& famv) { checkMethod(*this, famv, "+="); @@ -815,7 +779,7 @@ void faMatrix::operator+=(const faMatrix& famv) template -void faMatrix::operator+=(const tmp >& tfamv) +void Foam::faMatrix::operator+=(const tmp>& tfamv) { operator+=(tfamv()); tfamv.clear(); @@ -823,7 +787,7 @@ void faMatrix::operator+=(const tmp >& tfamv) template -void faMatrix::operator-=(const faMatrix& famv) +void Foam::faMatrix::operator-=(const faMatrix& famv) { checkMethod(*this, famv, "+="); @@ -847,7 +811,7 @@ void faMatrix::operator-=(const faMatrix& famv) template -void faMatrix::operator-=(const tmp >& tfamv) +void Foam::faMatrix::operator-=(const tmp>& tfamv) { operator-=(tfamv()); tfamv.clear(); @@ -855,7 +819,7 @@ void faMatrix::operator-=(const tmp >& tfamv) template -void faMatrix::operator+= +void Foam::faMatrix::operator+= ( const GeometricField& su ) @@ -866,9 +830,9 @@ void faMatrix::operator+= template -void faMatrix::operator+= +void Foam::faMatrix::operator+= ( - const tmp >& tsu + const tmp>& tsu ) { operator+=(tsu()); @@ -877,7 +841,7 @@ void faMatrix::operator+= template -void faMatrix::operator-= +void Foam::faMatrix::operator-= ( const GeometricField& su ) @@ -888,9 +852,9 @@ void faMatrix::operator-= template -void faMatrix::operator-= +void Foam::faMatrix::operator-= ( - const tmp >& tsu + const tmp>& tsu ) { operator-=(tsu()); @@ -899,7 +863,7 @@ void faMatrix::operator-= template -void faMatrix::operator+= +void Foam::faMatrix::operator+= ( const dimensioned& su ) @@ -909,7 +873,7 @@ void faMatrix::operator+= template -void faMatrix::operator-= +void Foam::faMatrix::operator-= ( const dimensioned& su ) @@ -919,7 +883,7 @@ void faMatrix::operator-= template -void faMatrix::operator*= +void Foam::faMatrix::operator*= ( const areaScalarField& vsf ) @@ -937,7 +901,7 @@ void faMatrix::operator*= if (faceFluxCorrectionPtr_) { - FatalErrorIn("faMatrix::operator*=(const tmp&)") + FatalErrorInFunction << "cannot scale a matrix containing a faceFluxCorrection" << abort(FatalError); } @@ -945,7 +909,7 @@ void faMatrix::operator*= template -void faMatrix::operator*= +void Foam::faMatrix::operator*= ( const tmp& tvsf ) @@ -956,7 +920,7 @@ void faMatrix::operator*= template -void faMatrix::operator*= +void Foam::faMatrix::operator*= ( const dimensioned& ds ) @@ -977,7 +941,7 @@ void faMatrix::operator*= // * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // template -void checkMethod +void Foam::checkMethod ( const faMatrix& fam1, const faMatrix& fam2, @@ -986,10 +950,8 @@ void checkMethod { if (&fam1.psi() != &fam2.psi()) { - FatalErrorIn - ( - "checkMethod(const faMatrix&, const faMatrix&)" - ) << "incompatible fields for operation " + FatalErrorInFunction + << "incompatible fields for operation " << endl << " " << "[" << fam1.psi().name() << "] " << op @@ -999,10 +961,8 @@ void checkMethod if (dimensionSet::debug && fam1.dimensions() != fam2.dimensions()) { - FatalErrorIn - ( - "checkMethod(const faMatrix&, const faMatrix&)" - ) << "incompatible dimensions for operation " + FatalErrorInFunction + << "incompatible dimensions for operation " << endl << " " << "[" << fam1.psi().name() << fam1.dimensions()/dimArea << " ] " << op @@ -1013,7 +973,7 @@ void checkMethod template -void checkMethod +void Foam::checkMethod ( const faMatrix& fam, const GeometricField& vf, @@ -1022,11 +982,8 @@ void checkMethod { if (dimensionSet::debug && fam.dimensions()/dimArea != vf.dimensions()) { - FatalErrorIn - ( - "checkMethod(const faMatrix&, const GeometricField&)" - ) << "incompatible dimensions for operation " + FatalErrorInFunction + << "incompatible dimensions for operation " << endl << " " << "[" << fam.psi().name() << fam.dimensions()/dimArea << " ] " << op @@ -1037,7 +994,7 @@ void checkMethod template -void checkMethod +void Foam::checkMethod ( const faMatrix& fam, const dimensioned& dt, @@ -1046,10 +1003,8 @@ void checkMethod { if (dimensionSet::debug && fam.dimensions()/dimArea != dt.dimensions()) { - FatalErrorIn - ( - "checkMethod(const faMatrix&, const dimensioned&)" - ) << "incompatible dimensions for operation " + FatalErrorInFunction + << "incompatible dimensions for operation " << endl << " " << "[" << fam.psi().name() << fam.dimensions()/dimArea << " ] " << op @@ -1060,7 +1015,7 @@ void checkMethod template -SolverPerformance solve +Foam::SolverPerformance Foam::solve ( faMatrix& fam, Istream& solverControls @@ -1069,10 +1024,11 @@ SolverPerformance solve return fam.solve(solverControls); } + template -SolverPerformance solve +Foam::SolverPerformance Foam::solve ( - const tmp >& tfam, + const tmp>& tfam, Istream& solverControls ) { @@ -1085,13 +1041,14 @@ SolverPerformance solve template -SolverPerformance solve(faMatrix& fam) +Foam::SolverPerformance Foam::solve(faMatrix& fam) { return fam.solve(); } + template -SolverPerformance solve(const tmp >& tfam) +Foam::SolverPerformance Foam::solve(const tmp>& tfam) { SolverPerformance solverPerf = const_cast&>(tfam()).solve(); @@ -1104,56 +1061,56 @@ SolverPerformance solve(const tmp >& tfam) // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // template -tmp > operator+ +Foam::tmp> Foam::operator+ ( const faMatrix& A, const faMatrix& B ) { checkMethod(A, B, "+"); - tmp > tC(new faMatrix(A)); + tmp> tC(new faMatrix(A)); tC.ref() += B; return tC; } template -tmp > operator+ +Foam::tmp> Foam::operator+ ( - const tmp >& tA, + const tmp>& tA, const faMatrix& B ) { checkMethod(tA(), B, "+"); - tmp > tC(tA.ptr()); + tmp> tC(tA.ptr()); tC.ref() += B; return tC; } template -tmp > operator+ +Foam::tmp> Foam::operator+ ( const faMatrix& A, - const tmp >& tB + const tmp>& tB ) { checkMethod(A, tB(), "+"); - tmp > tC(tB.ptr()); + tmp> tC(tB.ptr()); tC.ref() += A; return tC; } template -tmp > operator+ +Foam::tmp> Foam::operator+ ( - const tmp >& tA, - const tmp >& tB + const tmp>& tA, + const tmp>& tB ) { checkMethod(tA(), tB(), "+"); - tmp > tC(tA.ptr()); + tmp> tC(tA.ptr()); tC.ref() += tB(); tB.clear(); return tC; @@ -1161,66 +1118,66 @@ tmp > operator+ template -tmp > operator- +Foam::tmp> Foam::operator- ( const faMatrix& A ) { - tmp > tC(new faMatrix(A)); + tmp> tC(new faMatrix(A)); tC.ref().negate(); return tC; } template -tmp > operator- +Foam::tmp> Foam::operator- ( - const tmp >& tA + const tmp>& tA ) { - tmp > tC(tA.ptr()); + tmp> tC(tA.ptr()); tC.ref().negate(); return tC; } template -tmp > operator- +Foam::tmp> Foam::operator- ( const faMatrix& A, const faMatrix& B ) { checkMethod(A, B, "-"); - tmp > tC(new faMatrix(A)); + tmp> tC(new faMatrix(A)); tC.ref() -= B; return tC; } template -tmp > operator- +Foam::tmp> Foam::operator- ( - const tmp >& tA, + const tmp>& tA, const faMatrix& B ) { checkMethod(tA(), B, "-"); - tmp > tC(tA.ptr()); + tmp> tC(tA.ptr()); tC.ref() -= B; return tC; } template -tmp > operator- +Foam::tmp> Foam::operator- ( const faMatrix& A, - const tmp >& tB + const tmp>& tB ) { checkMethod(A, tB(), "-"); - tmp > tC(tB.ptr()); + tmp> tC(tB.ptr()); tC.ref() -= A; tC.ref().negate(); return tC; @@ -1228,14 +1185,14 @@ tmp > operator- template -tmp > operator- +Foam::tmp> Foam::operator- ( - const tmp >& tA, - const tmp >& tB + const tmp>& tA, + const tmp>& tB ) { checkMethod(tA(), tB(), "-"); - tmp > tC(tA.ptr()); + tmp> tC(tA.ptr()); tC.ref() -= tB(); tB.clear(); return tC; @@ -1243,7 +1200,7 @@ tmp > operator- template -tmp > operator== +Foam::tmp> Foam::operator== ( const faMatrix& A, const faMatrix& B @@ -1255,9 +1212,9 @@ tmp > operator== template -tmp > operator== +Foam::tmp> Foam::operator== ( - const tmp >& tA, + const tmp>& tA, const faMatrix& B ) { @@ -1267,10 +1224,10 @@ tmp > operator== template -tmp > operator== +Foam::tmp> Foam::operator== ( const faMatrix& A, - const tmp >& tB + const tmp>& tB ) { checkMethod(A, tB(), "=="); @@ -1279,10 +1236,10 @@ tmp > operator== template -tmp > operator== +Foam::tmp> Foam::operator== ( - const tmp >& tA, - const tmp >& tB + const tmp>& tA, + const tmp>& tB ) { checkMethod(tA(), tB(), "=="); @@ -1291,40 +1248,42 @@ tmp > operator== template -tmp > operator+ +Foam::tmp> Foam::operator+ ( const faMatrix& A, const GeometricField& su ) { checkMethod(A, su, "+"); - tmp > tC(new faMatrix(A)); + tmp> tC(new faMatrix(A)); tC.ref().source() -= su.mesh().S()*su.internalField(); return tC; } + template -tmp > operator+ +Foam::tmp> Foam::operator+ ( - const tmp >& tA, + const tmp>& tA, const GeometricField& su ) { checkMethod(tA(), su, "+"); - tmp > tC(tA.ptr()); + tmp> tC(tA.ptr()); tC.ref().source() -= su.mesh().S()*su.internalField(); return tC; } + template -tmp > operator+ +Foam::tmp> Foam::operator+ ( const faMatrix& A, - const tmp >& tsu + const tmp>& tsu ) { checkMethod(A, tsu(), "+"); - tmp > tC(new faMatrix(A)); + tmp> tC(new faMatrix(A)); tC.ref().source() -= tsu().mesh().S()*tsu().internalField(); tsu.clear(); return tC; @@ -1332,68 +1291,72 @@ tmp > operator+ template -tmp > operator+ +Foam::tmp> Foam::operator+ ( - const tmp >& tA, - const tmp >& tsu + const tmp>& tA, + const tmp>& tsu ) { checkMethod(tA(), tsu(), "+"); - tmp > tC(tA.ptr()); + tmp> tC(tA.ptr()); tC.ref().source() -= tsu().mesh().S()*tsu().internalField(); tsu.clear(); return tC; } + template -tmp > operator+ +Foam::tmp> Foam::operator+ ( const GeometricField& su, const faMatrix& A ) { checkMethod(A, su, "+"); - tmp > tC(new faMatrix(A)); + tmp> tC(new faMatrix(A)); tC.ref().source() -= su.mesh().S()*su.internalField(); return tC; } + template -tmp > operator+ +Foam::tmp> Foam::operator+ ( const GeometricField& su, - const tmp >& tA + const tmp>& tA ) { checkMethod(tA(), su, "+"); - tmp > tC(tA.ptr()); + tmp> tC(tA.ptr()); tC.ref().source() -= su.mesh().S()*su.internalField(); return tC; } + template -tmp > operator+ +Foam::tmp> Foam::operator+ ( - const tmp >& tsu, + const tmp>& tsu, const faMatrix& A ) { checkMethod(A, tsu(), "+"); - tmp > tC(new faMatrix(A)); + tmp> tC(new faMatrix(A)); tC.ref().source() -= tsu().mesh().S()*tsu().internalField(); tsu.clear(); return tC; } + template -tmp > operator+ +Foam::tmp> Foam::operator+ ( - const tmp >& tsu, - const tmp >& tA + const tmp>& tsu, + const tmp>& tA ) { checkMethod(tA(), tsu(), "+"); - tmp > tC(tA.ptr()); + tmp> tC(tA.ptr()); tC.ref().source() -= tsu().mesh().S()*tsu().internalField(); tsu.clear(); return tC; @@ -1401,54 +1364,42 @@ tmp > operator+ template -tmp > operator- +Foam::tmp> Foam::operator- ( const faMatrix& A, const GeometricField& su ) { checkMethod(A, su, "-"); - tmp > tC(new faMatrix(A)); + tmp> tC(new faMatrix(A)); tC.ref().source() += su.mesh().S()*su.internalField(); return tC; } + template -tmp > operator- +Foam::tmp> Foam::operator- ( - const tmp >& tA, + const tmp>& tA, const GeometricField& su ) { checkMethod(tA(), su, "-"); - tmp > tC(tA.ptr()); + tmp> tC(tA.ptr()); tC.ref().source() += su.mesh().S()*su.internalField(); return tC; } + template -tmp > operator- +Foam::tmp> Foam::operator- ( const faMatrix& A, - const tmp >& tsu + const tmp>& tsu ) { checkMethod(A, tsu(), "-"); - tmp > tC(new faMatrix(A)); - tC.ref().source() += tsu().mesh().S()*tsu().internalField(); - tsu.clear(); - return tC; -} - -template -tmp > operator- -( - const tmp >& tA, - const tmp >& tsu -) -{ - checkMethod(tA(), tsu(), "-"); - tmp > tC(tA.ptr()); + tmp> tC(new faMatrix(A)); tC.ref().source() += tsu().mesh().S()*tsu().internalField(); tsu.clear(); return tC; @@ -1456,14 +1407,29 @@ tmp > operator- template -tmp > operator- +Foam::tmp> Foam::operator- +( + const tmp>& tA, + const tmp>& tsu +) +{ + checkMethod(tA(), tsu(), "-"); + tmp> tC(tA.ptr()); + tC.ref().source() += tsu().mesh().S()*tsu().internalField(); + tsu.clear(); + return tC; +} + + +template +Foam::tmp> Foam::operator- ( const GeometricField& su, const faMatrix& A ) { checkMethod(A, su, "-"); - tmp > tC(new faMatrix(A)); + tmp> tC(new faMatrix(A)); tC.ref().negate(); tC.ref().source() -= su.mesh().S()*su.internalField(); return tC; @@ -1471,28 +1437,29 @@ tmp > operator- template -tmp > operator- +Foam::tmp> Foam::operator- ( const GeometricField& su, - const tmp >& tA + const tmp>& tA ) { checkMethod(tA(), su, "-"); - tmp > tC(tA.ptr()); + tmp> tC(tA.ptr()); tC.ref().negate(); tC.ref().source() -= su.mesh().S()*su.internalField(); return tC; } + template -tmp > operator- +Foam::tmp> Foam::operator- ( - const tmp >& tsu, + const tmp>& tsu, const faMatrix& A ) { checkMethod(A, tsu(), "-"); - tmp > tC(new faMatrix(A)); + tmp> tC(new faMatrix(A)); tC.ref().negate(); tC.ref().source() -= tsu().mesh().S()*tsu().internalField(); tsu.clear(); @@ -1501,14 +1468,14 @@ tmp > operator- template -tmp > operator- +Foam::tmp> Foam::operator- ( - const tmp >& tsu, - const tmp >& tA + const tmp>& tsu, + const tmp>& tA ) { checkMethod(tA(), tsu(), "-"); - tmp > tC(tA.ptr()); + tmp> tC(tA.ptr()); tC.ref().negate(); tC.ref().source() -= tsu().mesh().S()*tsu().internalField(); tsu.clear(); @@ -1517,98 +1484,98 @@ tmp > operator- template -tmp > operator+ +Foam::tmp> Foam::operator+ ( const faMatrix& A, const dimensioned& su ) { checkMethod(A, su, "+"); - tmp > tC(new faMatrix(A)); + tmp> tC(new faMatrix(A)); tC.ref().source() -= su.value()*A.psi().mesh().S(); return tC; } template -tmp > operator+ +Foam::tmp> Foam::operator+ ( - const tmp >& tA, + const tmp>& tA, const dimensioned& su ) { checkMethod(tA(), su, "+"); - tmp > tC(tA.ptr()); + tmp> tC(tA.ptr()); tC.ref().source() -= su.value()*tC().psi().mesh().S(); return tC; } template -tmp > operator+ +Foam::tmp> Foam::operator+ ( const dimensioned& su, const faMatrix& A ) { checkMethod(A, su, "+"); - tmp > tC(new faMatrix(A)); + tmp> tC(new faMatrix(A)); tC.ref().source() -= su.value()*A.psi().mesh().S(); return tC; } template -tmp > operator+ +Foam::tmp> Foam::operator+ ( const dimensioned& su, - const tmp >& tA + const tmp>& tA ) { checkMethod(tA(), su, "+"); - tmp > tC(tA.ptr()); + tmp> tC(tA.ptr()); tC.ref().source() -= su.value()*tC().psi().mesh().S(); return tC; } template -tmp > operator- +Foam::tmp> Foam::operator- ( const faMatrix& A, const dimensioned& su ) { checkMethod(A, su, "-"); - tmp > tC(new faMatrix(A)); + tmp> tC(new faMatrix(A)); tC.ref().source() += su.value()*tC().psi().mesh().S(); return tC; } template -tmp > operator- +Foam::tmp> Foam::operator- ( - const tmp >& tA, + const tmp>& tA, const dimensioned& su ) { checkMethod(tA(), su, "-"); - tmp > tC(tA.ptr()); + tmp> tC(tA.ptr()); tC.ref().source() += su.value()*tC().psi().mesh().S(); return tC; } template -tmp > operator- +Foam::tmp> Foam::operator- ( const dimensioned& su, const faMatrix& A ) { checkMethod(A, su, "-"); - tmp > tC(new faMatrix(A)); + tmp> tC(new faMatrix(A)); tC.ref().negate(); tC.ref().source() -= su.value()*A.psi().mesh().S(); return tC; @@ -1616,14 +1583,14 @@ tmp > operator- template -tmp > operator- +Foam::tmp> Foam::operator- ( const dimensioned& su, - const tmp >& tA + const tmp>& tA ) { checkMethod(tA(), su, "-"); - tmp > tC(tA.ptr()); + tmp> tC(tA.ptr()); tC.ref().negate(); tC.ref().source() -= su.value()*tC().psi().mesh().S(); return tC; @@ -1631,54 +1598,57 @@ tmp > operator- template -tmp > operator== +Foam::tmp> Foam::operator== ( const faMatrix& A, const GeometricField& su ) { checkMethod(A, su, "=="); - tmp > tC(new faMatrix(A)); + tmp> tC(new faMatrix(A)); tC.ref().source() += su.mesh().S()*su.internalField(); return tC; } + template -tmp > operator== +Foam::tmp> Foam::operator== ( - const tmp >& tA, + const tmp>& tA, const GeometricField& su ) { checkMethod(tA(), su, "=="); - tmp > tC(tA.ptr()); + tmp> tC(tA.ptr()); tC.ref().source() += su.mesh().S()*su.internalField(); return tC; } + template -tmp > operator== +Foam::tmp> Foam::operator== ( const faMatrix& A, - const tmp >& tsu + const tmp>& tsu ) { checkMethod(A, tsu(), "=="); - tmp > tC(new faMatrix(A)); + tmp> tC(new faMatrix(A)); tC.ref().source() += tsu().mesh().S()*tsu().internalField(); tsu.clear(); return tC; } + template -tmp > operator== +Foam::tmp> Foam::operator== ( - const tmp >& tA, - const tmp >& tsu + const tmp>& tA, + const tmp>& tsu ) { checkMethod(tA(), tsu(), "=="); - tmp > tC(tA.ptr()); + tmp> tC(tA.ptr()); tC.ref().source() += tsu().mesh().S()*tsu().internalField(); tsu.clear(); return tC; @@ -1686,103 +1656,106 @@ tmp > operator== template -tmp > operator== +Foam::tmp> Foam::operator== ( const faMatrix& A, const dimensioned& su ) { checkMethod(A, su, "=="); - tmp > tC(new faMatrix(A)); + tmp> tC(new faMatrix(A)); tC.ref().source() += A.psi().mesh().S()*su.value(); return tC; } template -tmp > operator== +Foam::tmp> Foam::operator== ( - const tmp >& tA, + const tmp>& tA, const dimensioned& su ) { checkMethod(tA(), su, "=="); - tmp > tC(tA.ptr()); + tmp> tC(tA.ptr()); tC.ref().source() += tC().psi().mesh().S()*su.value(); return tC; } template -tmp > operator* +Foam::tmp> Foam::operator* ( const areaScalarField& vsf, const faMatrix& A ) { - tmp > tC(new faMatrix(A)); + tmp> tC(new faMatrix(A)); tC.ref() *= vsf; return tC; } + template -tmp > operator* +Foam::tmp> Foam::operator* ( const tmp& tvsf, const faMatrix& A ) { - tmp > tC(new faMatrix(A)); - tC.ref() *= tvsf; - return tC; -} - -template -tmp > operator* -( - const areaScalarField& vsf, - const tmp >& tA -) -{ - tmp > tC(tA.ptr()); - tC.ref() *= vsf; - return tC; -} - -template -tmp > operator* -( - const tmp& tvsf, - const tmp >& tA -) -{ - tmp > tC(tA.ptr()); + tmp> tC(new faMatrix(A)); tC.ref() *= tvsf; return tC; } template -tmp > operator* +Foam::tmp> Foam::operator* +( + const areaScalarField& vsf, + const tmp>& tA +) +{ + tmp> tC(tA.ptr()); + tC.ref() *= vsf; + return tC; +} + + +template +Foam::tmp> Foam::operator* +( + const tmp& tvsf, + const tmp>& tA +) +{ + tmp> tC(tA.ptr()); + tC.ref() *= tvsf; + return tC; +} + + +template +Foam::tmp> Foam::operator* ( const dimensioned& ds, const faMatrix& A ) { - tmp > tC(new faMatrix(A)); + tmp> tC(new faMatrix(A)); tC.ref() *= ds; return tC; } template -tmp > operator* +Foam::tmp> Foam::operator* ( const dimensioned& ds, - const tmp >& tA + const tmp>& tA ) { - tmp > tC(tA.ptr()); + tmp> tC(tA.ptr()); tC.ref() *= ds; return tC; } @@ -1791,7 +1764,7 @@ tmp > operator* // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // template -Ostream& operator<<(Ostream& os, const faMatrix& fam) +Foam::Ostream& Foam::operator<<(Ostream& os, const faMatrix& fam) { os << static_cast(fam) << nl << fam.dimensions_ << nl @@ -1799,16 +1772,12 @@ Ostream& operator<<(Ostream& os, const faMatrix& fam) << fam.internalCoeffs_ << nl << fam.boundaryCoeffs_ << endl; - os.check("Ostream& operator<<(Ostream&, faMatrix&"); + os.check(FUNCTION_NAME); return os; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // * * * * * * * * * * * * * * * * Solvers * * * * * * * * * * * * * * * * * // #include "faMatrixSolve.C" diff --git a/src/finiteArea/faMatrices/faMatrix/faMatrix.H b/src/finiteArea/faMatrices/faMatrix/faMatrix.H index 6172216a4b..8c815e404d 100644 --- a/src/finiteArea/faMatrices/faMatrix/faMatrix.H +++ b/src/finiteArea/faMatrices/faMatrix/faMatrix.H @@ -24,7 +24,7 @@ License along with OpenFOAM. If not, see . Class - faMatrix + Foam::faMatrix Description Finite-Area matrix. @@ -65,7 +65,7 @@ Ostream& operator<<(Ostream&, const faMatrix&); /*---------------------------------------------------------------------------*\ - Class faMatrix Declaration + Class faMatrix Declaration \*---------------------------------------------------------------------------*/ template @@ -114,7 +114,7 @@ class faMatrix void addToInternalField ( const labelUList& addr, - const tmp >& tpf, + const tmp>& tpf, Field& intf ) const; @@ -131,7 +131,7 @@ class faMatrix void subtractFromInternalField ( const labelUList& addr, - const tmp >& tpf, + const tmp>& tpf, Field& intf ) const; @@ -308,7 +308,7 @@ public: SolverPerformance solve(); //- Return the matrix residual - tmp > residual() const; + tmp> residual() const; //- Return the matrix diagonal tmp D() const; @@ -317,30 +317,30 @@ public: tmp A() const; //- Return the H operation source - tmp > H() const; + tmp> H() const; //- Return the face-flux field from the matrix - tmp > flux() const; + tmp> flux() const; // Member operators void operator=(const faMatrix&); - void operator=(const tmp >&); + void operator=(const tmp>&); void negate(); void operator+=(const faMatrix&); - void operator+=(const tmp >&); + void operator+=(const tmp>&); void operator-=(const faMatrix&); - void operator-=(const tmp >&); + void operator-=(const tmp>&); void operator+=(const GeometricField&); - void operator+=(const tmp >&); + void operator+=(const tmp>&); void operator-=(const GeometricField&); - void operator-=(const tmp >&); + void operator-=(const tmp>&); void operator+=(const dimensioned&); void operator-=(const dimensioned&); @@ -398,7 +398,7 @@ SolverPerformance solve(faMatrix&, Istream&); // deleting temporary matrix after solution. // Solver controls read Istream template -SolverPerformance solve(const tmp >&, Istream&); +SolverPerformance solve(const tmp>&, Istream&); //- Solve returning the solution statistics given convergence tolerance @@ -411,331 +411,358 @@ SolverPerformance solve(faMatrix&); // deleting temporary matrix after solution. // Solver controls read faSolution template -SolverPerformance solve(const tmp >&); +SolverPerformance solve(const tmp>&); // * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * // template -tmp > operator- +tmp> operator- ( const faMatrix& ); template -tmp > operator- +tmp> operator- ( - const tmp >& + const tmp>& ); template -tmp > operator+ +tmp> operator+ ( const faMatrix&, const faMatrix& ); template -tmp > operator+ +tmp> operator+ ( - const tmp >&, + const tmp>&, const faMatrix& ); template -tmp > operator+ +tmp> operator+ ( const faMatrix&, - const tmp >& + const tmp>& ); template -tmp > operator+ +tmp> operator+ ( - const tmp >&, - const tmp >& + const tmp>&, + const tmp>& ); template -tmp > operator- +tmp> operator- ( const faMatrix&, const faMatrix& ); template -tmp > operator- +tmp> operator- ( - const tmp >&, + const tmp>&, const faMatrix& ); template -tmp > operator- +tmp> operator- ( const faMatrix&, - const tmp >& + const tmp>& ); template -tmp > operator- +tmp> operator- ( - const tmp >&, - const tmp >& + const tmp>&, + const tmp>& ); template -tmp > operator== +tmp> operator== ( const faMatrix&, const faMatrix& ); template -tmp > operator== +tmp> operator== ( - const tmp >&, + const tmp>&, const faMatrix& ); template -tmp > operator== +tmp> operator== ( const faMatrix&, - const tmp >& + const tmp>& ); template -tmp > operator== +tmp> operator== ( - const tmp >&, - const tmp >& + const tmp>&, + const tmp>& ); template -tmp > operator+ +tmp> operator+ ( const faMatrix&, const GeometricField& ); template -tmp > operator+ +tmp> operator+ ( - const tmp >&, + const tmp>&, const GeometricField& ); template -tmp > operator+ +tmp> operator+ ( const faMatrix&, - const tmp >& + const tmp>& ); template -tmp > operator+ +tmp> operator+ ( - const tmp >&, - const tmp >& + const tmp>&, + const tmp>& ); template -tmp > operator+ +tmp> operator+ ( const GeometricField&, const faMatrix& ); template -tmp > operator+ +tmp> operator+ ( const GeometricField&, - const tmp >& + const tmp>& ); template -tmp > operator+ +tmp> operator+ ( - const tmp >&, + const tmp>&, const faMatrix& ); template -tmp > operator+ +tmp> operator+ ( - const tmp >&, - const tmp >& + const tmp>&, + const tmp>& ); template -tmp > operator- +tmp> operator- ( const faMatrix&, const GeometricField& ); template -tmp > operator- +tmp> operator- ( - const tmp >&, + const tmp>&, const GeometricField& ); template -tmp > operator- +tmp> operator- ( const faMatrix&, - const tmp >& + const tmp>& ); template -tmp > operator- +tmp> operator- ( - const tmp >&, - const tmp >& + const tmp>&, + const tmp>& ); template -tmp > operator- +tmp> operator- ( const GeometricField&, const faMatrix& ); template -tmp > operator- +tmp> operator- ( const GeometricField&, - const tmp >& + const tmp>& ); template -tmp > operator- +tmp> operator- ( - const tmp >&, + const tmp>&, const faMatrix& ); template -tmp > operator- +tmp> operator- ( - const tmp >&, - const tmp >& + const tmp>&, + const tmp>& ); template -tmp > operator+ +tmp> operator+ ( - const tmp >&, + const faMatrix&, const dimensioned& ); template -tmp > operator+ +tmp> operator+ +( + const tmp>&, + const dimensioned& +); + +template +tmp> operator+ ( const dimensioned&, - const tmp >& + const faMatrix& ); template -tmp > operator- -( - const tmp >&, - const dimensioned& -); - -template -tmp > operator- +tmp> operator+ ( const dimensioned&, - const tmp >& + const tmp>& ); template -tmp > operator== -( - const faMatrix&, - const GeometricField& -); - -template -tmp > operator== -( - const tmp >&, - const GeometricField& -); - -template -tmp > operator== -( - const faMatrix&, - const tmp >& -); - -template -tmp > operator== -( - const tmp >&, - const tmp >& -); - -template -tmp > operator== +tmp> operator- ( const faMatrix&, const dimensioned& ); template -tmp > operator== +tmp> operator- ( - const tmp >&, + const tmp>&, + const dimensioned& +); + +template +tmp> operator- +( + const dimensioned&, + const faMatrix& +); + +template +tmp> operator- +( + const dimensioned&, + const tmp>& +); + +template +tmp> operator== +( + const faMatrix&, + const GeometricField& +); + +template +tmp> operator== +( + const tmp>&, + const GeometricField& +); + +template +tmp> operator== +( + const faMatrix&, + const tmp>& +); + +template +tmp> operator== +( + const tmp>&, + const tmp>& +); + +template +tmp> operator== +( + const faMatrix&, + const dimensioned& +); + +template +tmp> operator== +( + const tmp>&, const dimensioned& ); template -tmp > operator* +tmp> operator* ( const areaScalarField&, const faMatrix& ); template -tmp > operator* +tmp> operator* ( const areaScalarField&, - const tmp >& + const tmp>& ); template -tmp > operator* +tmp> operator* ( const tmp&, const faMatrix& ); template -tmp > operator* +tmp> operator* ( const tmp&, - const tmp >& + const tmp>& ); - template -tmp > operator* +tmp> operator* ( const dimensioned&, const faMatrix& ); template -tmp > operator* +tmp> operator* ( const dimensioned&, - const tmp >& + const tmp>& ); @@ -746,7 +773,7 @@ tmp > operator* // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository -# include "faMatrix.C" + #include "faMatrix.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/faMatrices/faMatrix/faMatrixSolve.C b/src/finiteArea/faMatrices/faMatrix/faMatrixSolve.C index c5f6780a63..726f9c1500 100644 --- a/src/finiteArea/faMatrices/faMatrix/faMatrixSolve.C +++ b/src/finiteArea/faMatrices/faMatrix/faMatrixSolve.C @@ -28,15 +28,8 @@ Description \*---------------------------------------------------------------------------*/ -namespace Foam -{ - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -// Set reference level for a component of the solution -// on a given patch face template -void faMatrix::setComponentReference +void Foam::faMatrix::setComponentReference ( const label patchi, const label facei, @@ -53,14 +46,14 @@ void faMatrix::setComponentReference template -SolverPerformance faMatrix::solve(const dictionary& solverControls) +Foam::SolverPerformance Foam::faMatrix::solve +( + const dictionary& solverControls +) { - if (debug) - { - Info<< "faMatrix::solve(const dictionary&) : " - "solving faMatrix" - << endl; - } + DebugInFunction + << "solving faMatrix" + << endl; SolverPerformance solverPerfVec ( @@ -73,16 +66,15 @@ SolverPerformance faMatrix::solve(const dictionary& solverControls) Field source(source_); addBoundarySource(source); - // Make a copy of interfaces: no longer a reference - // HJ, 20/Nov/2007 + // Note: make a copy of interfaces: no longer a reference lduInterfaceFieldPtrsList interfaces = psi_.boundaryField().scalarInterfaces(); - // Cast into a non-const to solve. HJ, 6/May/2016 + // Cast into a non-const to solve GeometricField& psi = const_cast&>(psi_); - for (direction cmpt = 0; cmpt < Type::nComponents; cmpt++) + for (direction cmpt = 0; cmpt < Type::nComponents; ++cmpt) { // copy field and source @@ -156,7 +148,7 @@ SolverPerformance faMatrix::solve(const dictionary& solverControls) template -SolverPerformance faMatrix::faSolver::solve() +Foam::SolverPerformance Foam::faMatrix::faSolver::solve() { return solvei ( @@ -169,7 +161,7 @@ SolverPerformance faMatrix::faSolver::solve() template -SolverPerformance faMatrix::solve() +Foam::SolverPerformance Foam::faMatrix::solve() { return solve ( @@ -181,22 +173,19 @@ SolverPerformance faMatrix::solve() } -// Return the matrix residual template -tmp > faMatrix::residual() const +Foam::tmp> Foam::faMatrix::residual() const { - tmp > tres(source_); + tmp> tres(source_); Field& res = tres().ref(); addBoundarySource(res); - // Make a copy of interfaces: no longer a reference - // HJ, 20/Nov/2007 lduInterfaceFieldPtrsList interfaces = psi_.boundaryField().scalarInterfaces(); // Loop over field components - for (direction cmpt = 0; cmpt < Type::nComponents; cmpt++) + for (direction cmpt = 0; cmpt < Type::nComponents; ++cmpt) { scalarField psiCmpt(psi_.internalField().component(cmpt)); @@ -226,8 +215,4 @@ tmp > faMatrix::residual() const } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/finiteArea/faMatrices/faScalarMatrix/faScalarMatrix.C b/src/finiteArea/faMatrices/faScalarMatrix/faScalarMatrix.C index f1cacedd58..b110f62e0c 100644 --- a/src/finiteArea/faMatrices/faScalarMatrix/faScalarMatrix.C +++ b/src/finiteArea/faMatrices/faScalarMatrix/faScalarMatrix.C @@ -31,17 +31,10 @@ Description #include "faScalarMatrix.H" #include "zeroGradientFaPatchFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -// Set reference level for a component of the solution -// on a given patch face template<> -void faMatrix::setComponentReference +void Foam::faMatrix::setComponentReference ( const label patchI, const label edgeI, @@ -58,17 +51,14 @@ void faMatrix::setComponentReference template<> -solverPerformance faMatrix::solve +Foam::solverPerformance Foam::faMatrix::solve ( const dictionary& solverControls ) { - if (debug) - { - Info<< "faMatrix::solve(const dictionary&) : " - "solving faMatrix" - << endl; - } + DebugInFunction + << "solving faMatrix" + << endl; GeometricField& psi = const_cast&>(psi_); @@ -100,9 +90,8 @@ solverPerformance faMatrix::solve } -// Return the matrix residual template<> -tmp faMatrix::residual() const +Foam::tmp Foam::faMatrix::residual() const { scalarField boundaryDiag(psi_.size(), 0.0); addBoundaryDiag(boundaryDiag, 0); @@ -125,9 +114,8 @@ tmp faMatrix::residual() const } -// H operator template<> -tmp faMatrix::H() const +Foam::tmp Foam::faMatrix::H() const { tmp tHphi ( @@ -158,8 +146,4 @@ tmp faMatrix::H() const } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/finiteArea/faMatrices/faScalarMatrix/faScalarMatrix.H b/src/finiteArea/faMatrices/faScalarMatrix/faScalarMatrix.H index e865b9e930..4306ca0699 100644 --- a/src/finiteArea/faMatrices/faScalarMatrix/faScalarMatrix.H +++ b/src/finiteArea/faMatrices/faScalarMatrix/faScalarMatrix.H @@ -24,7 +24,7 @@ License along with OpenFOAM. If not, see . Class - faScalarMatrix + Foam::faScalarMatrix Description Template specialisation for scalar faMatrix diff --git a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C index 3968894470..9be62fad52 100644 --- a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C +++ b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C @@ -31,23 +31,17 @@ Description #include "faMesh.H" #include "primitiveMesh.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(faBoundaryMesh, 0); - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + defineTypeNameAndDebug(faBoundaryMesh, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from dictionary -faBoundaryMesh::faBoundaryMesh +Foam::faBoundaryMesh::faBoundaryMesh ( const IOobject& io, const faMesh& mesh @@ -83,19 +77,14 @@ faBoundaryMesh::faBoundaryMesh } // Check state of IOstream - is.check - ( - "faBoundaryMesh::polyBoundaryMesh" - "(const IOobject&, const faMesh&)" - ); + is.check(FUNCTION_NAME); close(); } } -// Construct given size. Patches will be set later -faBoundaryMesh::faBoundaryMesh +Foam::faBoundaryMesh::faBoundaryMesh ( const IOobject& io, const faMesh& pm, @@ -110,8 +99,7 @@ faBoundaryMesh::faBoundaryMesh // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -// Calculate the geometry for the patches (transformation tensors etc.) -void faBoundaryMesh::calcGeometry() +void Foam::faBoundaryMesh::calcGeometry() { forAll(*this, patchi) { @@ -125,25 +113,24 @@ void faBoundaryMesh::calcGeometry() } -// Return the mesh reference -const faMesh& faBoundaryMesh::mesh() const +const Foam::faMesh& Foam::faBoundaryMesh::mesh() const { return mesh_; } -lduInterfacePtrsList faBoundaryMesh::interfaces() const +Foam::lduInterfacePtrsList Foam::faBoundaryMesh::interfaces() const { lduInterfacePtrsList interfaces(size()); - forAll (interfaces, patchi) + forAll(interfaces, patchi) { if (isA(this->operator[](patchi))) { interfaces.set ( patchi, - &refCast(this->operator[](patchi)) + &refCast(this->operator[](patchi)) ); } } @@ -152,14 +139,13 @@ lduInterfacePtrsList faBoundaryMesh::interfaces() const } -// Return a list of patch types -wordList faBoundaryMesh::types() const +Foam::wordList Foam::faBoundaryMesh::types() const { const faPatchList& patches = *this; wordList t(patches.size()); - forAll (patches, patchI) + forAll(patches, patchI) { t[patchI] = patches[patchI].type(); } @@ -168,14 +154,13 @@ wordList faBoundaryMesh::types() const } -// Return a list of patch names -wordList faBoundaryMesh::names() const +Foam::wordList Foam::faBoundaryMesh::names() const { const faPatchList& patches = *this; wordList t(patches.size()); - forAll (patches, patchI) + forAll(patches, patchI) { t[patchI] = patches[patchI].name(); } @@ -184,11 +169,11 @@ wordList faBoundaryMesh::names() const } -label faBoundaryMesh::findPatchID(const word& patchName) const +Foam::label Foam::faBoundaryMesh::findPatchID(const word& patchName) const { const faPatchList& patches = *this; - forAll (patches, patchI) + forAll(patches, patchI) { if (patches[patchI].name() == patchName) { @@ -236,8 +221,7 @@ Foam::labelList Foam::faBoundaryMesh::findIndices } -// Return patch index for a given edge label -label faBoundaryMesh::whichPatch(const label edgeIndex) const +Foam::label Foam::faBoundaryMesh::whichPatch(const label edgeIndex) const { // Find out which patch the current face belongs to by comparing label // with patch start labels. @@ -245,10 +229,8 @@ label faBoundaryMesh::whichPatch(const label edgeIndex) const // if it is off the end of the list, abort if (edgeIndex >= mesh().nEdges()) { - FatalErrorIn - ( - "faBoundaryMesh::whichPatch(const label edgeIndex) const" - ) << "given label greater than the number of edges" + FatalErrorInFunction + << "given label greater than the number of edges" << abort(FatalError); } @@ -257,7 +239,7 @@ label faBoundaryMesh::whichPatch(const label edgeIndex) const return -1; } - forAll (*this, patchI) + forAll(*this, patchI) { label start = mesh_.patchStarts()[patchI]; label size = operator[](patchI).faPatch::size(); @@ -273,32 +255,28 @@ label faBoundaryMesh::whichPatch(const label edgeIndex) const } // If not in any of above, it's trouble! - FatalErrorIn - ( - "label faBoundaryMesh::whichPatch(const label edgeIndex) const" - ) << "error in patch search algorithm" + FatalErrorInFunction + << "error in patch search algorithm" << abort(FatalError); return -1; } -bool faBoundaryMesh::checkDefinition(const bool report) const +bool Foam::faBoundaryMesh::checkDefinition(const bool report) const { label nextPatchStart = mesh().nInternalEdges(); const faBoundaryMesh& bm = *this; bool boundaryError = false; - forAll (bm, patchI) + forAll(bm, patchI) { if (bm[patchI].start() != nextPatchStart) { boundaryError = true; - Info - << "bool faBoundaryMesh::checkDefinition(" - << "const bool report) const : " + InfoInFunction << "Problem with boundary patch " << patchI << ".\nThe patch should start on face no " << nextPatchStart << " and the boundary file specifies " << bm[patchI].start() @@ -310,11 +288,8 @@ bool faBoundaryMesh::checkDefinition(const bool report) const if (boundaryError) { - SeriousErrorIn - ( - "bool faBoundaryMesh::checkDefinition(" - "const bool report) const" - ) << "This mesh is not valid: boundary definition is in error." + SeriousErrorInFunction + << "This mesh is not valid: boundary definition is in error." << endl; } else @@ -329,24 +304,23 @@ bool faBoundaryMesh::checkDefinition(const bool report) const } -// Correct faBoundaryMesh after moving points -void faBoundaryMesh::movePoints(const pointField& p) +void Foam::faBoundaryMesh::movePoints(const pointField& p) { faPatchList& patches = *this; - forAll (patches, patchI) + forAll(patches, patchI) { patches[patchI].initMovePoints(p); } - forAll (patches, patchI) + forAll(patches, patchI) { patches[patchI].movePoints(p); } } -void faBoundaryMesh::updateMesh() +void Foam::faBoundaryMesh::updateMesh() { faPatchList& patches = *this; @@ -362,8 +336,7 @@ void faBoundaryMesh::updateMesh() } -// writeData member function required by regIOobject -bool faBoundaryMesh::writeData(Ostream& os) const +bool Foam::faBoundaryMesh::writeData(Ostream& os) const { const faPatchList& patches = *this; @@ -380,21 +353,17 @@ bool faBoundaryMesh::writeData(Ostream& os) const os << decrIndent << token::END_LIST; // Check state of IOstream - os.check("polyBoundaryMesh::writeData(Ostream& os) const"); + os.check(FUNCTION_NAME); return os.good(); } -Ostream& operator<<(Ostream& os, const faBoundaryMesh& bm) +Foam::Ostream& Foam::operator<<(Ostream& os, const faBoundaryMesh& bm) { bm.writeData(os); return os; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H index 93355ead80..f0973e950e 100644 --- a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H +++ b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H @@ -24,7 +24,7 @@ License along with OpenFOAM. If not, see . Class - faBoundaryMesh + Foam::faBoundaryMesh Description Finite area boundary mesh @@ -142,6 +142,7 @@ public: //- Check boundary definition bool checkDefinition(const bool report = false) const; + // Edit //- Correct faBoundaryMesh after moving points diff --git a/src/finiteArea/faMesh/faGlobalMeshData/faGlobalMeshData.C b/src/finiteArea/faMesh/faGlobalMeshData/faGlobalMeshData.C index 00bbc4edf6..6904776a9d 100644 --- a/src/finiteArea/faMesh/faGlobalMeshData/faGlobalMeshData.C +++ b/src/finiteArea/faMesh/faGlobalMeshData/faGlobalMeshData.C @@ -63,11 +63,9 @@ const Foam::faMesh& Foam::faGlobalMeshData::mesh() const } -// Update all data after morph void Foam::faGlobalMeshData::updateMesh() { - label polyMeshNGlobalPoints = - mesh_().globalData().nGlobalPoints(); + label polyMeshNGlobalPoints = mesh_().globalData().nGlobalPoints(); const labelList& polyMeshSharedPointLabels = mesh_().globalData().sharedPointLabels(); @@ -81,10 +79,11 @@ void Foam::faGlobalMeshData::updateMesh() forAll(mesh_.boundary(), patchI) { - if(mesh_.boundary()[patchI].type() == processorFaPatch::typeName) + const faPatch& fap = mesh_.boundary()[patchI]; + + if (isA(fap)) { - const labelList& localPointLabels = - mesh_.boundary()[patchI].pointLabels(); + const labelList& localPointLabels = fap.pointLabels(); forAll(localPointLabels, pointI) { @@ -111,12 +110,12 @@ void Foam::faGlobalMeshData::updateMesh() sharedPointLabels_ = sharedPointLabels.toc(); - combineReduce(globalList, plusEqOp()); + combineReduce(globalList, plusEqOp()); nGlobalPoints_ = 0; - for (label i=0; i 0) + if (globalList[i] > 0) { globalList[i] = ++nGlobalPoints_; } @@ -137,4 +136,5 @@ void Foam::faGlobalMeshData::updateMesh() } } + // ************************************************************************* // diff --git a/src/finiteArea/faMesh/faGlobalMeshData/faGlobalMeshData.H b/src/finiteArea/faMesh/faGlobalMeshData/faGlobalMeshData.H index 87b7ba7eda..acfef27d3c 100644 --- a/src/finiteArea/faMesh/faGlobalMeshData/faGlobalMeshData.H +++ b/src/finiteArea/faMesh/faGlobalMeshData/faGlobalMeshData.H @@ -24,7 +24,7 @@ License along with OpenFOAM. If not, see . Class - faGlobalMeshData + Foam::faGlobalMeshData Description Various mesh related information for a parallel run @@ -87,16 +87,11 @@ public: //- Runtime type information ClassName("faGlobalMeshData"); + //- Construct from mesh + faGlobalMeshData(const faMesh& mesh); - // Constructors - - //- Construct from mesh - faGlobalMeshData(const faMesh& mesh); - - - // Destructor - - ~faGlobalMeshData(); + //- Destructor + ~faGlobalMeshData(); // Member Functions diff --git a/src/finiteArea/faMesh/faGlobalMeshData/faProcessorTopology.H b/src/finiteArea/faMesh/faGlobalMeshData/faProcessorTopology.H index cc72fc5299..36a4534874 100644 --- a/src/finiteArea/faMesh/faGlobalMeshData/faProcessorTopology.H +++ b/src/finiteArea/faMesh/faGlobalMeshData/faProcessorTopology.H @@ -23,8 +23,8 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Class - faProcessorTopology +Typedef + Foam::faProcessorTopology Description diff --git a/src/finiteArea/faMesh/faMesh.C b/src/finiteArea/faMesh/faMesh.C index a14fc8e417..d6706dbd2a 100644 --- a/src/finiteArea/faMesh/faMesh.C +++ b/src/finiteArea/faMesh/faMesh.C @@ -23,8 +23,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Description - \*---------------------------------------------------------------------------*/ #include "faMesh.H" @@ -57,11 +55,8 @@ const int Foam::faMesh::quadricsFit_ = 0; void Foam::faMesh::setPrimitiveMeshData() { - if (debug) - { - Info<< "void faMesh::setPrimitiveMeshData() const : " - << "Setting primitive data" << endl; - } + DebugInFunction + << "Setting primitive data" << endl; const indirectPrimitivePatch& bp = patch(); @@ -70,19 +65,18 @@ void Foam::faMesh::setPrimitiveMeshData() label edgeI = -1; - label nIntEdges = bp.nInternalEdges(); - for (label curEdge = 0; curEdge < nIntEdges; curEdge++) + for (label curEdge = 0; curEdge < nIntEdges; ++curEdge) { edges_[++edgeI] = bp.edges()[curEdge]; } - forAll (boundary(), patchI) + forAll(boundary(), patchI) { const labelList& curP = boundary()[patchI]; - forAll (curP, eI) + forAll(curP, eI) { edges_[++edgeI] = bp.edges()[curP[eI]]; } @@ -100,18 +94,18 @@ void Foam::faMesh::setPrimitiveMeshData() const labelListList& bpef = bp.edgeFaces(); - for (label curEdge = 0; curEdge < nIntEdges; curEdge++) + for (label curEdge = 0; curEdge < nIntEdges; ++curEdge) { edgeOwner_[++edgeI] = bpef[curEdge][0]; edgeNeighbour_[edgeI] = bpef[curEdge][1]; } - forAll (boundary(), patchI) + forAll(boundary(), patchI) { const labelList& curP = boundary()[patchI]; - forAll (curP, eI) + forAll(curP, eI) { edgeOwner_[++edgeI] = bpef[curP[eI]][0]; } @@ -216,24 +210,24 @@ Foam::faMesh::faMesh(const polyMesh& pMesh) *this ), comm_(Pstream::worldComm), - patchPtr_(NULL), - lduPtr_(NULL), + patchPtr_(nullptr), + lduPtr_(nullptr), curTimeIndex_(time().timeIndex()), - SPtr_(NULL), - S0Ptr_(NULL), - S00Ptr_(NULL), - patchStartsPtr_(NULL), - LePtr_(NULL), - magLePtr_(NULL), - centresPtr_(NULL), - edgeCentresPtr_(NULL), - faceAreaNormalsPtr_(NULL), - edgeAreaNormalsPtr_(NULL), - pointAreaNormalsPtr_(NULL), - faceCurvaturesPtr_(NULL), - edgeTransformTensorsPtr_(NULL), - correctPatchPointNormalsPtr_(NULL), - globalMeshDataPtr_(NULL) + SPtr_(nullptr), + S0Ptr_(nullptr), + S00Ptr_(nullptr), + patchStartsPtr_(nullptr), + LePtr_(nullptr), + magLePtr_(nullptr), + centresPtr_(nullptr), + edgeCentresPtr_(nullptr), + faceAreaNormalsPtr_(nullptr), + edgeAreaNormalsPtr_(nullptr), + pointAreaNormalsPtr_(nullptr), + faceCurvaturesPtr_(nullptr), + edgeTransformTensorsPtr_(nullptr), + correctPatchPointNormalsPtr_(nullptr), + globalMeshDataPtr_(nullptr) { if (debug) { @@ -274,7 +268,6 @@ Foam::faMesh::faMesh(const polyMesh& pMesh) } -// Construct from components without boundary. Foam::faMesh::faMesh ( const polyMesh& pMesh, @@ -312,24 +305,24 @@ Foam::faMesh::faMesh 0 ), comm_(Pstream::worldComm), - patchPtr_(NULL), - lduPtr_(NULL), + patchPtr_(nullptr), + lduPtr_(nullptr), curTimeIndex_(time().timeIndex()), - SPtr_(NULL), - S0Ptr_(NULL), - S00Ptr_(NULL), - patchStartsPtr_(NULL), - LePtr_(NULL), - magLePtr_(NULL), - centresPtr_(NULL), - edgeCentresPtr_(NULL), - faceAreaNormalsPtr_(NULL), - edgeAreaNormalsPtr_(NULL), - pointAreaNormalsPtr_(NULL), - faceCurvaturesPtr_(NULL), - edgeTransformTensorsPtr_(NULL), - correctPatchPointNormalsPtr_(NULL), - globalMeshDataPtr_(NULL) + SPtr_(nullptr), + S0Ptr_(nullptr), + S00Ptr_(nullptr), + patchStartsPtr_(nullptr), + LePtr_(nullptr), + magLePtr_(nullptr), + centresPtr_(nullptr), + edgeCentresPtr_(nullptr), + faceAreaNormalsPtr_(nullptr), + edgeAreaNormalsPtr_(nullptr), + pointAreaNormalsPtr_(nullptr), + faceCurvaturesPtr_(nullptr), + edgeTransformTensorsPtr_(nullptr), + correctPatchPointNormalsPtr_(nullptr), + globalMeshDataPtr_(nullptr) { if (debug) { @@ -339,7 +332,6 @@ Foam::faMesh::faMesh } -// Construct from definition field Foam::faMesh::faMesh ( const polyMesh& pMesh, @@ -377,30 +369,27 @@ Foam::faMesh::faMesh 0 ), comm_(Pstream::worldComm), - patchPtr_(NULL), - lduPtr_(NULL), + patchPtr_(nullptr), + lduPtr_(nullptr), curTimeIndex_(time().timeIndex()), - SPtr_(NULL), - S0Ptr_(NULL), - S00Ptr_(NULL), - patchStartsPtr_(NULL), - LePtr_(NULL), - magLePtr_(NULL), - centresPtr_(NULL), - edgeCentresPtr_(NULL), - faceAreaNormalsPtr_(NULL), - edgeAreaNormalsPtr_(NULL), - pointAreaNormalsPtr_(NULL), - faceCurvaturesPtr_(NULL), - edgeTransformTensorsPtr_(NULL), - correctPatchPointNormalsPtr_(NULL), - globalMeshDataPtr_(NULL) + SPtr_(nullptr), + S0Ptr_(nullptr), + S00Ptr_(nullptr), + patchStartsPtr_(nullptr), + LePtr_(nullptr), + magLePtr_(nullptr), + centresPtr_(nullptr), + edgeCentresPtr_(nullptr), + faceAreaNormalsPtr_(nullptr), + edgeAreaNormalsPtr_(nullptr), + pointAreaNormalsPtr_(nullptr), + faceCurvaturesPtr_(nullptr), + edgeTransformTensorsPtr_(nullptr), + correctPatchPointNormalsPtr_(nullptr), + globalMeshDataPtr_(nullptr) { - if (debug) - { - Info<< "faMesh::faMesh(...) : " - << "Creating faMesh from definition file" << endl; - } + DebugInFunction + << "Creating faMesh from definition file" << endl; // Reading faMeshDefinition dictionary IOdictionary faMeshDefinition @@ -416,38 +405,29 @@ Foam::faMesh::faMesh ) ); - wordList polyMeshPatches - ( - faMeshDefinition.lookup("polyMeshPatches") - ); + const wordList polyMeshPatches(faMeshDefinition.lookup("polyMeshPatches")); - dictionary bndDict = faMeshDefinition.subDict("boundary"); + const dictionary& bndDict = faMeshDefinition.subDict("boundary"); - wordList faPatchNames = bndDict.toc(); + const wordList faPatchNames(bndDict.toc()); List faPatches(faPatchNames.size() + 1); - forAll (faPatchNames, patchI) + const polyBoundaryMesh& pbm = pMesh.boundaryMesh(); + + forAll(faPatchNames, patchI) { - dictionary curPatchDict = - bndDict.subDict(faPatchNames[patchI]); + dictionary curPatchDict = bndDict.subDict(faPatchNames[patchI]); faPatches[patchI].name_ = faPatchNames[patchI]; - faPatches[patchI].type_ = - word(curPatchDict.lookup("type")); + faPatches[patchI].type_ = word(curPatchDict.lookup("type")); faPatches[patchI].ownPolyPatchID_ = - mesh().boundaryMesh().findPatchID - ( - word(curPatchDict.lookup("ownerPolyPatch")) - ); + pbm.findPatchID(word(curPatchDict.lookup("ownerPolyPatch"))); - faPatches[patchI].ngbPolyPatchID_ = - mesh().boundaryMesh().findPatchID - ( - word(curPatchDict.lookup("neighbourPolyPatch")) - ); + faPatches[patchI].ngbPolyPatchID_ = + pbm.findPatchID(word(curPatchDict.lookup("neighbourPolyPatch"))); } @@ -456,12 +436,11 @@ Foam::faMesh::faMesh labelList patchIDs(polyMeshPatches.size(), -1); - forAll (polyMeshPatches, patchI) + forAll(polyMeshPatches, patchI) { - patchIDs[patchI] = - mesh().boundaryMesh().findPatchID(polyMeshPatches[patchI]); + patchIDs[patchI] = pbm.findPatchID(polyMeshPatches[patchI]); - size += mesh().boundaryMesh()[patchIDs[patchI]].size(); + size += pbm[patchIDs[patchI]].size(); } faceLabels_ = labelList(size, -1); @@ -472,12 +451,12 @@ Foam::faMesh::faMesh sort(patchIDs); - forAll (polyMeshPatches, patchI) + forAll(polyMeshPatches, patchI) { - label start = mesh().boundaryMesh()[patchIDs[patchI]].start(); - label size = mesh().boundaryMesh()[patchIDs[patchI]].size(); + label start = pbm[patchIDs[patchI]].start(); + label size = pbm[patchIDs[patchI]].size(); - for (label i = 0; i < size; i++) + for (label i = 0; i < size; ++i) { faceLabels_[++faceI] = start + i; } @@ -488,7 +467,7 @@ Foam::faMesh::faMesh // Result is in the bndEdgeFaPatchIDs list labelList faceCells(faceLabels_.size(), -1); - forAll (faceCells, faceI) + forAll(faceCells, faceI) { label faceID = faceLabels_[faceI]; @@ -510,7 +489,7 @@ Foam::faMesh::faMesh labelList bndEdgeFaPatchIDs(nTotalEdges - nInternalEdges, -1); - for (label edgeI = nInternalEdges; edgeI < nTotalEdges; edgeI++) + for (label edgeI = nInternalEdges; edgeI < nTotalEdges; ++edgeI) { label curMeshEdge = meshEdges[edgeI]; @@ -518,11 +497,11 @@ Foam::faMesh::faMesh label patchI = -1; - forAll (edgeFaces[curMeshEdge], faceI) + forAll(edgeFaces[curMeshEdge], faceI) { label curFace = edgeFaces[curMeshEdge][faceI]; - label curPatchID = mesh().boundaryMesh().whichPatch(curFace); + label curPatchID = pbm.whichPatch(curFace); if (curPatchID != -1) { @@ -530,7 +509,7 @@ Foam::faMesh::faMesh } } - for (label pI = 0; pI < faPatches.size() - 1; pI++) + for (label pI = 0; pI < faPatches.size() - 1; ++pI) { if ( @@ -553,11 +532,11 @@ Foam::faMesh::faMesh // Set edgeLabels for each faPatch - for (label pI = 0; pI < (faPatches.size() - 1); pI++) + for (label pI = 0; pI < (faPatches.size() - 1); ++pI) { SLList