From: Daniel Arndt Date: Tue, 22 Aug 2017 10:54:10 +0000 (+0200) Subject: Fix up documentation and (related) deprecations in the examples X-Git-Tag: v9.0.0-rc1~1189^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c9dff34d2ead7e912880be13fa0768046d9b1cf;p=dealii.git Fix up documentation and (related) deprecations in the examples --- diff --git a/examples/step-16/step-16.cc b/examples/step-16/step-16.cc index 06151f45b4..b107624905 100644 --- a/examples/step-16/step-16.cc +++ b/examples/step-16/step-16.cc @@ -261,7 +261,7 @@ namespace Step16 void LaplaceProblem::setup_system () { dof_handler.distribute_dofs (fe); - dof_handler.distribute_mg_dofs (fe); + dof_handler.distribute_mg_dofs (); deallog << " Number of degrees of freedom: " << dof_handler.n_dofs() diff --git a/examples/step-37/step-37.cc b/examples/step-37/step-37.cc index d0547ac1ff..ee7efd9bb9 100644 --- a/examples/step-37/step-37.cc +++ b/examples/step-37/step-37.cc @@ -811,7 +811,7 @@ namespace Step37 mg_matrices.clear_elements(); dof_handler.distribute_dofs (fe); - dof_handler.distribute_mg_dofs (fe); + dof_handler.distribute_mg_dofs (); pcout << "Number of degrees of freedom: " << dof_handler.n_dofs() diff --git a/examples/step-39/step-39.cc b/examples/step-39/step-39.cc index e0898fbeb5..3d94624139 100644 --- a/examples/step-39/step-39.cc +++ b/examples/step-39/step-39.cc @@ -492,7 +492,7 @@ namespace Step39 // First, we use the finite element to distribute degrees of freedom over // the mesh and number them. dof_handler.distribute_dofs(fe); - dof_handler.distribute_mg_dofs(fe); + dof_handler.distribute_mg_dofs(); unsigned int n_dofs = dof_handler.n_dofs(); // Then, we already know the size of the vectors representing finite // element functions. diff --git a/examples/step-50/step-50.cc b/examples/step-50/step-50.cc index daedd3b567..ba5ef567ae 100644 --- a/examples/step-50/step-50.cc +++ b/examples/step-50/step-50.cc @@ -254,7 +254,7 @@ namespace Step50 void LaplaceProblem::setup_system () { mg_dof_handler.distribute_dofs (fe); - mg_dof_handler.distribute_mg_dofs (fe); + mg_dof_handler.distribute_mg_dofs (); DoFTools::extract_locally_relevant_dofs (mg_dof_handler, locally_relevant_set); diff --git a/examples/step-56/step-56.cc b/examples/step-56/step-56.cc index 5fb81c9331..5fbfebad99 100644 --- a/examples/step-56/step-56.cc +++ b/examples/step-56/step-56.cc @@ -515,7 +515,7 @@ namespace Step56 // velocity space in a separate DoFHandler as described in the // introduction. velocity_dof_handler.distribute_dofs(velocity_fe); - velocity_dof_handler.distribute_mg_dofs(velocity_fe); + velocity_dof_handler.distribute_mg_dofs(); // The following block of code initializes the MGConstrainedDofs // (using the boundary conditions for the velocity), and the diff --git a/examples/step-6/doc/results.dox b/examples/step-6/doc/results.dox index 890eaa33e6..da72f27fa9 100644 --- a/examples/step-6/doc/results.dox +++ b/examples/step-6/doc/results.dox @@ -115,14 +115,12 @@ from this example. @code -------------------------------------------------------- -An error occurred in line <128> of file in function +An error occurred in line <104> of file in function void dealii::Subscriptor::check_no_subscribers() const The violated condition was: counter == 0 -The name and call sequence of the exception was: - ExcInUse (counter, object_info->name(), infostring) -Additional Information: -Object of class N6dealii4FE_QILi2ELi2EEE is still used by 1 other objects. +Additional information: +Object of class N6dealii17SphericalManifoldILi2ELi2EEE is still used by 1 other objects. (Additional information: ) @@ -134,7 +132,7 @@ Stacktrace: ----------- #0 /lib/libdeal_II.g.so: dealii::Subscriptor::check_no_subscribers() const #1 /lib/libdeal_II.g.so: dealii::Subscriptor::~Subscriptor() -#2 /lib/libdeal_II.g.so: dealii::FiniteElement<2, 2>::~FiniteElement() +#2 /lib/libdeal_II.g.so: dealii::Manifold<2, 2>::~Manifold() #3 ./step-6: Step6<2>::~Step6() #4 ./step-6: main -------------------------------------------------------- diff --git a/examples/step-6/step-6.cc b/examples/step-6/step-6.cc index db0e868c7b..6c23fad9f9 100644 --- a/examples/step-6/step-6.cc +++ b/examples/step-6/step-6.cc @@ -109,10 +109,11 @@ private: void refine_grid (); void output_results (const unsigned int cycle) const; - Triangulation triangulation; + Triangulation triangulation; + const SphericalManifold boundary; - DoFHandler dof_handler; FE_Q fe; + DoFHandler dof_handler; // This is the new variable in the main class. We need an object which holds // a list of constraints to hold the hanging nodes and the boundary @@ -153,39 +154,39 @@ double coefficient (const Point &p) template Step6::Step6 () : - dof_handler (triangulation), - fe (2) + fe (2), + dof_handler (triangulation) {} // @sect4{Step6::~Step6} // Here comes the added destructor of the class. The reason why we want to add -// it is a subtle change in the order of data elements in the class as -// compared to all previous examples: the dof_handler object was -// defined before and not after the fe object. Of course we could -// have left this order unchanged, but we would like to show what happens if -// the order is reversed since this produces a rather nasty side-effect and -// results in an error which is difficult to track down if one does not know -// what happens. +// it is to pick up an issue we already started to discuss in step-1: +// the boundary object was defined before and not after the +// triangulation object. Of course we could have left this order +// unchanged, but we would like to show what happens if the order is reversed +// since this produces a rather nasty side-effect and results in an error which +// is difficult to track down if one does not know what happens. // -// Basically what happens is the following: when we distribute the degrees of -// freedom using the function call dof_handler.distribute_dofs(), -// the dof_handler also stores a pointer to the finite element in -// use. Since this pointer is used every now and then until either the degrees -// of freedom are re-distributed using another finite element object or until -// the dof_handler object is destroyed, it would be unwise if we -// would allow the finite element object to be deleted before the -// dof_handler object. To disallow this, the DoF handler -// increases a counter inside the finite element object which counts how many -// objects use that finite element (this is what the +// Basically what happens is the following: when we set a manifold description +// to the triangulation using the function call +// triangulation.set_manifold (0, boundary), the +// Triangulation object also stores a pointer to the +// Manifold object in use. Since this pointer is used until either +// another Manifold object is set as boundary description or until +// the Triangulation object is destroyed, it would be unwise if we +// would allow the boundary to be deleted before the +// triangulation. To disallow this, the triangulation +// increases a counter inside the boundary which counts how many +// objects use it (this is what the // Subscriptor/SmartPointer class pair is used for, // in case you want something like this for your own programs; see step-7 for -// a more complete discussion of this topic). The finite element object will +// a more complete discussion of this topic). The boundary will // refuse its destruction if that counter is larger than zero, since then some -// other objects might rely on the persistence of the finite element -// object. An exception will then be thrown and the program will usually abort -// upon the attempt to destroy the finite element. +// other objects might rely on its persistence. An exception will then be +// thrown and the program will usually abort upon the attempt to destroy +// boundary. // // To be fair, such exceptions about still used objects are not particularly // popular among programmers using deal.II, since they only tell us that @@ -207,14 +208,14 @@ Step6::Step6 () // destructed before the DoF handler object, since its declaration is below // the one of the DoF handler. This triggers the situation above, and an // exception will be raised when the fe object is -// destructed. What needs to be done is to tell the dof_handler -// object to release its lock to the finite element. Of course, the -// dof_handler will only release its lock if it really does not -// need the finite element any more, i.e. when all finite element related data -// is deleted from it. For this purpose, the DoFHandler class has -// a function clear which deletes all degrees of freedom, and -// releases its lock to the finite element. After this, you can safely -// destruct the finite element object since its internal counter is then zero. +// destructed. What needs to be done is to tell the triangulation +// object to release its lock to boundary. Of course, the +// triangulation will only release its lock if it really does not +// need the boundary any more. For this purpose, the +// Triangulation class has a function clear which +// resets the object into a virgin state by deleting all data and releases its +// lock to the finite element. After this, you can safely destruct the +// boundary object since its internal counter is then zero. // // For completeness, we add the output of the exception that would have been // triggered without this destructor, to the end of the results section of @@ -222,7 +223,7 @@ Step6::Step6 () template Step6::~Step6 () { - dof_handler.clear (); + triangulation.clear (); } @@ -636,7 +637,6 @@ void Step6::run () { GridGenerator::hyper_ball (triangulation); - static const SphericalManifold boundary; triangulation.set_all_manifold_ids_on_boundary(0); triangulation.set_manifold (0, boundary);