From 35c9d7bbd5d3db55b623380a6894ed5a409459a2 Mon Sep 17 00:00:00 2001
From: henry <Henry Weller h.weller@opencfd.co.uk>
Date: Fri, 20 Nov 2009 12:40:19 +0000
Subject: [PATCH] Corrected test applications.

---
 .../DimensionedField/DimensionedFieldTest.C   | 133 ------------------
 applications/test/DimensionedField/Make/files |   3 -
 .../test/DimensionedField/Make/options        |   2 -
 applications/test/HashTable3/hashTableTest3.C |   3 +-
 applications/test/Matrix/MatrixTest.C         |  14 +-
 applications/test/ODETest/ODETest.C           |   2 +-
 applications/test/PtrList/PtrListTest.C       |   2 +
 .../UIndirectListTest/UIndirectListTest.C     |   8 +-
 applications/test/parallel/parallelTest.C     |   4 +-
 .../test/slicedField/slicedFieldTest.C        |  14 +-
 .../testPointEdgeWave/testPointEdgeWave.C     |   6 +-
 applications/test/volField/volFieldTest.C     |  18 +--
 .../containers/HashTables/HashSet/HashSet.C   |   4 +-
 src/OpenFOAM/matrices/Matrix/Matrix.C         |  64 ++++-----
 src/OpenFOAM/matrices/Matrix/Matrix.H         |   4 +-
 15 files changed, 68 insertions(+), 213 deletions(-)
 delete mode 100644 applications/test/DimensionedField/DimensionedFieldTest.C
 delete mode 100644 applications/test/DimensionedField/Make/files
 delete mode 100644 applications/test/DimensionedField/Make/options

diff --git a/applications/test/DimensionedField/DimensionedFieldTest.C b/applications/test/DimensionedField/DimensionedFieldTest.C
deleted file mode 100644
index bc1f875dbd1..00000000000
--- a/applications/test/DimensionedField/DimensionedFieldTest.C
+++ /dev/null
@@ -1,133 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
-     \\/     M anipulation  |
--------------------------------------------------------------------------------
-License
-    This file is part of OpenFOAM.
-
-    OpenFOAM is free software; you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by the
-    Free Software Foundation; either version 2 of the License, or (at your
-    option) any later version.
-
-    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-    for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-\*---------------------------------------------------------------------------*/
-
-#include "argList.H"
-#include "Time.H"
-#include "DimensionedFields.H"
-#include "DimensionedSphericalTensorField.H"
-#include "vector.H"
-#include "tensor.H"
-#include "GeoMesh.H"
-
-using namespace Foam;
-
-namespace Foam
-{
-
-class vMesh
-{
-
-public:
-
-    vMesh()
-    {}
-
-    label size() const
-    {
-        return 10;
-    }
-};
-
-};
-
-template<>
-const word Foam::DimensionedField<scalar, GeoMesh<vMesh> >::typeName
-(
-    "dimenionedScalarField"
-);
-
-template<>
-const word Foam::DimensionedField<vector, GeoMesh<vMesh> >::typeName
-(
-    "dimenionedVectorField"
-);
-
-template<>
-const word Foam::DimensionedField<tensor, GeoMesh<vMesh> >::typeName
-(
-    "dimenionedTensorField"
-);
-
-template<>
-const word Foam::DimensionedField<sphericalTensor, GeoMesh<vMesh> >::typeName
-(
-    "dimenionedSphericalTensorField"
-);
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
-
-int main(int argc, char *argv[])
-{
-
-#   include "setRootCase.H"
-#   include "createTime.H"
-
-    vMesh vm;
-
-    DimensionedField<scalar, GeoMesh<vMesh> > dsf
-    (
-        IOobject
-        (
-            "dsf",
-            runTime.timeName(),
-            runTime,
-            IOobject::MUST_READ,
-            IOobject::NO_WRITE
-        ),
-        vm
-    );
-
-    Info<< dsf << endl;
-    dsf += dsf;
-    dsf -= dimensionedScalar("5", dsf.dimensions(), 5.0);
-    Info<< dsf << endl;
-
-    Info<< sqr(dsf + dsf) - sqr(dsf + dsf) << endl;
-
-    DimensionedField<vector, GeoMesh<vMesh> > dvf
-    (
-        IOobject
-        (
-            "dvf",
-            runTime.timeName(),
-            runTime,
-            IOobject::MUST_READ,
-            IOobject::NO_WRITE
-        ),
-        vm
-    );
-
-    Info<< (dvf ^ (dvf ^ dvf)) << endl;
-
-    Info << "End\n" << endl;
-
-    return 0;
-}
-
-
-// ************************************************************************* //
diff --git a/applications/test/DimensionedField/Make/files b/applications/test/DimensionedField/Make/files
deleted file mode 100644
index 02c479015e6..00000000000
--- a/applications/test/DimensionedField/Make/files
+++ /dev/null
@@ -1,3 +0,0 @@
-DimensionedFieldTest.C
-
-EXE = $(FOAM_USER_APPBIN)/DimensionedFieldTest
diff --git a/applications/test/DimensionedField/Make/options b/applications/test/DimensionedField/Make/options
deleted file mode 100644
index 6a9e9810b3d..00000000000
--- a/applications/test/DimensionedField/Make/options
+++ /dev/null
@@ -1,2 +0,0 @@
-/* EXE_INC = -I$(LIB_SRC)/cfdTools/include */
-/* EXE_LIBS = -lfiniteVolume */
diff --git a/applications/test/HashTable3/hashTableTest3.C b/applications/test/HashTable3/hashTableTest3.C
index 910e4f22905..6229e6a3043 100644
--- a/applications/test/HashTable3/hashTableTest3.C
+++ b/applications/test/HashTable3/hashTableTest3.C
@@ -33,7 +33,6 @@ Description
 #include "HashPtrTable.H"
 #include "Map.H"
 #include "StaticHashTable.H"
