Dear all,

I found two issues in System::calculate_norm() that are very misleading, see attached patch.

This is:

1. If all weights of a norm are 1 and all types are discrete but different (e.g. DISCRETE_L1 for var #0 and DISCRETE_L2 for var #1), the wrong thing is done.

2. Talking about the non-discrete norms, no other norms than L2, H1, H2, and H1_SEMINORM are implemented, and the others (for instance L1 and L_INF) just silently return 0. I added a call to libmesh_not_implemented() for this case.

If nobody objects, I will commit this next week.

Best Regards,

Tim

--
Dr. Tim Kroeger
tim.kroe...@mevis.fraunhofer.de            Phone +49-421-218-7710
tim.kroe...@cevis.uni-bremen.de            Fax   +49-421-218-4236
www.mevis.fraunhofer.de/~tim

Fraunhofer MEVIS, Institute for Medical Image Computing
Universitaetsallee 29, 28359 Bremen, Germany
Index: src/systems/system.C
===================================================================
--- src/systems/system.C        (Revision 3834)
+++ src/systems/system.C        (Arbeitskopie)
@@ -1107,22 +1107,21 @@
   if (norm.is_discrete())
     {
       STOP_LOG ("calculate_norm()", "System");
-      //Check to see if all weights are 1.0
+      //Check to see if all weights are 1.0 and all types are equal
+      FEMNormType norm_type0 = norm.type(0);
       unsigned int check_var = 0;
       for (; check_var != this->n_vars(); ++check_var)
-        if(norm.weight(check_var) != 1.0)
+        if((norm.weight(check_var) != 1.0) || (norm.type(check_var) != 
norm_type0))
           break;
 
       //All weights were 1.0 so just do the full vector discrete norm
       if(check_var == this->n_vars())
         {
-          FEMNormType norm_type = norm.type(0);
-          
-          if(norm_type == DISCRETE_L1)
+          if(norm_type0 == DISCRETE_L1)
             return v.l1_norm();
-          if(norm_type == DISCRETE_L2)
+          if(norm_type0 == DISCRETE_L2)
             return v.l2_norm();
-          if(norm_type == DISCRETE_L_INF)
+          if(norm_type0 == DISCRETE_L_INF)
             return v.linfty_norm();
           else
             libmesh_error();
@@ -1154,6 +1153,11 @@
       if (norm.weight(var) == 0.0)
         continue;
 
+      // Check for unimplemented norms (rather than just returning 0).
+      if((norm.type(var)!=H1) && (norm.type(var)!=H2) &&
+        (norm.type(var)!=L2) && (norm.type(var)!=H1_SEMINORM))
+       libmesh_not_implemented();
+
       const FEType& fe_type = this->get_dof_map().variable_type(var);
       AutoPtr<QBase> qrule =
         fe_type.default_quadrature_rule (dim);
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Libmesh-devel mailing list
Libmesh-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to