]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Make FEFieldFunction capable of handling hp::DoFHandler.
authorbuerg <buerg@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 27 May 2012 13:39:54 +0000 (13:39 +0000)
committerbuerg <buerg@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 27 May 2012 13:39:54 +0000 (13:39 +0000)
git-svn-id: https://svn.dealii.org/trunk@25549 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/numerics/fe_field_function.h
deal.II/include/deal.II/numerics/fe_field_function.templates.h
deal.II/source/numerics/fe_field_function.inst.in

index 667175f670ed76efa985274c15dd72f128ff2cf2..86720bbeff815623b97492553f1e09bbffb675d7 100644 (file)
@@ -113,9 +113,7 @@ namespace Functions
  *
  *  \ingroup functions
  *
- *  \author Luca Heltai, 2006
- *
- *  \todo Add hp functionality
+ *  \author Luca Heltai, 2006, Markus Buerg, 2012
  */
   template <int dim,
             typename DH=DoFHandler<dim>,
index eeff02549f8b25eae49428a4a8ebe0b6e8716850..4c6859e16adae5d2e6ccc06a8c4d5339af89b593 100644 (file)
 #include <deal.II/base/utilities.h>
 #include <deal.II/base/logstream.h>
 #include <deal.II/grid/grid_tools.h>
+#include <deal.II/hp/fe_collection.h>
+#include <deal.II/hp/fe_values.h>
+#include <deal.II/hp/mapping_collection.h>
+#include <deal.II/hp/q_collection.h>
 #include <deal.II/fe/fe_values.h>
 #include <deal.II/numerics/fe_field_function.h>
 
@@ -72,7 +76,7 @@ namespace Functions
 
                                      // Now we can find out about the point
     Quadrature<dim> quad(qp);
