]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Make sure we don't even try to refine anisotropically in case of distributed meshes.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 24 Oct 2010 19:40:28 +0000 (19:40 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 24 Oct 2010 19:40:28 +0000 (19:40 +0000)
git-svn-id: https://svn.dealii.org/trunk@22463 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/distributed/tria.cc
tests/distributed_grids/anisotropic.cc [new file with mode: 0644]
tests/distributed_grids/anisotropic/cmp/generic [new file with mode: 0644]

index dfcdf874f7e41dc23cb0870fe13f7642ee8926b9..479041b78297fe5f931467f8177ce9ade757fdf5 100644 (file)
@@ -2469,6 +2469,16 @@ namespace parallel
            cell->clear_refine_flag ();
            cell->clear_coarsen_flag ();
          }
+       else
+                                          // if this is a cell we do
+                                          // own, make sure they are
+                                          // not refined
+                                          // anisotropically since we
+                                          // don't support this
+         if (cell->refine_flag_set())
+           Assert (cell->refine_flag_set() ==
+                   RefinementPossibilities<dim>::isotropic_refinement,
+                   ExcMessage ("This class does not support anisotropic refinement"));
 
 
 
diff --git a/tests/distributed_grids/anisotropic.cc b/tests/distributed_grids/anisotropic.cc
new file mode 100644 (file)
index 0000000..b08cd16
--- /dev/null
@@ -0,0 +1,79 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2008, 2009, 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+
+// Test that anisotropic refinement really doesn't work
+
+#include "../tests.h"
+#include "coarse_grid_common.h"
+#include <base/logstream.h>
+#include <base/tensor.h>
+#include <grid/tria.h>
+#include <distributed/tria.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
+#include <grid/grid_generator.h>
+#include <grid/grid_out.h>
+
+#include <fstream>
+
+
+template<int dim>
+void test(std::ostream& /*out*/)
+{
+  parallel::distributed::Triangulation<dim> tr(MPI_COMM_WORLD);
+
+  GridGenerator::hyper_cube(tr);
+  tr.begin_active()->set_refine_flag(RefinementCase<dim>::cut_x);
+
+  try
+    {
+      tr.execute_coarsening_and_refinement ();
+    }
+  catch (const ExcMessage &e)
+    {
+      deallog << "Caught exception:" << std::endl;
+      deallog << e.what() << std::endl;
+    }
+}
+
+
+int main(int argc, char *argv[])
+{
+#ifdef DEAL_II_COMPILER_SUPPORTS_MPI
+  MPI_Init (&argc,&argv);
+#else
+  (void)argc;
+  (void)argv;
+#endif
+
+  std::ofstream logfile("2d_refinement_01/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+                                  // we want to catch exceptions
+                                  // instead of aborting the program
+  deal_II_exceptions::disable_abort_on_exception();
+
+  deallog.push("2d");
+  test<2>(logfile);
+  deallog.pop();
+  deallog.push("2d");
+  test<3>(logfile);
+  deallog.pop();
+
+#ifdef DEAL_II_COMPILER_SUPPORTS_MPI
+  MPI_Finalize();
+#endif
+}
diff --git a/tests/distributed_grids/anisotropic/cmp/generic b/tests/distributed_grids/anisotropic/cmp/generic
new file mode 100644 (file)
index 0000000..16cc49d
--- /dev/null
@@ -0,0 +1,70 @@
+
+DEAL:2d::Checksum: 167510149
+<?xml version="1.0"?>
+<VTKFile type="PUnstructuredGrid" version="0.1" byte_order="LittleEndian">
+  <PUnstructuredGrid GhostLevel="0">
+    <PPoints>
+      <PDataArray type="Float32" Name="Position" NumberOfComponents="3" format="ascii"/>
+    </PPoints>
+    <PCellData Scalars="mpirank,treeid">
+      <PDataArray type="Int32" Name="mpirank" format="ascii"/>
+      <PDataArray type="Int32" Name="treeid" format="ascii"/>
+    </PCellData>
+    <PPointData>
+    </PPointData>
+    <Piece Source="2_0000.vtu"/>
+  </PUnstructuredGrid>
+</VTKFile>
+
+<?xml version="1.0"?>
+<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian">
+  <UnstructuredGrid>
+    <Piece NumberOfPoints="16" NumberOfCells="4">
+      <Points>
+        <DataArray type="Float32" Name="Position" NumberOfComponents="3" format="ascii">
+            1.25000002e-02   1.25000002e-02   0.00000000e+00
+            4.87500012e-01   1.25000002e-02   0.00000000e+00
+            1.25000002e-02   4.87500012e-01   0.00000000e+00
+            4.87500012e-01   4.87500012e-01   0.00000000e+00
+            5.12499988e-01   1.25000002e-02   0.00000000e+00
+            9.87500012e-01   1.25000002e-02   0.00000000e+00
+            5.12499988e-01   4.87500012e-01   0.00000000e+00
+            9.87500012e-01   4.87500012e-01   0.00000000e+00
+            1.25000002e-02   5.12499988e-01   0.00000000e+00
+            4.87500012e-01   5.12499988e-01   0.00000000e+00
+            1.25000002e-02   9.87500012e-01   0.00000000e+00
+            4.87500012e-01   9.87500012e-01   0.00000000e+00
+            5.12499988e-01   5.12499988e-01   0.00000000e+00
+            9.87500012e-01   5.12499988e-01   0.00000000e+00
+            5.12499988e-01   9.87500012e-01   0.00000000e+00
+            9.87500012e-01   9.87500012e-01   0.00000000e+00
+        </DataArray>
+      </Points>
+      <Cells>
+        <DataArray type="Int32" Name="connectivity" format="ascii">
+          0 1 2 3
+          4 5 6 7
+          8 9 10 11
+          12 13 14 15
+        </DataArray>
+        <DataArray type="Int32" Name="offsets" format="ascii">
+          4 8 12 16
+        </DataArray>
+        <DataArray type="UInt8" Name="types" format="ascii">
+          8 8 8 8
+        </DataArray>
+      </Cells>
+      <CellData Scalars="mpirank,treeid">
+        <DataArray type="Int32" Name="mpirank" format="ascii">
+          0 0 0 0
+        </DataArray>
+        <DataArray type="Int32" Name="treeid" format="ascii">
+          0 0 0 0
+        </DataArray>
+      </CellData>
+      <PointData>
+      </PointData>
+    </Piece>
+  </UnstructuredGrid>
+</VTKFile>
+

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.