Commit 450e9dfe authored by mattijs's avatar mattijs
Browse files

ENH: lduMatrix: added external resizing

parent 48092f65
......@@ -209,6 +209,53 @@ Foam::scalarField& Foam::lduMatrix::upper()
}
Foam::scalarField& Foam::lduMatrix::lower(const label nCoeffs)
{
if (!lowerPtr_)
{
if (upperPtr_)
{
lowerPtr_ = new scalarField(*upperPtr_);
}
else
{
lowerPtr_ = new scalarField(nCoeffs, 0.0);
}
}
return *lowerPtr_;
}
Foam::scalarField& Foam::lduMatrix::diag(const label size)
{
if (!diagPtr_)
{
diagPtr_ = new scalarField(size, 0.0);
}
return *diagPtr_;
}
Foam::scalarField& Foam::lduMatrix::upper(const label nCoeffs)
{
if (!upperPtr_)
{
if (lowerPtr_)
{
upperPtr_ = new scalarField(*lowerPtr_);
}
else
{
upperPtr_ = new scalarField(nCoeffs, 0.0);
}
}
return *upperPtr_;
}
const Foam::scalarField& Foam::lduMatrix::lower() const
{
if (!lowerPtr_ && !upperPtr_)
......@@ -320,33 +367,33 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const InfoProxy<lduMatrix>& ip)
}
if (hasLow)
{
os << "lower contents:" << endl;
forAll(ldum.lower(), i)
{
os << "i:" << i << "\t" << ldum.lower()[i] << endl;
}
os << endl;
}
if (hasDiag)
{
os << "diag contents:" << endl;
forAll(ldum.diag(), i)
{
os << "i:" << i << "\t" << ldum.diag()[i] << endl;
}
os << endl;
}
if (hasUp)
{
os << "upper contents:" << endl;
forAll(ldum.upper(), i)
{
os << "i:" << i << "\t" << ldum.upper()[i] << endl;
}
os << endl;
}
//if (hasLow)
//{
// os << "lower contents:" << endl;
// forAll(ldum.lower(), i)
// {
// os << "i:" << i << "\t" << ldum.lower()[i] << endl;
// }
// os << endl;
//}
//if (hasDiag)
//{
// os << "diag contents:" << endl;
// forAll(ldum.diag(), i)
// {
// os << "i:" << i << "\t" << ldum.diag()[i] << endl;
// }
// os << endl;
//}
//if (hasUp)
//{
// os << "upper contents:" << endl;
// forAll(ldum.upper(), i)
// {
// os << "i:" << i << "\t" << ldum.upper()[i] << endl;
// }
// os << endl;
//}
os.check("Ostream& operator<<(Ostream&, const lduMatrix&");
......
......@@ -563,6 +563,14 @@ public:
scalarField& diag();
scalarField& upper();
// Size with externally provided sizes (for constructing with 'fake'
// mesh in GAMG)
scalarField& lower(const label size);
scalarField& diag(const label nCoeffs);
scalarField& upper(const label nCoeffs);
const scalarField& lower() const;
const scalarField& diag() const;
const scalarField& upper() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment