From: wolf Date: Wed, 31 Mar 1999 16:07:20 +0000 (+0000) Subject: Fix two bugs when coarsening 3d grids. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=867977708a4406b157817a9509067b4c419c83e5;p=dealii-svn.git Fix two bugs when coarsening 3d grids. git-svn-id: https://svn.dealii.org/trunk@1068 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/grid/tria.cc b/deal.II/deal.II/source/grid/tria.cc index a9acc7b694..8367d88ae3 100644 --- a/deal.II/deal.II/source/grid/tria.cc +++ b/deal.II/deal.II/source/grid/tria.cc @@ -179,6 +179,27 @@ void Triangulation::copy_triangulation (const Triangulation &old_tria) +template +void Triangulation::block_write (ostream &out) const +{ + // write out the level information + out << levels.size() << endl << '['; + for (unsigned int level=0; levelblock_write (out); + out << ']'; + + // write out the vertices + out << '['; + out.write (reinterpret_cast(vertices.begin()), + reinterpret_cast(vertices.end()) + - reinterpret_cast(vertices.begin())); + out << ']'; + + write_bool_vector (0, vertices_used, 0, out); +}; + + + #if deal_II_dimension == 1 template <> @@ -3697,8 +3718,8 @@ void Triangulation<1>::print_gnuplot (ostream &out, const active_cell_iterator & cell) const { AssertThrow (out, ExcIO()); - out << cell->vertex(0) << " " << cell->level() << endl - << cell->vertex(1) << " " << cell->level() << endl + out << cell->vertex(0) << ' ' << cell->level() << endl + << cell->vertex(1) << ' ' << cell->level() << endl << endl; AssertThrow (out, ExcIO()); @@ -3714,11 +3735,11 @@ void Triangulation<2>::print_gnuplot (ostream &out, const active_cell_iterator & cell) const { AssertThrow (out, ExcIO()); - out << cell->vertex(0) << " " << cell->level() << endl - << cell->vertex(1) << " " << cell->level() << endl - << cell->vertex(2) << " " << cell->level() << endl - << cell->vertex(3) << " " << cell->level() << endl - << cell->vertex(0) << " " << cell->level() << endl + out << cell->vertex(0) << ' ' << cell->level() << endl + << cell->vertex(1) << ' ' << cell->level() << endl + << cell->vertex(2) << ' ' << cell->level() << endl + << cell->vertex(3) << ' ' << cell->level() << endl + << cell->vertex(0) << ' ' << cell->level() << endl << endl // double new line for gnuplot 3d plots << endl; @@ -3736,32 +3757,32 @@ void Triangulation<3>::print_gnuplot (ostream &out, AssertThrow (out, ExcIO()); // front face - out << cell->vertex(0) << " " << cell->level() << endl - << cell->vertex(1) << " " << cell->level() << endl - << cell->vertex(2) << " " << cell->level() << endl - << cell->vertex(3) << " " << cell->level() << endl - << cell->vertex(0) << " " << cell->level() << endl + out << cell->vertex(0) << ' ' << cell->level() << endl + << cell->vertex(1) << ' ' << cell->level() << endl + << cell->vertex(2) << ' ' << cell->level() << endl + << cell->vertex(3) << ' ' << cell->level() << endl + << cell->vertex(0) << ' ' << cell->level() << endl << endl; // back face - out << cell->vertex(4) << " " << cell->level() << endl - << cell->vertex(5) << " " << cell->level() << endl - << cell->vertex(6) << " " << cell->level() << endl - << cell->vertex(7) << " " << cell->level() << endl - << cell->vertex(4) << " " << cell->level() << endl + out << cell->vertex(4) << ' ' << cell->level() << endl + << cell->vertex(5) << ' ' << cell->level() << endl + << cell->vertex(6) << ' ' << cell->level() << endl + << cell->vertex(7) << ' ' << cell->level() << endl + << cell->vertex(4) << ' ' << cell->level() << endl << endl; // now for the four connecting lines - out << cell->vertex(0) << " " << cell->level() << endl - << cell->vertex(4) << " " << cell->level() << endl + out << cell->vertex(0) << ' ' << cell->level() << endl + << cell->vertex(4) << ' ' << cell->level() << endl << endl; - out << cell->vertex(1) << " " << cell->level() << endl - << cell->vertex(5) << " " << cell->level() << endl + out << cell->vertex(1) << ' ' << cell->level() << endl + << cell->vertex(5) << ' ' << cell->level() << endl << endl; - out << cell->vertex(2) << " " << cell->level() << endl - << cell->vertex(6) << " " << cell->level() << endl + out << cell->vertex(2) << ' ' << cell->level() << endl + << cell->vertex(6) << ' ' << cell->level() << endl << endl; - out << cell->vertex(3) << " " << cell->level() << endl - << cell->vertex(7) << " " << cell->level() << endl + out << cell->vertex(3) << ' ' << cell->level() << endl + << cell->vertex(7) << ' ' << cell->level() << endl << endl; AssertThrow (out, ExcIO()); @@ -7047,7 +7068,7 @@ void Triangulation<3>::delete_cell (cell_iterator &cell) { make_pair(cell->line(7), false), make_pair(cell->line(8), false), make_pair(cell->line(9), false), - make_pair(cell->line(0), false), + make_pair(cell->line(10), false), make_pair(cell->line(11), false) }; // next make a map out of this for simpler // access to the flag associated with a @@ -7081,7 +7102,7 @@ void Triangulation<3>::delete_cell (cell_iterator &cell) { line_is_needed[cell->face(nb)->line(i)] = true; }; // ok for this neighbor - break; + continue; }; // if the neighbor is not refined, @@ -7129,8 +7150,6 @@ void Triangulation<3>::delete_cell (cell_iterator &cell) { }; }; - Assert (line_is_needed.size()==12, ExcInternalError()); - // now, if the lines are not marked as // needed, we may delete their children @@ -7178,9 +7197,9 @@ void Triangulation::write_bool_vector (const unsigned int magic_number1, // 1. number of flags // 2. the flags // 3. magic number - out << magic_number1 << " " << N << endl; + out << magic_number1 << ' ' << N << endl; for (unsigned int i=0; i(flags[i]) << " "; + out << static_cast(flags[i]) << ' '; out << endl << magic_number2 << endl;