From 25706f4b6b4af57b4e50ea56ebf9aeb0ab056d8e Mon Sep 17 00:00:00 2001 From: wolf Date: Fri, 6 Nov 1998 16:17:19 +0000 Subject: [PATCH] Fix some things which did not compile right away in 1D. git-svn-id: https://svn.dealii.org/trunk@650 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/grid/tria_boundary.h | 12 ++- deal.II/deal.II/source/dofs/dof_handler.cc | 2 +- deal.II/deal.II/source/grid/tria.cc | 80 +++++++++++++++++++- 3 files changed, 87 insertions(+), 7 deletions(-) diff --git a/deal.II/deal.II/include/grid/tria_boundary.h b/deal.II/deal.II/include/grid/tria_boundary.h index f67f7b4515..ebdb8e3e7a 100644 --- a/deal.II/deal.II/include/grid/tria_boundary.h +++ b/deal.II/deal.II/include/grid/tria_boundary.h @@ -14,10 +14,18 @@ * Workaround for a bug in egcs snapshot 1998/08/03. */ template struct BoundaryHelper; + +template <> struct BoundaryHelper<1> { + // actually, this does not make much + // sense, but declaring a zero-sized + // array is forbidden nowadays + typedef const Point<1> *PointArray[1]; +}; + template <> struct BoundaryHelper<2> { typedef const Point<2> *PointArray[GeometryInfo<2>::vertices_per_face]; }; - + /** @@ -74,7 +82,7 @@ class Boundary { * arithmetic mean of the points. * * This class does not really describe a boundary in the usual sense. By - * placing new points in teh middle of old ones, it rather assumes that the + * placing new points in the middle of old ones, it rather assumes that the * boundary of the domain is given by the polygon/polyhedron defined by the * boundary of the initial coarse triangulation. */ diff --git a/deal.II/deal.II/source/dofs/dof_handler.cc b/deal.II/deal.II/source/dofs/dof_handler.cc index b6216e5241..fb090012be 100644 --- a/deal.II/deal.II/source/dofs/dof_handler.cc +++ b/deal.II/deal.II/source/dofs/dof_handler.cc @@ -1192,7 +1192,7 @@ void DoFHandler::renumber_dofs (const RenumberingMethod method, template <> void DoFHandler<1>::do_renumbering (const vector &new_numbers) { - Assert (new_number.size() == n_dofs(level), ExcRenumberingIncomplete()); + Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete()); // note that we can not use cell iterators // in this function since then we would diff --git a/deal.II/deal.II/source/grid/tria.cc b/deal.II/deal.II/source/grid/tria.cc index 2ac8a1a273..8ae4f6a27e 100644 --- a/deal.II/deal.II/source/grid/tria.cc +++ b/deal.II/deal.II/source/grid/tria.cc @@ -666,10 +666,84 @@ void Triangulation<2>::create_hyper_ball (const Point<2> &p, const double radius +#if deal_II_dimension == 1 + +template <> +void Triangulation<1>::distort_random (const double factor, + const bool keep_boundary) { + // this function is mostly equivalent to + // that for the general dimensional case + // the only difference being the correction + // for split faces which is not necessary + // in 1D + // + // if you change something here, don't + // forget to do so there as well + + const unsigned int dim = 1; + + // find the smallest length of the lines + // adjacent to the vertex + vector minimal_length (vertices.size(), 1e308); + // also note if a vertex is at + // the boundary + vector at_boundary (vertices.size(), false); + + for (active_line_iterator line=begin_active_line(); + line != end_line(); ++line) + { + if (keep_boundary && line->at_boundary()) + { + at_boundary[line->vertex_index(0)] = true; + at_boundary[line->vertex_index(1)] = true; + }; + + minimal_length[line->vertex_index(0)] + = min(line->diameter(), minimal_length[line->vertex_index(0)]); + minimal_length[line->vertex_index(1)] + = min(line->diameter(), minimal_length[line->vertex_index(1)]); + }; + + + const unsigned int n_vertices = vertices.size(); + Point shift_vector; + + for (unsigned int vertex=0; vertex void Triangulation::distort_random (const double factor, const bool keep_boundary) { + // this function is mostly equivalent to + // that for the general dimensional case + // the only difference being the correction + // for split faces which is not necessary + // in 1D + // + // if you change something here, don't + // forget to do so there as well + // find the smallest length of the lines // adjecent to the vertex vector minimal_length (vertices.size(), 1e308); @@ -717,10 +791,8 @@ void Triangulation::distort_random (const double factor, // finally correct hanging nodes - // again. not necessary for 1D - if (dim==1) - return; - + // again. The following is not + // necessary for 1D active_cell_iterator cell = begin_active(), endc = end(); for (; cell!=endc; ++cell) -- 2.39.5