From a9863d9a3fe44953d1aff48514d43e2e05d01075 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 27 Mar 2025 13:26:24 +0100 Subject: [PATCH] ENH: add size_type to Matrix and VectorSpace - easier to create type-specific looping in templated code STYLE: pass 'direction' and 'label' by value instead of reference COMP: qualify Foam::min() in dense matrix classes --- applications/test/IjkField/Make/files | 2 +- .../{Test-IjkField.C => Test-IjkField.cxx} | 0 .../test/matrices/DiagonalMatrix/Make/files | 2 +- ...agonalMatrix.C => Test-DiagonalMatrix.cxx} | 0 .../test/matrices/EigenMatrix/Make/files | 2 +- ...est-EigenMatrix.C => Test-EigenMatrix.cxx} | 0 applications/test/matrices/Matrix/Make/files | 2 +- .../Matrix/{Test-Matrix.C => Test-Matrix.cxx} | 0 .../test/matrices/QRMatrix/Make/files | 2 +- .../{Test-QRMatrix.C => Test-QRMatrix.cxx} | 0 .../matrices/RectangularMatrix/Make/files | 2 +- ...larMatrix.C => Test-RectangularMatrix.cxx} | 0 .../test/matrices/SquareMatrix/Make/files | 2 +- ...t-SquareMatrix.C => Test-SquareMatrix.cxx} | 0 .../matrices/SymmetricSquareMatrix/Make/files | 2 +- ...atrix.C => Test-SymmetricSquareMatrix.cxx} | 0 .../matrices/DiagonalMatrix/DiagonalMatrix.C | 16 ++--- .../matrices/DiagonalMatrix/DiagonalMatrix.H | 8 +-- .../matrices/EigenMatrix/EigenMatrix.C | 48 ++++---------- .../matrices/EigenMatrix/EigenMatrix.H | 6 ++ src/OpenFOAM/matrices/LLTMatrix/LLTMatrix.C | 5 -- src/OpenFOAM/matrices/LLTMatrix/LLTMatrix.H | 4 +- src/OpenFOAM/matrices/Matrix/Matrix.C | 18 +++--- src/OpenFOAM/matrices/Matrix/Matrix.H | 41 ++++++------ src/OpenFOAM/matrices/Matrix/MatrixI.H | 6 +- .../matrices/MatrixBlock/MatrixBlock.H | 45 ++++++++++--- .../matrices/MatrixBlock/MatrixBlockI.H | 28 +++------ src/OpenFOAM/matrices/QRMatrix/QRMatrix.C | 4 +- src/OpenFOAM/matrices/QRMatrix/QRMatrix.H | 18 ++++-- src/OpenFOAM/matrices/QRMatrix/QRMatrixI.H | 2 +- .../RectangularMatrix/RectangularMatrix.H | 6 +- .../RectangularMatrix/RectangularMatrixI.H | 10 +-- .../matrices/SquareMatrix/SquareMatrix.H | 9 ++- .../matrices/SquareMatrix/SquareMatrixI.H | 8 +-- .../SymmetricSquareMatrix.C | 4 +- .../SymmetricSquareMatrix.H | 4 +- .../SymmetricSquareMatrixI.H | 4 +- .../matrices/simpleMatrix/simpleMatrix.C | 10 ++- .../matrices/simpleMatrix/simpleMatrix.H | 63 ++++++++----------- src/OpenFOAM/meshes/ijkMesh/IjkField.H | 16 ++--- src/OpenFOAM/meshes/ijkMesh/IjkFieldI.H | 32 +--------- src/OpenFOAM/meshes/ijkMesh/ijkAddressing.H | 12 ++-- src/OpenFOAM/meshes/ijkMesh/ijkAddressingI.H | 22 ++----- .../primitives/MatrixSpace/MatrixSpace.H | 42 ++++--------- .../primitives/MatrixSpace/MatrixSpaceI.H | 16 ++--- .../primitives/VectorSpace/VectorSpace.H | 3 + .../field/DMD/DMDModels/derived/STDMD/STDMD.C | 4 +- 47 files changed, 238 insertions(+), 292 deletions(-) rename applications/test/IjkField/{Test-IjkField.C => Test-IjkField.cxx} (100%) rename applications/test/matrices/DiagonalMatrix/{Test-DiagonalMatrix.C => Test-DiagonalMatrix.cxx} (100%) rename applications/test/matrices/EigenMatrix/{Test-EigenMatrix.C => Test-EigenMatrix.cxx} (100%) rename applications/test/matrices/Matrix/{Test-Matrix.C => Test-Matrix.cxx} (100%) rename applications/test/matrices/QRMatrix/{Test-QRMatrix.C => Test-QRMatrix.cxx} (100%) rename applications/test/matrices/RectangularMatrix/{Test-RectangularMatrix.C => Test-RectangularMatrix.cxx} (100%) rename applications/test/matrices/SquareMatrix/{Test-SquareMatrix.C => Test-SquareMatrix.cxx} (100%) rename applications/test/matrices/SymmetricSquareMatrix/{Test-SymmetricSquareMatrix.C => Test-SymmetricSquareMatrix.cxx} (100%) diff --git a/applications/test/IjkField/Make/files b/applications/test/IjkField/Make/files index 8e1017d41d..d0a905bc00 100644 --- a/applications/test/IjkField/Make/files +++ b/applications/test/IjkField/Make/files @@ -1,3 +1,3 @@ -Test-IjkField.C +Test-IjkField.cxx EXE = $(FOAM_USER_APPBIN)/Test-IjkField diff --git a/applications/test/IjkField/Test-IjkField.C b/applications/test/IjkField/Test-IjkField.cxx similarity index 100% rename from applications/test/IjkField/Test-IjkField.C rename to applications/test/IjkField/Test-IjkField.cxx diff --git a/applications/test/matrices/DiagonalMatrix/Make/files b/applications/test/matrices/DiagonalMatrix/Make/files index 0f5877472a..e8338d6d54 100644 --- a/applications/test/matrices/DiagonalMatrix/Make/files +++ b/applications/test/matrices/DiagonalMatrix/Make/files @@ -1,3 +1,3 @@ -Test-DiagonalMatrix.C +Test-DiagonalMatrix.cxx EXE = $(FOAM_USER_APPBIN)/Test-DiagonalMatrix diff --git a/applications/test/matrices/DiagonalMatrix/Test-DiagonalMatrix.C b/applications/test/matrices/DiagonalMatrix/Test-DiagonalMatrix.cxx similarity index 100% rename from applications/test/matrices/DiagonalMatrix/Test-DiagonalMatrix.C rename to applications/test/matrices/DiagonalMatrix/Test-DiagonalMatrix.cxx diff --git a/applications/test/matrices/EigenMatrix/Make/files b/applications/test/matrices/EigenMatrix/Make/files index 1bd5722a5f..f652095c4f 100644 --- a/applications/test/matrices/EigenMatrix/Make/files +++ b/applications/test/matrices/EigenMatrix/Make/files @@ -1,3 +1,3 @@ -Test-EigenMatrix.C +Test-EigenMatrix.cxx EXE = $(FOAM_USER_APPBIN)/Test-EigenMatrix diff --git a/applications/test/matrices/EigenMatrix/Test-EigenMatrix.C b/applications/test/matrices/EigenMatrix/Test-EigenMatrix.cxx similarity index 100% rename from applications/test/matrices/EigenMatrix/Test-EigenMatrix.C rename to applications/test/matrices/EigenMatrix/Test-EigenMatrix.cxx diff --git a/applications/test/matrices/Matrix/Make/files b/applications/test/matrices/Matrix/Make/files index e167e86cdc..09565ca38a 100644 --- a/applications/test/matrices/Matrix/Make/files +++ b/applications/test/matrices/Matrix/Make/files @@ -1,3 +1,3 @@ -Test-Matrix.C +Test-Matrix.cxx EXE = $(FOAM_USER_APPBIN)/Test-Matrix diff --git a/applications/test/matrices/Matrix/Test-Matrix.C b/applications/test/matrices/Matrix/Test-Matrix.cxx similarity index 100% rename from applications/test/matrices/Matrix/Test-Matrix.C rename to applications/test/matrices/Matrix/Test-Matrix.cxx diff --git a/applications/test/matrices/QRMatrix/Make/files b/applications/test/matrices/QRMatrix/Make/files index 9825bbfcf3..55c6d30e68 100644 --- a/applications/test/matrices/QRMatrix/Make/files +++ b/applications/test/matrices/QRMatrix/Make/files @@ -1,3 +1,3 @@ -Test-QRMatrix.C +Test-QRMatrix.cxx EXE = $(FOAM_USER_APPBIN)/Test-QRMatrix diff --git a/applications/test/matrices/QRMatrix/Test-QRMatrix.C b/applications/test/matrices/QRMatrix/Test-QRMatrix.cxx similarity index 100% rename from applications/test/matrices/QRMatrix/Test-QRMatrix.C rename to applications/test/matrices/QRMatrix/Test-QRMatrix.cxx diff --git a/applications/test/matrices/RectangularMatrix/Make/files b/applications/test/matrices/RectangularMatrix/Make/files index 49b520d079..ad7d686317 100644 --- a/applications/test/matrices/RectangularMatrix/Make/files +++ b/applications/test/matrices/RectangularMatrix/Make/files @@ -1,3 +1,3 @@ -Test-RectangularMatrix.C +Test-RectangularMatrix.cxx EXE = $(FOAM_USER_APPBIN)/Test-RectangularMatrix diff --git a/applications/test/matrices/RectangularMatrix/Test-RectangularMatrix.C b/applications/test/matrices/RectangularMatrix/Test-RectangularMatrix.cxx similarity index 100% rename from applications/test/matrices/RectangularMatrix/Test-RectangularMatrix.C rename to applications/test/matrices/RectangularMatrix/Test-RectangularMatrix.cxx diff --git a/applications/test/matrices/SquareMatrix/Make/files b/applications/test/matrices/SquareMatrix/Make/files index e64b858cd6..37b022136f 100644 --- a/applications/test/matrices/SquareMatrix/Make/files +++ b/applications/test/matrices/SquareMatrix/Make/files @@ -1,3 +1,3 @@ -Test-SquareMatrix.C +Test-SquareMatrix.cxx EXE = $(FOAM_USER_APPBIN)/Test-SquareMatrix diff --git a/applications/test/matrices/SquareMatrix/Test-SquareMatrix.C b/applications/test/matrices/SquareMatrix/Test-SquareMatrix.cxx similarity index 100% rename from applications/test/matrices/SquareMatrix/Test-SquareMatrix.C rename to applications/test/matrices/SquareMatrix/Test-SquareMatrix.cxx diff --git a/applications/test/matrices/SymmetricSquareMatrix/Make/files b/applications/test/matrices/SymmetricSquareMatrix/Make/files index da88933c24..d0e7b1173e 100644 --- a/applications/test/matrices/SymmetricSquareMatrix/Make/files +++ b/applications/test/matrices/SymmetricSquareMatrix/Make/files @@ -1,3 +1,3 @@ -Test-SymmetricSquareMatrix.C +Test-SymmetricSquareMatrix.cxx EXE = $(FOAM_USER_APPBIN)/Test-SymmetricSquareMatrix diff --git a/applications/test/matrices/SymmetricSquareMatrix/Test-SymmetricSquareMatrix.C b/applications/test/matrices/SymmetricSquareMatrix/Test-SymmetricSquareMatrix.cxx similarity index 100% rename from applications/test/matrices/SymmetricSquareMatrix/Test-SymmetricSquareMatrix.C rename to applications/test/matrices/SymmetricSquareMatrix/Test-SymmetricSquareMatrix.cxx diff --git a/src/OpenFOAM/matrices/DiagonalMatrix/DiagonalMatrix.C b/src/OpenFOAM/matrices/DiagonalMatrix/DiagonalMatrix.C index 60aee73efc..d9a888049a 100644 --- a/src/OpenFOAM/matrices/DiagonalMatrix/DiagonalMatrix.C +++ b/src/OpenFOAM/matrices/DiagonalMatrix/DiagonalMatrix.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019-2022 OpenCFD Ltd. + Copyright (C) 2019-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -38,7 +38,7 @@ Foam::DiagonalMatrix::DiagonalMatrix(const label n) template -Foam::DiagonalMatrix::DiagonalMatrix(const label n, const Foam::zero) +Foam::DiagonalMatrix::DiagonalMatrix(const label n, Foam::zero) : List(n, Foam::zero{}) {} @@ -55,7 +55,7 @@ template template Foam::DiagonalMatrix::DiagonalMatrix(const Matrix& mat) : - List(min(mat.m(), mat.n())) + List(Foam::min(mat.m(), mat.n())) { label i = 0; @@ -86,9 +86,9 @@ void Foam::DiagonalMatrix::invert() template template -Foam::List Foam::DiagonalMatrix::sortPermutation +Foam::labelList Foam::DiagonalMatrix::sortPermutation ( - CompOp& compare + const CompOp& compare ) const { List