From 373d11f5687d58618194350a7f3b1b6e3dfeade8 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 2 Feb 2020 15:56:41 -0700 Subject: [PATCH] Fix an overzealous assertion. --- include/deal.II/numerics/data_out_dof_data.h | 29 ++++++++++++++------ 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/include/deal.II/numerics/data_out_dof_data.h b/include/deal.II/numerics/data_out_dof_data.h index 44a5686709..d7e3af8630 100644 --- a/include/deal.II/numerics/data_out_dof_data.h +++ b/include/deal.II/numerics/data_out_dof_data.h @@ -1125,20 +1125,33 @@ DataOut_DoFData::merge_patches( "Either you called this function on objects that " "are empty, or you may have forgotten to call " "the 'build_patches()' function.")); - // check equality of component - // names + // Check equality of component names Assert(get_dataset_names() == source.get_dataset_names(), Exceptions::DataOutImplementation::ExcIncompatibleDatasetNames()); - // make sure patches are compatible. we'll - // assume that if the first respective - // patches are ok that all the other ones - // are ok as well + + // Make sure patches are compatible. Ideally, we would check that all input + // patches from both collections are all compatible, but we'll be content + // with checking that just the first ones from both sources are. + // + // We check compatibility by testing that both sets of patches result + // from the same number of subdivisions, and that they have the same + // number of source vectors (they really should, since we already checked + // that there are the same number of source components above, but you + // never know). This implies that the data should have the same number of + // columns. They should really have the same number of rows as well, + // but depending on whether a patch has points included or not, the + // number of rows may or may not include coordinates for the points, + // and the comparison has to account for that because in each source + // stream, the patches may include some that have points included. Assert(patches[0].n_subdivisions == source_patches[0].n_subdivisions, Exceptions::DataOutImplementation::ExcIncompatiblePatchLists()); - Assert(patches[0].data.n_rows() == source_patches[0].data.n_rows(), - Exceptions::DataOutImplementation::ExcIncompatiblePatchLists()); Assert(patches[0].data.n_cols() == source_patches[0].data.n_cols(), Exceptions::DataOutImplementation::ExcIncompatiblePatchLists()); + Assert((patches[0].data.n_rows() + + (patches[0].points_are_available ? 0 : patch_space_dim)) == + (source_patches[0].data.n_rows() + + (source_patches[0].points_are_available ? 0 : patch_space_dim)), + Exceptions::DataOutImplementation::ExcIncompatiblePatchLists()); // check equality of the vector data // specifications -- 2.39.5