From f31942b3d41f8ec96f2409791860b79fe3e3af23 Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 4 Apr 2012 07:06:33 +0000 Subject: [PATCH] Patch by Jason Sheldon: Generalize FESystem::clone. git-svn-id: https://svn.dealii.org/trunk@25381 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/fe/fe_system.cc | 46 ++++++---------------------------- 1 file changed, 7 insertions(+), 39 deletions(-) diff --git a/deal.II/source/fe/fe_system.cc b/deal.II/source/fe/fe_system.cc index 9fee64915c..f5e91881ae 100644 --- a/deal.II/source/fe/fe_system.cc +++ b/deal.II/source/fe/fe_system.cc @@ -386,47 +386,15 @@ template FiniteElement* FESystem::clone() const { - switch (this->n_base_elements()) + std::vector< const FiniteElement* > fes; + std::vector multiplicities; + + for (unsigned int i=0; in_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(fes, multiplicities); } -- 2.39.5