1. Increase number of cells by global refinement to weaken influence of float truncation error;
2. Because number of cells increased, construct refinement indicator as test _01 to avoid float overflow;
3. Update test drivers interface because it is too complicated to calculate global number of cells;
4. Update reference output.
-// derived from _02, but with maximal cell number limit
+// derived from _01, but with maximal cell number limit
#include "../tests.h"
#include <deal.II/base/logstream.h>
#include <fstream>
-void test(const unsigned int max_n_cell)
+void test(const double max_n_cell_ratio)
{
unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD);
sub[1] = 1;
GridGenerator::subdivided_hyper_rectangle(static_cast<Triangulation<2>&>(tr),
sub, Point<2>(0,0), Point<2>(1,1));
- tr.refine_global (1);
+ tr.refine_global (3);
Vector<float> indicators (tr.dealii::Triangulation<2>::n_active_cells());
{
if (cell->subdomain_id() == myid)
{
++my_cell_index;
- indicators(cell_index) = std::pow (10, (float)my_cell_index);
+ indicators(cell_index) = my_cell_index;
}
}
+ const unsigned int max_n_cell = max_n_cell_ratio * tr.n_global_active_cells();
+
parallel::distributed::GridRefinement
::refine_and_coarsen_fixed_number (tr, indicators, 0.2, 0.2, max_n_cell);
// test effective maximal cell number limit
{
- const unsigned int max_n_cell = static_cast<unsigned int>
- (1.1
- * 4 // corresponds to tr.refine_global (1) in 2d
- * 5*Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD) // corresponds to definition in function test
- + 0.5 // avoid truncation
- );
+ const double max_n_cell_ratio = 1.1;
+
if (myid == 0)
{
std::ofstream logfile("output");
deallog.depth_console(0);
deallog.threshold_double(1.e-10);
- test(max_n_cell);
+ test(max_n_cell_ratio);
}
else
- test(max_n_cell);
+ test(max_n_cell_ratio);
}
MPI_Barrier(MPI_COMM_WORLD);
// cell number already exceeded maximal cell number limit
{
- const unsigned int max_n_cell = static_cast<unsigned int>
- (0.8 * 4 * 5*Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD));
+ const double max_n_cell_ratio = 0.8;
if (myid == 0)
{
std::ofstream logfile("output", std::ofstream::app);
deallog.depth_console(0);
deallog.threshold_double(1.e-10);
- test(max_n_cell);
+ test(max_n_cell_ratio);
}
else
- test(max_n_cell);
+ test(max_n_cell_ratio);
}
MPI_Barrier(MPI_COMM_WORLD);
// test non-effective maximal cell number limit
{
- const unsigned int max_n_cell = static_cast<unsigned int>
- (100.0 * 4 * 5*Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD));
+ const double max_n_cell_ratio = 100;
if (myid == 0)
{
std::ofstream logfile("output", std::ofstream::app);
deallog.depth_console(0);
deallog.threshold_double(1.e-10);
- test(max_n_cell);
+ test(max_n_cell_ratio);
}
else
- test(max_n_cell);
+ test(max_n_cell_ratio);
}
return (0);
-DEAL:0::total active cells = 20
-DEAL:0::n_refined = 1
-DEAL:0::n_coarsened = 2
-DEAL:0::total active cells = 23
-DEAL:0::cell number upper limit = 22
+DEAL:0::total active cells = 320
+DEAL:0::n_refined = 14
+DEAL:0::n_coarsened = 15
+DEAL:0::total active cells = 353
+DEAL:0::cell number upper limit = 352
-DEAL:0::total active cells = 20
+DEAL:0::total active cells = 320
DEAL:0::n_refined = 0
-DEAL:0::n_coarsened = 6
-DEAL:0::total active cells = 17
-DEAL:0::cell number upper limit = 16
+DEAL:0::n_coarsened = 86
+DEAL:0::total active cells = 257
+DEAL:0::cell number upper limit = 256
-DEAL:0::total active cells = 20
-DEAL:0::n_refined = 4
-DEAL:0::n_coarsened = 4
-DEAL:0::total active cells = 29
-DEAL:0::cell number upper limit = 2000
+DEAL:0::total active cells = 320
+DEAL:0::n_refined = 64
+DEAL:0::n_coarsened = 64
+DEAL:0::total active cells = 464
+DEAL:0::cell number upper limit = 32000
-DEAL:0::total active cells = 200
-DEAL:0::n_refined = 10
-DEAL:0::n_coarsened = 20
-DEAL:0::total active cells = 230
-DEAL:0::cell number upper limit = 220
+DEAL:0::total active cells = 3200
+DEAL:0::n_refined = 140
+DEAL:0::n_coarsened = 150
+DEAL:0::total active cells = 3557
+DEAL:0::cell number upper limit = 3520
-DEAL:0::total active cells = 200
+DEAL:0::total active cells = 3200
DEAL:0::n_refined = 0
-DEAL:0::n_coarsened = 50
-DEAL:0::total active cells = 170
-DEAL:0::cell number upper limit = 160
+DEAL:0::n_coarsened = 850
+DEAL:0::total active cells = 2570
+DEAL:0::cell number upper limit = 2560
-DEAL:0::total active cells = 200
-DEAL:0::n_refined = 40
-DEAL:0::n_coarsened = 40
-DEAL:0::total active cells = 317
-DEAL:0::cell number upper limit = 20000
+DEAL:0::total active cells = 3200
+DEAL:0::n_refined = 640
+DEAL:0::n_coarsened = 640
+DEAL:0::total active cells = 4748
+DEAL:0::cell number upper limit = 320000
-DEAL:0::total active cells = 80
-DEAL:0::n_refined = 4
-DEAL:0::n_coarsened = 8
-DEAL:0::total active cells = 92
-DEAL:0::cell number upper limit = 88
+DEAL:0::total active cells = 1280
+DEAL:0::n_refined = 56
+DEAL:0::n_coarsened = 60
+DEAL:0::total active cells = 1421
+DEAL:0::cell number upper limit = 1408
-DEAL:0::total active cells = 80
+DEAL:0::total active cells = 1280
DEAL:0::n_refined = 0
-DEAL:0::n_coarsened = 20
-DEAL:0::total active cells = 68
-DEAL:0::cell number upper limit = 64
+DEAL:0::n_coarsened = 340
+DEAL:0::total active cells = 1028
+DEAL:0::cell number upper limit = 1024
-DEAL:0::total active cells = 80
-DEAL:0::n_refined = 16
-DEAL:0::n_coarsened = 16
-DEAL:0::total active cells = 125
-DEAL:0::cell number upper limit = 8000
+DEAL:0::total active cells = 1280
+DEAL:0::n_refined = 256
+DEAL:0::n_coarsened = 256
+DEAL:0::total active cells = 1892
+DEAL:0::cell number upper limit = 128000