Commit 7c8ec348 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#859 Changes to reflect changes in Petsc 3.7: MatMatMatMultSymbolic/Numeric,...

#859 Changes to reflect changes in Petsc 3.7: MatMatMatMultSymbolic/Numeric, which was not defined, has been altogether removed, and another function is marked deprecated and must be replaced by another one.
parent 64a5a46b
......@@ -243,8 +243,6 @@ namespace HappyHeart
/*!
* \brief Wrapper over MatMatMatMult, that performs D = A * B * C.
*
* If the operation is performed many times with each time the same non zero pattern for the matrices,
* rather use MatMatMatMultSymbolic/MatMatMatMultNumeric to improve efficiency.
*
* \copydetails doxygen_hide_petsc_do_reuse_matrix_arg
*/
......@@ -266,84 +264,7 @@ namespace HappyHeart
const char* invoking_file, int invoking_line,
DoReuseMatrix do_reuse_matrix = DoReuseMatrix::no);
/*!
* \brief Wrapper over MatMatMultSymbolic, that performs D = A * B * C.
*
* Actual computation is done with a call to MatMatMatMultNumeric, which might be called many times.
*
* \param[in] matrix1 A in D = A * B * C.
* \param[in] matrix2 B in D = A * B * C.
* \param[in] matrix3 C in D = A * B * C.
* \param[out] matrix4 D in D = A * B * C. Its pattern is correctly allocated after the call.
* \todo #684 Investigate to use the argument fill, which provides an estimation of the non zero of the
* resulting matrix. Currently PETSC_DEFAULT is used.
* One can also reuse a pattern for several matrices, but so far I do not need that in HappyHeart so
* I equally use the default setting.
*
* \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__.
*
* \attention Currently not working due to lack of implementation in Petsc; a ticket has been issued.
*/
template
<
class MatrixT,
class MatrixU
>
std::enable_if_t
<
std::is_base_of<Private::BaseMatrix, MatrixT>::value
&& std::is_base_of<Private::BaseMatrix, MatrixU>::value,
void
>
MatMatMatMultSymbolic(const MatrixT& matrix1,
const MatrixT& matrix2,
const MatrixT& matrix3,
MatrixU& matrix4,
const char* invoking_file, int invoking_line);
/*!
* \brief Wrapper over MatMatMatMultNumeric, that performs D = A * B * C in the case MatMatMatMultSymbolic
* has been used to allocate structure of D.
*
* \copydetails doxygen_hide_matmatmult_warning
*
* \param[in] matrix1 A in D = A * B * C.
* \param[in] matrix2 B in D = A * B * C.
* \param[in] matrix3 C in D = A * B * C.
* \param[out] matrix4 D in D = A * B * C.
*
* \todo #684 Investigate to use the argument fill, which provides an estimation of the non zero of the
* resulting matrix. Currently PETSC_DEFAULT is used.
* One can also reuse a pattern for several matrices, but so far I do not need that in HappyHeart so
* I equally use the default setting.
*
* \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__.
*
* \attention Currently not working due to lack of implementation in Petsc; a ticket has been issued.
*/
template
<
class MatrixT,
class MatrixU
>
std::enable_if_t
<
std::is_base_of<Private::BaseMatrix, MatrixT>::value
&& std::is_base_of<Private::BaseMatrix, MatrixU>::value,
void
>
MatMatMatMultNumeric(const MatrixT& matrix1,
const MatrixT& matrix2,
const MatrixT& matrix3,
MatrixU& matrix4,
const char* invoking_file, int invoking_line);
/*!
* \brief Creates a new matrix object that behaves like A'.
*
......
......@@ -287,71 +287,6 @@ namespace HappyHeart
}
template
<
class MatrixT,
class MatrixU
>
std::enable_if_t
<
std::is_base_of<Private::BaseMatrix, MatrixT>::value
&& std::is_base_of<Private::BaseMatrix, MatrixU>::value,
void
>
MatMatMatMultSymbolic(const MatrixT& matrix1,
const MatrixT& matrix2,
const MatrixT& matrix3,
MatrixU& matrix4,
const char* invoking_file, int invoking_line)
{
Mat result;
int error_code = ::MatMatMatMultSymbolic(matrix1.Internal(),
matrix2.Internal(),
matrix3.Internal(),
matrix4.Internal(),
PETSC_DEFAULT,
&result);
matrix4.SetFromPetscMat(result);
if (error_code)
throw ExceptionNS::Exception(error_code, "MatMatMatMultSymbolic", invoking_file, invoking_line);
}
template
<
class MatrixT,
class MatrixU
>
std::enable_if_t
<
std::is_base_of<Private::BaseMatrix, MatrixT>::value
&& std::is_base_of<Private::BaseMatrix, MatrixU>::value,
void
>
MatMatMatMultNumeric(const MatrixT& matrix1,
const MatrixT& matrix2,
const MatrixT& matrix3,
MatrixU& matrix4,
const char* invoking_file, int invoking_line)
{
int error_code = ::MatMatMatMultNumeric(matrix1.Internal(),
matrix2.Internal(),
matrix3.Internal(),
matrix4.Internal());
if (error_code)
throw ExceptionNS::Exception(error_code, "MatMatMatMultNumeric", invoking_file, invoking_line);
}
template
<
class MatrixT,
......
......@@ -40,7 +40,7 @@ namespace HappyHeart
if (error_code)
throw ExceptionNS::Exception(error_code, "PetscViewerASCIIOpen", invoking_file, invoking_line);
error_code = PetscViewerSetFormat(viewer_, format);
error_code = PetscViewerPushFormat(viewer_, format);
if (error_code)
throw ExceptionNS::Exception(error_code, "PetscViewerSetFormat", invoking_file, invoking_line);
......
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