]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Patch by Jason Sheldon: Generalize FESystem::clone.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 4 Apr 2012 07:06:33 +0000 (07:06 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 4 Apr 2012 07:06:33 +0000 (07:06 +0000)
git-svn-id: https://svn.dealii.org/trunk@25381 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/fe/fe_system.cc

index 9fee64915cf595f2af060cdeced565725c80b261..f5e91881ae7573cb6b48482085fd7cadcf2ccd68 100644 (file)
@@ -386,47 +386,15 @@ template <int dim, int spacedim>
 FiniteElement<dim,spacedim>*
 FESystem<dim,spacedim>::clone() const
 {
-  switch (this->n_base_elements())
+  std::vector< const FiniteElement<dim,spacedim>* >  fes;
+  std::vector<unsigned int> multiplicities;
+
+  for (unsigned int i=0; i<this->n_base_elements(); i++)
     {
-    case 1:
-      return new FESystem(base_element(0),
-                          this->element_multiplicity(0));
-    case 2:
-      return new FESystem(base_element(0),
-                          this->element_multiplicity(0),
-                          base_element(1),
-                          this->element_multiplicity(1));
-    case 3:
-      return new FESystem(base_element(0),
-                          this->element_multiplicity(0),
-                          base_element(1),
-                          this->element_multiplicity(1),
-                          base_element(2),
-                          this->element_multiplicity(2));
-    case 4:
-      return new FESystem(base_element(0),
-                          this->element_multiplicity(0),
-                          base_element(1),
-                          this->element_multiplicity(1),
-                          base_element(2),
-                          this->element_multiplicity(2),
-                          base_element(3),
-                          this->element_multiplicity(3));
-    case 5:
-      return new FESystem(base_element(0),
-                          this->element_multiplicity(0),
-                          base_element(1),
-                          this->element_multiplicity(1),
-                          base_element(2),
-                          this->element_multiplicity(2),
-                          base_element(3),
-                          this->element_multiplicity(3),
-                          base_element(4),
-                          this->element_multiplicity(4));
-      default:
-                          Assert(false, ExcNotImplemented());
+      fes.push_back( & base_element(i) );
+      multiplicities.push_back(this->element_multiplicity(i) );
     }
-  return 0;
+  return new FESystem<dim>(fes, multiplicities);
 }
 
 

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.