From 26c975c115087e149bb583f52161fde6adb92527 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sat, 10 Sep 2016 15:10:09 -0600 Subject: [PATCH] Initialize a member variable. This is not strictly necessary, because the variable is later initialized in constructors of derived classes, but the patch avoids copying uninitialized variables when copying around objects of type FiniteElementData. (There are cases when we pass around these objects, without actually using derived classes; but in those cases, the flag appears to be unused. --- include/deal.II/fe/fe_base.h | 3 ++- source/fe/fe_data.cc | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/deal.II/fe/fe_base.h b/include/deal.II/fe/fe_base.h index 471766078f..c52019fa30 100644 --- a/include/deal.II/fe/fe_base.h +++ b/include/deal.II/fe/fe_base.h @@ -419,7 +419,8 @@ public: * then this is always the case. * * Since this is an extremely common operation, the result is cached in the - * #cached_primitivity variable which is computed in the constructor. + * #cached_primitivity variable which is computed in the constructor of the + * derived class FiniteElement. */ bool is_primitive () const; diff --git a/source/fe/fe_data.cc b/source/fe/fe_data.cc index 7eae662dda..672cf84930 100644 --- a/source/fe/fe_data.cc +++ b/source/fe/fe_data.cc @@ -61,7 +61,12 @@ FiniteElementData (const std::vector &dofs_per_object, ? BlockIndices(1, dofs_per_cell) : - block_indices) + block_indices), + // the following field is only set in the FiniteElement + // constructor by calling set_primitivity() of this base + // class. however, to ensure that we always have boolean + // values, initialize it with the safe choice + cached_primitivity (false) { Assert(dofs_per_object.size()==dim+1, ExcDimensionMismatch(dofs_per_object.size()-1,dim)); } -- 2.39.5