[cig-commits] r1395 - trunk/aspect/source/mesh_refinement

bangerth at dealii.org bangerth at dealii.org
Thu Nov 29 06:21:23 PST 2012


Author: bangerth
Date: 2012-11-29 07:21:19 -0700 (Thu, 29 Nov 2012)
New Revision: 1395

Modified:
   trunk/aspect/source/mesh_refinement/interface.cc
Log:
Merge refinement indicators.

Modified: trunk/aspect/source/mesh_refinement/interface.cc
===================================================================
--- trunk/aspect/source/mesh_refinement/interface.cc	2012-11-29 05:55:56 UTC (rev 1394)
+++ trunk/aspect/source/mesh_refinement/interface.cc	2012-11-29 14:21:19 UTC (rev 1395)
@@ -73,8 +73,7 @@
       {
         public:
           using SimulatorAccess<dim>::get_mpi_communicator;
-      };
-      MySimulatorAccess simulator_access;
+      } simulator_access;
       simulator_access.initialize (simulator);
       mpi_communicator = simulator_access.get_mpi_communicator();
     }
@@ -85,6 +84,8 @@
     void
     Manager<dim>::execute (Vector<float> &error_indicators)
     {
+      Assert (mesh_refinement_objects.size() > 0, ExcInternalError());
+
       // call the execute() functions of all plugins we have
       // here in turns. then normalize the output vector and
       // verify that its values are non-negative numbers
@@ -153,6 +154,32 @@
         }
 
       // now merge the results
+      switch  (merge_operation)
+        {
+          case plus:
+          {
+            for (unsigned int i=0; i<=mesh_refinement_objects.size(); ++i)
+              error_indicators += all_error_indicators[i];
+            break;
+          }
+
+          case max:
+          {
+            error_indicators = all_error_indicators[0];
+            for (unsigned int i=1; i<=mesh_refinement_objects.size(); ++i)
+              {
+                Assert (error_indicators.size() == all_error_indicators[i].size(),
+                        ExcInternalError());
+                for (unsigned int j=0; j<error_indicators.size(); ++j)
+                  error_indicators(j) = std::max (error_indicators(j),
+                                                  all_error_indicators[i](j));
+              }
+            break;
+          }
+
+          default:
+            Assert (false, ExcNotImplemented());
+        }
     }
 
 



More information about the CIG-COMMITS mailing list