From d830a1ca8fe67df64e6665fd0d66eb3597472ad0 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Fri, 5 Nov 2010 12:10:34 +0000 Subject: [PATCH] Reorganisation of block matrix --- .../Make/files | 1 - .../Make/options | 4 +- .../blockCoupledScalarTransportFoam/tensor2.H | 64 ---------- .../blockCoupledScalarTransportFoam/vector2.H | 66 ---------- .../fields/CoeffField/CoeffFieldFunctions.C | 4 +- .../CoeffField/DecoupledCoeffFieldFunctions.C | 2 +- src/VectorN/OpenFOAM/primitives/TensorNI.H | 116 +++++++++++++++--- src/VectorN/OpenFOAM/primitives/VectorN.H | 11 +- 8 files changed, 110 insertions(+), 158 deletions(-) delete mode 100644 applications/solvers/coupled/blockCoupledScalarTransportFoam/tensor2.H delete mode 100644 applications/solvers/coupled/blockCoupledScalarTransportFoam/vector2.H diff --git a/applications/solvers/coupled/blockCoupledScalarTransportFoam/Make/files b/applications/solvers/coupled/blockCoupledScalarTransportFoam/Make/files index e972ab9ea..bb426b65f 100644 --- a/applications/solvers/coupled/blockCoupledScalarTransportFoam/Make/files +++ b/applications/solvers/coupled/blockCoupledScalarTransportFoam/Make/files @@ -4,5 +4,4 @@ blockVector2Solvers.C blockCoupledScalarTransportFoam.C - EXE = $(FOAM_APPBIN)/blockCoupledScalarTransportFoam diff --git a/applications/solvers/coupled/blockCoupledScalarTransportFoam/Make/options b/applications/solvers/coupled/blockCoupledScalarTransportFoam/Make/options index d537a0f46..068c46323 100644 --- a/applications/solvers/coupled/blockCoupledScalarTransportFoam/Make/options +++ b/applications/solvers/coupled/blockCoupledScalarTransportFoam/Make/options @@ -1,8 +1,8 @@ EXE_INC = \ -ftemplate-depth-100 \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/blockMatrix/lnInclude + -I$(LIB_SRC)/VectorN/lnInclude EXE_LIBS = \ -lfiniteVolume \ - -lblockMatrix + -lVectorN diff --git a/applications/solvers/coupled/blockCoupledScalarTransportFoam/tensor2.H b/applications/solvers/coupled/blockCoupledScalarTransportFoam/tensor2.H deleted file mode 100644 index 5df2d9bbb..000000000 --- a/applications/solvers/coupled/blockCoupledScalarTransportFoam/tensor2.H +++ /dev/null @@ -1,64 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright held by original author - \\/ 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 - -Type - tensor2 - -Description - TensorN of 2 scalars. - -SourceFiles - tensor2.C - -\*---------------------------------------------------------------------------*/ - -#ifndef tensor2_H -#define tensor2_H - -#include "TensorN.H" -#include "contiguous.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -typedef TensorN tensor2; - -//- Specify data associated with tensor2 type is contiguous -template<> -inline bool contiguous() {return true;} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/solvers/coupled/blockCoupledScalarTransportFoam/vector2.H b/applications/solvers/coupled/blockCoupledScalarTransportFoam/vector2.H deleted file mode 100644 index fd0976ab1..000000000 --- a/applications/solvers/coupled/blockCoupledScalarTransportFoam/vector2.H +++ /dev/null @@ -1,66 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright held by original author - \\/ 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 - -Type - vector2 - -Description - vector2 obtained from generic VectorN - -SourceFiles - vector2.C - -\*---------------------------------------------------------------------------*/ - -#ifndef vector2_H -#define vector2_H - -#include "scalar.H" -#include "VectorN.H" -#include "contiguous.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -typedef VectorN vector2; - - -//- Specify data associated with vector2 type is contiguous -template<> -inline bool contiguous() {return true;} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/OpenFOAM/fields/CoeffField/CoeffFieldFunctions.C b/src/OpenFOAM/fields/CoeffField/CoeffFieldFunctions.C index f39f6210e..899c0137e 100644 --- a/src/OpenFOAM/fields/CoeffField/CoeffFieldFunctions.C +++ b/src/OpenFOAM/fields/CoeffField/CoeffFieldFunctions.C @@ -327,7 +327,9 @@ Foam::tmp > Foam::operator op \ BINARY_OPERATOR_TRF(Type1, Type2, op, opFunc) \ BINARY_OPERATOR_TRT(Type1, Type2, op, opFunc) -BINARY_OPERATOR_R(Type, Type, *, multiply) +// Operator multiply is not available for all types, as it expands rank +// HJ, 17/Jun/2010 +// BINARY_OPERATOR_R(Type, Type, *, multiply) #undef BINARY_OPERATOR_R #undef BINARY_OPERATOR_FF diff --git a/src/OpenFOAM/fields/CoeffField/DecoupledCoeffFieldFunctions.C b/src/OpenFOAM/fields/CoeffField/DecoupledCoeffFieldFunctions.C index 177f5485b..bfa1123aa 100644 --- a/src/OpenFOAM/fields/CoeffField/DecoupledCoeffFieldFunctions.C +++ b/src/OpenFOAM/fields/CoeffField/DecoupledCoeffFieldFunctions.C @@ -313,7 +313,7 @@ Foam::tmp > Foam::operator op \ BINARY_OPERATOR_TRF(Type1, Type2, op, opFunc) \ BINARY_OPERATOR_TRT(Type1, Type2, op, opFunc) -BINARY_OPERATOR_R(Type, Type, *, multiply) +// BINARY_OPERATOR_R(Type, Type, *, multiply) #undef BINARY_OPERATOR_R #undef BINARY_OPERATOR_FF diff --git a/src/VectorN/OpenFOAM/primitives/TensorNI.H b/src/VectorN/OpenFOAM/primitives/TensorNI.H index 2c07d382c..a1853f408 100644 --- a/src/VectorN/OpenFOAM/primitives/TensorNI.H +++ b/src/VectorN/OpenFOAM/primitives/TensorNI.H @@ -65,7 +65,12 @@ inline TensorN::TensorN template inline TensorN::TensorN(const Cmpt& tx) { - VectorSpaceOps::nComponents,0>::eqOpS(*this, tx, eqOp()); + VectorSpaceOps::nComponents,0>::eqOpS + ( + *this, + tx, + eqOp() + ); } @@ -121,7 +126,7 @@ template inline TensorN TensorN::negSumDiag() const { TensorN negsumdiag; - + // Zero main diagonal int diagI=0; for (int i = 0; i < TensorN::rowLength; i++) @@ -145,13 +150,14 @@ inline TensorN TensorN::negSumDiag() const diagI += TensorN::rowLength + 1; } } - + return negsumdiag; } //- Assign to a SphericalTensorN template -inline void TensorN::operator=(const SphericalTensorN& st) +inline void +TensorN::operator=(const SphericalTensorN& st) { int diag=0; for (int i = 0; i < TensorN::nComponents; i++) @@ -171,7 +177,8 @@ inline void TensorN::operator=(const SphericalTensorN -inline void TensorN::operator=(const DiagTensorN& dt) +inline void +TensorN::operator=(const DiagTensorN& dt) { int diag=0; int k=0; @@ -270,7 +277,11 @@ operator&(const TensorN& t1, const TensorN& t2) template inline typename innerProduct, TensorN >::type -operator&(const DiagTensorN& dt1, const TensorN& t2) +operator& +( + const DiagTensorN& dt1, + const TensorN& t2 +) { TensorN result; @@ -293,7 +304,11 @@ operator&(const DiagTensorN& dt1, const TensorN& t2) template inline typename innerProduct, DiagTensorN >::type -operator&(const TensorN& t1, const DiagTensorN& dt2) +operator& +( + const TensorN& t1, + const DiagTensorN& dt2 +) { TensorN result; @@ -315,11 +330,22 @@ operator&(const TensorN& t1, const DiagTensorN& dt2) template inline typename innerProduct, TensorN >::type -operator&(const SphericalTensorN& st1, const TensorN& t2) +operator& +( + const SphericalTensorN& st1, + const TensorN& t2 +) { const Cmpt& s = st1.v_[0]; TensorN res; - VectorSpaceOps::nComponents,0>::opSV(res, s, t2, multiplyOp()); + VectorSpaceOps::nComponents,0>::opSV + ( + res, + s, + t2, + multiplyOp() + ); + return res; } @@ -328,11 +354,22 @@ operator&(const SphericalTensorN& st1, const TensorN template inline typename innerProduct, SphericalTensorN >::type -operator&(const TensorN& t1, const SphericalTensorN& st2) +operator& +( + const TensorN& t1, + const SphericalTensorN& st2 +) { const Cmpt& s = st2.v_[0]; TensorN res; - VectorSpaceOps::nComponents,0>::opVS(res, t1, s, multiplyOp()); + VectorSpaceOps::nComponents,0>::opVS + ( + res, + t1, + s, + multiplyOp() + ); + return res; } @@ -413,7 +450,14 @@ inline TensorN operator+(const TensorN& t1, const TensorN& t2) { TensorN res; - VectorSpaceOps::nComponents,0>::op(res, t1, t2, plusOp()); + VectorSpaceOps::nComponents,0>::op + ( + res, + t1, + t2, + plusOp() + ); + return res; } @@ -457,7 +501,11 @@ operator+(const DiagTensorN& dt1, const TensorN& t2) //- Addition of TensorN and SphericalTensorN template inline TensorN -operator+(const TensorN& t1, const SphericalTensorN& st2) +operator+ +( + const TensorN& t1, + const SphericalTensorN& st2 +) { TensorN result(t1); @@ -476,7 +524,11 @@ operator+(const TensorN& t1, const SphericalTensorN& s //- Addition of SphericalTensorN and TensorN template inline TensorN -operator+(const SphericalTensorN& st1, const TensorN& t2) +operator+ +( + const SphericalTensorN& st1, + const TensorN& t2 +) { TensorN result(t2); @@ -498,7 +550,14 @@ inline TensorN operator-(const TensorN& t1, const TensorN& t2) { TensorN res; - VectorSpaceOps::nComponents,0>::op(res, t1, t2, minusOp()); + VectorSpaceOps::nComponents,0>::op + ( + res, + t1, + t2, + minusOp() + ); + return res; } @@ -542,7 +601,11 @@ operator-(const DiagTensorN& dt1, const TensorN& t2) //- Subtraction of TensorN and SphericalTensorN template inline TensorN -operator-(const TensorN& t1, const SphericalTensorN& st2) +operator- +( + const TensorN& t1, + const SphericalTensorN& st2 +) { TensorN result(t1); @@ -561,7 +624,11 @@ operator-(const TensorN& t1, const SphericalTensorN& s //- Subtraction of SphericalTensorN and TensorN template inline TensorN -operator-(const SphericalTensorN& st1, const TensorN& t2) +operator- +( + const SphericalTensorN& st1, + const TensorN& t2 +) { TensorN result(-t2); @@ -623,7 +690,11 @@ operator/(const TensorN& t1, const DiagTensorN& dt2) //- Inner Product of a SphericalTensorN and an inverse TensorN template inline TensorN -operator/(const SphericalTensorN& st1, const TensorN& t2) +operator/ +( + const SphericalTensorN& st1, + const TensorN& t2 +) { return st1.v_[0] * inv(t2); } @@ -632,7 +703,11 @@ operator/(const SphericalTensorN& st1, const TensorN& //- Inner Product of a TensorN and an inverse SphericalTensorN template inline TensorN -operator/(const TensorN& t1, const SphericalTensorN& st2) +operator/ +( + const TensorN& t1, + const SphericalTensorN& st2 +) { TensorN result; @@ -759,7 +834,8 @@ inline TensorN inv(const TensorN& t) label iRow=0, iCol=0; Cmpt largestCoeff, temp; - Cmpt __restrict__ *srcIter, *destIter; + Cmpt* __restrict__ srcIter; + Cmpt* __restrict__ destIter; // Lists used for bookkeeping on the pivoting List