[cig-commits] [commit] master: Convert a number of places where we had hardcoded base element indices by search/replace. A few places still need to be looked at. (c5a14e7)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Mon May 12 05:15:03 PDT 2014


Repository : https://github.com/geodynamics/aspect

On branch  : master
Link       : https://github.com/geodynamics/aspect/compare/555391b308f972e57b2488cb024ed6bda549ebf0...485a82a477d4e359644ce65c4155a55cdde612d7

>---------------------------------------------------------------

commit c5a14e7e6f72a63edb391dc2cc778eadc29ed367
Author: Wolfgang Bangerth <bangerth at math.tamu.edu>
Date:   Sun May 11 21:02:35 2014 -0500

    Convert a number of places where we had hardcoded base element indices
    by search/replace. A few places still need to be looked at.


>---------------------------------------------------------------

c5a14e7e6f72a63edb391dc2cc778eadc29ed367
 source/mesh_refinement/density.cc                  | 4 ++--
 source/mesh_refinement/nonadiabatic_temperature.cc | 4 ++--
 source/mesh_refinement/thermal_energy_density.cc   | 4 ++--
 source/mesh_refinement/velocity.cc                 | 2 +-
 source/mesh_refinement/viscosity.cc                | 4 ++--
 source/postprocess/duretz_et_al.cc                 | 2 +-
 source/postprocess/heat_flux_statistics.cc         | 2 +-
 source/postprocess/table_heat_flux_statistics.cc   | 2 +-
 source/postprocess/table_velocity_statistics.cc    | 2 +-
 source/postprocess/tan_gurnis.cc                   | 2 +-
 source/postprocess/temperature_statistics.cc       | 2 +-
 source/postprocess/velocity_statistics.cc          | 2 +-
 source/simulator/helper_functions.cc               | 8 ++++----
 source/simulator/initial_conditions.cc             | 2 +-
 source/termination_criteria/steady_rms_velocity.cc | 2 +-
 15 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/source/mesh_refinement/density.cc b/source/mesh_refinement/density.cc
index ae12951..a8007fd 100644
--- a/source/mesh_refinement/density.cc
+++ b/source/mesh_refinement/density.cc
@@ -53,7 +53,7 @@ namespace aspect
       LinearAlgebra::BlockVector vec_distributed (this->introspection().index_sets.system_partitioning,
                                                   this->get_mpi_communicator());
 
