Commit 0620163f authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#820 Wrappers/Petsc: add a wrapper to Petsc MatCreateTranspose. Update...

#820 Wrappers/Petsc: add a wrapper to Petsc MatCreateTranspose. Update Poromechanics to v16.14 interface.
parent ddc77f64
......@@ -165,6 +165,28 @@ namespace HappyHeart
const char* invoking_file, int invoking_line);
/*!
* \brief Creates a new matrix object that behaves like A'.
*
* The transpose A' is NOT actually formed! Rather the new matrix object performs the matrix-vector product
* by using the MatMultTranspose() on the original matrix.
*
* \param[in] A matrix to transpose.
* \param[out] transpose The matrix that figuratively represents A'. This matrix must not have been
* allocated!
* \param[in] invoking_file File that invoked the function or class; usually __FILE__.
* \param[in] invoking_line File that invoked the function or class; usually __LINE__.
*/
template<class MatrixT>
std::enable_if_t
<
std::is_base_of<Private::BaseMatrix, MatrixT>::value,
void
>
MatCreateTranspose(const MatrixT& A,
MatrixT& transpose,
const char* invoking_file, int invoking_line);
} //namespace Petsc
......
......@@ -166,6 +166,28 @@ namespace HappyHeart
}
template<class MatrixT>
std::enable_if_t
<
std::is_base_of<Private::BaseMatrix, MatrixT>::value,
void
>
MatCreateTranspose(const MatrixT& A,
MatrixT& transpose,
const char* invoking_file, int invoking_line)
{
Mat result;
int error_code = ::MatCreateTranspose(A.Internal(), &result);
if (error_code)
throw ExceptionNS::Exception(error_code, "MatCreateTranspose", invoking_file, invoking_line);
transpose.SetFromPetscMat(result);
}
} //namespace Petsc
......
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