From ab4612adf700b81041a669b246155cf22068a081 Mon Sep 17 00:00:00 2001 From: heister Date: Mon, 9 Sep 2013 21:26:14 +0000 Subject: [PATCH] reformat comments git-svn-id: https://svn.dealii.org/trunk@30659 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/distributed/tria.cc | 582 ++++++++++------------------- 1 file changed, 194 insertions(+), 388 deletions(-) diff --git a/deal.II/source/distributed/tria.cc b/deal.II/source/distributed/tria.cc index 93145356aa..ecac403f7b 100644 --- a/deal.II/source/distributed/tria.cc +++ b/deal.II/source/distributed/tria.cc @@ -58,21 +58,11 @@ namespace internal namespace p4est { /** - * A structure whose explicit - * specializations contain - * pointers to the relevant - * p4est_* and p8est_* - * functions. Using this - * structure, for example by - * saying - * functions::quadrant_compare, - * we can write code in a - * dimension independent way, - * either calling - * p4est_quadrant_compare or - * p8est_quadrant_compare, - * depending on template - * argument. + * A structure whose explicit specializations contain pointers to the + * relevant p4est_* and p8est_* functions. Using this structure, for + * example by saying functions::quadrant_compare, we can write code + * in a dimension independent way, either calling p4est_quadrant_compare + * or p8est_quadrant_compare, depending on template argument. */ template struct functions; @@ -826,9 +816,8 @@ namespace /** - * Set all vertex and cell - * related information in the - * p4est connectivity structure. + * Set all vertex and cell related information in the p4est connectivity + * structure. */ template void @@ -841,16 +830,12 @@ namespace const bool set_vertex_info, typename internal::p4est::types::connectivity *connectivity) { - // copy the vertices into the - // connectivity structure. the - // triangulation exports the array of - // vertices, but some of the entries are - // sometimes unused; this shouldn't be - // the case for a newly created - // triangulation, but make sure + // copy the vertices into the connectivity structure. the triangulation + // exports the array of vertices, but some of the entries are sometimes + // unused; this shouldn't be the case for a newly created triangulation, + // but make sure // - // note that p4est stores coordinates as - // a triplet of values even in 2d + // note that p4est stores coordinates as a triplet of values even in 2d Assert (triangulation.get_used_vertices().size() == triangulation.get_vertices().size(), ExcInternalError()); @@ -870,14 +855,11 @@ namespace triangulation.get_vertices()[v][2]); } - // next store the tree_to_vertex indices - // (each tree is here only a single cell - // in the coarse mesh). p4est requires - // vertex numbering in clockwise + // next store the tree_to_vertex indices (each tree is here only a single + // cell in the coarse mesh). p4est requires vertex numbering in clockwise // orientation // - // while we're at it, also copy the - // neighborship information between cells + // while we're at it, also copy the neighborship information between cells typename Triangulation::active_cell_iterator cell = triangulation.begin_active(), endc = triangulation.end(); @@ -893,8 +875,7 @@ namespace connectivity->tree_to_corner[index*GeometryInfo::vertices_per_cell+v] = cell->vertex_index(v); } - // neighborship information. if a - // cell is at a boundary, then enter + // neighborship information. if a cell is at a boundary, then enter // the index of the cell itself here for (unsigned int f=0; f::faces_per_cell; ++f) if (cell->face(f)->at_boundary() == false) @@ -904,10 +885,8 @@ namespace connectivity->tree_to_tree[index*GeometryInfo::faces_per_cell + f] = coarse_cell_to_p4est_tree_permutation[cell->index()]; - // fill tree_to_face, which is - // essentially neighbor_to_neighbor; - // however, we have to remap the - // resulting face number as well + // fill tree_to_face, which is essentially neighbor_to_neighbor; + // however, we have to remap the resulting face number as well for (unsigned int f=0; f::faces_per_cell; ++f) if (cell->face(f)->at_boundary() == false) { @@ -923,37 +902,16 @@ namespace case 3: { /* - * The values for - * tree_to_face are in - * 0..23 where ttf % 6 - * gives the face - * number and ttf / 6 - * the face orientation - * code. The - * orientation is - * determined as - * follows. Let - * my_face and - * other_face be the - * two face numbers of - * the connecting trees - * in 0..5. Then the - * first face vertex of - * the lower of my_face - * and other_face - * connects to a face - * vertex numbered 0..3 - * in the higher of - * my_face and - * other_face. The - * face orientation is - * defined as this - * number. If my_face - * == other_face, - * treating either of - * both faces as the - * lower one leads to - * the same result. + * The values for tree_to_face are in 0..23 where ttf % 6 + * gives the face number and ttf / 6 the face orientation + * code. The orientation is determined as follows. Let + * my_face and other_face be the two face numbers of the + * connecting trees in 0..5. Then the first face vertex of + * the lower of my_face and other_face connects to a face + * vertex numbered 0..3 in the higher of my_face and + * other_face. The face orientation is defined as this + * number. If my_face == other_face, treating either of + * both faces as the lower one leads to the same result. */ connectivity->tree_to_face[index*6 + f] @@ -974,10 +932,8 @@ namespace unsigned int v = 0; - // global vertex index of - // vertex 0 on face of - // cell with smaller - // local face index + // global vertex index of vertex 0 on face of cell with + // smaller local face index unsigned int g_idx = cell_list[smaller_idx]->vertex_index( GeometryInfo::face_to_cell_vertices( @@ -988,10 +944,8 @@ namespace cell_list[smaller_idx]->face_rotation(face_idx_list[smaller_idx])) ); - // loop over vertices on - // face from other cell - // and compare global - // vertex numbers + // loop over vertices on face from other cell and compare + // global vertex numbers for (unsigned int i=0; i::vertices_per_face; ++i) { unsigned int idx @@ -1173,8 +1127,7 @@ namespace const typename internal::p4est::types::forest &forest, const types::subdomain_id my_subdomain) { - // check if this cell exists in - // the local p4est cell + // check if this cell exists in the local p4est cell if (sc_array_bsearch(const_cast(&tree.quadrants), &p4est_cell, internal::p4est::functions::quadrant_compare) @@ -1187,19 +1140,11 @@ namespace } else { - // no, cell not found in - // local part of - // p4est. this means that - // the local part is more - // refined than the current - // cell. if this cell has - // no children of its own, - // we need to refine it, - // and if it does already - // have children then loop - // over all children and - // see if they are locally - // available as well + // no, cell not found in local part of p4est. this means that the + // local part is more refined than the current cell. if this cell has + // no children of its own, we need to refine it, and if it does + // already have children then loop over all children and see if they + // are locally available as well if (dealii_cell->has_children () == false) dealii_cell->set_refine_flag (); else @@ -1232,29 +1177,18 @@ namespace &p4est_child[c]) == false) { - // no, this child - // is locally not - // available in - // the p4est. - // delete all - // its children - // but, because this - // may not be successfull, - // make sure to mark all - // children recursively as - // not local. + // no, this child is locally not available in the p4est. + // delete all its children but, because this may not be + // successfull, make sure to mark all children recursively + // as not local. delete_all_children (dealii_cell->child(c)); dealii_cell->child(c) ->recursively_set_subdomain_id(numbers::artificial_subdomain_id); } else { - // at least some - // part of the - // tree rooted in - // this child is - // locally - // available + // at least some part of the tree rooted in this child is + // locally available match_tree_recursively (tree, dealii_cell->child(c), p4est_child[c], @@ -1384,8 +1318,7 @@ namespace { //this cell got refined - //attach to the first child, because - // we can only attach to active + //attach to the first child, because we can only attach to active // quadrants typename internal::p4est::types::quadrant p4est_child[GeometryInfo::max_children_per_cell]; @@ -1442,8 +1375,7 @@ namespace } else { - //it's children got coarsened into - //this cell + //it's children got coarsened into this cell typename internal::p4est::types::quadrant *q; q = static_cast::quadrant *> ( sc_array_index (const_cast(&tree.quadrants), idx) @@ -1481,8 +1413,7 @@ namespace quadrant_overlaps_tree (const_cast::tree *>(&tree), &p4est_cell) == false)) - // this quadrant and none of - // it's children belong to us. + // this quadrant and none of it's children belong to us. return; @@ -1565,10 +1496,9 @@ namespace /** - * A data structure that we use to store - * which cells (indicated by - * internal::p4est::types::quadrant objects) shall be - * refined and which shall be coarsened. + * A data structure that we use to store which cells (indicated by + * internal::p4est::types::quadrant objects) shall be refined and which + * shall be coarsened. */ template class RefineAndCoarsenList @@ -1580,21 +1510,12 @@ namespace typename internal::p4est::types::forest &forest); /** - * A callback function that we - * pass to the p4est data - * structures when a forest is - * to be refined. The p4est - * functions call it back with - * a tree (the index of the - * tree that grows out of a - * given coarse cell) and a - * refinement path from that - * coarse cell to a - * terminal/leaf cell. The - * function returns whether the - * corresponding cell in the - * deal.II triangulation has - * the refined flag set. + * A callback function that we pass to the p4est data structures when a + * forest is to be refined. The p4est functions call it back with a tree + * (the index of the tree that grows out of a given coarse cell) and a + * refinement path from that coarse cell to a terminal/leaf cell. The + * function returns whether the corresponding cell in the deal.II + * triangulation has the refined flag set. */ static int @@ -1603,12 +1524,8 @@ namespace typename internal::p4est::types::quadrant *quadrant); /** - * Same as the refine_callback - * function, but return whether - * all four of the given - * children of a non-terminal - * cell are to be coarsened - * away. + * Same as the refine_callback function, but return whether all four of + * the given children of a non-terminal cell are to be coarsened away. */ static int @@ -1655,8 +1572,7 @@ namespace : forest(forest) { - // count how many flags are set and - // allocate that much memory + // count how many flags are set and allocate that much memory unsigned int n_refine_flags = 0, n_coarsen_flags = 0; for (typename Triangulation::active_cell_iterator @@ -1677,20 +1593,13 @@ namespace coarsen_list.reserve (n_coarsen_flags); - // now build the lists of cells that - // are flagged. note that p4est will - // traverse its cells in the order in - // which trees appear in the - // forest. this order is not the same - // as the order of coarse cells in the - // deal.II Triangulation because we - // have translated everything by the - // coarse_cell_to_p4est_tree_permutation - // permutation. in order to make sure - // that the output array is already in - // the correct order, traverse our - // coarse cells in the same order in - // which p4est will: + // now build the lists of cells that are flagged. note that p4est will + // traverse its cells in the order in which trees appear in the + // forest. this order is not the same as the order of coarse cells in the + // deal.II Triangulation because we have translated everything by the + // coarse_cell_to_p4est_tree_permutation permutation. in order to make + // sure that the output array is already in the correct order, traverse + // our coarse cells in the same order in which p4est will: for (unsigned int c=0; c= refine_list[i-1].p.which_tree, @@ -1789,8 +1697,7 @@ namespace RefineAndCoarsenList *this_object = reinterpret_cast*>(forest->user_pointer); - // if there are no more cells in our - // list the current cell can't be + // if there are no more cells in our list the current cell can't be // flagged for refinement if (this_object->current_refine_pointer == this_object->refine_list.end()) return false; @@ -1799,29 +1706,25 @@ namespace this_object->current_refine_pointer->p.which_tree, ExcInternalError()); - // if p4est hasn't yet reached the tree - // of the next flagged cell the current - // cell can't be flagged for refinement + // if p4est hasn't yet reached the tree of the next flagged cell the + // current cell can't be flagged for refinement if (coarse_cell_index < this_object->current_refine_pointer->p.which_tree) return false; - // now we're in the right tree in the - // forest + // now we're in the right tree in the forest Assert (coarse_cell_index <= this_object->current_refine_pointer->p.which_tree, ExcInternalError()); - // make sure that the p4est loop over - // cells hasn't gotten ahead of our own + // make sure that the p4est loop over cells hasn't gotten ahead of our own // pointer Assert (internal::p4est::functions:: quadrant_compare (quadrant, &*this_object->current_refine_pointer) <= 0, ExcInternalError()); - // now, if the p4est cell is one in the - // list, it is supposed to be refined + // now, if the p4est cell is one in the list, it is supposed to be refined if (internal::p4est::functions:: quadrant_is_equal (quadrant, &*this_object->current_refine_pointer)) { @@ -1845,8 +1748,7 @@ namespace RefineAndCoarsenList *this_object = reinterpret_cast*>(forest->user_pointer); - // if there are no more cells in our - // list the current cell can't be + // if there are no more cells in our list the current cell can't be // flagged for coarsening if (this_object->current_coarsen_pointer == this_object->coarsen_list.end()) @@ -1856,29 +1758,26 @@ namespace this_object->current_coarsen_pointer->p.which_tree, ExcInternalError()); - // if p4est hasn't yet reached the tree - // of the next flagged cell the current - // cell can't be flagged for coarsening + // if p4est hasn't yet reached the tree of the next flagged cell the + // current cell can't be flagged for coarsening if (coarse_cell_index < this_object->current_coarsen_pointer->p.which_tree) return false; - // now we're in the right tree in the - // forest + // now we're in the right tree in the forest Assert (coarse_cell_index <= this_object->current_coarsen_pointer->p.which_tree, ExcInternalError()); - // make sure that the p4est loop over - // cells hasn't gotten ahead of our own + // make sure that the p4est loop over cells hasn't gotten ahead of our own // pointer Assert (internal::p4est::functions:: quadrant_compare (children[0], &*this_object->current_coarsen_pointer) <= 0, ExcInternalError()); - // now, if the p4est cell is one in the - // list, it is supposed to be coarsened + // now, if the p4est cell is one in the list, it is supposed to be + // coarsened if (internal::p4est::functions:: quadrant_is_equal (children[0], &*this_object->current_coarsen_pointer)) @@ -1886,10 +1785,8 @@ namespace // move current pointer one up ++this_object->current_coarsen_pointer; - // note that the next 3 cells in - // our list need to correspond to - // the other siblings of the cell - // we have just found + // note that the next 3 cells in our list need to correspond to the + // other siblings of the cell we have just found for (unsigned int c=1; c::max_children_per_cell; ++c) { Assert (internal::p4est::functions:: @@ -1920,12 +1817,8 @@ namespace internal { Singleton () { - // ensure that the - // initialization - // code is run only - // once, even if we - // link with 1d, 2d, - // and 3d libraries + // ensure that the initialization code is run only once, even if we + // link with 1d, 2d, and 3d libraries static bool initialized = false; if (initialized == false) @@ -1945,9 +1838,7 @@ namespace internal if (deinitialized == false) { - // p4est has no - // p4est_finalize - // function + // p4est has no p4est_finalize function sc_finalize (); deinitialized = true; @@ -1956,8 +1847,8 @@ namespace internal }; public: - // do run the initialization code, at least the first time around we - // get to this function + // do run the initialization code, at least the first time around we get + // to this function static void do_initialize () { static Singleton singleton; @@ -1991,9 +1882,7 @@ namespace parallel const typename dealii::Triangulation::MeshSmoothing smooth_grid, const Settings settings_) : - // do not check - // for distorted - // cells + // do not check for distorted cells dealii::Triangulation (smooth_grid, false), @@ -2009,9 +1898,9 @@ namespace parallel n_attached_datas(0), n_attached_deserialize(0) { - // initialize p4est. do this in a separate function since it has - // to happen only once, even if we have triangulation objects - // for several different space dimensions + // initialize p4est. do this in a separate function since it has to + // happen only once, even if we have triangulation objects for several + // different space dimensions dealii::internal::p4est::InitFinalize::do_initialize (); parallel_ghost = 0; @@ -2033,8 +1922,7 @@ namespace parallel Assert (parallel_forest == 0, ExcInternalError()); Assert (refinement_in_progress == false, ExcInternalError()); - // get rid of the unique - // communicator used here again + // get rid of the unique communicator used here again MPI_Comm_free (&mpi_communicator); } @@ -2055,17 +1943,13 @@ namespace parallel } catch (const typename dealii::Triangulation::DistortedCellList &) { - // the underlying - // triangulation should not - // be checking for - // distorted cells + // the underlying triangulation should not be checking for distorted + // cells AssertThrow (false, ExcInternalError()); } - // note that now we have some content in - // the p4est objects and call the - // functions that do the actual work - // (which are dimension dependent, so + // note that now we have some content in the p4est objects and call the + // functions that do the actual work (which are dimension dependent, so // separate) triangulation_has_content = true; @@ -2079,10 +1963,8 @@ namespace parallel } catch (const typename Triangulation::DistortedCellList &) { - // the underlying - // triangulation should not - // be checking for - // distorted cells + // the underlying triangulation should not be checking for distorted + // cells AssertThrow (false, ExcInternalError()); } @@ -2281,12 +2163,10 @@ namespace parallel Assert (this->n_cells(0) > 0, ExcInternalError()); Assert (this->n_levels() == 1, ExcInternalError()); - // data structures that counts how many - // cells touch each vertex - // (vertex_touch_count), and which cells - // touch a given vertex (together with - // the local numbering of that vertex - // within the cells that touch it) + // data structures that counts how many cells touch each vertex + // (vertex_touch_count), and which cells touch a given vertex (together + // with the local numbering of that vertex within the cells that touch + // it) std::vector vertex_touch_count; std::vector< std::list< @@ -2301,12 +2181,9 @@ namespace parallel vertex_touch_count.end(), 0); - // now create a connectivity - // object with the right sizes - // for all arrays. set vertex - // information only in debug - // mode (saves a few bytes in - // optimized mode) + // now create a connectivity object with the right sizes for all + // arrays. set vertex information only in debug mode (saves a few bytes + // in optimized mode) const bool set_vertex_info #ifdef DEBUG = true @@ -2332,8 +2209,7 @@ namespace parallel Assert (p4est_connectivity_is_valid (connectivity) == 1, ExcInternalError()); - // now create a forest out of the - // connectivity data structure + // now create a forest out of the connectivity data structure parallel_forest = dealii::internal::p4est::functions<2>:: new_forest (mpi_communicator, @@ -2348,9 +2224,8 @@ namespace parallel - // TODO: This is a verbatim copy of the 2,2 - // case. However, we can't just specialize the - // dim template argument, but let spacedim open + // TODO: This is a verbatim copy of the 2,2 case. However, we can't just + // specialize the dim template argument, but let spacedim open template <> void Triangulation<2,3>::copy_new_triangulation_to_p4est (dealii::internal::int2type<2>) @@ -2359,12 +2234,10 @@ namespace parallel Assert (this->n_cells(0) > 0, ExcInternalError()); Assert (this->n_levels() == 1, ExcInternalError()); - // data structures that counts how many - // cells touch each vertex - // (vertex_touch_count), and which cells - // touch a given vertex (together with - // the local numbering of that vertex - // within the cells that touch it) + // data structures that counts how many cells touch each vertex + // (vertex_touch_count), and which cells touch a given vertex (together + // with the local numbering of that vertex within the cells that touch + // it) std::vector vertex_touch_count; std::vector< std::list< @@ -2379,12 +2252,9 @@ namespace parallel vertex_touch_count.end(), 0); - // now create a connectivity - // object with the right sizes - // for all arrays. set vertex - // information only in debug - // mode (saves a few bytes in - // optimized mode) + // now create a connectivity object with the right sizes for all + // arrays. set vertex information only in debug mode (saves a few bytes + // in optimized mode) const bool set_vertex_info #ifdef DEBUG = true @@ -2410,8 +2280,7 @@ namespace parallel Assert (p4est_connectivity_is_valid (connectivity) == 1, ExcInternalError()); - // now create a forest out of the - // connectivity data structure + // now create a forest out of the connectivity data structure parallel_forest = dealii::internal::p4est::functions<2>:: new_forest (mpi_communicator, @@ -2434,12 +2303,10 @@ namespace parallel Assert (this->n_cells(0) > 0, ExcInternalError()); Assert (this->n_levels() == 1, ExcInternalError()); - // data structures that counts how many - // cells touch each vertex - // (vertex_touch_count), and which cells - // touch a given vertex (together with - // the local numbering of that vertex - // within the cells that touch it) + // data structures that counts how many cells touch each vertex + // (vertex_touch_count), and which cells touch a given vertex (together + // with the local numbering of that vertex within the cells that touch + // it) std::vector vertex_touch_count; std::vector< std::list< @@ -2467,9 +2334,8 @@ namespace parallel num_ett = std::accumulate (edge_touch_count.begin(), edge_touch_count.end(), 0); - // now create a connectivity object with - // the right sizes for all arrays - + + // now create a connectivity object with the right sizes for all arrays const bool set_vertex_info #ifdef DEBUG = true @@ -2566,8 +2432,7 @@ namespace parallel Assert (p8est_connectivity_is_valid (connectivity) == 1, ExcInternalError()); - // now create a forest out of the - // connectivity data structure + // now create a forest out of the connectivity data structure parallel_forest = dealii::internal::p4est::functions<3>:: new_forest (mpi_communicator, @@ -2586,14 +2451,10 @@ namespace parallel void Triangulation::copy_local_forest_to_triangulation () { - // disable mesh smoothing for - // recreating the deal.II - // triangulation, otherwise we might - // not be able to reproduce the p4est - // mesh exactly. We restore the - // original smoothing at the end of - // this function. Note that the - // smoothing flag is used in the normal + // disable mesh smoothing for recreating the deal.II triangulation, + // otherwise we might not be able to reproduce the p4est mesh + // exactly. We restore the original smoothing at the end of this + // function. Note that the smoothing flag is used in the normal // refinement process. typename Triangulation::MeshSmoothing save_smooth = this->smooth_grid; @@ -2638,9 +2499,7 @@ namespace parallel } catch (const typename Triangulation::DistortedCellList &) { - // the underlying - // triangulation should not - // be checking for + // the underlying triangulation should not be checking for // distorted cells AssertThrow (false, ExcInternalError()); } @@ -2682,14 +2541,9 @@ namespace parallel cell != this->end(0); ++cell) { - // if this processor - // stores no part of the - // forest that comes out - // of this coarse grid - // cell, then we need to - // delete all children of - // this cell (the coarse - // grid cell remains) + // if this processor stores no part of the forest that comes out + // of this coarse grid cell, then we need to delete all children + // of this cell (the coarse grid cell remains) if (tree_exists_locally(parallel_forest, coarse_cell_to_p4est_tree_permutation[cell->index()]) == false) @@ -2701,13 +2555,8 @@ namespace parallel else { - - // this processor - // stores at least a - // part of the tree - // that comes out of - // this cell. - + // this processor stores at least a part of the tree that + // comes out of this cell. typename dealii::internal::p4est::types::quadrant p4est_coarse_cell; typename dealii::internal::p4est::types::tree *tree = @@ -2722,11 +2571,9 @@ namespace parallel } } - // check mesh for ghostcells, - // refine as necessary. - // iterate over every ghostquadrant, - // find corresponding deal coarsecell - // and recurse. + // check mesh for ghostcells, refine as necessary. iterate over + // every ghostquadrant, find corresponding deal coarsecell and + // recurse. typename dealii::internal::p4est::types::quadrant *quadr; unsigned int ghost_owner=0; typename dealii::internal::p4est::types::topidx ghost_tree=0; @@ -2747,9 +2594,7 @@ namespace parallel match_quadrant (this, coarse_cell_index, *quadr, ghost_owner); } - // fix all the flags to make - // sure we have a consistent - // mesh + // fix all the flags to make sure we have a consistent mesh this->prepare_coarsening_and_refinement (); // see if any flags are still set @@ -2764,10 +2609,8 @@ namespace parallel break; } - // actually do the refinement - // but prevent the refinement - // hook below from taking - // over + // actually do the refinement but prevent the refinement hook below + // from taking over const bool saved_refinement_in_progress = refinement_in_progress; refinement_in_progress = true; @@ -2777,9 +2620,7 @@ namespace parallel } catch (const typename Triangulation::DistortedCellList &) { - // the underlying - // triangulation should not - // be checking for + // the underlying triangulation should not be checking for // distorted cells AssertThrow (false, ExcInternalError()); } @@ -2813,9 +2654,10 @@ namespace parallel // we need this information for all our ancestors and the same-level neighbors of our own cells (=level ghosts) if (settings & construct_multigrid_hierarchy) { - // step 1: We set our own ids all the way down and all the others to -1. Note that we do not fill - // other cells we could figure out the same way, because we might accidentally set an id for a - // cell that is not a ghost cell. + // step 1: We set our own ids all the way down and all the others to + // -1. Note that we do not fill other cells we could figure out the + // same way, because we might accidentally set an id for a cell that + // is not a ghost cell. for (unsigned int lvl=this->n_levels(); lvl>0;) { --lvl; @@ -2832,7 +2674,8 @@ namespace parallel } } - //step 2: make sure all the neighbors to our level_cells exist. Need to look up in p4est... + //step 2: make sure all the neighbors to our level_cells exist. Need + //to look up in p4est... std::vector > marked_vertices(this->n_levels()); for (unsigned int lvl=0; lvln_levels(); ++lvl) @@ -2877,7 +2720,8 @@ namespace parallel { if (cell->child(c)->level_subdomain_id()==this->locally_owned_subdomain()) { - //at least one of the children belongs to us, so make sure we set the level subdomain id + //at least one of the children belongs to us, so + //make sure we set the level subdomain id types::subdomain_id mark = numbers::artificial_subdomain_id; mark = cell->child(0)->level_subdomain_id(); Assert(mark != numbers::artificial_subdomain_id, ExcInternalError()); //we should know the child(0) @@ -2888,10 +2732,12 @@ namespace parallel } } - //step 4: Special case: on each level we need all the face neighbors of our own level cells - // these are normally on the same level, unless the neighbor is active and coarser. It - // can end up on a different processor. Luckily, the level_subdomain_id can be figured out - // without communication, because the cell is active (and so level_subdomain_id=subdomain_id): + //step 4: Special case: on each level we need all the face neighbors + // of our own level cells these are normally on the same level, + // unless the neighbor is active and coarser. It can end up on a + // different processor. Luckily, the level_subdomain_id can be + // figured out without communication, because the cell is active + // (and so level_subdomain_id=subdomain_id): for (typename Triangulation::cell_iterator cell = this->begin(); cell!=this->end(); ++cell) { if (cell->level_subdomain_id()!=this->locally_owned_subdomain()) @@ -2919,18 +2765,11 @@ namespace parallel - // check that our local copy has - // exactly as many cells as the - // p4est original (at least if we - // are on only one processor); - // for parallel computations, we - // want to check that we have at - // least as many as p4est stores - // locally (in the future we - // should check that we have - // exactly as many non-artificial - // cells as - // parallel_forest->local_num_quadrants) + // check that our local copy has exactly as many cells as the p4est + // original (at least if we are on only one processor); for parallel + // computations, we want to check that we have at least as many as p4est + // stores locally (in the future we should check that we have exactly as + // many non-artificial cells as parallel_forest->local_num_quadrants) { const unsigned int total_local_cells = this->n_active_cells(); @@ -2943,8 +2782,7 @@ namespace parallel total_local_cells, ExcInternalError()); - // count the number of owned, active - // cells and compare with p4est. + // count the number of owned, active cells and compare with p4est. unsigned int n_owned = 0; for (typename Triangulation::active_cell_iterator cell = this->begin_active(); @@ -2968,8 +2806,7 @@ namespace parallel void Triangulation::execute_coarsening_and_refinement () { - // first make sure that recursive - // calls are handled correctly + // first make sure that recursive calls are handled correctly if (refinement_in_progress == true) { dealii::Triangulation::execute_coarsening_and_refinement (); @@ -3000,17 +2837,12 @@ namespace parallel } } - // now do the work we're - // supposed to do when we are - // in charge + // now do the work we're supposed to do when we are in charge refinement_in_progress = true; this->prepare_coarsening_and_refinement (); - // make sure all flags are - // cleared on cells we don't - // own, since nothing good can - // come of that if they are - // still around + // make sure all flags are cleared on cells we don't own, since nothing + // good can come of that if they are still around for (typename Triangulation::active_cell_iterator cell = this->begin_active(); cell != this->end(); ++cell) @@ -3021,21 +2853,17 @@ namespace parallel } - // count how many cells will be refined - // and coarsened, and allocate that much - // memory + // count how many cells will be refined and coarsened, and allocate that + // much memory RefineAndCoarsenList refine_and_coarsen_list (*this, p4est_tree_to_coarse_cell_permutation, my_subdomain, *parallel_forest); - // copy refine and coarsen flags into - // p4est and execute the refinement and - // coarsening. this uses the - // refine_and_coarsen_list just built, - // which is communicated to the callback - // functions through the + // copy refine and coarsen flags into p4est and execute the refinement + // and coarsening. this uses the refine_and_coarsen_list just built, + // which is communicated to the callback functions through the // user_pointer Assert (parallel_forest->user_pointer == this, ExcInternalError()); @@ -3055,8 +2883,7 @@ namespace parallel &RefineAndCoarsenList::coarsen_callback, /*init_callback=*/NULL); - // make sure all cells in the lists have - // been consumed + // make sure all cells in the lists have been consumed Assert (refine_and_coarsen_list.pointers_are_at_end(), ExcInternalError()); @@ -3077,25 +2904,19 @@ namespace parallel /*init_callback=*/NULL); - // before repartitioning the mesh let - // others attach mesh related info - // (such as SolutionTransfer data) to - // the p4est + // before repartitioning the mesh let others attach mesh related info + // (such as SolutionTransfer data) to the p4est attach_mesh_data(); - // partition the new mesh between - // all processors + // partition the new mesh between all processors dealii::internal::p4est::functions:: partition (parallel_forest, /* prepare coarsening */ 1, /* weight_callback */ NULL); - // finally copy back from local - // part of tree to deal.II - // triangulation. before doing - // so, make sure there are no - // refine or coarsen flags - // pending + // finally copy back from local part of tree to deal.II + // triangulation. before doing so, make sure there are no refine or + // coarsen flags pending for (typename Triangulation::active_cell_iterator cell = this->begin_active(); cell != this->end(); ++cell) @@ -3110,10 +2931,8 @@ namespace parallel } catch (const typename Triangulation::DistortedCellList &) { - // the underlying - // triangulation should not - // be checking for - // distorted cells + // the underlying triangulation should not be checking for distorted + // cells AssertThrow (false, ExcInternalError()); } @@ -3158,10 +2977,7 @@ namespace parallel number_cache.n_global_active_cells = std::accumulate (number_cache.n_locally_owned_active_cells.begin(), number_cache.n_locally_owned_active_cells.end(), - /* ensure sum is - computed with - correct data - type:*/ + /* ensure sum is computed with correct data type:*/ static_cast(0)); number_cache.n_global_levels = Utilities::MPI::max(this->n_levels(), mpi_communicator); } @@ -3266,8 +3082,7 @@ namespace parallel dealii::internal::p4est::init_coarse_quadrant (p4est_coarse_cell); - // parent_cell is not correct here, - // but is only used in a refined + // parent_cell is not correct here, but is only used in a refined // cell post_mesh_data_recursively (*tree, cell, @@ -3285,10 +3100,10 @@ namespace parallel } // important: only remove data if we are not in the deserialization - // process. There, each SolutionTransfer registers and unpacks - // before the next one does this, so n_attached_datas is only 1 here. - // This would destroy the saved data before the second SolutionTransfer - // can get it. This created a bug that is documented in + // process. There, each SolutionTransfer registers and unpacks before + // the next one does this, so n_attached_datas is only 1 here. This + // would destroy the saved data before the second SolutionTransfer can + // get it. This created a bug that is documented in // tests/mpi/p4est_save_03 with more than one SolutionTransfer. if (!n_attached_datas && n_attached_deserialize == 0) { @@ -3686,8 +3501,7 @@ namespace parallel (connectivity) == 1, ExcInternalError()); - // now create a forest out of the - // connectivity data structure + // now create a forest out of the connectivity data structure dealii::internal::p4est::functions::destroy (parallel_forest); parallel_forest = dealii::internal::p4est::functions:: @@ -3755,17 +3569,13 @@ namespace parallel } catch (const typename dealii::Triangulation::DistortedCellList &) { - // the underlying - // triangulation should not - // be checking for - // distorted cells + // the underlying triangulation should not be checking for distorted + // cells AssertThrow (false, ExcInternalError()); } - // note that now we have some content in - // the p4est objects and call the - // functions that do the actual work - // (which are dimension dependent, so + // note that now we have some content in the p4est objects and call the + // functions that do the actual work (which are dimension dependent, so // separate) triangulation_has_content = true; @@ -3802,10 +3612,8 @@ namespace parallel } catch (const typename Triangulation::DistortedCellList &) { - // the underlying - // triangulation should not - // be checking for - // distorted cells + // the underlying triangulation should not be checking for distorted + // cells AssertThrow (false, ExcInternalError()); } @@ -3818,9 +3626,8 @@ namespace parallel Triangulation:: attach_mesh_data() { - // determine size of memory in bytes to - // attach to each cell. This needs to - // be constant because of p4est. + // determine size of memory in bytes to attach to each cell. This needs + // to be constant because of p4est. if (attached_data_size==0) { Assert(n_attached_datas==0, ExcInternalError()); @@ -3890,8 +3697,7 @@ namespace parallel - // TODO: again problems with specialization in - // only one template argument + // TODO: again problems with specialization in only one template argument template <> Triangulation<1,1>::Triangulation (MPI_Comm) { -- 2.39.5