diff --git a/applications/test/QRMatrix/Test-QRMatrix.C b/applications/test/QRMatrix/Test-QRMatrix.C index fb22d78bde3f9c8316a2a51485fdd9d61a5daaf7..281c62dd5b40dcd3d8983541fab42af31fc9608d 100644 --- a/applications/test/QRMatrix/Test-QRMatrix.C +++ b/applications/test/QRMatrix/Test-QRMatrix.C @@ -324,7 +324,7 @@ void verification_QRMatrix // QRMatrix Constructors #if (0 | RUNALL) { - QRMatrix<MatrixType> QRNull(); + QRMatrix<MatrixType> QRNull; } #endif @@ -967,14 +967,14 @@ void verification_tsqr typedef RectangularMatrix<Type> RMatrix; // Size of the full matrix and its partitions - const label nColsSum = rndGen.position(1, 100); - const label qParts = rndGen.position(10, 30); + const label nColsSum = rndGen.position<label>(1, 100); + const label qParts = rndGen.position<label>(10, 30); List<label> mRowsList(qParts, Zero); label mRowsSum = 0; for (label i = 0; i < qParts; ++i) { - const label mRows = rndGen.position(nColsSum, 10*nColsSum); + const label mRows = rndGen.position<label>(nColsSum, 10*nColsSum); mRowsList[i] = mRows; mRowsSum += mRows; } @@ -1084,7 +1084,7 @@ void verification_backSubstitution { Info<< nl << "# A*X = b:" << nl; const RMatrix AX(A*X); - equal(AX, b, verbose, 1e-3, 1e-3); + equal(AX, b, verbose, 10, 1e-3, 1e-3); } #endif } @@ -1170,7 +1170,7 @@ int main(int argc, char *argv[]) for (label i = 0; i < numberOfTests; ++i) { - const label mRows = rndGen.position(1, 50); + const label mRows = rndGen.position<label>(1, 50); Info<< nl << nl << "# Random A with random mRows = " << mRows << nl; SMatrix A(makeRandomMatrix<SMatrix>({mRows, mRows}, rndGen)); @@ -1199,8 +1199,8 @@ int main(int argc, char *argv[]) for (label i = 0; i < numberOfTests; ++i) { - const label mRows = rndGen.position(1, 50); - const label nCols = rndGen.position(1, 50); + const label mRows = rndGen.position<label>(1, 50); + const label nCols = rndGen.position<label>(1, 50); Info<< nl << nl << "# Random matrix A with" << " random mRows = " << mRows << " random nCols = " << nCols << nl; @@ -1231,7 +1231,7 @@ int main(int argc, char *argv[]) for (label i = 0; i < numberOfTests; ++i) { - const label mRows = rndGen.position(1, 50); + const label mRows = rndGen.position<label>(1, 50); Info<< nl << nl << "# Random A with random mRows = " << mRows << nl; SCMatrix A({mRows, mRows}, complex(0, 0)); @@ -1258,7 +1258,7 @@ int main(int argc, char *argv[]) for (label i = 0; i < numberOfTests; ++i) { - const label mRows = rndGen.position(1, 50); + const label mRows = rndGen.position<label>(1, 50); Info<< nl << nl << "# Random A with random mRows = " << mRows << nl; SCMatrix A(makeRandomMatrix<SCMatrix>({mRows, mRows}, rndGen)); @@ -1287,8 +1287,8 @@ int main(int argc, char *argv[]) for (label i = 0; i < numberOfTests; ++i) { - const label mRows = rndGen.position(1, 50); - const label nCols = rndGen.position(1, 50); + const label mRows = rndGen.position<label>(1, 50); + const label nCols = rndGen.position<label>(1, 50); Info<< nl << nl << "# Random matrix A with" << " random mRows = " << mRows << " random nCols = " << nCols << nl; @@ -1363,8 +1363,8 @@ int main(int argc, char *argv[]) for (label i = 0; i < numberOfTests; ++i) { - const label mRows = rndGen.position(20, 50); - const label pCols = rndGen.position(20, 50); + const label mRows = rndGen.position<label>(20, 50); + const label pCols = rndGen.position<label>(20, 50); Info<< nl << nl << "# Random square matrix A with" << " random mRows = " << mRows << " random nCols = " << mRows << nl; @@ -1422,8 +1422,8 @@ int main(int argc, char *argv[]) for (label i = 0; i < numberOfTests; ++i) { - const label mRows = rndGen.position(20, 50); - const label pCols = rndGen.position(20, 50); + const label mRows = rndGen.position<label>(20, 50); + const label pCols = rndGen.position<label>(20, 50); Info<< nl << nl << "# Random square matrix A with" << " random mRows = " << mRows << " random nCols = " << mRows << nl; diff --git a/src/OpenFOAM/matrices/Matrix/MatrixTools.C b/src/OpenFOAM/matrices/Matrix/MatrixTools.C index 30dbce057147b3a16bb106bf0c25f44162e35e78..2000628aee14c77e94a8a2c80df3312055275628 100644 --- a/src/OpenFOAM/matrices/Matrix/MatrixTools.C +++ b/src/OpenFOAM/matrices/Matrix/MatrixTools.C @@ -35,7 +35,7 @@ bool Foam::MatrixTools::equal const Matrix<Form1, Type>& A, const Matrix<Form2, Type>& B, const bool verbose, - const label lenDiffs, + const label maxDiffs, const scalar relTol, const scalar absTol ) @@ -55,24 +55,24 @@ bool Foam::MatrixTools::equal auto iter1 = A.cbegin(); auto iter2 = B.cbegin(); - label j = 0; + label nDiffs = 0; for (label i = 0; i < len; ++i) { if ((absTol + relTol*mag(*iter2)) < Foam::mag(*iter1 - *iter2)) { + ++nDiffs; + if (verbose) { Info<< "Matrix element " << i << " differs beyond tolerance: " << *iter1 << " vs " << *iter2 << nl; - ++j; } - if (lenDiffs < j) + if (maxDiffs && maxDiffs < nDiffs) { - Info<< "Number of different elements exceeds = " << lenDiffs - << " Ceasing comparisons for the remaining of elements." - << nl; + Info<< "More than " << maxDiffs << " elements differ." + << " Skipping further comparisons." << nl; return false; } } @@ -83,10 +83,17 @@ bool Foam::MatrixTools::equal if (verbose) { - Info<< "All elements equal within the tolerances" << nl; + if (nDiffs) + { + Info<< "Some elements differed" << nl; + } + else + { + Info<< "All elements equal within the tolerances" << nl; + } } - return true; + return !nDiffs; } diff --git a/src/OpenFOAM/matrices/Matrix/MatrixTools.H b/src/OpenFOAM/matrices/Matrix/MatrixTools.H index 58bdac3ef482662637ae340201dfd1568d9cab50..95fa5bcd59a9bfd127376ab1b084831c14b8407d 100644 --- a/src/OpenFOAM/matrices/Matrix/MatrixTools.H +++ b/src/OpenFOAM/matrices/Matrix/MatrixTools.H @@ -27,7 +27,7 @@ Namespace Foam::MatrixTools Description - Collection of static functions for matrix-related verifications. + Collection of functions for matrix-related verifications. SourceFiles MatrixTools.C @@ -47,7 +47,6 @@ namespace Foam // Forward declarations class Ostream; - /*---------------------------------------------------------------------------*\ Namespace MatrixTools Declaration \*---------------------------------------------------------------------------*/ @@ -56,13 +55,14 @@ namespace MatrixTools { //- Compare matrix elements for absolute or relative equality +// template<class Form1, class Form2, class Type> bool equal ( const Matrix<Form1, Type>& A, const Matrix<Form2, Type>& B, const bool verbose = false, - const label lenDiffs = 10, + const label maxDiffs = 10, //!< Stop reporting after maxDiffs (0 to disable) const scalar relTol = 1e-5, const scalar absTol = 1e-8 ); diff --git a/src/finiteVolume/expressions/volume/volumeExprDriver.C b/src/finiteVolume/expressions/volume/volumeExprDriver.C index 8cb2c5002ec94ddaf83bddbe29ba91274501fd2d..6a417e5eddc3be76b725448dc9ed0e949a2377c1 100644 --- a/src/finiteVolume/expressions/volume/volumeExprDriver.C +++ b/src/finiteVolume/expressions/volume/volumeExprDriver.C @@ -81,39 +81,6 @@ addNamedToRunTimeSelectionTable } // End namespace Foam -// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * // - -namespace Foam -{ - static label getPatchID(const fvMesh& mesh, const word& patchName) - { - const auto& bMesh = mesh.boundaryMesh(); - - const label patchId = bMesh.findPatchID(patchName); - - if (patchId < 0) - { - FatalErrorInFunction - << "No patch " << patchName << " found in " - << flatOutput(bMesh.names()) << nl - << exit(FatalError); - } - return patchId; - } - - - static inline const polyPatch& findPolyPatch - ( - const fvMesh& mesh, - const word& patchName - ) - { - return mesh.boundaryMesh()[getPatchID(mesh, patchName)]; - } - -} // End namespace Foam - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::expressions::volumeExpr::parseDriver::parseDriver diff --git a/src/functionObjects/utilities/parProfiling/parProfiling.H b/src/functionObjects/utilities/parProfiling/parProfiling.H index d29629bbe92ccfb4b9008f3a0446d941f1938880..7cc6fc3dd4e65ed614efd2eb28e75827960c78cf 100644 --- a/src/functionObjects/utilities/parProfiling/parProfiling.H +++ b/src/functionObjects/utilities/parProfiling/parProfiling.H @@ -77,10 +77,10 @@ class parProfiling { // Private Member Functions - //- Disallow default bitwise copy construct + //- No copy construct parProfiling(const parProfiling&) = delete; - //- Disallow default bitwise assignment + //- No copy assignment void operator=(const parProfiling&) = delete; diff --git a/src/parallel/distributed/patchDistMethods/exact/exactPatchDistMethod.H b/src/parallel/distributed/patchDistMethods/exact/exactPatchDistMethod.H index 0804d62fd995884ab38b448101a57dcf4fed3ee1..4fd1f82fb1ac3a1fc3f18a3f56a4565b411a3cfb 100644 --- a/src/parallel/distributed/patchDistMethods/exact/exactPatchDistMethod.H +++ b/src/parallel/distributed/patchDistMethods/exact/exactPatchDistMethod.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -72,11 +72,11 @@ class exact const distributedTriSurfaceMesh& patchSurface() const; - //- Disallow default bitwise copy construct - exact(const exact&); + //- No copy construct + exact(const exact&) = delete; - //- Disallow default bitwise assignment - void operator=(const exact&); + //- No copy assignment + void operator=(const exact&) = delete; public: