From: Wolfgang Bangerth Date: Wed, 4 Apr 2012 07:06:33 +0000 (+0000) Subject: Patch by Jason Sheldon: Generalize FESystem::clone. X-Git-Tag: v8.0.0~2703 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5fb437aec9a0a2f0ba1b295559cadeed974fbfd1;p=dealii.git Patch by Jason Sheldon: Generalize FESystem::clone. git-svn-id: https://svn.dealii.org/trunk@25381 0785d39b-7218-0410-832d-ea1e28bc413d --- 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); }