Matrices: Rename private member 'nRows_' -> 'mRows_' for consistency with access member function 'm()'
This commit is contained in:
@ -125,23 +125,23 @@ Foam::CompactListList<T, Container>::CompactListList
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Container>
|
||||
void Foam::CompactListList<T, Container>::setSize(const label nRows)
|
||||
void Foam::CompactListList<T, Container>::setSize(const label mRows)
|
||||
{
|
||||
if (nRows == 0)
|
||||
if (mRows == 0)
|
||||
{
|
||||
clear();
|
||||
}
|
||||
if (nRows < size())
|
||||
if (mRows < size())
|
||||
{
|
||||
size_ = nRows;
|
||||
offsets_.setSize(nRows+1);
|
||||
m_.setSize(offsets_[nRows]);
|
||||
size_ = mRows;
|
||||
offsets_.setSize(mRows+1);
|
||||
m_.setSize(offsets_[mRows]);
|
||||
}
|
||||
else if (nRows > size())
|
||||
else if (mRows > size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot be used to extend the list from " << offsets_.size()
|
||||
<< " to " << nRows << nl
|
||||
<< " to " << mRows << nl
|
||||
<< " Please use one of the other setSize member functions"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
@ -151,12 +151,12 @@ void Foam::CompactListList<T, Container>::setSize(const label nRows)
|
||||
template<class T, class Container>
|
||||
void Foam::CompactListList<T, Container>::setSize
|
||||
(
|
||||
const label nRows,
|
||||
const label mRows,
|
||||
const label nData
|
||||
)
|
||||
{
|
||||
size_ = nRows;
|
||||
offsets_.setSize(nRows+1);
|
||||
size_ = mRows;
|
||||
offsets_.setSize(mRows+1);
|
||||
m_.setSize(nData);
|
||||
}
|
||||
|
||||
@ -164,13 +164,13 @@ void Foam::CompactListList<T, Container>::setSize
|
||||
template<class T, class Container>
|
||||
void Foam::CompactListList<T, Container>::setSize
|
||||
(
|
||||
const label nRows,
|
||||
const label mRows,
|
||||
const label nData,
|
||||
const T& t
|
||||
)
|
||||
{
|
||||
size_ = nRows;
|
||||
offsets_.setSize(nRows+1);
|
||||
size_ = mRows;
|
||||
offsets_.setSize(mRows+1);
|
||||
m_.setSize(nData, t);
|
||||
}
|
||||
|
||||
|
||||
@ -107,11 +107,11 @@ public:
|
||||
|
||||
//- Construct given size of offset table (number of rows)
|
||||
// and number of data.
|
||||
inline CompactListList(const label nRows, const label nData);
|
||||
inline CompactListList(const label mRows, const label nData);
|
||||
|
||||
//- Construct given size of offset table (number of rows),
|
||||
// the number of data and a value for all elements.
|
||||
inline CompactListList(const label nRows, const label nData, const T&);
|
||||
inline CompactListList(const label mRows, const label nData, const T&);
|
||||
|
||||
//- Construct given list of row-sizes.
|
||||
explicit CompactListList(const labelUList& rowSizes);
|
||||
@ -159,26 +159,26 @@ public:
|
||||
|
||||
//- Reset size of CompactListList.
|
||||
// This form only allows contraction of the CompactListList.
|
||||
void setSize(const label nRows);
|
||||
void setSize(const label mRows);
|
||||
|
||||
//- Reset size of CompactListList.
|
||||
void setSize(const label nRows, const label nData);
|
||||
void setSize(const label mRows, const label nData);
|
||||
|
||||
//- Reset sizes of CompactListList and value for new elements.
|
||||
void setSize(const label nRows, const label nData, const T&);
|
||||
void setSize(const label mRows, const label nData, const T&);
|
||||
|
||||
//- Reset size of CompactListList.
|
||||
void setSize(const labelUList& rowSizes);
|
||||
|
||||
//- Reset size of CompactListList.
|
||||
// This form only allows contraction of the CompactListList.
|
||||
inline void resize(const label nRows);
|
||||
inline void resize(const label mRows);
|
||||
|
||||
//- Reset size of CompactListList.
|
||||
inline void resize(const label nRows, const label nData);
|
||||
inline void resize(const label mRows, const label nData);
|
||||
|
||||
//- Reset sizes of CompactListList and value for new elements.
|
||||
inline void resize(const label nRows, const label nData, const T&);
|
||||
inline void resize(const label mRows, const label nData, const T&);
|
||||
|
||||
//- Reset size of CompactListList.
|
||||
inline void resize(const labelUList& rowSizes);
|
||||
|
||||
@ -38,12 +38,12 @@ inline Foam::CompactListList<T, Container>::CompactListList()
|
||||
template<class T, class Container>
|
||||
inline Foam::CompactListList<T, Container>::CompactListList
|
||||
(
|
||||
const label nRows,
|
||||
const label mRows,
|
||||
const label nData
|
||||
)
|
||||
:
|
||||
size_(nRows),
|
||||
offsets_(nRows+1, 0),
|
||||
size_(mRows),
|
||||
offsets_(mRows+1, 0),
|
||||
m_(nData)
|
||||
{}
|
||||
|
||||
@ -51,13 +51,13 @@ inline Foam::CompactListList<T, Container>::CompactListList
|
||||
template<class T, class Container>
|
||||
inline Foam::CompactListList<T, Container>::CompactListList
|
||||
(
|
||||
const label nRows,
|
||||
const label mRows,
|
||||
const label nData,
|
||||
const T& t
|
||||
)
|
||||
:
|
||||
size_(nRows),
|
||||
offsets_(nRows+1, 0),
|
||||
size_(mRows),
|
||||
offsets_(mRows+1, 0),
|
||||
m_(nData, t)
|
||||
{}
|
||||
|
||||
@ -173,32 +173,32 @@ Foam::CompactListList<T, Container>::xfer()
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline void Foam::CompactListList<T, Container>::resize(const label nRows)
|
||||
inline void Foam::CompactListList<T, Container>::resize(const label mRows)
|
||||
{
|
||||
this->setSize(nRows);
|
||||
this->setSize(mRows);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline void Foam::CompactListList<T, Container>::resize
|
||||
(
|
||||
const label nRows,
|
||||
const label mRows,
|
||||
const label nData
|
||||
)
|
||||
{
|
||||
this->setSize(nRows, nData);
|
||||
this->setSize(mRows, nData);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline void Foam::CompactListList<T, Container>::resize
|
||||
(
|
||||
const label nRows,
|
||||
const label mRows,
|
||||
const label nData,
|
||||
const T& t
|
||||
)
|
||||
{
|
||||
this->setSize(nRows, nData, t);
|
||||
this->setSize(mRows, nData, t);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -244,14 +244,14 @@ label findLower
|
||||
|
||||
//- To construct a List from a C array. Has extra Container type
|
||||
// to initialise e.g. wordList from arrays of char*.
|
||||
template<class Container, class T, int nRows>
|
||||
List<Container> initList(const T[nRows]);
|
||||
template<class Container, class T, int mRows>
|
||||
List<Container> initList(const T[mRows]);
|
||||
|
||||
|
||||
//- To construct a (square) ListList from a C array. Has extra Container type
|
||||
// to initialise e.g. faceList from arrays of labels.
|
||||
template<class Container, class T, int nRows, int nColumns>
|
||||
List<Container> initListList(const T[nRows][nColumns]);
|
||||
template<class Container, class T, int mRows, int nColumns>
|
||||
List<Container> initListList(const T[mRows][nColumns]);
|
||||
|
||||
|
||||
//- Helper class for list to append y onto the end of x
|
||||
|
||||
@ -687,10 +687,10 @@ Foam::label Foam::findLower
|
||||
}
|
||||
|
||||
|
||||
template<class Container, class T, int nRows>
|
||||
Foam::List<Container> Foam::initList(const T elems[nRows])
|
||||
template<class Container, class T, int mRows>
|
||||
Foam::List<Container> Foam::initList(const T elems[mRows])
|
||||
{
|
||||
List<Container> lst(nRows);
|
||||
List<Container> lst(mRows);
|
||||
|
||||
forAll(lst, rowI)
|
||||
{
|
||||
@ -700,10 +700,10 @@ Foam::List<Container> Foam::initList(const T elems[nRows])
|
||||
}
|
||||
|
||||
|
||||
template<class Container, class T, int nRows, int nColumns>
|
||||
Foam::List<Container> Foam::initListList(const T elems[nRows][nColumns])
|
||||
template<class Container, class T, int mRows, int nColumns>
|
||||
Foam::List<Container> Foam::initListList(const T elems[mRows][nColumns])
|
||||
{
|
||||
List<Container> lst(nRows);
|
||||
List<Container> lst(mRows);
|
||||
|
||||
Container cols(nColumns);
|
||||
forAll(lst, rowI)
|
||||
|
||||
@ -144,13 +144,13 @@ Foam::LUscalarMatrix::LUscalarMatrix
|
||||
|
||||
if (Pstream::master(comm_))
|
||||
{
|
||||
label nRows = m();
|
||||
label mRows = m();
|
||||
label nColumns = n();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "LUscalarMatrix : size:" << nRows << endl;
|
||||
for (label rowI = 0; rowI < nRows; rowI++)
|
||||
Pout<< "LUscalarMatrix : size:" << mRows << endl;
|
||||
for (label rowI = 0; rowI < mRows; rowI++)
|
||||
{
|
||||
const scalar* row = operator[](rowI);
|
||||
|
||||
|
||||
@ -52,21 +52,21 @@ namespace Foam
|
||||
Class MatrixSpace Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Form, class Cmpt, direction Nrows, direction Ncols>
|
||||
template<class Form, class Cmpt, direction Mrows, direction Ncols>
|
||||
class MatrixSpace
|
||||
:
|
||||
public VectorSpace<Form, Cmpt, Nrows*Ncols>
|
||||
public VectorSpace<Form, Cmpt, Mrows*Ncols>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- MatrixSpace type
|
||||
typedef MatrixSpace<Form, Cmpt, Nrows, Ncols> msType;
|
||||
typedef MatrixSpace<Form, Cmpt, Mrows, Ncols> msType;
|
||||
|
||||
|
||||
// Member constants
|
||||
|
||||
static const direction nRows = Nrows;
|
||||
static const direction mRows = Mrows;
|
||||
static const direction nCols = Ncols;
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ public:
|
||||
//- Return the number of rows
|
||||
static direction m()
|
||||
{
|
||||
return Nrows;
|
||||
return Mrows;
|
||||
}
|
||||
|
||||
//- Return the number of columns
|
||||
@ -99,13 +99,13 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
static const direction nRows = SubTensor::nRows;
|
||||
static const direction mRows = SubTensor::mRows;
|
||||
static const direction nCols = SubTensor::nCols;
|
||||
|
||||
//- Return the number of rows in the block
|
||||
static direction m()
|
||||
{
|
||||
return nRows;
|
||||
return mRows;
|
||||
}
|
||||
|
||||
//- Return the number of columns in the block
|
||||
@ -143,13 +143,13 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
static const direction nRows = SubTensor::nRows;
|
||||
static const direction mRows = SubTensor::mRows;
|
||||
static const direction nCols = SubTensor::nCols;
|
||||
|
||||
//- Return the number of rows in the block
|
||||
static direction m()
|
||||
{
|
||||
return nRows;
|
||||
return mRows;
|
||||
}
|
||||
|
||||
//- Return the number of columns in the block
|
||||
@ -169,7 +169,7 @@ public:
|
||||
<
|
||||
Form2,
|
||||
Cmpt,
|
||||
SubTensor::nRows,
|
||||
SubTensor::mRows,
|
||||
SubTensor::nCols
|
||||
>& matrix
|
||||
);
|
||||
@ -178,7 +178,7 @@ public:
|
||||
template<class VSForm>
|
||||
inline void operator=
|
||||
(
|
||||
const VectorSpace<VSForm, Cmpt, SubTensor::nRows>& v
|
||||
const VectorSpace<VSForm, Cmpt, SubTensor::mRows>& v
|
||||
);
|
||||
|
||||
//- Construct and return the sub-ensor corresponding to this block
|
||||
@ -208,7 +208,7 @@ public:
|
||||
template<class Form2, class Cmpt2>
|
||||
inline explicit MatrixSpace
|
||||
(
|
||||
const VectorSpace<Form2, Cmpt2, Nrows*Ncols>&
|
||||
const VectorSpace<Form2, Cmpt2, Mrows*Ncols>&
|
||||
);
|
||||
|
||||
//- Construct from a block of another matrix space
|
||||
|
||||
@ -27,13 +27,13 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::MatrixSpace()
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::MatrixSpace()
|
||||
{}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::MatrixSpace
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::MatrixSpace
|
||||
(
|
||||
const Foam::zero
|
||||
)
|
||||
@ -42,30 +42,30 @@ inline Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::MatrixSpace
|
||||
{}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
template<class Form2, class Cmpt2>
|
||||
inline Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::MatrixSpace
|
||||
inline Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::MatrixSpace
|
||||
(
|
||||
const VectorSpace<Form2, Cmpt2, Nrows*Ncols>& vs
|
||||
const VectorSpace<Form2, Cmpt2, Mrows*Ncols>& vs
|
||||
)
|
||||
:
|
||||
MatrixSpace::vsType(vs)
|
||||
{}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
template
|
||||
<
|
||||
template<class, Foam::direction, Foam::direction> class Block2,
|
||||
Foam::direction BRowStart,
|
||||
Foam::direction BColStart
|
||||
>
|
||||
inline Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::MatrixSpace
|
||||
inline Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::MatrixSpace
|
||||
(
|
||||
const Block2<Form, BRowStart, BColStart>& block
|
||||
)
|
||||
{
|
||||
for (direction i=0; i<Nrows; ++i)
|
||||
for (direction i=0; i<Mrows; ++i)
|
||||
{
|
||||
for (direction j=0; j<Ncols; ++j)
|
||||
{
|
||||
@ -75,188 +75,188 @@ inline Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::MatrixSpace
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::MatrixSpace(Istream& is)
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::MatrixSpace(Istream& is)
|
||||
:
|
||||
MatrixSpace::vsType(is)
|
||||
{}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
template<class SubTensor, Foam::direction BRowStart, Foam::direction BColStart>
|
||||
inline Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::
|
||||
inline Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::
|
||||
ConstBlock<SubTensor, BRowStart, BColStart>::
|
||||
ConstBlock(const msType& matrix)
|
||||
:
|
||||
matrix_(matrix)
|
||||
{
|
||||
StaticAssert(msType::nRows >= BRowStart + nRows);
|
||||
StaticAssert(msType::mRows >= BRowStart + mRows);
|
||||
StaticAssert(msType::nCols >= BColStart + nCols);
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
template<class SubTensor, Foam::direction BRowStart, Foam::direction BColStart>
|
||||
inline Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::
|
||||
inline Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::
|
||||
Block<SubTensor, BRowStart, BColStart>::
|
||||
Block(msType& matrix)
|
||||
:
|
||||
matrix_(matrix)
|
||||
{
|
||||
StaticAssert(msType::nRows >= BRowStart + nRows);
|
||||
StaticAssert(msType::mRows >= BRowStart + mRows);
|
||||
StaticAssert(msType::nCols >= BColStart + nCols);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
template<Foam::direction Row, Foam::direction Col>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::elmt() const
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::elmt() const
|
||||
{
|
||||
StaticAssert(Row < Nrows && Col < Ncols);
|
||||
StaticAssert(Row < Mrows && Col < Ncols);
|
||||
return this->v_[Row*Ncols + Col];
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
template<Foam::direction Row, Foam::direction Col>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::elmt()
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::elmt()
|
||||
{
|
||||
StaticAssert(Row < Nrows && Col < Ncols);
|
||||
StaticAssert(Row < Mrows && Col < Ncols);
|
||||
return this->v_[Row*Ncols + Col];
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::xx() const
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::xx() const
|
||||
{
|
||||
return elmt<0, 0>();
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::xx()
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::xx()
|
||||
{
|
||||
return elmt<0, 0>();
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::xy() const
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::xy() const
|
||||
{
|
||||
return elmt<0,1>();
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::xy()
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::xy()
|
||||
{
|
||||
return elmt<0,1>();
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::xz() const
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::xz() const
|
||||
{
|
||||
return elmt<0,2>();
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::xz()
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::xz()
|
||||
{
|
||||
return elmt<0,2>();
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::yx() const
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::yx() const
|
||||
{
|
||||
return elmt<1,0>();
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::yx()
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::yx()
|
||||
{
|
||||
return elmt<1,0>();
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::yy() const
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::yy() const
|
||||
{
|
||||
return elmt<1,1>();
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::yy()
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::yy()
|
||||
{
|
||||
return elmt<1,1>();
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::yz() const
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::yz() const
|
||||
{
|
||||
return elmt<1,2>();
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::yz()
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::yz()
|
||||
{
|
||||
return elmt<1,2>();
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::zx() const
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::zx() const
|
||||
{
|
||||
return elmt<2,0>();
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::zx()
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::zx()
|
||||
{
|
||||
return elmt<2,0>();
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::zy() const
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::zy() const
|
||||
{
|
||||
return elmt<2,1>();
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::zy()
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::zy()
|
||||
{
|
||||
return elmt<2,1>();
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::zz() const
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::zz() const
|
||||
{
|
||||
return elmt<2,2>();
|
||||
}
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::zz()
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::zz()
|
||||
{
|
||||
return elmt<2,2>();
|
||||
}
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>
|
||||
Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::identity()
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>
|
||||
Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::identity()
|
||||
{
|
||||
StaticAssert(Nrows == Ncols);
|
||||
StaticAssert(Mrows == Ncols);
|
||||
msType result(Zero);
|
||||
|
||||
for (direction i=0; i<Ncols; ++i)
|
||||
@ -268,13 +268,13 @@ Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::identity()
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline typename Foam::typeOfTranspose<Cmpt, Form>::type
|
||||
Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::T() const
|
||||
Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::T() const
|
||||
{
|
||||
typename typeOfTranspose<Cmpt, Form>::type result;
|
||||
|
||||
for (direction i=0; i<Nrows; ++i)
|
||||
for (direction i=0; i<Mrows; ++i)
|
||||
{
|
||||
for (direction j=0; j<Ncols; ++j)
|
||||
{
|
||||
@ -286,22 +286,22 @@ Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::T() const
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
template
|
||||
<
|
||||
class SubTensor,
|
||||
Foam::direction BRowStart,
|
||||
Foam::direction BColStart
|
||||
>
|
||||
inline typename Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::template
|
||||
inline typename Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::template
|
||||
ConstBlock<SubTensor, BRowStart, BColStart>
|
||||
Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::block() const
|
||||
Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::block() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
template
|
||||
<
|
||||
class SubTensor,
|
||||
@ -309,9 +309,9 @@ template
|
||||
Foam::direction BColStart
|
||||
>
|
||||
inline
|
||||
typename Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::template
|
||||
typename Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::template
|
||||
Block<SubTensor, BRowStart, BColStart>
|
||||
Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::block()
|
||||
Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::block()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
@ -319,15 +319,15 @@ Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::block()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::operator()
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::operator()
|
||||
(
|
||||
const direction& i,
|
||||
const direction& j
|
||||
) const
|
||||
{
|
||||
#ifdef FULLDEBUG
|
||||
if (i > Nrows-1 || j > Ncols-1)
|
||||
if (i > Mrows-1 || j > Ncols-1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "indices out of range"
|
||||
@ -339,15 +339,15 @@ inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::operator()
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::operator()
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::operator()
|
||||
(
|
||||
const direction& i,
|
||||
const direction& j
|
||||
)
|
||||
{
|
||||
#ifdef FULLDEBUG
|
||||
if (i > Nrows-1 || j > Ncols-1)
|
||||
if (i > Mrows-1 || j > Ncols-1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "indices out of range"
|
||||
@ -359,10 +359,10 @@ inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::operator()
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
template<class SubTensor, Foam::direction BRowStart, Foam::direction BColStart>
|
||||
inline SubTensor
|
||||
Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::
|
||||
Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::
|
||||
ConstBlock<SubTensor, BRowStart, BColStart>::
|
||||
operator()() const
|
||||
{
|
||||
@ -370,10 +370,10 @@ operator()() const
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
template<class SubTensor, Foam::direction BRowStart, Foam::direction BColStart>
|
||||
inline const Cmpt&
|
||||
Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::
|
||||
Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::
|
||||
ConstBlock<SubTensor, BRowStart, BColStart>::
|
||||
operator()(const direction i, const direction j) const
|
||||
{
|
||||
@ -381,10 +381,10 @@ operator()(const direction i, const direction j) const
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
template<class SubTensor, Foam::direction BRowStart, Foam::direction BColStart>
|
||||
inline SubTensor
|
||||
Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::
|
||||
Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::
|
||||
Block<SubTensor, BRowStart, BColStart>::
|
||||
operator()() const
|
||||
{
|
||||
@ -392,10 +392,10 @@ operator()() const
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
template<class SubTensor, Foam::direction BRowStart, Foam::direction BColStart>
|
||||
inline const Cmpt&
|
||||
Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::
|
||||
Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::
|
||||
Block<SubTensor, BRowStart, BColStart>::
|
||||
operator()(const direction i, const direction j) const
|
||||
{
|
||||
@ -403,10 +403,10 @@ operator()(const direction i, const direction j) const
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
template<class SubTensor, Foam::direction BRowStart, Foam::direction BColStart>
|
||||
inline Cmpt&
|
||||
Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::
|
||||
Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::
|
||||
Block<SubTensor, BRowStart, BColStart>::
|
||||
operator()(const direction i, const direction j)
|
||||
{
|
||||
@ -414,8 +414,8 @@ operator()(const direction i, const direction j)
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
inline void Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::operator=
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
inline void Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::operator=
|
||||
(
|
||||
const Foam::zero
|
||||
)
|
||||
@ -424,9 +424,9 @@ inline void Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::operator=
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
template<class Form2>
|
||||
inline void Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::operator&=
|
||||
inline void Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::operator&=
|
||||
(
|
||||
const MatrixSpace<Form, Cmpt, Ncols, Ncols>& matrix
|
||||
)
|
||||
@ -435,19 +435,19 @@ inline void Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::operator&=
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
template
|
||||
<
|
||||
template<class, Foam::direction, Foam::direction> class Block2,
|
||||
Foam::direction BRowStart,
|
||||
Foam::direction BColStart
|
||||
>
|
||||
inline void Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::operator=
|
||||
inline void Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::operator=
|
||||
(
|
||||
const Block2<Form, BRowStart, BColStart>& block
|
||||
)
|
||||
{
|
||||
for (direction i = 0; i < Nrows; ++i)
|
||||
for (direction i = 0; i < Mrows; ++i)
|
||||
{
|
||||
for (direction j = 0; j < Ncols; ++j)
|
||||
{
|
||||
@ -457,18 +457,18 @@ inline void Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::operator=
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
template<class SubTensor, Foam::direction BRowStart, Foam::direction BColStart>
|
||||
template<class Form2>
|
||||
inline void
|
||||
Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::
|
||||
Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::
|
||||
Block<SubTensor, BRowStart, BColStart>::
|
||||
operator=
|
||||
(
|
||||
const MatrixSpace<Form2, Cmpt, SubTensor::nRows, SubTensor::nCols>& matrix
|
||||
const MatrixSpace<Form2, Cmpt, SubTensor::mRows, SubTensor::nCols>& matrix
|
||||
)
|
||||
{
|
||||
for (direction i=0; i<nRows; ++i)
|
||||
for (direction i=0; i<mRows; ++i)
|
||||
{
|
||||
for (direction j=0; j<nCols; ++j)
|
||||
{
|
||||
@ -478,20 +478,20 @@ operator=
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Cmpt, Foam::direction Nrows, Foam::direction Ncols>
|
||||
template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
|
||||
template<class SubTensor, Foam::direction BRowStart, Foam::direction BColStart>
|
||||
template<class VSForm>
|
||||
inline void
|
||||
Foam::MatrixSpace<Form, Cmpt, Nrows, Ncols>::
|
||||
Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::
|
||||
Block<SubTensor, BRowStart, BColStart>::
|
||||
operator=
|
||||
(
|
||||
const VectorSpace<VSForm, Cmpt, SubTensor::nRows>& v
|
||||
const VectorSpace<VSForm, Cmpt, SubTensor::mRows>& v
|
||||
)
|
||||
{
|
||||
StaticAssert(nCols == 1);
|
||||
|
||||
for (direction i=0; i<SubTensor::nRows; ++i)
|
||||
for (direction i=0; i<SubTensor::mRows; ++i)
|
||||
{
|
||||
operator()(i,0) = v[i];
|
||||
}
|
||||
@ -505,10 +505,10 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Form, class Cmpt, direction Nrows, direction Ncols>
|
||||
template<class Form, class Cmpt, direction Mrows, direction Ncols>
|
||||
inline typename typeOfTranspose<Cmpt, Form>::type T
|
||||
(
|
||||
const MatrixSpace<Form, Cmpt, Ncols, Nrows>& matrix
|
||||
const MatrixSpace<Form, Cmpt, Ncols, Mrows>& matrix
|
||||
)
|
||||
{
|
||||
return matrix.T();
|
||||
@ -539,26 +539,26 @@ template
|
||||
class Form1,
|
||||
class Form2,
|
||||
class Cmpt,
|
||||
direction Nrows1,
|
||||
direction Mrows1,
|
||||
direction Ncols1,
|
||||
direction Nrows2,
|
||||
direction Mrows2,
|
||||
direction Ncols2
|
||||
>
|
||||
inline typename typeOfInnerProduct<Cmpt, Form1, Form2>::type operator&
|
||||
(
|
||||
const MatrixSpace<Form1, Cmpt, Nrows1, Ncols1>& matrix1,
|
||||
const MatrixSpace<Form2, Cmpt, Nrows2, Ncols2>& matrix2
|
||||
const MatrixSpace<Form1, Cmpt, Mrows1, Ncols1>& matrix1,
|
||||
const MatrixSpace<Form2, Cmpt, Mrows2, Ncols2>& matrix2
|
||||
)
|
||||
{
|
||||
StaticAssert(Ncols1 == Nrows2);
|
||||
StaticAssert(Ncols1 == Mrows2);
|
||||
|
||||
typename typeOfInnerProduct<Cmpt, Form1, Form2>::type result(Zero);
|
||||
|
||||
for (direction i=0; i<Nrows1; ++i)
|
||||
for (direction i=0; i<Mrows1; ++i)
|
||||
{
|
||||
for (direction j=0; j<Ncols2; ++j)
|
||||
{
|
||||
for (direction k=0; k<Nrows2; k++)
|
||||
for (direction k=0; k<Mrows2; k++)
|
||||
{
|
||||
result(i, j) += matrix1(i, k)*matrix2(k, j);
|
||||
}
|
||||
@ -569,16 +569,16 @@ inline typename typeOfInnerProduct<Cmpt, Form1, Form2>::type operator&
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class VSForm, class Cmpt, direction Nrows, direction Ncols>
|
||||
template<class Form, class VSForm, class Cmpt, direction Mrows, direction Ncols>
|
||||
inline typename typeOfInnerProduct<Cmpt, Form, VSForm>::type operator&
|
||||
(
|
||||
const MatrixSpace<Form, Cmpt, Nrows, Ncols>& matrix,
|
||||
const MatrixSpace<Form, Cmpt, Mrows, Ncols>& matrix,
|
||||
const VectorSpace<VSForm, Cmpt, Ncols>& v
|
||||
)
|
||||
{
|
||||
typename typeOfInnerProduct<Cmpt, Form, VSForm>::type result(Zero);
|
||||
|
||||
for (direction i=0; i<Nrows; ++i)
|
||||
for (direction i=0; i<Mrows; ++i)
|
||||
{
|
||||
for (direction j=0; j<Ncols; ++j)
|
||||
{
|
||||
|
||||
@ -100,7 +100,7 @@ public:
|
||||
// VectorSpace currently defaults to a column-vector
|
||||
// This will be removed when column-vector is introduced
|
||||
// as a specialization
|
||||
static const direction nRows = Ncmpts;
|
||||
static const direction mRows = Ncmpts;
|
||||
static const direction nCols = 1;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user