From 834c69a119d2584f37bb09f41897d0904b21c4e8 Mon Sep 17 00:00:00 2001 From: wolf Date: Tue, 23 Mar 1999 12:26:19 +0000 Subject: [PATCH] Add constructors and other functions for FESystem with three different sub-elements. git-svn-id: https://svn.dealii.org/trunk@1034 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/fe/fe_system.h | 62 +++++++++++++++++++++++++- deal.II/deal.II/source/fe/fe_system.cc | 48 ++++++++++++++++++++ 2 files changed, 108 insertions(+), 2 deletions(-) diff --git a/deal.II/deal.II/include/fe/fe_system.h b/deal.II/deal.II/include/fe/fe_system.h index 8d6d5d3859..98d77ad4a1 100644 --- a/deal.II/deal.II/include/fe/fe_system.h +++ b/deal.II/deal.II/include/fe/fe_system.h @@ -112,6 +112,18 @@ class FESystem // FESystem (const FE1 &fe1, const unsigned int n1, const FE2 &fe2, const unsigned int n2); + /** + * Constructor for mixed + * discretizations with three + * base elements. + * + * See the other constructor. + */ + template + FESystem (const FE1 &fe1, const unsigned int n1, + const FE2 &fe2, const unsigned int n2, + const FE3 &fe3, const unsigned int n3); + /** * Destructor. */ @@ -423,14 +435,27 @@ class FESystem // const unsigned int N); /** - * Same as above for mixed elements. + * Same as above for mixed elements + * with two different sub-elements. */ static FiniteElementData multiply_dof_numbers (const FiniteElementData &fe1, const unsigned int N1, const FiniteElementData &fe2, const unsigned int N2); - + + /** + * Same as above for mixed elements + * with three different sub-elements. + */ + static FiniteElementData + multiply_dof_numbers (const FiniteElementData &fe1, + const unsigned int N1, + const FiniteElementData &fe2, + const unsigned int N2, + const FiniteElementData &fe3, + const unsigned int N3); + /** * This function is simply singled out of * the constructor. It sets up the @@ -476,6 +501,7 @@ FESystem::n_base_elements() const } + template inline unsigned FESystem::element_multiplicity(unsigned index) const @@ -484,6 +510,7 @@ FESystem::element_multiplicity(unsigned index) const } + template inline const FiniteElement& FESystem::base_element(unsigned index) const @@ -492,6 +519,7 @@ FESystem::base_element(unsigned index) const } + template template FESystem::FESystem (const FE &fe, const unsigned int n_elements) : @@ -504,6 +532,8 @@ FESystem::FESystem (const FE &fe, const unsigned int n_elements) : initialize (); }; + + template template FESystem::FESystem (const FE1 &fe1, const unsigned int n1, @@ -525,6 +555,34 @@ FESystem::FESystem (const FE1 &fe1, const unsigned int n1, +template +template +FESystem::FESystem (const FE1 &fe1, const unsigned int n1, + const FE2 &fe2, const unsigned int n2, + const FE3 &fe3, const unsigned int n3) + : + FiniteElement (multiply_dof_numbers(fe1, n1, + fe2, n2, + fe3, n3)), + base_elements(3), + component_to_base_table(n_components) +{ + Assert(fe1.n_transform_functions == fe2.n_transform_functions, + ExcElementTransformNotEqual()); + Assert(fe1.n_transform_functions == fe3.n_transform_functions, + ExcElementTransformNotEqual()); + + base_elements[0] = ElementPair(new FE1, n1); + base_elements[0].first -> subscribe (); + base_elements[1] = ElementPair(new FE2, n2); + base_elements[1].first -> subscribe (); + base_elements[2] = ElementPair(new FE3, n3); + base_elements[2].first -> subscribe (); + initialize (); +}; + + + /*---------------------------- fe_lib.system.h ---------------------------*/ /* end of #ifndef __fe_system_H */ diff --git a/deal.II/deal.II/source/fe/fe_system.cc b/deal.II/deal.II/source/fe/fe_system.cc index c7cbb58a48..20c0b9c5d5 100644 --- a/deal.II/deal.II/source/fe/fe_system.cc +++ b/deal.II/deal.II/source/fe/fe_system.cc @@ -301,6 +301,7 @@ FESystem<1>::multiply_dof_numbers (const FiniteElementData<1> &fe_data, fe_data.n_components * N); }; + template <> FiniteElementData<1> FESystem<1>::multiply_dof_numbers (const FiniteElementData<1> &fe1, @@ -314,6 +315,28 @@ FESystem<1>::multiply_dof_numbers (const FiniteElementData<1> &fe1, fe1.n_components * N1 + fe2.n_components * N2 ); }; + +template <> +FiniteElementData<1> +FESystem<1>::multiply_dof_numbers (const FiniteElementData<1> &fe1, + const unsigned int N1, + const FiniteElementData<1> &fe2, + const unsigned int N2, + const FiniteElementData<1> &fe3, + const unsigned int N3) +{ + return FiniteElementData<1> (fe1.dofs_per_vertex * N1 + + fe2.dofs_per_vertex * N2 + + fe3.dofs_per_vertex * N3, + fe1.dofs_per_line * N1 + + fe2.dofs_per_line * N2 + + fe3.dofs_per_line * N3, + fe1.n_transform_functions, + fe1.n_components * N1 + + fe2.n_components * N2 + + fe3.n_components * N3); +}; + #endif @@ -345,6 +368,31 @@ FESystem<2>::multiply_dof_numbers (const FiniteElementData<2> &fe1, fe1.n_components * N1 + fe2.n_components * N2 ); }; + +template <> +FiniteElementData<2> +FESystem<2>::multiply_dof_numbers (const FiniteElementData<2> &fe1, + const unsigned int N1, + const FiniteElementData<2> &fe2, + const unsigned int N2, + const FiniteElementData<2> &fe3, + const unsigned int N3) +{ + return FiniteElementData<2> (fe1.dofs_per_vertex * N1 + + fe2.dofs_per_vertex * N2 + + fe3.dofs_per_vertex * N3 , + fe1.dofs_per_line * N1 + + fe2.dofs_per_line * N2 + + fe3.dofs_per_line * N3 , + fe1.dofs_per_quad * N1 + + fe2.dofs_per_quad * N2 + + fe3.dofs_per_quad * N3 , + fe1.n_transform_functions, + fe1.n_components * N1 + + fe2.n_components * N2 + + fe3.n_components * N3 ); +}; + #endif -- 2.39.5