-#include "HashTbl.H"
 #include "cpuTime.H"
 
 using namespace Foam;
@@ -53,7 +52,7 @@ int main(int argc, char *argv[])
     // Map<label> map(2 * nSize);
     // HashTable<label, label, Hash<label> > map(2 * nSize);
     // StaticHashTable<label, label, Hash<label> > map(2 * nSize);
-    HashTbl<label, label, Hash<label> > map(2 * nSize);
+    HashTable<label, label, Hash<label> > map(2 * nSize);
 
     Info<< "Constructed map of size: " << nSize
         << " (size " << map.size() << " capacity " << map.capacity() << ") "
diff --git a/applications/test/Matrix/MatrixTest.C b/applications/test/Matrix/MatrixTest.C
index 24bcc682575..5576291fd50 100644
--- a/applications/test/Matrix/MatrixTest.C
+++ b/applications/test/Matrix/MatrixTest.C
@@ -24,7 +24,7 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-#include "Matrix.H"
+#include "SquareMatrix.H"
 #include "vector.H"
 
 using namespace Foam;
@@ -34,7 +34,7 @@ using namespace Foam;
 
 int main(int argc, char *argv[])
 {
-    Matrix<scalar> hmm(3, 3);
+    SquareMatrix<scalar> hmm(3);
 
     hmm[0][0] = -3.0;
     hmm[0][1] = 10.0;
@@ -46,27 +46,27 @@ int main(int argc, char *argv[])
     hmm[2][1] = 6.0;
     hmm[2][2] = 1.0;
 
-    Info<< hmm << endl << hmm - 2.0*(-hmm) << endl;
+    //Info<< hmm << endl << hmm - 2.0*(-hmm) << endl;
     Info<< max(hmm) << endl;
     Info<< min(hmm) << endl;
 
-    Matrix<scalar> hmm2(3, 3, 1.0);
+    SquareMatrix<scalar> hmm2(3, 1.0);
 
     hmm = hmm2;
 
     Info<< hmm << endl;
 
-    Matrix<scalar> hmm3(Sin);
+    SquareMatrix<scalar> hmm3(Sin);
 
     Info<< hmm3 << endl;
 
-    Matrix<scalar> hmm4;
+    SquareMatrix<scalar> hmm4;
 
     hmm4 = hmm2;
 
     Info<< hmm4 << endl;
 
-    Matrix<scalar> hmm5;
+    SquareMatrix<scalar> hmm5;
 
     hmm4 = hmm5;
     Info<< hmm5 << endl;
diff --git a/applications/test/ODETest/ODETest.C b/applications/test/ODETest/ODETest.C
index dfc7a663bbd..2d8cecfa9ac 100644
--- a/applications/test/ODETest/ODETest.C
+++ b/applications/test/ODETest/ODETest.C
@@ -69,7 +69,7 @@ public:
         const scalar x,
         const scalarField& y,
         scalarField& dfdx,
-        Matrix<scalar>& dfdy
+        scalarSquareMatrix& dfdy
     ) const
     {
         dfdx[0] = 0.0;
diff --git a/applications/test/PtrList/PtrListTest.C b/applications/test/PtrList/PtrListTest.C
index 5413a662b88..7fbff08d11c 100644
--- a/applications/test/PtrList/PtrListTest.C
+++ b/applications/test/PtrList/PtrListTest.C
@@ -57,6 +57,8 @@ public:
         Info <<"delete Scalar: " << data_ << endl;
     }
 
