From 1663863acd907f6b2754826a9ba60b9866b9d1a3 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 15 Jan 2025 14:35:04 -0700 Subject: [PATCH] Convert FETools::compute_face_embedding_matrices() to use ArrayView. --- include/deal.II/fe/fe_tools.h | 13 ++++++------- include/deal.II/fe/fe_tools.templates.h | 12 ++++++------ source/fe/fe_bdm.cc | 3 ++- source/fe/fe_raviart_thomas.cc | 14 +++++++------- source/fe/fe_tools.inst.in | 7 +++---- 5 files changed, 24 insertions(+), 25 deletions(-) diff --git a/include/deal.II/fe/fe_tools.h b/include/deal.II/fe/fe_tools.h index ea447a2392..69ed37fe1c 100644 --- a/include/deal.II/fe/fe_tools.h +++ b/include/deal.II/fe/fe_tools.h @@ -364,7 +364,7 @@ namespace FETools * @param fe The finite element for which to compute these matrices. * * @param matrices An array of GeometryInfo::subfaces_per_face = - * 2dim-1 FullMatrix objects,holding the embedding matrix for + * 2dim-1 FullMatrix objects, holding the embedding matrix for * each subface. * * @param face_coarse The number of the face on the coarse side of the face @@ -381,12 +381,11 @@ namespace FETools */ template void - compute_face_embedding_matrices( - const FiniteElement &fe, - FullMatrix (&matrices)[GeometryInfo::max_children_per_face], - const unsigned int face_coarse, - const unsigned int face_fine, - const double threshold = 1.e-12); + compute_face_embedding_matrices(const FiniteElement &fe, + const ArrayView> &matrices, + const unsigned int face_coarse, + const unsigned int face_fine, + const double threshold = 1.e-12); /** * For all possible (isotropic and anisotropic) refinement cases compute the diff --git a/include/deal.II/fe/fe_tools.templates.h b/include/deal.II/fe/fe_tools.templates.h index e211523b69..b31cbe3020 100644 --- a/include/deal.II/fe/fe_tools.templates.h +++ b/include/deal.II/fe/fe_tools.templates.h @@ -1811,13 +1811,13 @@ namespace FETools template void - compute_face_embedding_matrices( - const FiniteElement &fe, - FullMatrix (&matrices)[GeometryInfo::max_children_per_face], - const unsigned int face_coarse, - const unsigned int face_fine, - const double threshold) + compute_face_embedding_matrices(const FiniteElement &fe, + const ArrayView> &matrices, + const unsigned int face_coarse, + const unsigned int face_fine, + const double threshold) { + AssertDimension(matrices.size(), GeometryInfo::max_children_per_face); const unsigned int face_no = face_coarse; Assert(face_coarse == 0, ExcNotImplemented()); diff --git a/source/fe/fe_bdm.cc b/source/fe/fe_bdm.cc index bbf49bbaa4..5690427735 100644 --- a/source/fe/fe_bdm.cc +++ b/source/fe/fe_bdm.cc @@ -90,7 +90,8 @@ FE_BDM::FE_BDM(const unsigned int deg) for (unsigned int i = 0; i < GeometryInfo::max_children_per_face; ++i) face_embeddings[i].reinit(this->n_dofs_per_face(face_no), this->n_dofs_per_face(face_no)); - FETools::compute_face_embedding_matrices(*this, face_embeddings, 0, 0, 1.); + FETools::compute_face_embedding_matrices( + *this, make_array_view(face_embeddings), 0, 0, 1.); this->interface_constraints.reinit((1 << (dim - 1)) * this->n_dofs_per_face(face_no), this->n_dofs_per_face(face_no)); diff --git a/source/fe/fe_raviart_thomas.cc b/source/fe/fe_raviart_thomas.cc index 163a3623fb..c031f7ba56 100644 --- a/source/fe/fe_raviart_thomas.cc +++ b/source/fe/fe_raviart_thomas.cc @@ -93,13 +93,13 @@ FE_RaviartThomas::FE_RaviartThomas(const unsigned int deg) // TODO[TL]: for anisotropic refinement we will probably need a table of // submatrices with an array for each refine case FullMatrix face_embeddings[GeometryInfo::max_children_per_face]; - for (unsigned int i = 0; i < GeometryInfo::max_children_per_face; ++i) - face_embeddings[i].reinit(this->n_dofs_per_face(face_no), - this->n_dofs_per_face(face_no)); - FETools::compute_face_embedding_matrices(*this, - face_embeddings, - 0, - 0); + for (auto &face_embedding : face_embeddings) + face_embedding.reinit(this->n_dofs_per_face(face_no), + this->n_dofs_per_face(face_no)); + FETools::compute_face_embedding_matrices(*this, + make_array_view(face_embeddings), + 0, + 0); this->interface_constraints.reinit((1 << (dim - 1)) * this->n_dofs_per_face(face_no), this->n_dofs_per_face(face_no)); diff --git a/source/fe/fe_tools.inst.in b/source/fe/fe_tools.inst.in index 45b549d125..7c9e101c04 100644 --- a/source/fe/fe_tools.inst.in +++ b/source/fe/fe_tools.inst.in @@ -228,10 +228,9 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) template void compute_face_embedding_matrices( const FiniteElement &, - FullMatrix ( - &)[GeometryInfo::max_children_per_face], - unsigned int, - unsigned int, + const ArrayView> &, + const unsigned int, + const unsigned int, const double); template void -- 2.39.5