]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Implement get_fe_from_name for FE_Q with Gauss-Lobatto points.
authorKatharina Kormann <katharina.kormann@tum.de>
Wed, 23 Feb 2011 18:51:21 +0000 (18:51 +0000)
committerKatharina Kormann <katharina.kormann@tum.de>
Wed, 23 Feb 2011 18:51:21 +0000 (18:51 +0000)
git-svn-id: https://svn.dealii.org/trunk@23439 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/fe/fe_tools.h
deal.II/source/fe/fe_tools.cc

index fc60375e4f2a77cb025c6bfa4b490ea75bd30586..9cc3c0d9e97462a3fad6e700045ec62bd9d191a3 100644 (file)
@@ -100,6 +100,15 @@ namespace FETools
       virtual FiniteElement<dim,spacedim>*
       get (const unsigned int degree) const = 0;
 
+                                      /**
+                                       * Create a FiniteElement from a
+                                       * quadrature formula (currently only
+                                       * implemented for FE_Q) and return a
+                                       * pointer to it.
+                                       */
+
+      virtual FiniteElement<dim,spacedim>*
+      get (const Quadrature<1> &quad) const = 0;
                                       /**
                                        * Virtual destructor doing
                                        * nothing but making the
@@ -134,6 +143,15 @@ namespace FETools
                                        */
       virtual FiniteElement<FE::dimension,FE::dimension>*
       get (const unsigned int degree) const;
+
+                                      /**
+                                       * Create a FiniteElement from a
+                                       * quadrature formula (currently only
+                                       * implemented for FE_Q) and return a
+                                       * pointer to it.
+                                       */
+      virtual FiniteElement<FE::dimension,FE::dimension>*
+      get (const Quadrature<1> &quad) const;
   };
 
                                   /**
index ff3291b4432846e98fa0f084076aa54b9aa1d20a..dab4fa8a1bae2a9df86258115ba3c70039b50f9e 100644 (file)
 
 DEAL_II_NAMESPACE_OPEN
 
+namespace FETools
+{
+                               // Not implemented in the general case.
+  template <class FE>
+  FiniteElement<FE::dimension, FE::dimension>*
+  FEFactory<FE>::get (const Quadrature<1> &quad) const
+  {
+    Assert(false, ExcNotImplemented());
+    return 0;
+  }
+
+                               // Specializations for FE_Q.
+  template <>
+  FiniteElement<1, 1>*
+  FEFactory<FE_Q<1, 1> >::get (const Quadrature<1> &quad) const
+  {
+    return new FE_Q<1>(quad);
+  }
+  template <>
+  FiniteElement<2, 2>*
+  FEFactory<FE_Q<2, 2> >::get (const Quadrature<1> &quad) const
+  {
+    return new FE_Q<2>(quad);
+  }
+  template <>
+  FiniteElement<3, 3>*
+  FEFactory<FE_Q<3, 3> >::get (const Quadrature<1> &quad) const
+  {
+    return new FE_Q<3>(quad);
+  }
+}
 
 namespace
 {
@@ -2149,16 +2180,15 @@ namespace FETools
            else
              {
                unsigned int position = name.find('(');
-               const std::string quadrature_name(name, 0, position-1);
-               name.erase(0,position);
+               const std::string quadrature_name(name, 0, position);
+               name.erase(0,position+1);
                if (quadrature_name.compare("QGaussLobatto") == 0)
                  {
                    const std::pair<int,unsigned int> tmp
                      = Utilities::get_integer_at_position (name, 0);
-                   name.erase(0, tmp.second+1);
-//TODO: Implement a get function taking Quadrature<1> in fe_tools.h.
-//return fe_name_map.find(name_part)->second->get(QGaussLobatto<1>(tmp.first));
-                   AssertThrow (false, ExcNotImplemented());
+                               // delete "))"
+                   name.erase(0, tmp.second+2);
+                   return fe_name_map.find(name_part)->second->get(QGaussLobatto<1>(tmp.first));
                  }
                else
                  {

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.