+    autoPtr<Scalar> clone() const;
+
     friend Ostream& operator<<(Ostream& os, const Scalar& val)
     {
         os << val.data_;
diff --git a/applications/test/UIndirectListTest/UIndirectListTest.C b/applications/test/UIndirectListTest/UIndirectListTest.C
index 6902f47eeab..67943b7d942 100644
--- a/applications/test/UIndirectListTest/UIndirectListTest.C
+++ b/applications/test/UIndirectListTest/UIndirectListTest.C
@@ -84,11 +84,11 @@ int main(int argc, char *argv[])
 
     // test List operations
 
-    List<double> flatList = UIndirectList<double>(completeList, addresses);
-    Info<< "List assigned from UIndirectList: " << flatList << endl;
+    List<double> flatList(UIndirectList<double>(completeList, addresses));
+    Info<< "List constructed from UIndirectList: " << flatList << endl;
 
-    List<double> flatList2(UIndirectList<double>(completeList, addresses));
-    Info<< "List constructed from UIndirectList: " << flatList2 << endl;
+    flatList = UIndirectList<double>(completeList, addresses);
+    Info<< "List assigned from UIndirectList: " << flatList << endl;
 
     flatList.append(UIndirectList<double>(completeList, addresses));
     Info<< "List::append(UIndirectList): " << flatList << endl;
diff --git a/applications/test/parallel/parallelTest.C b/applications/test/parallel/parallelTest.C
index 6120de31a51..caf9e6fc8d9 100644
--- a/applications/test/parallel/parallelTest.C
+++ b/applications/test/parallel/parallelTest.C
@@ -84,7 +84,7 @@ int main(int argc, char *argv[])
         // Sync how many to send
         labelListList allNTrans(Pstream::nProcs());
         allNTrans[Pstream::myProcNo()] = nSend;
-        combineReduce(allNTrans, mapDistribute::listEq());
+        combineReduce(allNTrans, UPstream::listEq());
 
         // Collect items to be sent
         labelListList sendMap(Pstream::nProcs());
@@ -161,7 +161,7 @@ int main(int argc, char *argv[])
                 toMaster << data;
             }
 
-            Perr<< "slave receiving from master " 
+            Perr<< "slave receiving from master "
                 << Pstream::masterNo() << endl;
             IPstream fromMaster(Pstream::blocking, Pstream::masterNo());
             fromMaster >> data;
