Commit 4f93bc3b by Mark Olesen Committed by Andrew Heather

### ENH: support LLTMatrix, QRMatrix solve of indirect lists (#1220)

parent 96d0a8f2
 ... ... @@ -91,10 +91,11 @@ void Foam::LLTMatrix::decompose(const SquareMatrix& mat) template void Foam::LLTMatrix::solve template class ListContainer> void Foam::LLTMatrix::solveImpl ( List& x, const UList& source const ListContainer& source ) const { // If x and source are different, copy initialize x = source ... ... @@ -132,6 +133,28 @@ void Foam::LLTMatrix::solve } template void Foam::LLTMatrix::solve ( List& x, const UList& source ) const { solveImpl(x, source); } template template void Foam::LLTMatrix::solve ( List& x, const IndirectListBase& source ) const { solveImpl(x, source); } template Foam::tmp> Foam::LLTMatrix::solve ( ... ... @@ -146,4 +169,19 @@ Foam::tmp> Foam::LLTMatrix::solve } template template Foam::tmp> Foam::LLTMatrix::solve ( const IndirectListBase& source ) const { auto tresult(tmp>::New(source.size())); solve(tresult.ref(), source); return tresult; } // ************************************************************************* //
 ... ... @@ -58,6 +58,20 @@ class LLTMatrix : public SquareMatrix { // Private Member Functions //- Solve the linear system with the given source //- and return the solution in x // This function may be called with the same field for x and source. template class ListContainer> void solveImpl ( List& x, const ListContainer& source ) const; public: // Constructors ... ... @@ -75,13 +89,38 @@ public: void decompose(const SquareMatrix& mat); //- Solve the linear system with the given source //- and returning the solution in the Field argument x. //- and return the solution in the argument x. // This function may be called with the same field for x and source. void solve(List& x, const UList& source) const; void solve ( List& x, const UList& source ) const; //- Solve the linear system with the given source //- and return the solution in the argument x. // This function may be called with the same field for x and source. template void solve ( List& x, const IndirectListBase& source ) const; //- Solve the linear system with the given source //- return the solution tmp> solve ( const UList& source ) const; //- Solve the linear system with the given source //- returning the solution tmp> solve(const UList& source) const; //- return the solution template tmp> solve ( const IndirectListBase& source ) const; }; ... ...
 ... ... @@ -326,10 +326,7 @@ public: Form T() const; //- Multiply matrix with vector (A * x) inline tmp> Amul ( const UList& x ) const; inline tmp> Amul(const UList& x) const; //- Multiply matrix with vector (A * x) template ... ...
 ... ... @@ -188,10 +188,11 @@ void Foam::QRMatrix::solvex template void Foam::QRMatrix::solve template class ListContainer> void Foam::QRMatrix::solveImpl ( List& x, const UList& source const ListContainer& source ) const { // Assert (&x != &source) ? ... ... @@ -211,6 +212,29 @@ void Foam::QRMatrix::solve } template void Foam::QRMatrix::solve ( List& x, const UList& source ) const { solveImpl(x, source); } template template void Foam::QRMatrix::solve ( List& x, const IndirectListBase& source ) const { solveImpl(x, source); } template Foam::tmp> Foam::QRMatrix::solve ... ... @@ -218,9 +242,25 @@ Foam::QRMatrix::solve const UList& source ) const { auto tresult(tmp>::New(Q_.m())); auto tresult(Q_.Tmul(source)); solvex(tresult.ref()); return tresult; } template template Foam::tmp> Foam::QRMatrix::solve ( const IndirectListBase& source ) const { auto tresult(Q_.Tmul(source)); solve(tresult.ref(), source); solvex(tresult.ref()); return tresult; } ... ...
 ... ... @@ -79,6 +79,15 @@ private: template class ListContainer> void solvex(ListContainer& x) const; //- Solve the linear system with the given source //- and return the solution in x template class ListContainer> void solveImpl ( List& x, const ListContainer& source ) const; public: ... ... @@ -103,12 +112,36 @@ public: void decompose(const MatrixType& M); //- Solve the linear system with the given source //- and return the solution in the Field argument x void solve(List& x, const UList& source) const; //- and return the solution in the argument x void solve ( List& x, const UList& source ) const; //- Solve the linear system with the given source //- and return the solution in the argument x template void solve ( List& x, const IndirectListBase& source ) const; //- Solve the linear system with the given source //- and return the solution tmp> solve ( const UList& source ) const; //- Solve the linear system with the given source //- and return the solution tmp> solve(const UList& source) const; template tmp> solve ( const IndirectListBase& source ) const; //- Return the inverse of (Q*R), so that solving x = (Q*R).inv()*source QMatrixType inv() const; ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!