]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Print function for DerivativeForm 16082/head
authorMaximilian Bergbauer <maximilian.bergbauer@tum.de>
Mon, 2 Oct 2023 20:11:15 +0000 (22:11 +0200)
committerMaximilian Bergbauer <maximilian.bergbauer@tum.de>
Mon, 2 Oct 2023 20:11:15 +0000 (22:11 +0200)
include/deal.II/base/derivative_form.h

index 8c1e4710f689211d28a32339041d581441195453..bf49bdd770d74e74c79dafdc637750c1d9a800d8 100644 (file)
@@ -428,6 +428,30 @@ DerivativeForm<order, dim, spacedim, Number>::memory_consumption()
 
 
 
+/**
+ * Output operator for DerivativeForm. Print the elements consecutively, with a
+ * space in between, two spaces between rank 1 subtensors, three between rank 2
+ * and so on.
+ *
+ * @relatesalso DerivativeForm
+ */
+template <int order, int dim, int spacedim, typename Number>
+inline std::ostream &
+operator<<(std::ostream                                       &out,
+           const DerivativeForm<order, dim, spacedim, Number> &df)
+{
+  for (unsigned int i = 0; i < spacedim; ++i)
+    {
+      out << df[i];
+      if (i != spacedim - 1)
+        out << ' ';
+    }
+
+  return out;
+}
+
+
+
 /**
  * One of the uses of DerivativeForm is to apply it as a linear transformation.
  * This function returns $\nabla \mathbf F(\mathbf x) \Delta \mathbf x$, which

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.