Added component function

This commit is contained in:
Hrvoje Jasak 2011-09-22 15:12:49 +01:00
parent af90dfe52c
commit 225f880c20
2 changed files with 42 additions and 1 deletions

View file

@ -101,6 +101,13 @@ public:
// Member Functions
//- Return direction given (i, j) indices
static inline direction cmpt
(
const direction i,
const direction j
);
//- Return (i, j) component
inline const Cmpt& operator()
(

View file

@ -217,6 +217,36 @@ inline TensorN<Cmpt, length> transform
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template <class Cmpt, int length>
inline direction TensorN<Cmpt, length>::cmpt
(
const direction i,
const direction j
)
{
if
(
i > TensorN<Cmpt, length>::rowLength - 1
|| j > TensorN<Cmpt, length>::rowLength - 1
)
{
FatalErrorIn
(
"direction TensorN<Cmpt, length>::cmpt()\n"
"(\n"
" const direction i,\n"
" const direction j\n"
") const"
) << "Direction out of range (0 "
<< TensorN<Cmpt, length>::rowLength - 1 << ")"
<< " and (i j) = (" << i << " " << j << ")"
<< abort(FatalError);
}
return i*TensorN<Cmpt, length>::rowLength + j;
}
template <class Cmpt, int length>
inline const Cmpt& TensorN<Cmpt, length>::operator()
(
@ -857,7 +887,11 @@ inline TensorN<Cmpt, length> inv(const TensorN<Cmpt, length>& t)
{
if (iPivot[k] == 0)
{
if ((temp = Foam::mag(result[curRowOffset+k])) >= largestCoeff)
if
(
(temp = Foam::mag(result[curRowOffset+k]))
>= largestCoeff
)
{
largestCoeff = temp;
iRow = j;