From 020ca4f72bdf99dbfa44d98aeefa6f856986e27c Mon Sep 17 00:00:00 2001 From: wolf Date: Thu, 28 Sep 2000 10:12:05 +0000 Subject: [PATCH] In create_triangulations, when we throw hard exceptions (not through Assert, but AssertThrow), then we call clean() before to bring the triangulation back into a reasonable state. However, clean() wants that there be no subscriptions beforehand, so we temporarily disable them and re-enable them afterwards again. git-svn-id: https://svn.dealii.org/trunk@3358 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/grid/tria.cc | 238 +++++++++++++++++++++++++--- 1 file changed, 216 insertions(+), 22 deletions(-) diff --git a/deal.II/deal.II/source/grid/tria.cc b/deal.II/deal.II/source/grid/tria.cc index 1ed27c1471..6ba3e6ad4e 100644 --- a/deal.II/deal.II/source/grid/tria.cc +++ b/deal.II/deal.II/source/grid/tria.cc @@ -275,7 +275,24 @@ void Triangulation<1>::create_triangulation (const vector > &v, // a node must have one // or two adjacent // lines + + // clear will only work if + // there are no + // subscriptions. however, this + // is bogus here, as the + // subscriptions were for the + // initially empty grid, and we + // want to clear it again now, + // so temporarily disable + // subscriptions, clear, and + // then set them again + const unsigned int n=n_subscriptions(); + for (unsigned int i=0; i::create_triangulation (const vector > &v, // nodes if (boundary_nodes != 2) { + // clear will only work if + // there are no + // subscriptions. however, this + // is bogus here, as the + // subscriptions were for the + // initially empty grid, and we + // want to clear it again now, + // so temporarily disable + // subscriptions, clear, and + // then set them again + const unsigned int n=n_subscriptions(); + for (unsigned int i=0; i::create_triangulation (const vector > &v, if ( ! ((0<=cells[cell].vertices[vertex]) && (cells[cell].vertices[vertex](vertices.size())))) { + // clear will only work if + // there are no + // subscriptions. however, this + // is bogus here, as the + // subscriptions were for the + // initially empty grid, and we + // want to clear it again now, + // so temporarily disable + // subscriptions, clear, and + // then set them again + const unsigned int n=n_subscriptions(); + for (unsigned int i=0; i::create_triangulation (const vector > &v, // this by rotating by one or three // vertices, but deciding this is // difficult and not implemented. - for (unsigned int line=0; line<4; ++line) - if (needed_lines.find(make_pair(line_vertices[line].second, - line_vertices[line].first)) - != - needed_lines.end()) - { - // rotate vertex numbers - swap (cells[cell].vertices[0], cells[cell].vertices[2]); - swap (cells[cell].vertices[1], cells[cell].vertices[3]); - // remake lines - line_vertices[0] - = make_pair (cells[cell].vertices[0], cells[cell].vertices[1]); - line_vertices[1] - = make_pair (cells[cell].vertices[1], cells[cell].vertices[2]); - line_vertices[2] - = make_pair (cells[cell].vertices[0], cells[cell].vertices[3]); - line_vertices[3] - = make_pair (cells[cell].vertices[3], cells[cell].vertices[2]); - // allow for only one such - // rotation - break; - }; +// for (unsigned int line=0; line<4; ++line) +// if (needed_lines.find(make_pair(line_vertices[line].second, +// line_vertices[line].first)) +// != +// needed_lines.end()) +// { +// // rotate vertex numbers +// swap (cells[cell].vertices[0], cells[cell].vertices[2]); +// swap (cells[cell].vertices[1], cells[cell].vertices[3]); +// // remake lines +// line_vertices[0] +// = make_pair (cells[cell].vertices[0], cells[cell].vertices[1]); +// line_vertices[1] +// = make_pair (cells[cell].vertices[1], cells[cell].vertices[2]); +// line_vertices[2] +// = make_pair (cells[cell].vertices[0], cells[cell].vertices[3]); +// line_vertices[3] +// = make_pair (cells[cell].vertices[3], cells[cell].vertices[2]); +// // allow for only one such +// // rotation +// break; +// }; for (unsigned int line=0; line<4; ++line) @@ -448,7 +497,23 @@ void Triangulation<2>::create_triangulation (const vector > &v, == needed_lines.end())) { + // clear will only work if + // there are no + // subscriptions. however, this + // is bogus here, as the + // subscriptions were for the + // initially empty grid, and we + // want to clear it again now, + // so temporarily disable + // subscriptions, clear, and + // then set them again + const unsigned int n=n_subscriptions(); + for (unsigned int i=0; i::create_triangulation (const vector > &v, if ( ! (* (min_element(vertex_touch_count.begin(), vertex_touch_count.end())) >= 2)) { + // clear will only work if + // there are no + // subscriptions. however, this + // is bogus here, as the + // subscriptions were for the + // initially empty grid, and we + // want to clear it again now, + // so temporarily disable + // subscriptions, clear, and + // then set them again + const unsigned int n=n_subscriptions(); + for (unsigned int i=0; i::create_triangulation (const vector > &v, if (! ((n_adj_cells >= 1) && (n_adj_cells <= 2))) { + // clear will only work if + // there are no + // subscriptions. however, this + // is bogus here, as the + // subscriptions were for the + // initially empty grid, and we + // want to clear it again now, + // so temporarily disable + // subscriptions, clear, and + // then set them again + const unsigned int n=n_subscriptions(); + for (unsigned int i=0; i::create_triangulation (const vector > &v, else { // line does not exist + + // clear will only work if + // there are no + // subscriptions. however, this + // is bogus here, as the + // subscriptions were for the + // initially empty grid, and we + // want to clear it again now, + // so temporarily disable + // subscriptions, clear, and + // then set them again + const unsigned int n=n_subscriptions(); + for (unsigned int i=0; i::create_triangulation (const vector > &v, // are given a boundary indicator if (! (line->boundary_indicator() == 0)) { + // clear will only work if + // there are no + // subscriptions. however, this + // is bogus here, as the + // subscriptions were for the + // initially empty grid, and we + // want to clear it again now, + // so temporarily disable + // subscriptions, clear, and + // then set them again + const unsigned int n=n_subscriptions(); + for (unsigned int i=0; i::create_triangulation (const vector > &v, if (! ((0<=cells[cell].vertices[vertex]) && (cells[cell].vertices[vertex](vertices.size())))) { + // clear will only work if + // there are no + // subscriptions. however, this + // is bogus here, as the + // subscriptions were for the + // initially empty grid, and we + // want to clear it again now, + // so temporarily disable + // subscriptions, clear, and + // then set them again + const unsigned int n=n_subscriptions(); + for (unsigned int i=0; i::create_triangulation (const vector > &v, == needed_lines.end())) { + // clear will only work if + // there are no + // subscriptions. however, this + // is bogus here, as the + // subscriptions were for the + // initially empty grid, and we + // want to clear it again now, + // so temporarily disable + // subscriptions, clear, and + // then set them again + const unsigned int n=n_subscriptions(); + for (unsigned int i=0; i::create_triangulation (const vector > &v, if (! (* (min_element(vertex_touch_count.begin(), vertex_touch_count.end())) >= 2)) { + // clear will only work if + // there are no + // subscriptions. however, this + // is bogus here, as the + // subscriptions were for the + // initially empty grid, and we + // want to clear it again now, + // so temporarily disable + // subscriptions, clear, and + // then set them again + const unsigned int n=n_subscriptions(); + for (unsigned int i=0; i::create_triangulation (const vector > &v, if (! ((n_adj_cells >= 1) && (n_adj_cells <= 2))) { + // clear will only work if + // there are no + // subscriptions. however, this + // is bogus here, as the + // subscriptions were for the + // initially empty grid, and we + // want to clear it again now, + // so temporarily disable + // subscriptions, clear, and + // then set them again + const unsigned int n=n_subscriptions(); + for (unsigned int i=0; i