-    FEValues<dim> fe_v(mapping, dh->get_fe(), quad,
+    FEValues<dim> fe_v(mapping, cell->get_fe(), quad,
                        update_values);
     fe_v.reinit(cell);
     std::vector< Vector<double> > vvalues (1, values);
@@ -119,7 +123,7 @@ namespace Functions
 
                                      // Now we can find out about the point
     Quadrature<dim> quad(qp);
-    FEValues<dim> fe_v(mapping, dh->get_fe(), quad,
+    FEValues<dim> fe_v(mapping, cell->get_fe(), quad,
                        update_gradients);
     fe_v.reinit(cell);
     std::vector< std::vector<Tensor<1,dim> > > vgrads
@@ -165,7 +169,7 @@ namespace Functions
 
     // Now we can find out about the point
     Quadrature<dim> quad(qp);
-    FEValues<dim> fe_v(mapping, dh->get_fe(), quad,
+    FEValues<dim> fe_v(mapping, cell->get_fe(), quad,
         update_hessians);
     fe_v.reinit(cell);
     std::vector< Vector<double> > vvalues (1, values);
@@ -202,23 +206,28 @@ namespace Functions
     std::vector<std::vector<unsigned int> > maps;
 
     unsigned int ncells = compute_point_locations(points, cells, qpoints, maps);
-
-                                     // Now gather all the informations we need
-    for (unsigned int i=0; i<ncells; ++i)
-      {
+    hp::MappingCollection<dim> mapping_collection (mapping);
+    hp::FECollection<dim> fe_collection (dh->get_fe ());
+    hp::QCollection<dim> quadrature_collection;
+                                     // Create quadrature collection
+    for (unsigned int i=0; i<ncells; ++i) {
                                          // Number of quadrature points on this cell
-        unsigned int nq = qpoints[i].size();
-
+      unsigned int nq = qpoints[i].size();
                                          // Construct a quadrature formula
-        std::vector< double > ww(nq, 1./((double) nq));
-        Quadrature<dim> quad(qpoints[i], ww);
-
-                                         // Get a function value object
-        FEValues<dim> fe_v(mapping, dh->get_fe(), quad,
+      std::vector< double > ww(nq, 1./((double) nq));
+      
+      quadrature_collection.push_back (Quadrature<dim> (qpoints[i], ww));
+    }
+                                     // Get a function value object
+    hp::FEValues<dim> fe_v(mapping_collection, fe_collection, quadrature_collection,
                            update_values);
-        fe_v.reinit(cells[i]);
+                                     // Now gather all the informations we need
+    for (unsigned int i=0; i<ncells; ++i)
+      {
+        fe_v.reinit(cells[i], i, 0);
+        const unsigned int nq = qpoints[i].size();
         std::vector< Vector<double> > vvalues (nq, Vector<double>(n_components));
-        fe_v.get_function_values(data_vector, vvalues);
+        fe_v.get_present_fe_values ().get_function_values(data_vector, vvalues);
         for (unsigned int q=0; q<nq; ++q)
           values[maps[i][q]] = vvalues[q];
       }
@@ -256,24 +265,29 @@ namespace Functions
     std::vector<std::vector<unsigned int> > maps;
 
     unsigned int ncells = compute_point_locations(points, cells, qpoints, maps);
-
-                                     // Now gather all the informations we need
-    for (unsigned int i=0; i<ncells; ++i)
-      {
+    hp::MappingCollection<dim> mapping_collection (mapping);
+    hp::FECollection<dim> fe_collection (dh->get_fe ());
+    hp::QCollection<dim> quadrature_collection;
+                                     // Create quadrature collection
+    for (unsigned int i=0; i<ncells; ++i) {
                                          // Number of quadrature points on this cell
-        unsigned int nq = qpoints[i].size();
-
+      unsigned int nq = qpoints[i].size();
                                          // Construct a quadrature formula
-        std::vector< double > ww(nq, 1./((double) nq));
-        Quadrature<dim> quad(qpoints[i], ww);
-
-                                         // Get a function value object
-        FEValues<dim> fe_v(mapping, dh->get_fe(), quad,
+      std::vector< double > ww(nq, 1./((double) nq));
+      
+      quadrature_collection.push_back (Quadrature<dim> (qpoints[i], ww));
+    }
+                                     // Get a function value object
+    hp::FEValues<dim> fe_v(mapping_collection, fe_collection, quadrature_collection,
                            update_gradients);
-        fe_v.reinit(cells[i]);
+                                     // Now gather all the informations we need
+    for (unsigned int i=0; i<ncells; ++i)
+      {
+        fe_v.reinit(cells[i], i, 0);
+        const unsigned int nq = qpoints[i].size();
         std::vector< std::vector<Tensor<1,dim> > >
           vgrads (nq, std::vector<Tensor<1,dim> >(n_components));
-        fe_v.get_function_grads(data_vector, vgrads);
+        fe_v.get_present_fe_values ().get_function_grads(data_vector, vgrads);
         for (unsigned int q=0; q<nq; ++q)
           values[maps[i][q]] = vgrads[q];
       }
@@ -310,25 +324,30 @@ namespace Functions
     std::vector<std::vector<unsigned int> > maps;
 
     unsigned int ncells = compute_point_locations(points, cells, qpoints, maps);
-
+    hp::MappingCollection<dim> mapping_collection (mapping);
+    hp::FECollection<dim> fe_collection (dh->get_fe ());
+    hp::QCollection<dim> quadrature_collection;
+                                     // Create quadrature collection
+    for (unsigned int i=0; i<ncells; ++i) {
+                                         // Number of quadrature points on this cell
+      unsigned int nq = qpoints[i].size();
+                                         // Construct a quadrature formula
+      std::vector< double > ww(nq, 1./((double) nq));
+      
+      quadrature_collection.push_back (Quadrature<dim> (qpoints[i], ww));
+    }
+                                     // Get a function value object
+    hp::FEValues<dim> fe_v(mapping_collection, fe_collection, quadrature_collection,
+                           update_hessians);
              // Now gather all the informations we need
     for (unsigned int i=0; i<ncells; ++i)
       {
-           // Number of quadrature points on this cell
-  unsigned int nq = qpoints[i].size();
-
-           // Construct a quadrature formula
-  std::vector< double > ww(nq, 1./((double) nq));
-  Quadrature<dim> quad(qpoints[i], ww);
-
-           // Get a function value object
-  FEValues<dim> fe_v(mapping, dh->get_fe(), quad,
-         update_hessians);
-  fe_v.reinit(cells[i]);
-  std::vector< Vector<double> > vvalues (nq, Vector<double>(n_components));
-  fe_v.get_function_laplacians(data_vector, vvalues);
-  for (unsigned int q=0; q<nq; ++q)
-    values[maps[i][q]] = vvalues[q];
+        fe_v.reinit(cells[i], i, 0);
+        const unsigned int nq = qpoints[i].size();
+        std::vector< Vector<double> > vvalues (nq, Vector<double>(n_components));
+        fe_v.get_present_fe_values ().get_function_laplacians(data_vector, vvalues);
+        for (unsigned int q=0; q<nq; ++q)
+          values[maps[i][q]] = vvalues[q];
       }
   }
 
index 3ac96c122eba93ccc4a95360b86ab4b5003fe7c0..5832e4504a068af2999c2dd8c7548a259009d30f 100644 (file)
@@ -20,4 +20,8 @@ for (VECTOR : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS)
   template class FEFieldFunction<deal_II_dimension,
                                  MGDoFHandler<deal_II_dimension>,
                                  VECTOR>;
+
+  template class FEFieldFunction<deal_II_dimension,
+                                 hp::DoFHandler<deal_II_dimension>,
+                                 VECTOR>;
 }

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.