[cig-commits] r1399 - in trunk/aspect: include/aspect include/aspect/mesh_refinement source/mesh_refinement source/simulator

bangerth at dealii.org bangerth at dealii.org
Thu Nov 29 17:03:24 PST 2012


Author: bangerth
Date: 2012-11-29 18:03:24 -0700 (Thu, 29 Nov 2012)
New Revision: 1399

Modified:
   trunk/aspect/include/aspect/mesh_refinement/interface.h
   trunk/aspect/include/aspect/simulator.h
   trunk/aspect/source/mesh_refinement/interface.cc
   trunk/aspect/source/simulator/core.cc
   trunk/aspect/source/simulator/parameters.cc
Log:
Move forward somewhat with plugin-izing mesh refinement.

Modified: trunk/aspect/include/aspect/mesh_refinement/interface.h
===================================================================
--- trunk/aspect/include/aspect/mesh_refinement/interface.h	2012-11-29 21:59:14 UTC (rev 1398)
+++ trunk/aspect/include/aspect/mesh_refinement/interface.h	2012-11-30 01:03:24 UTC (rev 1399)
@@ -143,7 +143,7 @@
          */
         virtual
         void
-        execute (Vector<float> &error_indicators) = 0;
+        execute (Vector<float> &error_indicators) const;
 
         /**
          * Declare the parameters of all known mesh refinement plugins, as

Modified: trunk/aspect/include/aspect/simulator.h
===================================================================
--- trunk/aspect/include/aspect/simulator.h	2012-11-29 21:59:14 UTC (rev 1398)
+++ trunk/aspect/include/aspect/simulator.h	2012-11-30 01:03:24 UTC (rev 1399)
@@ -47,6 +47,7 @@
 #include <aspect/initial_conditions/interface.h>
 #include <aspect/compositional_initial_conditions/interface.h>
 #include <aspect/velocity_boundary_conditions/interface.h>
+#include <aspect/mesh_refinement/interface.h>
 #include <aspect/postprocess/interface.h>
 #include <aspect/adiabatic_conditions.h>
 
@@ -392,6 +393,8 @@
       SmartPointer<const Simulator<dim> > simulator;
   };
 
+
+
   /**
    * This is the main class of ASPECT. It implements the overall simulation
    * algorithm using the numerical methods discussed in the papers and manuals
@@ -1281,6 +1284,7 @@
       TableHandler                        statistics;
 
       Postprocess::Manager<dim>           postprocess_manager;
+      MeshRefinement::Manager<dim>        mesh_refinement_manager;
       TimerOutput                         computing_timer;
 
       /**
@@ -1299,17 +1303,17 @@
        * @name Variables that describe the physical setup of the problem
        * @{
        */