-      const Quadrature<dim> quadrature(this->get_fe().base_element(2).get_unit_support_points());
+      const Quadrature<dim> quadrature(this->get_fe().base_element(this->introspection().base_elements.temperature).get_unit_support_points());
       std::vector<types::global_dof_index> local_dof_indices (this->get_fe().dofs_per_cell);
       FEValues<dim> fe_values (this->get_mapping(),
                                this->get_fe(),
@@ -100,7 +100,7 @@ namespace aspect
             // for each temperature dof, write into the output
             // vector the density. note that quadrature points and
             // dofs are enumerated in the same order
-            for (unsigned int i=0; i<this->get_fe().base_element(2).dofs_per_cell; ++i)
+            for (unsigned int i=0; i<this->get_fe().base_element(this->introspection().base_elements.temperature).dofs_per_cell; ++i)
               {
                 const unsigned int system_local_dof
                   = this->get_fe().component_to_system_index(/*temperature component=*/dim+1,
diff --git a/source/mesh_refinement/nonadiabatic_temperature.cc b/source/mesh_refinement/nonadiabatic_temperature.cc
index ec44dea..996ce95 100644
--- a/source/mesh_refinement/nonadiabatic_temperature.cc
+++ b/source/mesh_refinement/nonadiabatic_temperature.cc
@@ -49,7 +49,7 @@ namespace aspect
       LinearAlgebra::BlockVector vec_distributed (this->introspection().index_sets.system_partitioning,
                                                   this->get_mpi_communicator());
 
-      const Quadrature<dim> quadrature(this->get_fe().base_element(2).get_unit_support_points());
+      const Quadrature<dim> quadrature(this->get_fe().base_element(this->introspection().base_elements.temperature).get_unit_support_points());
       std::vector<unsigned int> local_dof_indices (this->get_fe().dofs_per_cell);
       FEValues<dim> fe_values (this->get_mapping(),
                                this->get_fe(),
@@ -78,7 +78,7 @@ namespace aspect
             // for each temperature dof, write into the output
             // vector the density. note that quadrature points and
             // dofs are enumerated in the same order
-            for (unsigned int i=0; i<this->get_fe().base_element(2).dofs_per_cell; ++i)
+            for (unsigned int i=0; i<this->get_fe().base_element(this->introspection().base_elements.temperature).dofs_per_cell; ++i)
               {
                 const unsigned int system_local_dof
                   = this->get_fe().component_to_system_index(/*temperature component=*/dim+1,
diff --git a/source/mesh_refinement/thermal_energy_density.cc b/source/mesh_refinement/thermal_energy_density.cc
index d92cbac..c24dc8c 100644
--- a/source/mesh_refinement/thermal_energy_density.cc
+++ b/source/mesh_refinement/thermal_energy_density.cc
@@ -49,7 +49,7 @@ namespace aspect
       LinearAlgebra::BlockVector vec_distributed (this->introspection().index_sets.system_partitioning,
                                                   this->get_mpi_communicator());
 
-      const Quadrature<dim> quadrature(this->get_fe().base_element(2).get_unit_support_points());
+      const Quadrature<dim> quadrature(this->get_fe().base_element(this->introspection().base_elements.temperature).get_unit_support_points());
       std::vector<types::global_dof_index> local_dof_indices (this->get_fe().dofs_per_cell);
       FEValues<dim> fe_values (this->get_mapping(),
                                this->get_fe(),
@@ -98,7 +98,7 @@ namespace aspect
             // for each temperature dof, write into the output
             // vector the density. note that quadrature points and
             // dofs are enumerated in the same order
-            for (unsigned int i=0; i<this->get_fe().base_element(2).dofs_per_cell; ++i)
+            for (unsigned int i=0; i<this->get_fe().base_element(this->introspection().base_elements.temperature).dofs_per_cell; ++i)
               {
                 const unsigned int system_local_dof
                   = this->get_fe().component_to_system_index(/*temperature component=*/dim+1,
diff --git a/source/mesh_refinement/velocity.cc b/source/mesh_refinement/velocity.cc
index 30e41fb..f2b30b6 100644
--- a/source/mesh_refinement/velocity.cc
+++ b/source/mesh_refinement/velocity.cc
@@ -36,7 +36,7 @@ namespace aspect
       indicators = 0;
 
       KellyErrorEstimator<dim>::estimate (this->get_dof_handler(),
-                                          QGauss<dim-1>(this->get_fe().base_element(0).degree+1),
+                                          QGauss<dim-1>(this->get_fe().base_element(this->introspection().base_elements.velocities).degree+1),
                                           typename FunctionMap<dim>::type(),
                                           this->get_solution(),
                                           indicators,
diff --git a/source/mesh_refinement/viscosity.cc b/source/mesh_refinement/viscosity.cc
index a34be07..9e599ad 100644
--- a/source/mesh_refinement/viscosity.cc
+++ b/source/mesh_refinement/viscosity.cc
@@ -53,7 +53,7 @@ namespace aspect
       LinearAlgebra::BlockVector vec_distributed (this->introspection().index_sets.system_partitioning,
                                                   this->get_mpi_communicator());
 
-      const Quadrature<dim> quadrature(this->get_fe().base_element(2).get_unit_support_points());
+      const Quadrature<dim> quadrature(this->get_fe().base_element(this->introspection().base_elements.temperature).get_unit_support_points());
       std::vector<unsigned int> local_dof_indices (this->get_fe().dofs_per_cell);
       FEValues<dim> fe_values (this->get_mapping(),
                                this->get_fe(),
@@ -100,7 +100,7 @@ namespace aspect
             // for each temperature dof, write into the output
             // vector the viscosity. note that quadrature points and
             // dofs are enumerated in the same order
-            for (unsigned int i=0; i<this->get_fe().base_element(2).dofs_per_cell; ++i)
+            for (unsigned int i=0; i<this->get_fe().base_element(this->introspection().base_elements.temperature).dofs_per_cell; ++i)
               {
                 const unsigned int system_local_dof
                   = this->get_fe().component_to_system_index(/*temperature component=*/dim+1,
diff --git a/source/postprocess/duretz_et_al.cc b/source/postprocess/duretz_et_al.cc
index 02b8797..deace4a 100644
--- a/source/postprocess/duretz_et_al.cc
+++ b/source/postprocess/duretz_et_al.cc
@@ -3014,7 +3014,7 @@ namespace aspect
                       ExcMessage("Postprocessor DuretzEtAl only works with the material model SolCx, SolKz, and Inclusion."));
         }
 
-      const QGauss<dim> quadrature_formula (this->get_fe().base_element(0).degree+2);
+      const QGauss<dim> quadrature_formula (this->get_fe().base_element(this->introspection().base_elements.velocities).degree+2);
 
       Vector<float> cellwise_errors_u (this->get_triangulation().n_active_cells());
       Vector<float> cellwise_errors_p (this->get_triangulation().n_active_cells());
diff --git a/source/postprocess/heat_flux_statistics.cc b/source/postprocess/heat_flux_statistics.cc
index 380e95e..21fe1a0 100644
--- a/source/postprocess/heat_flux_statistics.cc
+++ b/source/postprocess/heat_flux_statistics.cc
@@ -40,7 +40,7 @@ namespace aspect
       // element, is it in fact
       Assert (this->get_fe().n_base_elements() == 3+(this->n_compositional_fields()>0 ? 1 : 0),
               ExcNotImplemented());
-      const QGauss<dim-1> quadrature_formula (this->get_fe().base_element(2).degree+1);
+      const QGauss<dim-1> quadrature_formula (this->get_fe().base_element(this->introspection().base_elements.temperature).degree+1);
 
       FEFaceValues<dim> fe_face_values (this->get_mapping(),
                                         this->get_fe(),
diff --git a/source/postprocess/table_heat_flux_statistics.cc b/source/postprocess/table_heat_flux_statistics.cc
index 71b9784..dd75a5a 100644
--- a/source/postprocess/table_heat_flux_statistics.cc
+++ b/source/postprocess/table_heat_flux_statistics.cc
@@ -49,7 +49,7 @@ namespace aspect
       // element is it in fact
       Assert (this->get_fe().n_base_elements() == 3,
               ExcNotImplemented());
-      const QGauss<dim-1> quadrature (this->get_fe().base_element(2).degree+1);
+      const QGauss<dim-1> quadrature (this->get_fe().base_element(this->introspection().base_elements.temperature).degree+1);
 
       FEFaceValues<dim> fe_face_values (this->get_mapping(),
                                         this->get_fe(),
diff --git a/source/postprocess/table_velocity_statistics.cc b/source/postprocess/table_velocity_statistics.cc
index 21ce742..1700670 100644
--- a/source/postprocess/table_velocity_statistics.cc
+++ b/source/postprocess/table_velocity_statistics.cc
@@ -51,7 +51,7 @@ namespace aspect
         = dynamic_cast<const MaterialModel::Table<dim> &>(this->get_material_model());
 
       const QGauss<dim> quadrature_formula (this->get_fe()
-                                            .base_element(0).degree+1);
+                                            .base_element(this->introspection().base_elements.velocities).degree+1);
       const unsigned int n_q_points = quadrature_formula.size();
 
       FEValues<dim> fe_values (this->get_mapping(),
diff --git a/source/postprocess/tan_gurnis.cc b/source/postprocess/tan_gurnis.cc
index 0bfcb28..3dfe9fa 100644
--- a/source/postprocess/tan_gurnis.cc
+++ b/source/postprocess/tan_gurnis.cc
@@ -62,7 +62,7 @@ namespace aspect
       f << std::scientific;
 
 
-      const QGauss<dim> quadrature_formula (this->get_fe().base_element(0).degree+2);
+      const QGauss<dim> quadrature_formula (this->get_fe().base_element(this->introspection().base_elements.velocities).degree+2);
 
       const unsigned int n_q_points =  quadrature_formula.size();
       FEValues<dim> fe_values (this->get_mapping(), this->get_fe(),  quadrature_formula,
diff --git a/source/postprocess/temperature_statistics.cc b/source/postprocess/temperature_statistics.cc
index f00ac19..91fa322 100644
--- a/source/postprocess/temperature_statistics.cc
+++ b/source/postprocess/temperature_statistics.cc
@@ -43,7 +43,7 @@ namespace aspect
       // element is it in fact
       Assert (this->get_fe().n_base_elements() == 3+(this->n_compositional_fields()>0 ? 1 : 0),
               ExcNotImplemented());
-      const QGauss<dim> quadrature_formula (this->get_fe().base_element(2).degree+1);
+      const QGauss<dim> quadrature_formula (this->get_fe().base_element(this->introspection().base_elements.temperature).degree+1);
       const unsigned int n_q_points = quadrature_formula.size();
 
       FEValues<dim> fe_values (this->get_mapping(),
diff --git a/source/postprocess/velocity_statistics.cc b/source/postprocess/velocity_statistics.cc
index ecf4edc..69f1392 100644
--- a/source/postprocess/velocity_statistics.cc
+++ b/source/postprocess/velocity_statistics.cc
@@ -41,7 +41,7 @@ namespace aspect
     VelocityStatistics<dim>::execute (TableHandler &statistics)
     {
       const QGauss<dim> quadrature_formula (this->get_fe()
-                                            .base_element(0).degree+1);
+                                            .base_element(this->introspection().base_elements.velocities).degree+1);
       const unsigned int n_q_points = quadrature_formula.size();
 
       FEValues<dim> fe_values (this->get_mapping(),
diff --git a/source/simulator/helper_functions.cc b/source/simulator/helper_functions.cc
index 5276aad..1759954 100644
--- a/source/simulator/helper_functions.cc
+++ b/source/simulator/helper_functions.cc
@@ -478,7 +478,7 @@ namespace aspect
     hanging_constraints.close();
 
     Assert(introspection.block_indices.velocities == 0, ExcNotImplemented());
-    const std::vector<Point<dim> > mesh_support_points = finite_element.base_element(0).get_unit_support_points();
+    const std::vector<Point<dim> > mesh_support_points = finite_element.base_element(introspection.base_elements.velocities).get_unit_support_points();
     FEValues<dim> mesh_points (mapping, finite_element, mesh_support_points, update_quadrature_points);
     std::vector<unsigned int> cell_dof_indices (finite_element.dofs_per_cell);
 
@@ -489,7 +489,7 @@ namespace aspect
         {
           mesh_points.reinit(cell);
           cell->get_dof_indices (cell_dof_indices);
-          for (unsigned int j=0; j<finite_element.base_element(0).dofs_per_cell; ++j)
+          for (unsigned int j=0; j<finite_element.base_element(introspection.base_elements.velocities).dofs_per_cell; ++j)
             for (unsigned int dir=0; dir<dim; ++dir)
               {
                 unsigned int support_point_index
@@ -624,7 +624,7 @@ namespace aspect
         // consequently, adding the adjustment to the global function is
         // achieved by adding the adjustment to the first pressure degree
         // of freedom on each cell.
-        Assert (dynamic_cast<const FE_DGP<dim>*>(&finite_element.base_element(1)) != 0,
+        Assert (dynamic_cast<const FE_DGP<dim>*>(&finite_element.base_element(introspection.base_elements.pressure)) != 0,
                 ExcInternalError());
         std::vector<types::global_dof_index> local_dof_indices (finite_element.dofs_per_cell);
         typename DoFHandler<dim>::active_cell_iterator
@@ -679,7 +679,7 @@ namespace aspect
         // consequently, adding the adjustment to the global function is
         // achieved by adding the adjustment to the first pressure degree
         // of freedom on each cell.
-        Assert (dynamic_cast<const FE_DGP<dim>*>(&finite_element.base_element(1)) != 0,
+        Assert (dynamic_cast<const FE_DGP<dim>*>(&finite_element.base_element(introspection.base_elements.pressure)) != 0,
                 ExcInternalError());
         std::vector<types::global_dof_index> local_dof_indices (finite_element.dofs_per_cell);
         typename DoFHandler<dim>::active_cell_iterator
diff --git a/source/simulator/initial_conditions.cc b/source/simulator/initial_conditions.cc
index 8f1e552..de8e0c2 100644
--- a/source/simulator/initial_conditions.cc
+++ b/source/simulator/initial_conditions.cc
@@ -215,7 +215,7 @@ namespace aspect
         // implement the local projection for the discontinuous pressure
         // element. this is only going to work if, indeed, the element
         // is discontinuous
-        const FiniteElement<dim> &system_pressure_fe = finite_element.base_element(1);
+        const FiniteElement<dim> &system_pressure_fe = finite_element.base_element(introspection.base_elements.pressure);
         Assert (system_pressure_fe.dofs_per_face == 0,
                 ExcNotImplemented());
 
diff --git a/source/termination_criteria/steady_rms_velocity.cc b/source/termination_criteria/steady_rms_velocity.cc
index 0d36792..aa8912f 100644
--- a/source/termination_criteria/steady_rms_velocity.cc
+++ b/source/termination_criteria/steady_rms_velocity.cc
@@ -34,7 +34,7 @@ namespace aspect
     SteadyRMSVelocity<dim>::execute(void)
     {
       const QGauss<dim> quadrature_formula (this->get_fe()
-                                            .base_element(0).degree+1);
+                                            .base_element(this->introspection().base_elements.velocities).degree+1);
       const unsigned int n_q_points = quadrature_formula.size();
 
       FEValues<dim> fe_values (this->get_mapping(),



More information about the CIG-COMMITS mailing list