]> https://gitweb.dealii.org/ - dealii.git/commitdiff
No longer mark the finite element as 'static' in step-2. 6645/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 22 May 2018 15:27:31 +0000 (23:27 +0800)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 22 May 2018 15:27:31 +0000 (23:27 +0800)
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

index 68c9a2dd0b7a43f27c9f683b5a7a2f18fab71f0c..43cd96f6298ba25336b333bd7f11274dd6534a96 100644 (file)
@@ -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
 // <code>DoFHandler</code> object to allocate storage for the degrees of
-// freedom (in deal.II lingo: we <code>distribute degrees of
-// freedom</code>). 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 <code>DoFHandler</code>; 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 <i>distribute degrees of
+// freedom</i>).
 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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.