From c18d8a751b398acc2fb2d4fbb840b4689740e1ec Mon Sep 17 00:00:00 2001 From: David Wells Date: Mon, 1 Jul 2024 08:26:39 -0400 Subject: [PATCH] MappingFEField: check that vectors have the correct size. --- source/fe/mapping_fe_field.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/fe/mapping_fe_field.cc b/source/fe/mapping_fe_field.cc index 719f429e51..4711207f28 100644 --- a/source/fe/mapping_fe_field.cc +++ b/source/fe/mapping_fe_field.cc @@ -291,6 +291,7 @@ MappingFEField::MappingFEField( reference_cell.template get_nodal_type_quadrature(), update_values) { + AssertDimension(euler_dof_handler.n_dofs(), euler_vector.size()); unsigned int size = 0; for (unsigned int i = 0; i < fe_mask.size(); ++i) { @@ -337,7 +338,10 @@ MappingFEField::MappingFEField( this->euler_vector.clear(); this->euler_vector.resize(euler_vector.size()); for (unsigned int i = 0; i < euler_vector.size(); ++i) - this->euler_vector[i] = &euler_vector[i]; + { + AssertDimension(euler_dof_handler.n_dofs(i), euler_vector[i].size()); + this->euler_vector[i] = &euler_vector[i]; + } } @@ -379,7 +383,10 @@ MappingFEField::MappingFEField( euler_dof_handler.get_triangulation().n_global_levels()); for (unsigned int i = euler_vector.min_level(); i <= euler_vector.max_level(); ++i) - this->euler_vector[i] = &euler_vector[i]; + { + AssertDimension(euler_dof_handler.n_dofs(i), euler_vector[i].size()); + this->euler_vector[i] = &euler_vector[i]; + } } -- 2.39.5