git-svn-id: https://svn.dealii.org/branches/branch_petscscalar_complex@31308
0785d39b-7218-0410-832d-
ea1e28bc413d
/**
* Return the imaginary part of the value of the referenced element.
+ *
+ * @note This operation is not defined for real numbers and an
+ * exception is thrown.
*/
const PetscReal imag () const;
const PetscReal
VectorReference::real () const
{
+#ifndef PETSC_USE_COMPLEX
+ return static_cast<PetscScalar>(*this);
+#else
return PetscRealPart (static_cast<PetscScalar>(*this));
+#endif
}
const PetscReal
VectorReference::imag () const
{
+#ifndef PETSC_USE_COMPLEX
+ // This is a no op if complex numbers are not defined.
+ AssertThrow (false, ExcNotImplemented ());
+#else
return PetscImaginaryPart (static_cast<PetscScalar>(*this));
+#endif
}
} // namespace internal
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