From 8666a6eeed6b5f86cddbebb1732e5b714c502663 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Sun, 22 Mar 2020 08:55:33 +0100 Subject: [PATCH] Name alias of VectorizedArray::size() consistently --- .../deal.II/matrix_free/evaluation_kernels.h | 10 +- include/deal.II/matrix_free/fe_evaluation.h | 100 ++++++++---------- .../matrix_free/mapping_info.templates.h | 20 ++-- include/deal.II/matrix_free/matrix_free.h | 26 ++--- .../matrix_free/matrix_free.templates.h | 87 +++++++-------- 5 files changed, 115 insertions(+), 128 deletions(-) diff --git a/include/deal.II/matrix_free/evaluation_kernels.h b/include/deal.II/matrix_free/evaluation_kernels.h index 090b985625..086c35440b 100644 --- a/include/deal.II/matrix_free/evaluation_kernels.h +++ b/include/deal.II/matrix_free/evaluation_kernels.h @@ -2781,7 +2781,7 @@ namespace internal dof_info.component_dof_indices_offset[active_fe_index] [first_selected_component] * strides[v]; - const unsigned int nvec = + const unsigned int n_filled_lanes = dof_info.n_vectorization_lanes_filled[dof_access_index][cell]; if (fe_degree > 1 && integrate_gradients == true) @@ -2796,7 +2796,7 @@ namespace internal const unsigned int *index_array = &data.face_to_cell_index_hermite(face_no, 0); - if (nvec == VectorizedArrayType::size()) + if (n_filled_lanes == VectorizedArrayType::size()) for (unsigned int comp = 0; comp < n_components; ++comp) for (unsigned int i = 0; i < dofs_per_face; ++i) { @@ -2828,7 +2828,7 @@ namespace internal } else { - for (unsigned int v = 0; v < nvec; ++v) + for (unsigned int v = 0; v < n_filled_lanes; ++v) for (unsigned int comp = 0; comp < n_components; ++comp) for (unsigned int i = 0; i < dofs_per_face; ++i) { @@ -2858,7 +2858,7 @@ namespace internal dofs_per_face); const unsigned int *index_array = &data.face_to_cell_index_nodal(face_no, 0); - if (nvec == VectorizedArrayType::size()) + if (n_filled_lanes == VectorizedArrayType::size()) for (unsigned int comp = 0; comp < n_components; ++comp) for (unsigned int i = 0; i < dofs_per_face; ++i) { @@ -2875,7 +2875,7 @@ namespace internal } else { - for (unsigned int v = 0; v < nvec; ++v) + for (unsigned int v = 0; v < n_filled_lanes; ++v) for (unsigned int comp = 0; comp < n_components; ++comp) for (unsigned int i = 0; i < dofs_per_face; ++i) { diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index 35f6d577b1..ffc9427cde 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -3563,11 +3563,11 @@ std::array FEEvaluationBase:: get_cell_ids() const { - const unsigned int v_len = VectorizedArrayType::size(); - std::array cells; + const unsigned int n_lanes = VectorizedArrayType::size(); + std::array cells; // initialize array - for (unsigned int i = 0; i < v_len; ++i) + for (unsigned int i = 0; i < n_lanes; ++i) cells[i] = numbers::invalid_unsigned_int; if ((is_face == false) || @@ -3577,8 +3577,8 @@ FEEvaluationBase:: this->is_interior_face)) { // cell or interior face face (element-centric loop) - for (unsigned int i = 0; i < v_len; ++i) - cells[i] = cell * v_len + i; + for (unsigned int i = 0; i < n_lanes; ++i) + cells[i] = cell * n_lanes + i; } else if (is_face && this->dof_access_index == @@ -3589,10 +3589,10 @@ FEEvaluationBase:: // look into the FaceInfo field that collects information from both // sides of a face once for the global mesh, and pick the face id that // is not the local one (cell_this). - for (unsigned int i = 0; i < v_len; i++) + for (unsigned int i = 0; i < n_lanes; i++) { // compute actual (non vectorized) cell ID - const unsigned int cell_this = this->cell * v_len + i; + const unsigned int cell_this = this->cell * n_lanes + i; // compute face ID unsigned int face_index = this->matrix_info->get_cell_and_face_to_plain_faces()(this->cell, @@ -3603,10 +3603,10 @@ FEEvaluationBase:: continue; // invalid face ID: no neighbor on boundary // get cell ID on both sides of face - auto cell_m = this->matrix_info->get_face_info(face_index / v_len) - .cells_interior[face_index % v_len]; - auto cell_p = this->matrix_info->get_face_info(face_index / v_len) - .cells_exterior[face_index % v_len]; + auto cell_m = this->matrix_info->get_face_info(face_index / n_lanes) + .cells_interior[face_index % n_lanes]; + auto cell_p = this->matrix_info->get_face_info(face_index / n_lanes) + .cells_exterior[face_index % n_lanes]; // compare the IDs with the given cell ID if (cell_m == cell_this) @@ -3824,8 +3824,8 @@ FEEvaluationBase:: // Case 3: standard operation with one index per degree of freedom -> go on // here - constexpr unsigned int n_vectorization = VectorizedArrayType::size(); - Assert(mask.count() == n_vectorization, + constexpr unsigned int n_lanes = VectorizedArrayType::size(); + Assert(mask.count() == n_lanes, ExcNotImplemented("Masking currently not implemented for " "non-contiguous DoF storage")); @@ -3843,13 +3843,13 @@ FEEvaluationBase:: { const unsigned int *dof_indices = dof_info->dof_indices_interleaved.data() + - dof_info->row_starts[cell * n_fe_components * n_vectorization].first + + dof_info->row_starts[cell * n_fe_components * n_lanes].first + dof_info->component_dof_indices_offset[active_fe_index] [first_selected_component] * - n_vectorization; + n_lanes; if (n_components == 1 || n_fe_components == 1) for (unsigned int i = 0; i < dofs_per_component; - ++i, dof_indices += n_vectorization) + ++i, dof_indices += n_lanes) for (unsigned int comp = 0; comp < n_components; ++comp) operation.process_dof_gather(dof_indices, *src[comp], @@ -3859,19 +3859,19 @@ FEEvaluationBase:: else for (unsigned int comp = 0; comp < n_components; ++comp) for (unsigned int i = 0; i < dofs_per_component; - ++i, dof_indices += n_vectorization) + ++i, dof_indices += n_lanes) operation.process_dof_gather( dof_indices, *src[0], 0, values_dofs[comp][i], vector_selector); return; } - const unsigned int * dof_indices[n_vectorization]; + const unsigned int * dof_indices[n_lanes]; VectorizedArrayType **values_dofs = const_cast(&this->values_dofs[0]); // Assign the appropriate cell ids for face/cell case and get the pointers // to the dof indices of the cells on all lanes - unsigned int cells_copied[n_vectorization]; + unsigned int cells_copied[n_lanes]; const unsigned int *cells; unsigned int n_vectorization_actual = dof_info->n_vectorization_lanes_filled[dof_access_index][cell]; @@ -3905,21 +3905,20 @@ FEEvaluationBase:: dof_indices[v] = dof_info->dof_indices.data() + my_index_start[0].first; } - for (unsigned int v = n_vectorization_actual; v < n_vectorization; ++v) + for (unsigned int v = n_vectorization_actual; v < n_lanes; ++v) dof_indices[v] = nullptr; } else { - AssertIndexRange((cell + 1) * n_vectorization * n_fe_components, + AssertIndexRange((cell + 1) * n_lanes * n_fe_components, dof_info->row_starts.size()); const unsigned int n_components_read = n_fe_components > 1 ? n_components : 1; for (unsigned int v = 0; v < n_vectorization_actual; ++v) { const std::pair *my_index_start = - &dof_info - ->row_starts[(cell * n_vectorization + v) * n_fe_components + - first_selected_component]; + &dof_info->row_starts[(cell * n_lanes + v) * n_fe_components + + first_selected_component]; if (my_index_start[n_components_read].second != my_index_start[0].second) has_constraints = true; @@ -3932,7 +3931,7 @@ FEEvaluationBase:: dof_indices[v] = dof_info->dof_indices.data() + my_index_start[0].first; } - for (unsigned int v = n_vectorization_actual; v < n_vectorization; ++v) + for (unsigned int v = n_vectorization_actual; v < n_lanes; ++v) dof_indices[v] = nullptr; } @@ -3940,7 +3939,7 @@ FEEvaluationBase:: // through the list of DoFs directly if (!has_constraints) { - if (n_vectorization_actual < n_vectorization) + if (n_vectorization_actual < n_lanes) for (unsigned int comp = 0; comp < n_components; ++comp) for (unsigned int i = 0; i < dofs_per_component; ++i) operation.process_empty(values_dofs[comp][i]); @@ -3971,7 +3970,7 @@ FEEvaluationBase:: // holds local number on cell, index iterates over the elements of // index_local_to_global and dof_indices points to the global indices stored // in index_local_to_global - if (n_vectorization_actual < n_vectorization) + if (n_vectorization_actual < n_lanes) for (unsigned int comp = 0; comp < n_components; ++comp) for (unsigned int i = 0; i < dofs_per_component; ++i) operation.process_empty(values_dofs[comp][i]); @@ -3995,37 +3994,35 @@ FEEvaluationBase:: { index_indicators = dof_info - ->row_starts[(cell * n_vectorization + v) * n_fe_components + + ->row_starts[(cell * n_lanes + v) * n_fe_components + first_selected_component] .second; next_index_indicators = dof_info - ->row_starts[(cell * n_vectorization + v) * n_fe_components + + ->row_starts[(cell * n_lanes + v) * n_fe_components + first_selected_component + 1] .second; } if (apply_constraints == false && dof_info - ->row_starts[(cell * n_vectorization + v) * n_fe_components + + ->row_starts[(cell * n_lanes + v) * n_fe_components + first_selected_component] .second != dof_info - ->row_starts[(cell * n_vectorization + v) * n_fe_components + + ->row_starts[(cell * n_lanes + v) * n_fe_components + first_selected_component + n_components_read] .second) { - Assert( - dof_info->row_starts_plain_indices[cell * n_vectorization + v] != - numbers::invalid_unsigned_int, - ExcNotInitialized()); + Assert(dof_info->row_starts_plain_indices[cell * n_lanes + v] != + numbers::invalid_unsigned_int, + ExcNotInitialized()); dof_indices[v] = dof_info->plain_dof_indices.data() + dof_info->component_dof_indices_offset[active_fe_index] [first_selected_component] + - (is_face ? - dof_info->row_starts_plain_indices[cells[v]] : - dof_info->row_starts_plain_indices[cell * n_vectorization + v]); + (is_face ? dof_info->row_starts_plain_indices[cells[v]] : + dof_info->row_starts_plain_indices[cell * n_lanes + v]); next_index_indicators = index_indicators; } @@ -4149,8 +4146,7 @@ FEEvaluationBase:: else next_index_indicators = dof_info - ->row_starts[(cell * n_vectorization + v) * - n_fe_components + + ->row_starts[(cell * n_lanes + v) * n_fe_components + first_selected_component + comp + 2] .second; } @@ -4254,11 +4250,11 @@ FEEvaluationBase:: // More general case: Must go through the components one by one and apply // some transformations - const unsigned int vectorization_populated = + const unsigned int n_filled_lanes = dof_info->n_vectorization_lanes_filled[ind][this->cell]; unsigned int dof_indices[VectorizedArrayType::size()]; - for (unsigned int v = 0; v < vectorization_populated; ++v) + for (unsigned int v = 0; v < n_filled_lanes; ++v) dof_indices[v] = dof_indices_cont[cell * VectorizedArrayType::size() + v] + dof_info->component_dof_indices_offset[active_fe_index] @@ -4266,14 +4262,12 @@ FEEvaluationBase:: dof_info->dof_indices_interleave_strides [ind][cell * VectorizedArrayType::size() + v]; - for (unsigned int v = vectorization_populated; - v < VectorizedArrayType::size(); - ++v) + for (unsigned int v = n_filled_lanes; v < VectorizedArrayType::size(); ++v) dof_indices[v] = numbers::invalid_unsigned_int; // In the case with contiguous cell indices, we know that there are no // constraints and that the indices within each element are contiguous - if (vectorization_populated == VectorizedArrayType::size() && + if (n_filled_lanes == VectorizedArrayType::size() && n_lanes == VectorizedArrayType::size()) { if (dof_info->index_storage_variants[ind][cell] == @@ -4373,7 +4367,7 @@ FEEvaluationBase:: { if (n_components == 1 || n_fe_components == 1) { - for (unsigned int v = 0; v < vectorization_populated; ++v) + for (unsigned int v = 0; v < n_filled_lanes; ++v) if (mask[v] == true) for (unsigned int i = 0; i < data->dofs_per_component_on_cell; @@ -4384,7 +4378,7 @@ FEEvaluationBase:: } else { - for (unsigned int v = 0; v < vectorization_populated; ++v) + for (unsigned int v = 0; v < n_filled_lanes; ++v) if (mask[v] == true) for (unsigned int i = 0; i < data->dofs_per_component_on_cell; @@ -4401,10 +4395,10 @@ FEEvaluationBase:: const unsigned int *offsets = &dof_info->dof_indices_interleave_strides [ind][VectorizedArrayType::size() * cell]; - for (unsigned int v = 0; v < vectorization_populated; ++v) + for (unsigned int v = 0; v < n_filled_lanes; ++v) AssertIndexRange(offsets[v], VectorizedArrayType::size() + 1); if (n_components == 1 || n_fe_components == 1) - for (unsigned int v = 0; v < vectorization_populated; ++v) + for (unsigned int v = 0; v < n_filled_lanes; ++v) { if (mask[v] == true) for (unsigned int i = 0; @@ -4416,7 +4410,7 @@ FEEvaluationBase:: } else { - for (unsigned int v = 0; v < vectorization_populated; ++v) + for (unsigned int v = 0; v < n_filled_lanes; ++v) if (mask[v] == true) for (unsigned int i = 0; i < data->dofs_per_component_on_cell; @@ -7309,8 +7303,8 @@ FEFaceEvaluationmapping_data != nullptr, ExcNotInitialized()); - const unsigned int n_vectors = VectorizedArrayType::size(); - const internal::MatrixFreeFunctions::FaceToCellTopology &faces = + const internal::MatrixFreeFunctions::FaceToCellTopology< + VectorizedArrayType::size()> &faces = this->matrix_info->get_face_info(face_index); if (face_index >= this->matrix_info->get_task_info().face_partition_data.back() && diff --git a/include/deal.II/matrix_free/mapping_info.templates.h b/include/deal.II/matrix_free/mapping_info.templates.h index 18882a192a..bb41fc52ac 100644 --- a/include/deal.II/matrix_free/mapping_info.templates.h +++ b/include/deal.II/matrix_free/mapping_info.templates.h @@ -1103,10 +1103,10 @@ namespace internal const std::vector & active_fe_index, const Mapping & mapping) { - const unsigned int n_cells = cells.size(); - const unsigned int vectorization_width = VectorizedArrayType::size(); - Assert(n_cells % vectorization_width == 0, ExcInternalError()); - const unsigned int n_macro_cells = n_cells / vectorization_width; + const unsigned int n_cells = cells.size(); + const unsigned int n_lanes = VectorizedArrayType::size(); + Assert(n_cells % n_lanes == 0, ExcInternalError()); + const unsigned int n_macro_cells = n_cells / n_lanes; cell_type.resize(n_macro_cells); if (n_macro_cells == 0) @@ -1947,8 +1947,8 @@ namespace internal if (update_flags_faces_by_cells == update_default) return; - const unsigned int n_quads = face_data_by_cells.size(); - const unsigned int vectorization_width = VectorizedArrayType::size(); + const unsigned int n_quads = face_data_by_cells.size(); + const unsigned int n_lanes = VectorizedArrayType::size(); UpdateFlags update_flags = (update_flags_faces_by_cells & update_quadrature_points ? update_quadrature_points : @@ -1960,7 +1960,7 @@ namespace internal // since we already know the cell type, we can pre-allocate the right // amount of data straight away and we just need to do some basic // counting - AssertDimension(cell_type.size(), cells.size() / vectorization_width); + AssertDimension(cell_type.size(), cells.size() / n_lanes); face_data_by_cells[my_q].data_index_offsets.resize( cell_type.size() * GeometryInfo::faces_per_cell); if (update_flags & update_quadrature_points) @@ -2056,12 +2056,12 @@ namespace internal .data_index_offsets[cell * GeometryInfo::faces_per_cell + face]; - for (unsigned int v = 0; v < vectorization_width; ++v) + for (unsigned int v = 0; v < n_lanes; ++v) { typename dealii::Triangulation::cell_iterator cell_it( &tria, - cells[cell * vectorization_width + v].first, - cells[cell * vectorization_width + v].second); + cells[cell * n_lanes + v].first, + cells[cell * n_lanes + v].second); fe_val.reinit(cell_it, face); const bool is_local = diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index 68efa4c5cf..bcd71ec4fc 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -2484,15 +2484,15 @@ MatrixFree::n_active_entries_per_cell_batch( const unsigned int cell_batch_number) const { AssertIndexRange(cell_batch_number, task_info.cell_partition_data.back()); - unsigned int n_components = VectorizedArrayType::size(); - while (n_components > 1 && + unsigned int n_lanes = VectorizedArrayType::size(); + while (n_lanes > 1 && cell_level_index[cell_batch_number * VectorizedArrayType::size() + - n_components - 1] == + n_lanes - 1] == cell_level_index[cell_batch_number * VectorizedArrayType::size() + - n_components - 2]) - --n_components; - AssertIndexRange(n_components - 1, VectorizedArrayType::size()); - return n_components; + n_lanes - 2]) + --n_lanes; + AssertIndexRange(n_lanes - 1, VectorizedArrayType::size()); + return n_lanes; } @@ -2503,13 +2503,13 @@ MatrixFree::n_active_entries_per_face_batch( const unsigned int face_batch_number) const { AssertIndexRange(face_batch_number, face_info.faces.size()); - unsigned int n_components = VectorizedArrayType::size(); - while (n_components > 1 && - face_info.faces[face_batch_number].cells_interior[n_components - 1] == + unsigned int n_lanes = VectorizedArrayType::size(); + while (n_lanes > 1 && + face_info.faces[face_batch_number].cells_interior[n_lanes - 1] == numbers::invalid_unsigned_int) - --n_components; - AssertIndexRange(n_components - 1, VectorizedArrayType::size()); - return n_components; + --n_lanes; + AssertIndexRange(n_lanes - 1, VectorizedArrayType::size()); + return n_lanes; } diff --git a/include/deal.II/matrix_free/matrix_free.templates.h b/include/deal.II/matrix_free/matrix_free.templates.h index c9a206fd0e..0b88f7aff0 100644 --- a/include/deal.II/matrix_free/matrix_free.templates.h +++ b/include/deal.II/matrix_free/matrix_free.templates.h @@ -199,7 +199,6 @@ MatrixFree::get_cell_iterator( const unsigned int vector_number, const unsigned int dof_handler_index) const { - const unsigned int vectorization_length = VectorizedArrayType::size(); AssertIndexRange(dof_handler_index, dof_handlers.n_dof_handlers); AssertIndexRange(macro_cell_number, task_info.cell_partition_data.back()); AssertIndexRange(vector_number, n_components_filled(macro_cell_number)); @@ -219,7 +218,8 @@ MatrixFree::get_cell_iterator( } std::pair index = - cell_level_index[macro_cell_number * vectorization_length + vector_number]; + cell_level_index[macro_cell_number * VectorizedArrayType::size() + + vector_number]; return typename DoFHandler::cell_iterator(&dofh->get_triangulation(), index.first, index.second, @@ -234,12 +234,12 @@ MatrixFree::get_cell_level_and_index( const unsigned int macro_cell_number, const unsigned int vector_number) const { - const unsigned int vectorization_length = VectorizedArrayType::size(); AssertIndexRange(macro_cell_number, task_info.cell_partition_data.back()); AssertIndexRange(vector_number, n_components_filled(macro_cell_number)); std::pair level_index_pair = - cell_level_index[macro_cell_number * vectorization_length + vector_number]; + cell_level_index[macro_cell_number * VectorizedArrayType::size() + + vector_number]; return level_index_pair; } @@ -306,7 +306,6 @@ MatrixFree::get_hp_cell_iterator( const unsigned int vector_number, const unsigned int dof_handler_index) const { - constexpr unsigned int vectorization_length = VectorizedArrayType::size(); AssertIndexRange(dof_handler_index, dof_handlers.n_dof_handlers); AssertIndexRange(macro_cell_number, task_info.cell_partition_data.back()); AssertIndexRange(vector_number, n_components_filled(macro_cell_number)); @@ -316,7 +315,8 @@ MatrixFree::get_hp_cell_iterator( const hp::DoFHandler *dofh = dof_handlers.hp_dof_handler[dof_handler_index]; std::pair index = - cell_level_index[macro_cell_number * vectorization_length + vector_number]; + cell_level_index[macro_cell_number * VectorizedArrayType::size() + + vector_number]; return typename hp::DoFHandler::cell_iterator(&dofh->get_triangulation(), index.first, index.second, @@ -1132,10 +1132,10 @@ MatrixFree::initialize_indices( subdomain_boundary_cells.push_back(counter); } - const unsigned int vectorization_length = VectorizedArrayType::size(); + const unsigned int n_lanes = VectorizedArrayType::size(); task_info.collect_boundary_cells(cell_level_index_end_local, n_active_cells, - vectorization_length, + n_lanes, subdomain_boundary_cells); // Finalize the creation of the ghost indices @@ -1259,9 +1259,8 @@ MatrixFree::initialize_indices( renumbering_fe_index.resize(dof_info[0].max_fe_index); unsigned int counter; n_macro_cells_before = 0; - for (counter = 0; - counter < std::min(start_nonboundary * vectorization_length, - task_info.n_active_cells); + for (counter = 0; counter < std::min(start_nonboundary * n_lanes, + task_info.n_active_cells); counter++) { AssertIndexRange(counter, renumbering.size()); @@ -1276,17 +1275,15 @@ MatrixFree::initialize_indices( { for (const auto jj : renumbering_fe_index[j]) renumbering[counter++] = jj; - irregular_cells[renumbering_fe_index[j].size() / - vectorization_length + + irregular_cells[renumbering_fe_index[j].size() / n_lanes + n_macro_cells_before] = - renumbering_fe_index[j].size() % vectorization_length; - n_macro_cells_before += (renumbering_fe_index[j].size() + - vectorization_length - 1) / - vectorization_length; + renumbering_fe_index[j].size() % n_lanes; + n_macro_cells_before += + (renumbering_fe_index[j].size() + n_lanes - 1) / n_lanes; renumbering_fe_index[j].resize(0); } - for (counter = start_nonboundary * vectorization_length; + for (counter = start_nonboundary * n_lanes; counter < task_info.n_active_cells; counter++) { @@ -1296,18 +1293,16 @@ MatrixFree::initialize_indices( dof_info[0].cell_active_fe_index[renumbering[counter]]] .push_back(renumbering[counter]); } - counter = start_nonboundary * vectorization_length; + counter = start_nonboundary * n_lanes; for (unsigned int j = 0; j < dof_info[0].max_fe_index; j++) { for (const auto jj : renumbering_fe_index[j]) renumbering[counter++] = jj; - irregular_cells[renumbering_fe_index[j].size() / - vectorization_length + + irregular_cells[renumbering_fe_index[j].size() / n_lanes + n_macro_cells_before] = - renumbering_fe_index[j].size() % vectorization_length; - n_macro_cells_before += (renumbering_fe_index[j].size() + - vectorization_length - 1) / - vectorization_length; + renumbering_fe_index[j].size() % n_lanes; + n_macro_cells_before += + (renumbering_fe_index[j].size() + n_lanes - 1) / n_lanes; } AssertIndexRange(n_macro_cells_before, task_info.cell_partition_data.back() + @@ -1351,22 +1346,19 @@ MatrixFree::initialize_indices( i < task_info.cell_partition_data.back() + n_ghost_slots - 1; ++i) irregular_cells[i] = 0; - irregular_cells.back() = - task_info.n_ghost_cells % vectorization_length; + irregular_cells.back() = task_info.n_ghost_cells % n_lanes; } { unsigned int n_cells = 0; for (unsigned int i = 0; i < task_info.cell_partition_data.back(); ++i) - n_cells += - irregular_cells[i] > 0 ? irregular_cells[i] : vectorization_length; + n_cells += irregular_cells[i] > 0 ? irregular_cells[i] : n_lanes; AssertDimension(n_cells, task_info.n_active_cells); n_cells = 0; for (unsigned int i = task_info.cell_partition_data.back(); i < n_ghost_slots + task_info.cell_partition_data.back(); ++i) - n_cells += - irregular_cells[i] > 0 ? irregular_cells[i] : vectorization_length; + n_cells += irregular_cells[i] > 0 ? irregular_cells[i] : n_lanes; AssertDimension(n_cells, task_info.n_ghost_cells); } @@ -1390,13 +1382,12 @@ MatrixFree::initialize_indices( { std::vector> cell_level_index_old; cell_level_index.swap(cell_level_index_old); - cell_level_index.reserve(task_info.cell_partition_data.back() * - vectorization_length); + cell_level_index.reserve(task_info.cell_partition_data.back() * n_lanes); unsigned int position_cell = 0; for (unsigned int i = 0; i < task_info.cell_partition_data.back(); ++i) { unsigned int n_comp = - (irregular_cells[i] > 0) ? irregular_cells[i] : vectorization_length; + (irregular_cells[i] > 0) ? irregular_cells[i] : n_lanes; for (unsigned int j = 0; j < n_comp; ++j) cell_level_index.push_back( cell_level_index_old[renumbering[position_cell + j]]); @@ -1405,7 +1396,7 @@ MatrixFree::initialize_indices( // vectorization_length cells. This is needed for MappingInfo when the // transformation data is initialized. We just set the value to the // last valid cell in that case. - for (unsigned int j = n_comp; j < vectorization_length; ++j) + for (unsigned int j = n_comp; j < n_lanes; ++j) cell_level_index.push_back( cell_level_index_old[renumbering[position_cell + n_comp - 1]]); position_cell += n_comp; @@ -1413,8 +1404,7 @@ MatrixFree::initialize_indices( AssertDimension(position_cell, task_info.n_active_cells + task_info.n_ghost_cells); AssertDimension(cell_level_index.size(), - task_info.cell_partition_data.back() * - vectorization_length); + task_info.cell_partition_data.back() * n_lanes); } // set constraint pool from the std::map and reorder the indices @@ -1668,22 +1658,25 @@ MatrixFree::initialize_indices( const unsigned int, const bool, const bool)> &fu) { + const unsigned int n_lanes = VectorizedArrayType::size(); + for (unsigned int c = 0; c < n_cell_batches(); ++c) for (const unsigned int d : GeometryInfo::face_indices()) - for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) + for (unsigned int v = 0; v < n_lanes; ++v) { unsigned int f = this->face_info.cell_and_face_to_plain_faces(c, d, v); if (f == numbers::invalid_unsigned_int) continue; - const unsigned int v_len = VectorizedArrayType::size(); - const unsigned int cell_this = c * v_len + v; + const unsigned int cell_this = c * n_lanes + v; - const unsigned int cell_m = this->get_face_info(f / v_len) - .cells_interior[f % v_len]; - const unsigned int cell_p = this->get_face_info(f / v_len) - .cells_exterior[f % v_len]; + const unsigned int cell_m = + this->get_face_info(f / n_lanes) + .cells_interior[f % n_lanes]; + const unsigned int cell_p = + this->get_face_info(f / n_lanes) + .cells_exterior[f % n_lanes]; const bool ext = cell_this == cell_m; @@ -1692,10 +1685,10 @@ MatrixFree::initialize_indices( const unsigned int p = ext ? cell_p : cell_m; const unsigned int face_no = - ext ? face_info.faces[f / v_len].exterior_face_no : - face_info.faces[f / v_len].interior_face_no; + ext ? face_info.faces[f / n_lanes].exterior_face_no : + face_info.faces[f / n_lanes].interior_face_no; - fu(p, face_no, f / v_len, v, ext, true); + fu(p, face_no, f / n_lanes, v, ext, true); } }; -- 2.39.5