]> https://gitweb.dealii.org/ - dealii.git/commitdiff
improve the output
authorMichał Wichrowski <mtwichrowski@gmail.com>
Thu, 1 May 2025 17:46:59 +0000 (19:46 +0200)
committerMichał Wichrowski <mtwichrowski@gmail.com>
Thu, 1 May 2025 17:46:59 +0000 (19:46 +0200)
tests/numerics/tensor_product_creator_02.cc

index a19a6ef9f89948b6aa89db3a62ca266ffebe4c67..c8c8232091ef2702db43fb93332ad1e7282bc1a4 100644 (file)
@@ -28,15 +28,18 @@ test(const unsigned int fe_degree)
       FE_Q<1>(fe_degree), 1.);
 
 
-  for (unsigned int row = 0; row < ghost_penalty_1d.n_rows(); ++row)
-    {
-      for (unsigned int col = 0; col < ghost_penalty_1d.n_cols(); ++col)
-        deallog << std::setw(10) << std::fixed << std::setprecision(4)
-                << ghost_penalty_1d(row, col) << " ";
-
-      deallog << std::endl;
-    }
-  deallog << std::endl;
+  std::stringstream sstring;
+
+  sstring << "Ghost penalty matrix for FE_Q<1>(" << fe_degree << "):\n";
+  ghost_penalty_1d.print_formatted(sstring, 4, true, 10, "0.");
+
+  deallog << sstring.str() << std::endl;
+
+  // Check that the matrix is symmetric
+  for (unsigned int i = 0; i < ghost_penalty_1d.m(); ++i)
+    for (unsigned int j = 0; j < ghost_penalty_1d.n(); ++j)
+      AssertThrow(ghost_penalty_1d(i, j) == ghost_penalty_1d(j, i),
+                  ExcMessage("Matrix is not symmetric"));
 }
 
 

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.