diff --git a/applications/test/slicedField/slicedFieldTest.C b/applications/test/slicedField/slicedFieldTest.C
index a82b4ac7129..dd8da252238 100644
--- a/applications/test/slicedField/slicedFieldTest.C
+++ b/applications/test/slicedField/slicedFieldTest.C
@@ -23,7 +23,7 @@ License
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Application
-    volField
+    slicedFieldTest
 
 Description
 
@@ -32,16 +32,16 @@ Description
 #include "fvCFD.H"
 #include "SlicedGeometricField.H"
 #include "slicedFvPatchFields.H"
+#include "slicedSurfaceFields.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 int main(int argc, char *argv[])
 {
+    #include "setRootCase.H"
 
-#   include "setRootCase.H"
-
-#   include "createTime.H"
-#   include "createMesh.H"
+    #include "createTime.H"
+    #include "createMesh.H"
 
     Info<< "Reading field p\n" << endl;
     volScalarField p
@@ -91,7 +91,7 @@ int main(int argc, char *argv[])
     Info<< C << endl;
     Info<< (C & U) << endl;
 
-    SlicedGeometricField<vector, fvPatchField, slicedFvPatchField, surfaceMesh>
+    SlicedGeometricField<vector, fvsPatchField, slicedFvsPatchField, surfaceMesh>
     Sf
     (
         IOobject
@@ -105,7 +105,7 @@ int main(int argc, char *argv[])
         mesh.faceAreas()
     );
 
-    Info<< Sf << endl;
+    //Info<< Sf << endl;
 
     return 0;
 }
diff --git a/applications/test/testPointEdgeWave/testPointEdgeWave.C b/applications/test/testPointEdgeWave/testPointEdgeWave.C
index 3a1ff900eb8..124b7a921ab 100644
--- a/applications/test/testPointEdgeWave/testPointEdgeWave.C
+++ b/applications/test/testPointEdgeWave/testPointEdgeWave.C
@@ -48,8 +48,6 @@ int main(int argc, char *argv[])
 #   include "createTime.H"
 #   include "createPolyMesh.H"
 
-    pointMesh pMesh(mesh);
-
     const polyBoundaryMesh& patches = mesh.boundaryMesh();
 
     // Get name of patch
@@ -99,7 +97,7 @@ int main(int argc, char *argv[])
 
     PointEdgeWave<pointEdgePoint> wallCalc
     (
-        pMesh,
+        mesh,
         wallPoints,
         wallInfo,
 
@@ -119,7 +117,7 @@ int main(int argc, char *argv[])
             IOobject::NO_READ,
             IOobject::AUTO_WRITE
         ),
-        pMesh,
+        pointMesh::New(mesh),
         dimensionedScalar("wallDist", dimLength, 0.0)
     );
 
diff --git a/applications/test/volField/volFieldTest.C b/applications/test/volField/volFieldTest.C
index 3b7dafef8e4..f910c225444 100644
--- a/applications/test/volField/volFieldTest.C
+++ b/applications/test/volField/volFieldTest.C
@@ -34,11 +34,10 @@ Application
 
 int main(int argc, char *argv[])
 {
+    #include "setRootCase.H"
 
-#   include "setRootCase.H"
-
-#   include "createTime.H"
-#   include "createMesh.H"
+    #include "createTime.H"
+    #include "createMesh.H"
 
     Info<< "Reading field p\n" << endl;
     volScalarField p
@@ -70,12 +69,9 @@ int main(int argc, char *argv[])
         mesh
     );
 
-#   include "createPhi.H"
-
-    //Info<< transform(dimensionedTensor("I", dimless, 0.1*I), U) << endl;
-
+    #include "createPhi.H"
 
-    GeometricField<sphericalTensor, fvPatchField, volMesh> st
+    GeometricField<symmTensor, fvPatchField, volMesh> st
     (
         IOobject
         (
@@ -86,8 +82,8 @@ int main(int argc, char *argv[])
             IOobject::NO_WRITE
         ),
         mesh,
-        dimensioned<sphericalTensor>("st", dimless, sphericalTensor::I),
-        zeroGradientFvPatchSphericalTensorField::typeName
+        dimensioned<symmTensor>("st", dimless, symmTensor::one),
+        zeroGradientFvPatchSymmTensorField::typeName
     );
 
     //Info<< fvc::div(st) << endl;
