From: Wolfgang Bangerth Date: Tue, 11 Aug 2009 21:37:12 +0000 (+0000) Subject: Work around another problem with gcc 3.3.x. X-Git-Tag: v8.0.0~7343 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75419d68acd93db3bd94ee6c833bb067fbb0c260;p=dealii.git Work around another problem with gcc 3.3.x. git-svn-id: https://svn.dealii.org/trunk@19225 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/grid/grid_tools.cc b/deal.II/deal.II/source/grid/grid_tools.cc index 97382bfba2..b41710a43b 100644 --- a/deal.II/deal.II/source/grid/grid_tools.cc +++ b/deal.II/deal.II/source/grid/grid_tools.cc @@ -190,7 +190,7 @@ GridTools::cell_measure<3>(const std::vector > &all_vertices, with (linalg): J := matrix(3,3, [[diff(x_real, xi), diff(x_real, eta), diff(x_real, zeta)], [diff(y_real, xi), diff(y_real, eta), diff(y_real, zeta)], - [diff(z_real, xi), diff(z_real, eta), diff(z_real, zeta)]]): + [diff(z_real, xi), diff(z_real, eta), diff(z_real, zeta)]]): detJ := det (J): measure := simplify ( int ( int ( int (detJ, xi=0..1), eta=0..1), zeta=0..1)): @@ -270,7 +270,7 @@ GridTools::cell_measure(const std::vector > &all_vertices, \int_K 1 dx dy = \int_{\hat K} |det J| d(xi) d(eta) # x and y are arrays holding the x- and y-values of the four vertices - # of this cell in real space. + # of this cell in real space. x := array(0..3); y := array(0..3); z := array(0..3); @@ -281,10 +281,10 @@ GridTools::cell_measure(const std::vector > &all_vertices, x_real := sum(x[s]*tphi[s], s=0..3): y_real := sum(y[s]*tphi[s], s=0..3): z_real := sum(z[s]*tphi[s], s=0..3): - + Jxi := ; Jeta := ; - with(VectorCalculus): + with(VectorCalculus): J := CrossProduct(Jxi, Jeta); detJ := sqrt(J[1]^2 + J[2]^2 +J[3]^2); @@ -428,7 +428,7 @@ GridTools::delete_duplicated_vertices (std::vector > &vertice // vertex, so break here break; } - } + } } // now we got a renumbering list. simply @@ -520,7 +520,7 @@ GridTools::shift (const Point &shift_vector, transform (TRANS::ShiftPoint(shift_vector), triangulation); #else transform (ShiftPoint(shift_vector), triangulation); -#endif +#endif } @@ -534,7 +534,7 @@ GridTools::rotate (const double angle, transform (TRANS::Rotate2d(angle), triangulation); #else transform (Rotate2d(angle), triangulation); -#endif +#endif } #endif @@ -550,7 +550,7 @@ GridTools::scale (const double scaling_factor, transform (TRANS::ScalePoint(scaling_factor), triangulation); #else transform (ScalePoint(scaling_factor), triangulation); -#endif +#endif } @@ -577,7 +577,7 @@ GridTools::find_closest_vertex (const Container &container, // Assert that at least one vertex // is actually used Assert(first != used.end(), ExcInternalError()); - + unsigned int best_vertex = std::distance(used.begin(), first); double best_dist = (p - vertices[best_vertex]).square(); @@ -612,16 +612,16 @@ GridTools::find_cells_adjacent_to_vertex(const Container &containe ExcVertexNotUsed(vertex)); // We use a set instead of a vector - // to ensure that cells are inserted only - // once. A bug in the previous version - // prevented some cases to be + // to ensure that cells are inserted only + // once. A bug in the previous version + // prevented some cases to be // treated correctly std::set::active_cell_iterator> adj_cells_set; - + typename Container::active_cell_iterator cell = container.begin_active(), endc = container.end(); - + // go through all active cells and look // if the vertex is part of that cell for (; cell != endc; ++cell) @@ -650,7 +650,7 @@ GridTools::find_cells_adjacent_to_vertex(const Container &containe { typename Container::cell_iterator nb = cell->neighbor(face); - + // Here we // check // whether @@ -686,26 +686,26 @@ GridTools::find_cells_adjacent_to_vertex(const Container &containe } } } - + break; } - + std::vector::active_cell_iterator> adjacent_cells; // We now produce the output vector // from the set that we assembled above. - typename std::set::active_cell_iterator>::iterator - it = adj_cells_set.begin(), + typename std::set::active_cell_iterator>::iterator + it = adj_cells_set.begin(), endit = adj_cells_set.end(); - for(; it != endit; ++it) + for(; it != endit; ++it) adjacent_cells.push_back(*it); - - + + Assert(adjacent_cells.size() > 0, ExcInternalError()); - + return adjacent_cells; -} +} @@ -738,7 +738,7 @@ GridTools::find_active_cell_around_point (const Mapping &mapping // Find closest vertex and determine // all adjacent cells unsigned int vertex = find_closest_vertex(container, p); - + std::vector adjacent_cells = find_cells_adjacent_to_vertex(container, vertex); @@ -794,7 +794,7 @@ GridTools::find_active_cell_around_point (const hp::MappingCollection adjacent_cells = find_cells_adjacent_to_vertex(container, vertex); @@ -896,7 +896,7 @@ get_face_connectivity_of_cells (const Triangulation &triangulation index); } } - + // now compress the so-built connectivity // pattern and restore user indices. the // const-cast is necessary since we treat @@ -904,7 +904,7 @@ get_face_connectivity_of_cells (const Triangulation &triangulation // return it to its original state) cell_connectivity.compress (); const_cast&>(triangulation) - .load_user_indices (saved_user_indices); + .load_user_indices (saved_user_indices); } @@ -935,7 +935,7 @@ partition_triangulation (const unsigned int n_partitions, // partitioning and assigning subdomain ids SparsityPattern cell_connectivity; get_face_connectivity_of_cells (triangulation, cell_connectivity); - + partition_triangulation (n_partitions, cell_connectivity, triangulation); @@ -954,8 +954,8 @@ partition_triangulation (const unsigned int n_partitions, Assert (cell_connection_graph.n_rows() == triangulation.n_active_cells(), ExcMessage ("Connectivity graph has wrong size")); Assert (cell_connection_graph.n_cols() == triangulation.n_active_cells(), - ExcMessage ("Connectivity graph has wrong size")); - + ExcMessage ("Connectivity graph has wrong size")); + // check for an easy return if (n_partitions == 1) { @@ -1054,7 +1054,7 @@ GridTools::get_finest_common_cells (const Container &mesh_1, std::list > CellList; - + CellList cell_list; // first push the coarse level cells @@ -1273,7 +1273,7 @@ namespace internal const unsigned int structdim = Iterator::AccessorType::structure_dimension; Assert (spacedim == Iterator::AccessorType::dimension, ExcInternalError()); - + // everything below is wrong // if not for the following // condition @@ -1298,7 +1298,7 @@ namespace internal = std::accumulate (&parent_alternating_forms[0], &parent_alternating_forms[GeometryInfo::vertices_per_cell], Tensor()); - + // now do the same // computation for the // children where we use the @@ -1312,7 +1312,7 @@ namespace internal Tensor child_alternating_forms [GeometryInfo::max_children_per_cell] [GeometryInfo::vertices_per_cell]; - + for (unsigned int c=0; cn_children(); ++c) for (unsigned int i=0; i::vertices_per_cell; ++i) child_vertices[c][i] = object->child(c)->vertex(i); @@ -1326,7 +1326,7 @@ namespace internal for (unsigned int c=0; cn_children(); ++c) child_vertices[c][GeometryInfo::max_children_per_cell-c-1] = object_mid_point; - + for (unsigned int c=0; cn_children(); ++c) GeometryInfo::alternating_form_at_vertices (child_vertices[c], child_alternating_forms[c]); @@ -1347,7 +1347,7 @@ namespace internal objective += (child_alternating_forms[c][i] - average_parent_alternating_form/std::pow(2.,1.*structdim)) .norm_square(); - + return objective; } @@ -1381,7 +1381,7 @@ namespace internal { return object->line(f)->center(); } - + /** @@ -1397,7 +1397,7 @@ namespace internal { return object->face(f)->center(); } - + @@ -1429,7 +1429,7 @@ namespace internal { const unsigned int structdim = Iterator::AccessorType::structure_dimension; - + double diameter = object->diameter(); for (unsigned int f=0; f::faces_per_cell; @@ -1448,7 +1448,7 @@ namespace internal return diameter; } - + /** @@ -1471,10 +1471,10 @@ namespace internal *manifold = (respect_manifold ? &object->get_boundary() : 0); - + const unsigned int structdim = Iterator::AccessorType::structure_dimension; const unsigned int spacedim = Iterator::AccessorType::space_dimension; - + // right now we can only deal // with cells that have been // refined isotropically @@ -1484,7 +1484,7 @@ namespace internal // around without having to // consider boundary // information - Assert (object->has_children(), ExcInternalError()); + Assert (object->has_children(), ExcInternalError()); Assert (object->refinement_case() == RefinementCase::isotropic_refinement, ExcNotImplemented()); @@ -1504,7 +1504,7 @@ namespace internal // function and initial delta double current_value = objective_function (object, object_mid_point); double initial_delta = 0; - + do { // choose a step length @@ -1516,7 +1516,7 @@ namespace internal // premature termination of // the iteration) const double step_length = diameter / 4 / (iteration + 1); - + // compute the objective // function's derivative using a // two-sided difference formula @@ -1525,7 +1525,7 @@ namespace internal for (unsigned int d=0; d h; h[d] = eps/2; @@ -1560,7 +1560,7 @@ namespace internal // quite the loop here if (gradient.norm() == 0) break; - + // so we need to go in // direction -gradient. the // optimal value of the @@ -1589,7 +1589,7 @@ namespace internal if (iteration == 0) initial_delta = (previous_value - current_value); - + // stop if we aren't moving much // any more if ((iteration >= 1) && @@ -1648,7 +1648,7 @@ namespace internal for (unsigned int c=0; cn_children(); ++c) GeometryInfo::alternating_form_at_vertices (child_vertices[c], child_alternating_forms[c]); - + old_min_product = child_alternating_forms[0][0] * parent_alternating_forms[0]; for (unsigned int c=0; cn_children(); ++c) for (unsigned int i=0; i::vertices_per_cell; ++i) @@ -1670,7 +1670,7 @@ namespace internal for (unsigned int c=0; cn_children(); ++c) GeometryInfo::alternating_form_at_vertices (child_vertices[c], child_alternating_forms[c]); - + new_min_product = child_alternating_forms[0][0] * parent_alternating_forms[0]; for (unsigned int c=0; cn_children(); ++c) for (unsigned int i=0; i::vertices_per_cell; ++i) @@ -1694,13 +1694,15 @@ namespace internal // is well oriented return (std::max (new_min_product, old_min_product) > 0); } - + // possibly fix up the faces of // a cell by moving around its // mid-points template - void fix_up_faces (const typename dealii::Triangulation::cell_iterator &cell) + void fix_up_faces (const typename dealii::Triangulation::cell_iterator &cell, + internal::int2type, + internal::int2type) { // see if we first can fix up // some of the faces of this @@ -1744,7 +1746,7 @@ namespace internal if (subface_is_more_refined == true) continue; - + // so, now we finally know // that we can do something // about this face @@ -1754,20 +1756,24 @@ namespace internal #if deal_II_dimension == 1 - template - void fix_up_faces (const typename dealii::Triangulation<1,spacedim>::cell_iterator &) + template + void fix_up_faces (const typename dealii::Triangulation<1,spacedim>::cell_iterator &, + internal::int2type<1>, + internal::int2type) { // nothing to do for the faces of // cells in 1d } -#endif - template - void fix_up_faces (const dealii::Triangulation<1,1>::cell_iterator &) + + void fix_up_faces (const dealii::Triangulation<1,1>::cell_iterator &, + internal::int2type<1>, + internal::int2type<1>) { // nothing to do for the faces of // cells in 1d } +#endif } } } @@ -1791,7 +1797,10 @@ fix_up_distorted_child_cells (const typename Triangulation::Distor const typename Triangulation::cell_iterator cell = *cell_ptr; - internal::GridTools::FixUpDistortedChildCells::fix_up_faces (cell); + internal::GridTools::FixUpDistortedChildCells + ::fix_up_faces (cell, + internal::int2type(), + internal::int2type()); // fix up the object. we need to // respect the manifold if the cell is @@ -1803,7 +1812,7 @@ fix_up_distorted_child_cells (const typename Triangulation::Distor (dim < spacedim))) unfixable_subset.distorted_cells.push_back (cell); } - + return unfixable_subset; }