From: Peter Munch Date: Fri, 26 Nov 2021 19:41:52 +0000 (+0100) Subject: Move FEEvaluationImplHangingNodes::run_internal() into a specialized class X-Git-Tag: v9.4.0-rc1~795^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a50ed3f209a9064305e0b85be174c9e8079b3d29;p=dealii.git Move FEEvaluationImplHangingNodes::run_internal() into a specialized class --- diff --git a/include/deal.II/matrix_free/evaluation_kernels_hanging_nodes.h b/include/deal.II/matrix_free/evaluation_kernels_hanging_nodes.h index 7283ae8260..265f4c5b35 100644 --- a/include/deal.II/matrix_free/evaluation_kernels_hanging_nodes.h +++ b/include/deal.II/matrix_free/evaluation_kernels_hanging_nodes.h @@ -36,40 +36,32 @@ class FEEvaluationBaseData; namespace internal { - template - struct FEEvaluationImplHangingNodes + enum class FEEvaluationImplHangingNodesRunnerTypes { - template - static bool - run(const unsigned int n_desired_components, - const FEEvaluationBaseData &fe_eval, - const bool transpose, - const std::array - & c_mask, - Number *values) - { - if (transpose) - run_internal(n_desired_components, - fe_eval, - c_mask, - values); - else - run_internal(n_desired_components, - fe_eval, - c_mask, - values); + vectorized + }; - return false; - } + + template + class FEEvaluationImplHangingNodesRunner; + + + + template + class FEEvaluationImplHangingNodesRunner< + FEEvaluationImplHangingNodesRunnerTypes::vectorized, + dim, + fe_degree, + Number, + is_face> + { private: - template + template static void interpolate(const unsigned int offset, const unsigned int outer_stride, @@ -121,7 +113,8 @@ namespace internal } } - template + public: + template static void run_internal(const unsigned int n_components, const FEEvaluationBaseData(offsets[face], - 0, - given_degree, - mask_weights[0], - mask_write[0][face], - weights, - values + c * n_dofs); + interpolate<1, 0, transpose>(offsets[face], + 0, + given_degree, + mask_weights[0], + mask_write[0][face], + weights, + values + c * n_dofs); } // y direction @@ -200,13 +193,13 @@ namespace internal for (unsigned int c = 0; c < n_components; ++c) for (unsigned int face = 0; face < 2; ++face) if (do_face[1][face]) - interpolate<1, fe_degree, 1, transpose>(offsets[face], - 0, - given_degree, - mask_weights[1], - mask_write[1][face], - weights, - values + c * n_dofs); + interpolate<1, 1, transpose>(offsets[face], + 0, + given_degree, + mask_weights[1], + mask_write[1][face], + weights, + values + c * n_dofs); } } else if (dim == 3) @@ -309,27 +302,26 @@ namespace internal for (unsigned int c = 0; c < n_components; ++c) for (unsigned int face = 0; face < 4; ++face) if (process_face[0][face]) - interpolate<2, fe_degree, 0, transpose>( - face_offsets[face], - outer_strides[face / 2], - given_degree, - mask_weights[0], - mask_face[0][face], - weights, - values + c * n_dofs); + interpolate<2, 0, transpose>(face_offsets[face], + outer_strides[face / 2], + given_degree, + mask_weights[0], + mask_face[0][face], + weights, + values + c * n_dofs); } { const std::array edge_offsets = {{p0, p2, p4, p6}}; for (unsigned int c = 0; c < n_components; ++c) for (unsigned int edge = 0; edge < 4; ++edge) if (process_edge[0][edge]) - interpolate<1, fe_degree, 0, transpose>(edge_offsets[edge], - 0, - given_degree, - mask_weights[0], - mask_edge[0][edge], - weights, - values + c * n_dofs); + interpolate<1, 0, transpose>(edge_offsets[edge], + 0, + given_degree, + mask_weights[0], + mask_edge[0][edge], + weights, + values + c * n_dofs); } // direction 1: @@ -342,14 +334,13 @@ namespace internal for (unsigned int c = 0; c < n_components; ++c) for (unsigned int face = 0; face < 4; ++face) if (process_face[1][face]) - interpolate<2, fe_degree, 1, transpose>( - face_offsets[face], - outer_strides[face / 2], - given_degree, - mask_weights[1], - mask_face[1][face], - weights, - values + c * n_dofs); + interpolate<2, 1, transpose>(face_offsets[face], + outer_strides[face / 2], + given_degree, + mask_weights[1], + mask_face[1][face], + weights, + values + c * n_dofs); } { @@ -357,13 +348,13 @@ namespace internal for (unsigned int c = 0; c < n_components; ++c) for (unsigned int edge = 0; edge < 4; ++edge) if (process_edge[1][edge]) - interpolate<1, fe_degree, 1, transpose>(edge_offsets[edge], - 0, - given_degree, - mask_weights[1], - mask_edge[1][edge], - weights, - values + c * n_dofs); + interpolate<1, 1, transpose>(edge_offsets[edge], + 0, + given_degree, + mask_weights[1], + mask_edge[1][edge], + weights, + values + c * n_dofs); } // direction 2: @@ -375,14 +366,13 @@ namespace internal for (unsigned int c = 0; c < n_components; ++c) for (unsigned int face = 0; face < 4; ++face) if (process_face[2][face]) - interpolate<2, fe_degree, 2, transpose>( - face_offsets[face], - outer_strides[face / 2], - given_degree, - mask_weights[2], - mask_face[2][face], - weights, - values + c * n_dofs); + interpolate<2, 2, transpose>(face_offsets[face], + outer_strides[face / 2], + given_degree, + mask_weights[2], + mask_face[2][face], + weights, + values + c * n_dofs); } { @@ -390,13 +380,13 @@ namespace internal for (unsigned int c = 0; c < n_components; ++c) for (unsigned int edge = 0; edge < 4; ++edge) if (process_edge[2][edge]) - interpolate<1, fe_degree, 2, transpose>(edge_offsets[edge], - 0, - given_degree, - mask_weights[2], - mask_edge[2][edge], - weights, - values + c * n_dofs); + interpolate<1, 2, transpose>(edge_offsets[edge], + 0, + given_degree, + mask_weights[2], + mask_edge[2][edge], + weights, + values + c * n_dofs); } } else @@ -407,6 +397,46 @@ namespace internal }; + + template + struct FEEvaluationImplHangingNodes + { + public: + template + static bool + run(const unsigned int n_desired_components, + const FEEvaluationBaseData &fe_eval, + const bool transpose, + const std::array + & c_mask, + Number *values) + { + using RunnerType = FEEvaluationImplHangingNodesRunner< + FEEvaluationImplHangingNodesRunnerTypes::vectorized, + dim, + fe_degree, + Number, + is_face>; + + if (transpose) + RunnerType::template run_internal(n_desired_components, + fe_eval, + c_mask, + values); + else + RunnerType::template run_internal(n_desired_components, + fe_eval, + c_mask, + values); + + return false; + } + }; + + } // end of namespace internal