Added component function
This commit is contained in:
parent
e935307a00
commit
9c34f0166f
2 changed files with 42 additions and 1 deletions
|
@ -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()
|
||||
(
|
||||
|
|
|
@ -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;
|
||||
|
|
Reference in a new issue