From bceb00fe83ab5d5ab428f6ab49ad149bbf3a0135 Mon Sep 17 00:00:00 2001 From: bangerth Date: Sat, 17 Aug 2013 01:16:04 +0000 Subject: [PATCH] Fix http://code.google.com/p/dealii/issues/detail?id=82 by ignoring DoFs that are already identity constrained to each other. git-svn-id: https://svn.dealii.org/trunk@30327 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/dofs/dof_tools.cc | 80 +++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 6 deletions(-) diff --git a/deal.II/source/dofs/dof_tools.cc b/deal.II/source/dofs/dof_tools.cc index bcc29284f5..ad41b28892 100644 --- a/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/source/dofs/dof_tools.cc @@ -2768,6 +2768,12 @@ namespace DoFTools // to this particular child // // @precondition: face_1 is supposed to be active + // + // @note As bug #82 ((http://code.google.com/p/dealii/issues/detail?id=82) and the + // corresponding testcase bits/periodicity_05 demonstrate, we can occasionally + // get into trouble if we already have the constraint x1=x2 and want to insert + // x2=x1. we avoid this by skipping an identity constraint if the opposite + // constraint already exists template void set_periodicity_constraints (const FaceIterator &face_1, @@ -2873,21 +2879,83 @@ namespace DoFTools || component_mask[fe.face_system_to_component_index(i).first]) { - constraint_matrix.add_line(dofs_2[i]); + // as mentioned in the comment above this function, we need + // to be careful about treating identity constraints differently. + // consequently, find out whether this dof 'i' will be + // identity constrained + // + // to check whether this is the case, first see whether there are + // any weights other than 0 and 1, then in a first stage make sure + // that if so there is only one weight equal to 1 + bool is_identity_constrained = true; for (unsigned int jj=0; jj