From: Denis Davydov Date: Sat, 23 Feb 2019 19:14:04 +0000 (+0100) Subject: use is_vectorizable type trait in FEEvaluation classes X-Git-Tag: v9.1.0-rc1~323^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61585e1c8b826c9f2a8729e646e59fd84691145b;p=dealii.git use is_vectorizable type trait in FEEvaluation classes --- diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index 3b498f167a..56b5a6b2b2 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -3477,7 +3477,7 @@ namespace internal // if both begin() and local_element() // exist, then begin() + offset == local_element(offset) template - struct vectorizable + struct is_vectorizable { static constexpr bool value = has_begin::value && has_local_element::value && @@ -4084,6 +4084,10 @@ FEEvaluationBase::read_write_operation( ExcNotImplemented("Masking currently not implemented for " "non-contiguous DoF storage")); + std::integral_constant::value> + vector_selector; + const unsigned int dofs_per_component = this->data->dofs_per_component_on_cell; if (dof_info->index_storage_variants @@ -4102,28 +4106,17 @@ FEEvaluationBase::read_write_operation( for (unsigned int i = 0; i < dofs_per_component; ++i, dof_indices += n_vectorization) for (unsigned int comp = 0; comp < n_components; ++comp) - operation.process_dof_gather( - dof_indices, - *src[comp], - 0, - values_dofs[comp][i], - std::integral_constant< - bool, - std::is_same::value>()); + operation.process_dof_gather(dof_indices, + *src[comp], + 0, + values_dofs[comp][i], + vector_selector); else for (unsigned int comp = 0; comp < n_components; ++comp) for (unsigned int i = 0; i < dofs_per_component; ++i, dof_indices += n_vectorization) operation.process_dof_gather( - dof_indices, - *src[0], - 0, - values_dofs[comp][i], - std::integral_constant< - bool, - std::is_same::value>()); + dof_indices, *src[0], 0, values_dofs[comp][i], vector_selector); return; } @@ -4498,9 +4491,8 @@ FEEvaluationBase:: // a vector and puts the data into the local data field or write local data // into the vector. Certain operations are no-ops for the given use case. - std::integral_constant< - bool, - std::is_same::value> + std::integral_constant::value> vector_selector; const internal::MatrixFreeFunctions::DoFInfo::DoFAccessIndex ind = is_face ? dof_access_index : @@ -7628,9 +7620,8 @@ FEFaceEvaluation:: temp1 = this->scratch_data; internal::VectorReader reader; - std::integral_constant< - bool, - std::is_same::value> + std::integral_constant::value> vector_selector; // case 1: contiguous and interleaved indices @@ -8188,9 +8179,8 @@ FEFaceEvaluation:: # endif internal::VectorDistributorLocalToGlobal writer; - std::integral_constant< - bool, - std::is_same::value> + std::integral_constant::value> vector_selector; // case 1: contiguous and interleaved indices diff --git a/tests/matrix_free/fe_evaluation_type_traits.cc b/tests/matrix_free/fe_evaluation_type_traits.cc index 3655a18f2f..a574038442 100644 --- a/tests/matrix_free/fe_evaluation_type_traits.cc +++ b/tests/matrix_free/fe_evaluation_type_traits.cc @@ -137,19 +137,19 @@ main() << std::endl << "TrilinosWrappers::MPI::Vector = " << internal::has_begin::value << std::endl; - // check vectorizable: + // check is_vectorizable: deallog - << "vectorizable:" << std::endl + << "is_vectorizable:" << std::endl << "LinearAlgebra::distributed::Vector && double = " - << internal::vectorizable, - double>::value + << internal::is_vectorizable, + double>::value << std::endl << "LinearAlgebra::distributed::Vector && float = " - << internal::vectorizable, - float>::value + << internal::is_vectorizable, + float>::value << std::endl << "TrilinosWrappers::MPI::Vector && double = " - << internal::vectorizable::value + << internal::is_vectorizable::value << std::endl; deallog << "OK" << std::endl; diff --git a/tests/matrix_free/fe_evaluation_type_traits.with_trilinos=true.output b/tests/matrix_free/fe_evaluation_type_traits.with_trilinos=true.output index d514ab7eea..d6140df342 100644 --- a/tests/matrix_free/fe_evaluation_type_traits.with_trilinos=true.output +++ b/tests/matrix_free/fe_evaluation_type_traits.with_trilinos=true.output @@ -13,7 +13,7 @@ DEAL::TrilinosWrappers::MPI::Vector = 0 DEAL::has_begin: DEAL::LinearAlgebra::distributed::Vector = 1 DEAL::TrilinosWrappers::MPI::Vector = 1 -DEAL::vectorizable: +DEAL::is_vectorizable: DEAL::LinearAlgebra::distributed::Vector && double = 1 DEAL::LinearAlgebra::distributed::Vector && float = 0 DEAL::TrilinosWrappers::MPI::Vector && double = 0