From: Luca Heltai Date: Mon, 12 Jun 2017 08:08:00 +0000 (+0200) Subject: Fixed Determinant in DerivativeForm. X-Git-Tag: v9.0.0-rc1~1512^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4507%2Fhead;p=dealii.git Fixed Determinant in DerivativeForm. --- diff --git a/include/deal.II/base/derivative_form.h b/include/deal.II/base/derivative_form.h index 6feebed47b..2dc2f13a6a 100644 --- a/include/deal.II/base/derivative_form.h +++ b/include/deal.II/base/derivative_form.h @@ -116,7 +116,7 @@ public: * 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)}$. */ - double determinant () const; + Number determinant () const; /** * Assuming that the current object stores the Jacobian of a mapping @@ -325,8 +325,7 @@ DerivativeForm::norm () const template inline -double -DerivativeForm::determinant () const +Number DerivativeForm::determinant() const { Assert( order==1, ExcMessage("Only for order == 1.")); if (dim == spacedim) @@ -337,7 +336,7 @@ DerivativeForm::determinant () const else { Assert( spacedim>dim, ExcMessage("Only for spacedim>dim.")); - const DerivativeForm<1,spacedim,dim> DF_t = this->transpose(); + const DerivativeForm<1,spacedim,dim,Number> DF_t = this->transpose(); Tensor<2,dim,Number> G; //First fundamental form for (unsigned int i=0; i + + +template +void test() +{ + DerivativeForm<1,dim,spacedim,std::complex > dF; + for (unsigned int i=0; i(i+2*j+1,i+2*j+1); + } + + // output the determinants of these objects + deallog << "det(dF): " << dF.determinant() << std::endl; +} + +int main() +{ + initlog(); + test<1,1>(); + test<1,2>(); + test<1,3>(); + test<2,2>(); + test<2,3>(); + test<3,3>(); +} diff --git a/tests/base/derivative_forms_04.output b/tests/base/derivative_forms_04.output new file mode 100644 index 0000000000..16e7b65d28 --- /dev/null +++ b/tests/base/derivative_forms_04.output @@ -0,0 +1,7 @@ + +DEAL::det(dF): (1.00000,1.00000) +DEAL::det(dF): (2.23607,2.23607) +DEAL::det(dF): (3.74166,3.74166) +DEAL::det(dF): (0.00000,-4.00000) +DEAL::det(dF): (5.99952e-16,9.79796) +DEAL::det(dF): (0.00000,0.00000)