]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a function DerivativeForm::norm().
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 8 Jul 2016 16:43:28 +0000 (11:43 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 11 Jul 2016 11:56:37 +0000 (06:56 -0500)
doc/news/changes.h
include/deal.II/base/derivative_form.h

index 47a3e9d5f9c5dfb16aa4f0028a006d386fc46405..694cc22ace14be7008b1cbdc1a2c77e15b07e857 100644 (file)
@@ -348,6 +348,11 @@ inconvenience this causes.
  (Wolfgang Bangerth, 2016/07/08)
  </li>
 
+ <li> New: There is now a function DerivativeForm::norm().
+ <br>
+ (Wolfgang Bangerth, 2016/07/08)
+ </li>
+
  <li> 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.
index f110b52154414c9afb8935ffe5d2dcb5eb329b13..39e07b1249d461f45e5918c05d889a374bb8fe07 100644 (file)
@@ -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<Number>::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<order,dim,spacedim,Number>::times_T_t (const Tensor<2,dim,Number>
 }
 
 
+
+template <int order, int dim, int spacedim, typename Number>
+inline
+typename numbers::NumberTraits<Number>::real_type
+DerivativeForm<order,dim,spacedim,Number>::norm () const
+{
+  typename numbers::NumberTraits<Number>::real_type sum_of_squares = 0;
+  for (unsigned int i=0; i<spacedim; ++i)
+    sum_of_squares += tensor[i].norm_square();
+  return std::sqrt(sum_of_squares);
+}
+
+
+
 template <int order, int dim, int spacedim, typename Number>
 inline
 double
@@ -340,9 +361,7 @@ DerivativeForm<order,dim,spacedim,Number>::determinant () const
           G[i][j] = DF_t[i] * DF_t[j];
 
       return ( sqrt(dealii::determinant(G)) );
-
     }
-
 }
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.