diff --git a/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C b/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C
index d63921f95ba..4701c8020de 100644
--- a/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C
+++ b/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C
@@ -105,7 +105,7 @@ template<class Key, class Hash>
 void Foam::HashSet<Key, Hash>::operator&=(const HashSet<Key, Hash>& rhs)
 {
     // Remove elements not also found in rhs
-    for (iterator iter = this->cbegin(); iter != this->cend(); ++iter)
+    for (iterator iter = this->begin(); iter != this->end(); ++iter)
     {
         if (!rhs.found(iter.key()))
         {
@@ -145,8 +145,6 @@ void Foam::HashSet<Key, Hash>::operator-=(const HashSet<Key, Hash>& rhs)
 }
 
 
-// * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
-
 /* * * * * * * * * * * * * * * * Global operators  * * * * * * * * * * * * * */
 
 template<class Key, class Hash>
diff --git a/src/OpenFOAM/matrices/Matrix/Matrix.C b/src/OpenFOAM/matrices/Matrix/Matrix.C
index 7f91a5f36c8..0062d897a43 100644
--- a/src/OpenFOAM/matrices/Matrix/Matrix.C
+++ b/src/OpenFOAM/matrices/Matrix/Matrix.C
@@ -235,12 +235,12 @@ void Foam::Matrix<Form, Type>::operator=(const Matrix<Form, Type>& a)
 template<class Form, class Type>
 const Type& Foam::max(const Matrix<Form, Type>& a)
 {
-    label nm = a.n_*a.m_;
+    label nm = a.n()*a.m();
 
     if (nm)
     {
         label curMaxI = 0;
-        const Type* v = a.v_[0];
+        const Type* v = a[0];
 
         for (register label i=1; i<nm; i++)
         {
@@ -267,12 +267,12 @@ const Type& Foam::max(const Matrix<Form, Type>& a)
 template<class Form, class Type>
 const Type& Foam::min(const Matrix<Form, Type>& a)
 {
-    label nm = a.n_*a.m_;
+    label nm = a.n()*a.m();
 
     if (nm)
     {
         label curMinI = 0;
-        const Type* v = a.v_[0];
+        const Type* v = a[0];
 
         for (register label i=1; i<nm; i++)
         {
@@ -301,14 +301,14 @@ const Type& Foam::min(const Matrix<Form, Type>& a)
 template<class Form, class Type>
 Form Foam::operator-(const Matrix<Form, Type>& a)
 {
-    Form na(a.n_, a.m_);
+    Form na(a.n(), a.m());
 
-    if (a.n_ && a.m_)
+    if (a.n() && a.m())
     {
-        Type* nav = na.v_[0];
-        const Type* av = a.v_[0];
+        Type* nav = na[0];
+        const Type* av = a[0];
 
-        label nm = a.n_*a.m_;
+        label nm = a.n()*a.m();
         for (register label i=0; i<nm; i++)
         {
             nav[i] = -av[i];
@@ -322,33 +322,33 @@ Form Foam::operator-(const Matrix<Form, Type>& a)
 template<class Form, class Type>
 Form Foam::operator+(const Matrix<Form, Type>& a, const Matrix<Form, Type>& b)
 {
-    if (a.n_ != b.n_)
+    if (a.n() != b.n())
     {
         FatalErrorIn
         (
             "Matrix<Form, Type>::operator+(const Matrix<Form, Type>&, const Matrix<Form, Type>&)"
         )   << "attempted add matrices with different number of rows: "
-            << a.n_ << ", " << b.n_
+            << a.n() << ", " << b.n()
             << abort(FatalError);
     }
 
-    if (a.m_ != b.m_)
+    if (a.m() != b.m())
     {
         FatalErrorIn
         (
             "Matrix<Form, Type>::operator+(const Matrix<Form, Type>&, const Matrix<Form, Type>&)"
         )   << "attempted add matrices with different number of columns: "
-            << a.m_ << ", " << b.m_
+            << a.m() << ", " << b.m()
             << abort(FatalError);
     }
 
-    Form ab(a.n_, a.m_);
+    Form ab(a.n(), a.m());
 
-    Type* abv = ab.v_[0];
-    const Type* av = a.v_[0];
-    const Type* bv = b.v_[0];
+    Type* abv = ab[0];
+    const Type* av = a[0];
+    const Type* bv = b[0];
 
-    label nm = a.n_*a.m_;
+    label nm = a.n()*a.m();
     for (register label i=0; i<nm; i++)
     {
         abv[i] = av[i] + bv[i];
@@ -361,33 +361,33 @@ Form Foam::operator+(const Matrix<Form, Type>& a, const Matrix<Form, Type>& b)
 template<class Form, class Type>
 Form Foam::operator-(const Matrix<Form, Type>& a, const Matrix<Form, Type>& b)
 {
-    if (a.n_ != b.n_)
+    if (a.n() != b.n())
     {
         FatalErrorIn
         (
             "Matrix<Form, Type>::operator-(const Matrix<Form, Type>&, const Matrix<Form, Type>&)"
         )   << "attempted add matrices with different number of rows: "
-            << a.n_ << ", " << b.n_
+            << a.n() << ", " << b.n()
             << abort(FatalError);
     }
 
-    if (a.m_ != b.m_)
+    if (a.m() != b.m())
     {
         FatalErrorIn
         (
             "Matrix<Form, Type>::operator-(const Matrix<Form, Type>&, const Matrix<Form, Type>&)"
         )   << "attempted add matrices with different number of columns: "
-            << a.m_ << ", " << b.m_
+            << a.m() << ", " << b.m()
             << abort(FatalError);
     }
 
-    Form ab(a.n_, a.m_);
+    Form ab(a.n(), a.m());
 
-    Type* abv = ab.v_[0];
-    const Type* av = a.v_[0];
-    const Type* bv = b.v_[0];
+    Type* abv = ab[0];
+    const Type* av = a[0];
+    const Type* bv = b[0];
 
-    label nm = a.n_*a.m_;
+    label nm = a.n()*a.m();
     for (register label i=0; i<nm; i++)
     {
         abv[i] = av[i] - bv[i];
@@ -400,14 +400,14 @@ Form Foam::operator-(const Matrix<Form, Type>& a, const Matrix<Form, Type>& b)
 template<class Form, class Type>
 Form Foam::operator*(const scalar s, const Matrix<Form, Type>& a)
 {
-    Form sa(a.n_, a.m_);
+    Form sa(a.n(), a.m());
 
-    if (a.n_ && a.m_)
+    if (a.n() && a.m())
     {
-        Type* sav = sa.v_[0];
-        const Type* av = a.v_[0];
+        Type* sav = sa[0];
+        const Type* av = a[0];
 
-        label nm = a.n_*a.m_;
+        label nm = a.n()*a.m();
         for (register label i=0; i<nm; i++)
         {
             sav[i] = s*av[i];
diff --git a/src/OpenFOAM/matrices/Matrix/Matrix.H b/src/OpenFOAM/matrices/Matrix/Matrix.H
index fd623fdb206..b674956e2f2 100644
--- a/src/OpenFOAM/matrices/Matrix/Matrix.H
+++ b/src/OpenFOAM/matrices/Matrix/Matrix.H
@@ -161,10 +161,10 @@ public:
 
     // Member operators
 
-        //- Return subscript-checked element of Matrix.
+        //- Return subscript-checked row of Matrix.
         inline Type* operator[](const label);
 
-        //- Return subscript-checked element of constant Matrix.
+        //- Return subscript-checked row of constant Matrix.
         inline const Type* operator[](const label) const;
 
         //- Assignment operator. Takes linear time.
-- 
GitLab