From fcd4965a523049f6dafb1870f48b032e72117087 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 8 Jul 2016 11:43:28 -0500 Subject: [PATCH] Add a function DerivativeForm::norm(). --- doc/news/changes.h | 5 +++++ include/deal.II/base/derivative_form.h | 25 ++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/doc/news/changes.h b/doc/news/changes.h index 47a3e9d5f9..694cc22ace 100644 --- a/doc/news/changes.h +++ b/doc/news/changes.h @@ -348,6 +348,11 @@ inconvenience this causes. (Wolfgang Bangerth, 2016/07/08) +
  • New: There is now a function DerivativeForm::norm(). +
    + (Wolfgang Bangerth, 2016/07/08) +
  • +
  • Fixed: The function DoFTools::dof_couplings_from_component_couplings for hp::FECollection arguments was compiled but not exported from the object file. This is now fixed. diff --git a/include/deal.II/base/derivative_form.h b/include/deal.II/base/derivative_form.h index f110b52154..39e07b1249 100644 --- a/include/deal.II/base/derivative_form.h +++ b/include/deal.II/base/derivative_form.h @@ -110,7 +110,14 @@ public: DerivativeForm<1, spacedim, dim, Number> transpose () const; /** - * Computes the volume element associated with the jacobian of the + * Compute the Frobenius norm of this form, i.e., the expression + * $\sqrt{\sum_{ij} |DF_{ij}|^2}$. + */ + typename numbers::NumberTraits::real_type + norm () const; + + /** + * Compute the volume element associated with the jacobian of the * transformation F. That is to say if $DF$ is square, it computes * $\det(DF)$, in case DF is not square returns $\sqrt{\det(DF^T * DF)}$. */ @@ -319,6 +326,20 @@ DerivativeForm::times_T_t (const Tensor<2,dim,Number> } + +template +inline +typename numbers::NumberTraits::real_type +DerivativeForm::norm () const +{ + typename numbers::NumberTraits::real_type sum_of_squares = 0; + for (unsigned int i=0; i inline double @@ -340,9 +361,7 @@ DerivativeForm::determinant () const G[i][j] = DF_t[i] * DF_t[j]; return ( sqrt(dealii::determinant(G)) ); - } - } -- 2.39.5