Reorganisation of block matrix

This commit is contained in:
Hrvoje Jasak 2010-11-05 12:10:34 +00:00
parent fad81530ca
commit d830a1ca8f
8 changed files with 110 additions and 158 deletions

View file

@ -4,5 +4,4 @@ blockVector2Solvers.C
blockCoupledScalarTransportFoam.C blockCoupledScalarTransportFoam.C
EXE = $(FOAM_APPBIN)/blockCoupledScalarTransportFoam EXE = $(FOAM_APPBIN)/blockCoupledScalarTransportFoam

View file

@ -1,8 +1,8 @@
EXE_INC = \ EXE_INC = \
-ftemplate-depth-100 \ -ftemplate-depth-100 \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/blockMatrix/lnInclude -I$(LIB_SRC)/VectorN/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
-lblockMatrix -lVectorN

View file

@ -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<scalar, 2> tensor2;
//- Specify data associated with tensor2 type is contiguous
template<>
inline bool contiguous<tensor2>() {return true;}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -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<scalar, 2> vector2;
//- Specify data associated with vector2 type is contiguous
template<>
inline bool contiguous<vector2>() {return true;}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -327,7 +327,9 @@ Foam::tmp<Foam::Field<Type> > Foam::operator op \
BINARY_OPERATOR_TRF(Type1, Type2, op, opFunc) \ BINARY_OPERATOR_TRF(Type1, Type2, op, opFunc) \
BINARY_OPERATOR_TRT(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_R
#undef BINARY_OPERATOR_FF #undef BINARY_OPERATOR_FF

View file

@ -313,7 +313,7 @@ Foam::tmp<Foam::Field<Type> > Foam::operator op \
BINARY_OPERATOR_TRF(Type1, Type2, op, opFunc) \ BINARY_OPERATOR_TRF(Type1, Type2, op, opFunc) \
BINARY_OPERATOR_TRT(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_R
#undef BINARY_OPERATOR_FF #undef BINARY_OPERATOR_FF

View file

@ -65,7 +65,12 @@ inline TensorN<Cmpt, length>::TensorN
template <class Cmpt, int length> template <class Cmpt, int length>
inline TensorN<Cmpt, length>::TensorN(const Cmpt& tx) inline TensorN<Cmpt, length>::TensorN(const Cmpt& tx)
{ {
VectorSpaceOps<TensorN<Cmpt, length>::nComponents,0>::eqOpS(*this, tx, eqOp<Cmpt>()); VectorSpaceOps<TensorN<Cmpt, length>::nComponents,0>::eqOpS
(
*this,
tx,
eqOp<Cmpt>()
);
} }
@ -151,7 +156,8 @@ inline TensorN<Cmpt, length> TensorN<Cmpt, length>::negSumDiag() const
//- Assign to a SphericalTensorN //- Assign to a SphericalTensorN
template <class Cmpt, int length> template <class Cmpt, int length>
inline void TensorN<Cmpt, length>::operator=(const SphericalTensorN<Cmpt, length>& st) inline void
TensorN<Cmpt, length>::operator=(const SphericalTensorN<Cmpt, length>& st)
{ {
int diag=0; int diag=0;
for (int i = 0; i < TensorN<Cmpt, length>::nComponents; i++) for (int i = 0; i < TensorN<Cmpt, length>::nComponents; i++)
@ -171,7 +177,8 @@ inline void TensorN<Cmpt, length>::operator=(const SphericalTensorN<Cmpt, length
//- Assign to a DiagTensorN //- Assign to a DiagTensorN
template <class Cmpt, int length> template <class Cmpt, int length>
inline void TensorN<Cmpt, length>::operator=(const DiagTensorN<Cmpt, length>& dt) inline void
TensorN<Cmpt, length>::operator=(const DiagTensorN<Cmpt, length>& dt)
{ {
int diag=0; int diag=0;
int k=0; int k=0;
@ -270,7 +277,11 @@ operator&(const TensorN<Cmpt, length>& t1, const TensorN<Cmpt, length>& t2)
template <class Cmpt, int length> template <class Cmpt, int length>
inline typename inline typename
innerProduct<DiagTensorN<Cmpt, length>, TensorN<Cmpt, length> >::type innerProduct<DiagTensorN<Cmpt, length>, TensorN<Cmpt, length> >::type
operator&(const DiagTensorN<Cmpt, length>& dt1, const TensorN<Cmpt, length>& t2) operator&
(
const DiagTensorN<Cmpt, length>& dt1,
const TensorN<Cmpt, length>& t2
)
{ {
TensorN<Cmpt, length> result; TensorN<Cmpt, length> result;
@ -293,7 +304,11 @@ operator&(const DiagTensorN<Cmpt, length>& dt1, const TensorN<Cmpt, length>& t2)
template <class Cmpt, int length> template <class Cmpt, int length>
inline typename inline typename
innerProduct<TensorN<Cmpt, length>, DiagTensorN<Cmpt, length> >::type innerProduct<TensorN<Cmpt, length>, DiagTensorN<Cmpt, length> >::type
operator&(const TensorN<Cmpt, length>& t1, const DiagTensorN<Cmpt, length>& dt2) operator&
(
const TensorN<Cmpt, length>& t1,
const DiagTensorN<Cmpt, length>& dt2
)
{ {
TensorN<Cmpt, length> result; TensorN<Cmpt, length> result;
@ -315,11 +330,22 @@ operator&(const TensorN<Cmpt, length>& t1, const DiagTensorN<Cmpt, length>& dt2)
template <class Cmpt, int length> template <class Cmpt, int length>
inline typename inline typename
innerProduct<SphericalTensorN<Cmpt, length>, TensorN<Cmpt, length> >::type innerProduct<SphericalTensorN<Cmpt, length>, TensorN<Cmpt, length> >::type
operator&(const SphericalTensorN<Cmpt, length>& st1, const TensorN<Cmpt, length>& t2) operator&
(
const SphericalTensorN<Cmpt, length>& st1,
const TensorN<Cmpt, length>& t2
)
{ {
const Cmpt& s = st1.v_[0]; const Cmpt& s = st1.v_[0];
TensorN<Cmpt, length> res; TensorN<Cmpt, length> res;
VectorSpaceOps<TensorN<Cmpt, length>::nComponents,0>::opSV(res, s, t2, multiplyOp<Cmpt>()); VectorSpaceOps<TensorN<Cmpt, length>::nComponents,0>::opSV
(
res,
s,
t2,
multiplyOp<Cmpt>()
);
return res; return res;
} }
@ -328,11 +354,22 @@ operator&(const SphericalTensorN<Cmpt, length>& st1, const TensorN<Cmpt, length>
template <class Cmpt, int length> template <class Cmpt, int length>
inline typename inline typename
innerProduct<TensorN<Cmpt, length>, SphericalTensorN<Cmpt, length> >::type innerProduct<TensorN<Cmpt, length>, SphericalTensorN<Cmpt, length> >::type
operator&(const TensorN<Cmpt, length>& t1, const SphericalTensorN<Cmpt, length>& st2) operator&
(
const TensorN<Cmpt, length>& t1,
const SphericalTensorN<Cmpt, length>& st2
)
{ {
const Cmpt& s = st2.v_[0]; const Cmpt& s = st2.v_[0];
TensorN<Cmpt, length> res; TensorN<Cmpt, length> res;
VectorSpaceOps<TensorN<Cmpt, length>::nComponents,0>::opVS(res, t1, s, multiplyOp<Cmpt>()); VectorSpaceOps<TensorN<Cmpt, length>::nComponents,0>::opVS
(
res,
t1,
s,
multiplyOp<Cmpt>()
);
return res; return res;
} }
@ -413,7 +450,14 @@ inline TensorN<Cmpt,length>
operator+(const TensorN<Cmpt,length>& t1, const TensorN<Cmpt,length>& t2) operator+(const TensorN<Cmpt,length>& t1, const TensorN<Cmpt,length>& t2)
{ {
TensorN<Cmpt,length> res; TensorN<Cmpt,length> res;
VectorSpaceOps<TensorN<Cmpt,length>::nComponents,0>::op(res, t1, t2, plusOp<Cmpt>()); VectorSpaceOps<TensorN<Cmpt,length>::nComponents,0>::op
(
res,
t1,
t2,
plusOp<Cmpt>()
);
return res; return res;
} }
@ -457,7 +501,11 @@ operator+(const DiagTensorN<Cmpt,length>& dt1, const TensorN<Cmpt,length>& t2)
//- Addition of TensorN and SphericalTensorN //- Addition of TensorN and SphericalTensorN
template <class Cmpt, int length> template <class Cmpt, int length>
inline TensorN<Cmpt,length> inline TensorN<Cmpt,length>
operator+(const TensorN<Cmpt,length>& t1, const SphericalTensorN<Cmpt,length>& st2) operator+
(
const TensorN<Cmpt,length>& t1,
const SphericalTensorN<Cmpt,length>& st2
)
{ {
TensorN<Cmpt, length> result(t1); TensorN<Cmpt, length> result(t1);
@ -476,7 +524,11 @@ operator+(const TensorN<Cmpt,length>& t1, const SphericalTensorN<Cmpt,length>& s
//- Addition of SphericalTensorN and TensorN //- Addition of SphericalTensorN and TensorN
template <class Cmpt, int length> template <class Cmpt, int length>
inline TensorN<Cmpt,length> inline TensorN<Cmpt,length>
operator+(const SphericalTensorN<Cmpt,length>& st1, const TensorN<Cmpt,length>& t2) operator+
(
const SphericalTensorN<Cmpt,length>& st1,
const TensorN<Cmpt,length>& t2
)
{ {
TensorN<Cmpt, length> result(t2); TensorN<Cmpt, length> result(t2);
@ -498,7 +550,14 @@ inline TensorN<Cmpt,length>
operator-(const TensorN<Cmpt,length>& t1, const TensorN<Cmpt,length>& t2) operator-(const TensorN<Cmpt,length>& t1, const TensorN<Cmpt,length>& t2)
{ {
TensorN<Cmpt,length> res; TensorN<Cmpt,length> res;
VectorSpaceOps<TensorN<Cmpt,length>::nComponents,0>::op(res, t1, t2, minusOp<Cmpt>()); VectorSpaceOps<TensorN<Cmpt,length>::nComponents,0>::op
(
res,
t1,
t2,
minusOp<Cmpt>()
);
return res; return res;
} }
@ -542,7 +601,11 @@ operator-(const DiagTensorN<Cmpt,length>& dt1, const TensorN<Cmpt,length>& t2)
//- Subtraction of TensorN and SphericalTensorN //- Subtraction of TensorN and SphericalTensorN
template <class Cmpt, int length> template <class Cmpt, int length>
inline TensorN<Cmpt,length> inline TensorN<Cmpt,length>
operator-(const TensorN<Cmpt,length>& t1, const SphericalTensorN<Cmpt,length>& st2) operator-
(
const TensorN<Cmpt,length>& t1,
const SphericalTensorN<Cmpt,length>& st2
)
{ {
TensorN<Cmpt, length> result(t1); TensorN<Cmpt, length> result(t1);
@ -561,7 +624,11 @@ operator-(const TensorN<Cmpt,length>& t1, const SphericalTensorN<Cmpt,length>& s
//- Subtraction of SphericalTensorN and TensorN //- Subtraction of SphericalTensorN and TensorN
template <class Cmpt, int length> template <class Cmpt, int length>
inline TensorN<Cmpt,length> inline TensorN<Cmpt,length>
operator-(const SphericalTensorN<Cmpt,length>& st1, const TensorN<Cmpt,length>& t2) operator-
(
const SphericalTensorN<Cmpt,length>& st1,
const TensorN<Cmpt,length>& t2
)
{ {
TensorN<Cmpt, length> result(-t2); TensorN<Cmpt, length> result(-t2);
@ -623,7 +690,11 @@ operator/(const TensorN<Cmpt,length>& t1, const DiagTensorN<Cmpt,length>& dt2)
//- Inner Product of a SphericalTensorN and an inverse TensorN //- Inner Product of a SphericalTensorN and an inverse TensorN
template <class Cmpt, int length> template <class Cmpt, int length>
inline TensorN<Cmpt,length> inline TensorN<Cmpt,length>
operator/(const SphericalTensorN<Cmpt,length>& st1, const TensorN<Cmpt,length>& t2) operator/
(
const SphericalTensorN<Cmpt,length>& st1,
const TensorN<Cmpt,length>& t2
)
{ {
return st1.v_[0] * inv(t2); return st1.v_[0] * inv(t2);
} }
@ -632,7 +703,11 @@ operator/(const SphericalTensorN<Cmpt,length>& st1, const TensorN<Cmpt,length>&
//- Inner Product of a TensorN and an inverse SphericalTensorN //- Inner Product of a TensorN and an inverse SphericalTensorN
template <class Cmpt, int length> template <class Cmpt, int length>
inline TensorN<Cmpt,length> inline TensorN<Cmpt,length>
operator/(const TensorN<Cmpt,length>& t1, const SphericalTensorN<Cmpt,length>& st2) operator/
(
const TensorN<Cmpt,length>& t1,
const SphericalTensorN<Cmpt,length>& st2
)
{ {
TensorN<Cmpt, length> result; TensorN<Cmpt, length> result;
@ -759,7 +834,8 @@ inline TensorN<Cmpt, length> inv(const TensorN<Cmpt, length>& t)
label iRow=0, iCol=0; label iRow=0, iCol=0;
Cmpt largestCoeff, temp; Cmpt largestCoeff, temp;
Cmpt __restrict__ *srcIter, *destIter; Cmpt* __restrict__ srcIter;
Cmpt* __restrict__ destIter;
// Lists used for bookkeeping on the pivoting // Lists used for bookkeeping on the pivoting
List<label> indexCol(length), indexRow(length), iPivot(length); List<label> indexCol(length), indexRow(length), iPivot(length);

View file

@ -79,7 +79,10 @@ public:
inline VectorN(); inline VectorN();
//- Construct given VectorSpace //- Construct given VectorSpace
inline VectorN(const VectorSpace<VectorN<Cmpt, length>, Cmpt, length>&); inline VectorN
(
const VectorSpace<VectorN<Cmpt, length>, Cmpt, length>&
);
//- Construct given component value. Special use only! //- Construct given component value. Special use only!
explicit inline VectorN(const Cmpt& vx); explicit inline VectorN(const Cmpt& vx);
@ -97,8 +100,10 @@ public:
inline Cmpt& operator()(const direction i); inline Cmpt& operator()(const direction i);
//- Componentwise multiply //- Componentwise multiply
inline VectorN<Cmpt, length> cmptMultiply(const VectorN<Cmpt, length>&); inline VectorN<Cmpt, length> cmptMultiply
(
const VectorN<Cmpt, length>&
);
}; };