]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Do not use std::numeric_limits on enum types -- max() is always zero
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 2 May 2013 15:25:44 +0000 (15:25 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 2 May 2013 15:25:44 +0000 (15:25 +0000)
in that case...

git-svn-id: https://svn.dealii.org/trunk@29431 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/fe/fe_system.cc

index 88b5f3666ab2adaad2eff13df6eda2df61563b02..6bb7de848964e7983b09014e97d34f68f45d661c 100644 (file)
@@ -2677,18 +2677,27 @@ FESystem<dim,spacedim>::multiply_dof_numbers (
         summed_multiplicities += multiplicities[i];
       }
 
-  // assume maximal conformity and then take away bits
-  // as indicated by the base elements
-  typename FiniteElementData<dim>::Conformity
-    total_conformity
-    = std::numeric_limits<typename FiniteElementData<dim>::Conformity>::max();
-
-  for (unsigned int i=0; i<fes.size(); i++)
-    if (multiplicities[i]>0)
-      total_conformity =
-       typename FiniteElementData<dim>::Conformity(total_conformity
-                                                   &
-                                                   fes[i]->conforming_space);
+  // assume conformity of the first finite element and then take away
+  // bits as indicated by the base elements. if all multiplicities
+  // happen to be zero, then it doesn't matter what we set it to.
+  typename FiniteElementData<dim>::Conformity total_conformity
+    = typename FiniteElementData<dim>::Conformity();
+  {
+    unsigned int index = 0;
+    for (unsigned int index=0; index<fes.size(); ++index)
+      if (multiplicities[index]>0)
+       {
+         total_conformity = fes[index]->conforming_space;
+         break;
+       }
+
+    for (; index<fes.size(); ++index)
+      if (multiplicities[index]>0)
+       total_conformity =
+         typename FiniteElementData<dim>::Conformity(total_conformity
+                                                     &
+                                                     fes[index]->conforming_space);
+  }
 
   std::vector<unsigned int> dpo;
   dpo.push_back(multiplied_dofs_per_vertex);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.