From f59d2f060492ae10a5ee64cea7c05697bd8f6f15 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 30 Mar 2001 07:50:03 +0000 Subject: [PATCH] Automagically determine number of elements in fields. git-svn-id: https://svn.dealii.org/trunk@4345 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/fe/fe_dgq_1d.cc | 9 +++++++-- deal.II/deal.II/source/fe/fe_dgq_2d.cc | 10 +++++++--- deal.II/deal.II/source/fe/fe_dgq_3d.cc | 9 +++++++-- deal.II/deal.II/source/fe/fe_q_1d.cc | 8 ++++++-- deal.II/deal.II/source/fe/fe_q_2d.cc | 11 ++++++++--- deal.II/deal.II/source/fe/fe_q_3d.cc | 14 ++++++++++---- 6 files changed, 45 insertions(+), 16 deletions(-) diff --git a/deal.II/deal.II/source/fe/fe_dgq_1d.cc b/deal.II/deal.II/source/fe/fe_dgq_1d.cc index 9438ba5649..1c54afdc0f 100644 --- a/deal.II/deal.II/source/fe/fe_dgq_1d.cc +++ b/deal.II/deal.II/source/fe/fe_dgq_1d.cc @@ -138,7 +138,9 @@ const double * const FE_DGQ<1>::Matrices::embedding[] = }; -const unsigned int FE_DGQ<1>::Matrices::n_embedding_matrices = 5; +const unsigned int FE_DGQ<1>::Matrices::n_embedding_matrices + = sizeof(FE_DGQ<1>::Matrices::embedding) / + sizeof(FE_DGQ<1>::Matrices::embedding[0]); @@ -156,7 +158,10 @@ const double * const FE_DGQ<1>::Matrices::projection_matrices[] = }; -const unsigned int FE_DGQ<1>::Matrices::n_projection_matrices = 8; +const unsigned int FE_DGQ<1>::Matrices::n_projection_matrices + = sizeof(FE_DGQ<1>::Matrices::projection_matrices) / + sizeof(FE_DGQ<1>::Matrices::projection_matrices[0]); + #else // #if deal_II_dimension // On gcc2.95 on Alpha OSF1, the native assembler does not like empty diff --git a/deal.II/deal.II/source/fe/fe_dgq_2d.cc b/deal.II/deal.II/source/fe/fe_dgq_2d.cc index facf0ff509..47b95aaf35 100644 --- a/deal.II/deal.II/source/fe/fe_dgq_2d.cc +++ b/deal.II/deal.II/source/fe/fe_dgq_2d.cc @@ -344,8 +344,9 @@ const double * const FE_DGQ<2>::Matrices::embedding[] = FE_DGQ_2d::dgq4_into_dgq4_refined }; -const unsigned int FE_DGQ<2>::Matrices::n_embedding_matrices = 5; - +const unsigned int FE_DGQ<2>::Matrices::n_embedding_matrices + = sizeof(FE_DGQ<2>::Matrices::embedding) / + sizeof(FE_DGQ<2>::Matrices::embedding[0]); const double * const FE_DGQ<2>::Matrices::projection_matrices[] = @@ -361,7 +362,10 @@ const double * const FE_DGQ<2>::Matrices::projection_matrices[] = }; -const unsigned int FE_DGQ<2>::Matrices::n_projection_matrices = 8; +const unsigned int FE_DGQ<2>::Matrices::n_projection_matrices + = sizeof(FE_DGQ<2>::Matrices::projection_matrices) / + sizeof(FE_DGQ<2>::Matrices::projection_matrices[0]); + #else // #if deal_II_dimension // On gcc2.95 on Alpha OSF1, the native assembler does not like empty diff --git a/deal.II/deal.II/source/fe/fe_dgq_3d.cc b/deal.II/deal.II/source/fe/fe_dgq_3d.cc index 9061839872..07ae49c5cb 100644 --- a/deal.II/deal.II/source/fe/fe_dgq_3d.cc +++ b/deal.II/deal.II/source/fe/fe_dgq_3d.cc @@ -396,7 +396,10 @@ const double * const FE_DGQ<3>::Matrices::embedding[] = }; -const unsigned int FE_DGQ<3>::Matrices::n_embedding_matrices = 4; +const unsigned int FE_DGQ<3>::Matrices::n_embedding_matrices + = sizeof(FE_DGQ<3>::Matrices::embedding) / + sizeof(FE_DGQ<3>::Matrices::embedding[0]); + const double * const FE_DGQ<3>::Matrices::projection_matrices[] = @@ -408,7 +411,9 @@ const double * const FE_DGQ<3>::Matrices::projection_matrices[] = FE_DGQ_3d::dgq4_refined_onto_dgq4 }; -const unsigned int FE_DGQ<3>::Matrices::n_projection_matrices = 5; +const unsigned int FE_DGQ<3>::Matrices::n_projection_matrices + = sizeof(FE_DGQ<3>::Matrices::projection_matrices) / + sizeof(FE_DGQ<3>::Matrices::projection_matrices[0]); #else // #if deal_II_dimension diff --git a/deal.II/deal.II/source/fe/fe_q_1d.cc b/deal.II/deal.II/source/fe/fe_q_1d.cc index 4ff87beabf..3d8cbaa3b0 100644 --- a/deal.II/deal.II/source/fe/fe_q_1d.cc +++ b/deal.II/deal.II/source/fe/fe_q_1d.cc @@ -90,8 +90,6 @@ namespace FE_Q_1d // embedding matrices -const unsigned int FE_Q<1>::Matrices::n_embedding_matrices = 4; - const double * const FE_Q<1>::Matrices::embedding[][GeometryInfo<1>::children_per_cell] = { @@ -101,6 +99,12 @@ FE_Q<1>::Matrices::embedding[][GeometryInfo<1>::children_per_cell] = {FE_Q_1d::q4_into_q4_refined_0, FE_Q_1d::q4_into_q4_refined_1}, }; +const unsigned int +FE_Q<1>::Matrices::n_embedding_matrices + = sizeof(FE_Q<1>::Matrices::embedding) / + sizeof(FE_Q<1>::Matrices::embedding[0]); + + // No constraints in 1d const unsigned int diff --git a/deal.II/deal.II/source/fe/fe_q_2d.cc b/deal.II/deal.II/source/fe/fe_q_2d.cc index 4ccccb945c..aa9422a8e0 100644 --- a/deal.II/deal.II/source/fe/fe_q_2d.cc +++ b/deal.II/deal.II/source/fe/fe_q_2d.cc @@ -190,8 +190,6 @@ namespace FE_Q_2d // embedding matrices -const unsigned int FE_Q<2>::Matrices::n_embedding_matrices = 3; - const double * const FE_Q<2>::Matrices::embedding[][GeometryInfo<2>::children_per_cell] = { @@ -204,6 +202,11 @@ FE_Q<2>::Matrices::embedding[][GeometryInfo<2>::children_per_cell] = }; +const unsigned int +FE_Q<2>::Matrices::n_embedding_matrices + = sizeof(FE_Q<2>::Matrices::embedding) / + sizeof(FE_Q<2>::Matrices::embedding[0]); + // Constraint matrices taken from Wolfgangs old version namespace FE_Q_2d @@ -253,7 +256,9 @@ FE_Q<2>::Matrices::constraint_matrices[] = const unsigned int -FE_Q<2>::Matrices::n_constraint_matrices = 4; +FE_Q<2>::Matrices::n_constraint_matrices + = sizeof(FE_Q<2>::Matrices::constraint_matrices) / + sizeof(FE_Q<2>::Matrices::constraint_matrices[0]); diff --git a/deal.II/deal.II/source/fe/fe_q_3d.cc b/deal.II/deal.II/source/fe/fe_q_3d.cc index 1ffb80dc26..bf96e3a55e 100644 --- a/deal.II/deal.II/source/fe/fe_q_3d.cc +++ b/deal.II/deal.II/source/fe/fe_q_3d.cc @@ -369,9 +369,6 @@ namespace FE_Q_3d // embedding matrices -const unsigned int -FE_Q<3>::Matrices::n_embedding_matrices = 2; - const double * const FE_Q<3>::Matrices::embedding[][GeometryInfo<3>::children_per_cell] = { @@ -386,6 +383,12 @@ FE_Q<3>::Matrices::embedding[][GeometryInfo<3>::children_per_cell] = }; +const unsigned int +FE_Q<3>::Matrices::n_embedding_matrices + = sizeof(FE_Q<3>::Matrices::embedding) / + sizeof(FE_Q<3>::Matrices::embedding[0]); + + // Constraint matrices taken from Wolfgangs old version @@ -434,7 +437,10 @@ FE_Q<3>::Matrices::constraint_matrices[] = }; const unsigned int -FE_Q<3>::Matrices::n_constraint_matrices = 2; +FE_Q<3>::Matrices::n_constraint_matrices + = sizeof(FE_Q<3>::Matrices::constraint_matrices) / + sizeof(FE_Q<3>::Matrices::constraint_matrices[0]); + #else // #if deal_II_dimension -- 2.39.5