From: David Wells Date: Mon, 1 Jul 2024 12:26:39 +0000 (-0400) Subject: MappingFEField: check that vectors have the correct size. X-Git-Tag: v9.6.0-rc1~151^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F17186%2Fhead;p=dealii.git MappingFEField: check that vectors have the correct size. --- 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]; + } }