From: Wolfgang Bangerth Date: Wed, 13 Sep 2017 22:12:36 +0000 (-0600) Subject: Simplify some function calls now that we have hp::DoFHandler::get_fe(index). X-Git-Tag: v9.0.0-rc1~1089^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dfc0cfcab8ac63e6dd3d476219bed96eacaf110a;p=dealii.git Simplify some function calls now that we have hp::DoFHandler::get_fe(index). --- diff --git a/include/deal.II/dofs/dof_accessor.templates.h b/include/deal.II/dofs/dof_accessor.templates.h index 9387b9345b..9e23ec096c 100644 --- a/include/deal.II/dofs/dof_accessor.templates.h +++ b/include/deal.II/dofs/dof_accessor.templates.h @@ -1166,9 +1166,9 @@ namespace internal Assert (dof_handler.finite_elements != nullptr, ExcMessage ("No finite element collection is associated with " "this DoFHandler")); - Assert (local_index < (*dof_handler.finite_elements)[fe_index].dofs_per_vertex, + Assert (local_index < dof_handler.get_fe(fe_index).dofs_per_vertex, ExcIndexRange(local_index, 0, - (*dof_handler.finite_elements)[fe_index].dofs_per_vertex)); + dof_handler.get_fe(fe_index).dofs_per_vertex)); Assert (fe_index < dof_handler.finite_elements->size(), ExcInternalError()); Assert (dof_handler.vertex_dof_offsets[vertex_index] != @@ -1204,7 +1204,7 @@ namespace internal } else pointer += static_cast( - (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1); + dof_handler.get_fe(this_fe_index).dofs_per_vertex + 1); } } @@ -1251,9 +1251,9 @@ namespace internal Assert (dof_handler.finite_elements != nullptr, ExcMessage ("No finite element collection is associated with " "this DoFHandler")); - Assert (local_index < (*dof_handler.finite_elements)[fe_index].dofs_per_vertex, + Assert (local_index < dof_handler.get_fe(fe_index).dofs_per_vertex, ExcIndexRange(local_index, 0, - (*dof_handler.finite_elements)[fe_index].dofs_per_vertex)); + dof_handler.get_fe(fe_index).dofs_per_vertex)); Assert (vertex_index < dof_handler.vertex_dof_offsets.size(), ExcIndexRange (vertex_index, 0, dof_handler.vertex_dof_offsets.size())); @@ -1286,7 +1286,7 @@ namespace internal return *(pointer + 1 + local_index); else pointer += static_cast( - (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1); + dof_handler.get_fe(this_fe_index).dofs_per_vertex + 1); } } @@ -1330,7 +1330,7 @@ namespace internal else { pointer += static_cast( - (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1); + dof_handler.get_fe(this_fe_index).dofs_per_vertex + 1); ++counter; } } @@ -1388,7 +1388,7 @@ namespace internal ExcInternalError()); pointer += static_cast( - (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1); + dof_handler.get_fe(this_fe_index).dofs_per_vertex + 1); ++counter; } } @@ -1445,7 +1445,7 @@ namespace internal else if (this_fe_index == fe_index) return true; else - pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; + pointer += dof_handler.get_fe(this_fe_index).dofs_per_vertex + 1; } } diff --git a/source/dofs/dof_handler_policy.cc b/source/dofs/dof_handler_policy.cc index 90ac2e3db6..4e2f71e36e 100644 --- a/source/dofs/dof_handler_policy.cc +++ b/source/dofs/dof_handler_policy.cc @@ -739,37 +739,38 @@ namespace internal // do a first loop over all sets of dofs and do identity // uniquification - for (unsigned int f=0; fn_active_fe_indices(); ++f) - for (unsigned int g=f+1; gn_active_fe_indices(); ++g) + const unsigned int n_active_fe_indices = line->n_active_fe_indices(); + for (unsigned int f=0; fnth_active_fe_index (f), fe_index_2 = line->nth_active_fe_index (g); - if (((*dof_handler.finite_elements)[fe_index_1].dofs_per_line + if ((dof_handler.get_fe(fe_index_1).dofs_per_line == - (*dof_handler.finite_elements)[fe_index_2].dofs_per_line) + dof_handler.get_fe(fe_index_2).dofs_per_line) && - ((*dof_handler.finite_elements)[fe_index_1].dofs_per_line > 0)) + (dof_handler.get_fe(fe_index_1).dofs_per_line > 0)) { ensure_existence_of_dof_identities<1> - ((*dof_handler.finite_elements)[fe_index_1], - (*dof_handler.finite_elements)[fe_index_2], + (dof_handler.get_fe(fe_index_1), + dof_handler.get_fe(fe_index_2), line_dof_identities[fe_index_1][fe_index_2]); // see if these sets of dofs are identical. the first // condition for this is that indeed there are n identities if (line_dof_identities[fe_index_1][fe_index_2]->size() == - (*dof_handler.finite_elements)[fe_index_1].dofs_per_line) + dof_handler.get_fe(fe_index_1).dofs_per_line) { unsigned int i=0; - for (; i<(*dof_handler.finite_elements)[fe_index_1].dofs_per_line; ++i) + for (; idof_index (j, fe_index_1); @@ -848,8 +849,8 @@ namespace internal other_fe_index = line->nth_active_fe_index (f); ensure_existence_of_dof_identities<1> - ((*dof_handler.finite_elements)[most_dominating_fe_index], - (*dof_handler.finite_elements)[other_fe_index], + (dof_handler.get_fe(most_dominating_fe_index), + dof_handler.get_fe(other_fe_index), line_dof_identities[most_dominating_fe_index][other_fe_index]); DoFIdentities &identities @@ -972,8 +973,8 @@ namespace internal other_fe_index = quad->nth_active_fe_index (f); ensure_existence_of_dof_identities<2> - ((*dof_handler.finite_elements)[most_dominating_fe_index], - (*dof_handler.finite_elements)[other_fe_index], + (dof_handler.get_fe(most_dominating_fe_index), + dof_handler.get_fe(other_fe_index), quad_dof_identities[most_dominating_fe_index][other_fe_index]); DoFIdentities &identities diff --git a/source/hp/dof_handler.cc b/source/hp/dof_handler.cc index 664e4d6c06..9dcc6758ef 100644 --- a/source/hp/dof_handler.cc +++ b/source/hp/dof_handler.cc @@ -185,7 +185,7 @@ namespace internal for (unsigned int fe=0; fesize(); ++fe) if (vertex_fe_association[fe][v] == true) - vertex_slots_needed += (*dof_handler.finite_elements)[fe].dofs_per_vertex + 1; + vertex_slots_needed += dof_handler.get_fe(fe).dofs_per_vertex + 1; // don't forget the end_marker: ++vertex_slots_needed; @@ -206,7 +206,7 @@ namespace internal // if this vertex uses this fe, then set the // fe_index and move the pointer ahead dof_handler.vertex_dofs[current_index] = fe; - current_index += (*dof_handler.finite_elements)[fe].dofs_per_vertex + 1; + current_index += dof_handler.get_fe(fe).dofs_per_vertex + 1; } // finally place the end marker dof_handler.vertex_dofs[current_index] = numbers::invalid_dof_index; @@ -414,7 +414,7 @@ namespace internal // ok, one set of dofs. that makes one active_fe_index, 1 // times dofs_per_face dofs, and one stop index n_face_slots - += 1 + (*dof_handler.finite_elements)[cell->active_fe_index()].template n_dofs_per_object() + 1; + += 1 + dof_handler.get_fe(cell->active_fe_index()).template n_dofs_per_object() + 1; // otherwise we do indeed need two sets, i.e. two // active_fe_indices, two sets of dofs, and one stop index: @@ -422,9 +422,9 @@ namespace internal n_face_slots += (2 + - (*dof_handler.finite_elements)[cell->active_fe_index()].template n_dofs_per_object() + dof_handler.get_fe(cell->active_fe_index()).template n_dofs_per_object() + - (*dof_handler.finite_elements)[cell->neighbor(face)->active_fe_index()] + dof_handler.get_fe(cell->neighbor(face)->active_fe_index()) .template n_dofs_per_object() + 1); @@ -510,7 +510,7 @@ namespace internal // finally, mark those slots as used next_free_face_slot - += (*dof_handler.finite_elements)[cell->active_fe_index()].template n_dofs_per_object() + 2; + += dof_handler.get_fe(cell->active_fe_index()).template n_dofs_per_object() + 2; } else { @@ -529,7 +529,7 @@ namespace internal // cell: face_dof_indices[next_free_face_slot + - (*dof_handler.finite_elements)[cell->active_fe_index()].template n_dofs_per_object() + dof_handler.get_fe(cell->active_fe_index()).template n_dofs_per_object() + 1] = cell->neighbor(face)->active_fe_index(); @@ -542,9 +542,9 @@ namespace internal // finally, mark those slots as used next_free_face_slot - += ((*dof_handler.finite_elements)[cell->active_fe_index()].template n_dofs_per_object() + += (dof_handler.get_fe(cell->active_fe_index()).template n_dofs_per_object() + - (*dof_handler.finite_elements)[cell->neighbor(face)->active_fe_index()] + dof_handler.get_fe(cell->neighbor(face)->active_fe_index()) .template n_dofs_per_object() + 3); @@ -730,7 +730,7 @@ namespace internal for (unsigned int fe=0; fesize(); ++fe) if (line_fe_association[fe][line] == true) - line_slots_needed += (*dof_handler.finite_elements)[fe].dofs_per_line + 1; + line_slots_needed += dof_handler.get_fe(fe).dofs_per_line + 1; ++line_slots_needed; } @@ -748,7 +748,7 @@ namespace internal // if this line uses this fe, then set the // fe_index and move the pointer ahead dof_handler.faces->lines.dofs[pointer] = fe; - pointer += (*dof_handler.finite_elements)[fe].dofs_per_line + 1; + pointer += dof_handler.get_fe(fe).dofs_per_line + 1; } // finally place the end marker dof_handler.faces->lines.dofs[pointer] = numbers::invalid_dof_index;