-      const std::auto_ptr<GeometryModel::Interface<dim> >       geometry_model;
-      const std::auto_ptr<MaterialModel::Interface<dim> >       material_model;
-      const std::auto_ptr<GravityModel::Interface<dim> >        gravity_model;
-      const std::auto_ptr<BoundaryTemperature::Interface<dim> > boundary_temperature;
-      std::auto_ptr<    InitialConditions::Interface<dim> >   initial_conditions;
-      std::auto_ptr<CompositionalInitialConditions::Interface<dim> >   compositional_initial_conditions;
-      std::auto_ptr<const AdiabaticConditions<dim> >            adiabatic_conditions;
+      const std::auto_ptr<GeometryModel::Interface<dim> >            geometry_model;
+      const std::auto_ptr<MaterialModel::Interface<dim> >            material_model;
+      const std::auto_ptr<GravityModel::Interface<dim> >             gravity_model;
+      const std::auto_ptr<BoundaryTemperature::Interface<dim> >      boundary_temperature;
+      std::auto_ptr<InitialConditions::Interface<dim> >              initial_conditions;
+      std::auto_ptr<CompositionalInitialConditions::Interface<dim> > compositional_initial_conditions;
+      std::auto_ptr<const AdiabaticConditions<dim> >                 adiabatic_conditions;
       std::map<types::boundary_id_t,std_cxx1x::shared_ptr<VelocityBoundaryConditions::Interface<dim> > > velocity_boundary_conditions;
       /**
-       * @}
-       */
+      * @}
+      */
 
       /**
        * @name Variables that describe the time discretization

Modified: trunk/aspect/source/mesh_refinement/interface.cc
===================================================================
--- trunk/aspect/source/mesh_refinement/interface.cc	2012-11-29 21:59:14 UTC (rev 1398)
+++ trunk/aspect/source/mesh_refinement/interface.cc	2012-11-30 01:03:24 UTC (rev 1399)
@@ -82,7 +82,7 @@
 
     template <int dim>
     void
-    Manager<dim>::execute (Vector<float> &error_indicators)
+    Manager<dim>::execute (Vector<float> &error_indicators) const
     {
       Assert (mesh_refinement_objects.size() > 0, ExcInternalError());
 
@@ -92,7 +92,7 @@
       std::vector<Vector<float> > all_error_indicators (mesh_refinement_objects.size(),
                                                         Vector<float>(error_indicators.size()));
       unsigned int index = 0;
-      for (typename std::list<std_cxx1x::shared_ptr<Interface<dim> > >::iterator
+      for (typename std::list<std_cxx1x::shared_ptr<Interface<dim> > >::const_iterator
            p = mesh_refinement_objects.begin();
            p != mesh_refinement_objects.end(); ++p, ++index)
         {
@@ -208,9 +208,11 @@
         // construct a string for Patterns::MultipleSelection that
         // contains the names of all registered plugins
         const std::string pattern_of_names
-          = std_cxx1x::get<dim>(registered_plugins).get_pattern_of_names (true);
-        prm.declare_entry("List of mesh refinement criteria",
-                          "plus",
+          = std_cxx1x::get<dim>(registered_plugins).get_pattern_of_names ();
+//TODO: rename when the parameter in parameters.cc has been deletd
+        prm.declare_entry("Strategy x",
+//TODO: set to rho c_p temperature
+                          "temperature",
                           Patterns::MultipleSelection(pattern_of_names),
                           "A comma separated list of mesh refinement criteria that "
                           "will be run whenever mesh refinement is required. The "
@@ -223,10 +225,12 @@
                           +
                           std_cxx1x::get<dim>(registered_plugins).get_description_string());
 
-        prm.declare_entry("Merge operation",
+        prm.declare_entry("Refinement criteria merge operation",
                           "plus",
                           Patterns::Selection("plus|max"),
-                          "If multiple mesh refinement criteria are computed for each cell, "
+                          "If multiple mesh refinement criteria are computed for each cell "
+                          "(by passing a list of more than element to the \\texttt{Strategy} "
+                          "parameter in this section of the input file) "
                           "then one will have to decide which one should win when deciding "
                           "which cell to refine. The operation that selects from these competing "
                           "criteria is the one that is selected here. The options are:\n\n"
@@ -258,12 +262,12 @@
       prm.enter_subsection("Mesh refinement");
       {
         plugin_names
-          = Utilities::split_string_list(prm.get("List of mesh refinement criteria"));
+          = Utilities::split_string_list(prm.get("Strategy x"));
 
         // while we're in this section, also read the merge operation
-        if (prm.get("Merge operation") == "plus")
+        if (prm.get("Refinement criteria merge operation") == "plus")
           merge_operation = plus;
-        else if (prm.get("Merge operation") == "max")
+        else if (prm.get("Refinement criteria merge operation") == "max")
           merge_operation = max;
         else
           Assert (false, ExcNotImplemented());
@@ -272,6 +276,8 @@
 
       // go through the list, create objects and let them parse
       // their own parameters
+      AssertThrow (plugin_names.size() >= 1,
+                   ExcMessage ("You need to provide at least one mesh refinement criterion in the input file!"));
       for (unsigned int name=0; name<plugin_names.size(); ++name)
         mesh_refinement_objects.push_back (std_cxx1x::shared_ptr<Interface<dim> >
                                            (std_cxx1x::get<dim>(registered_plugins)

Modified: trunk/aspect/source/simulator/core.cc
===================================================================
--- trunk/aspect/source/simulator/core.cc	2012-11-29 21:59:14 UTC (rev 1398)
+++ trunk/aspect/source/simulator/core.cc	2012-11-30 01:03:24 UTC (rev 1399)
@@ -210,6 +210,9 @@
     postprocess_manager.parse_parameters (prm);
     postprocess_manager.initialize (*this);
 
+    mesh_refinement_manager.parse_parameters (prm);
+    mesh_refinement_manager.initialize (*this);
+
     geometry_model->create_coarse_mesh (triangulation);
     global_Omega_diameter = GridTools::diameter (triangulation);
 

Modified: trunk/aspect/source/simulator/parameters.cc
===================================================================
--- trunk/aspect/source/simulator/parameters.cc	2012-11-29 21:59:14 UTC (rev 1398)
+++ trunk/aspect/source/simulator/parameters.cc	2012-11-30 01:03:24 UTC (rev 1399)
@@ -636,6 +636,7 @@
   {
     Parameters::declare_parameters (prm);
     Postprocess::Manager<dim>::declare_parameters (prm);
+    MeshRefinement::Manager<dim>::declare_parameters (prm);
     MaterialModel::declare_parameters<dim> (prm);
     GeometryModel::declare_parameters <dim>(prm);
     GravityModel::declare_parameters<dim> (prm);



More information about the CIG-COMMITS mailing list