From 7ec67676b2f0b24f91db46671775557f825bd486 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 22 May 2018 23:27:31 +0800 Subject: [PATCH] No longer mark the finite element as 'static' in step-2. This is not necessary any more since the DoFHandler copies the FE instead of storing a reference to it. This also allows to remove a good deal of commentary that is completely obscure to anyone not familiar with C++. --- examples/step-2/step-2.cc | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/examples/step-2/step-2.cc b/examples/step-2/step-2.cc index 68c9a2dd0b..43cd96f629 100644 --- a/examples/step-2/step-2.cc +++ b/examples/step-2/step-2.cc @@ -125,20 +125,11 @@ void make_grid (Triangulation<2> &triangulation) // // We first need to create an object of this class and then pass it on to the // DoFHandler object to allocate storage for the degrees of -// freedom (in deal.II lingo: we distribute degrees of -// freedom). Note that the DoFHandler object will store a reference to -// this finite element object, so we have to make sure its lifetime is at -// least as long as that of the DoFHandler; one way to make sure -// this is so is to make it static as well, in order to prevent its preemptive -// destruction. (However, the library would warn us if we forgot about this -// and abort the program if that occurred. You can check this, if you want, by -// removing the 'static' declaration.) +// freedom (in deal.II lingo: we distribute degrees of +// freedom). void distribute_dofs (DoFHandler<2> &dof_handler) { - // As described above, let us first create a finite element object, and then - // use it to allocate degrees of freedom on the triangulation with which the - // dof_handler object is associated: - static const FE_Q<2> finite_element(1); + const FE_Q<2> finite_element(1); dof_handler.distribute_dofs (finite_element); // Now that we have associated a degree of freedom with a global number to -- 2.39.5