Commit b8f7431d authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#829 Petsc: add an assert in the norm to check norm required is relevant.

parent d32d949b
......@@ -424,6 +424,8 @@ namespace HappyHeart
{
PetscReal norm;
assert(type == NORM_1 || type == NORM_FROBENIUS || type == NORM_INFINITY);
int error_code = MatNorm(Internal(), type, &norm);
if (error_code)
throw ExceptionNS::Exception(error_code, "MatNorm", invoking_file, invoking_line);
......
......@@ -414,8 +414,9 @@ namespace HappyHeart
PetscViewerFormat format = PETSC_VIEWER_DEFAULT) const;
/*!
* \brief Wrapper over MatNorm. Available norms are NORM_1, NORM_FROBENIUS and NORM_INFINITY.
* \brief Wrapper over MatNorm.
*
* Available norms are NORM_1, NORM_FROBENIUS and NORM_INFINITY.
*/
double Norm(NormType type, const char* invoking_file, int invoking_line) const;
......
......@@ -422,10 +422,12 @@ namespace HappyHeart
}
double Vector::Norm(NormType type, const char* invoking_file, int invoking_line) const
double Vector::Norm(NormType type, const char* invoking_file, int invoking_line) const
{
PetscReal norm;
assert(type == NORM_1 || type == NORM_2 || type == NORM_INFINITY);
int error_code = VecNorm(Internal(), type, &norm);
if (error_code)
throw ExceptionNS::Exception(error_code, "VecNorm", invoking_file, invoking_line);
......
......@@ -464,7 +464,9 @@ namespace HappyHeart
std::pair<PetscInt, PetscReal> Max(const char* invoking_file, int invoking_line) const;
/*!
* \brief Wrapper over VecNorm. Available norms are NORM_1, NORM_2 and NORM_INFINITY.
* \brief Wrapper over VecNorm.
*
* Available norms are NORM_1, NORM_2 and NORM_INFINITY.
*
*/
double Norm(NormType type, const char* invoking_file, int invoking_line) 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