From 10dcb8bb51e32105f75e36e867ef0c54e6ede650 Mon Sep 17 00:00:00 2001 From: wolf Date: Mon, 20 Dec 1999 15:36:40 +0000 Subject: [PATCH] Finish this example. git-svn-id: https://svn.dealii.org/trunk@2092 0785d39b-7218-0410-832d-ea1e28bc413d --- .../examples/step-by-step/step-3/step-3.cc | 60 +++++++++++++++---- deal.II/examples/step-3/step-3.cc | 60 +++++++++++++++---- 2 files changed, 98 insertions(+), 22 deletions(-) diff --git a/deal.II/deal.II/Attic/examples/step-by-step/step-3/step-3.cc b/deal.II/deal.II/Attic/examples/step-by-step/step-3/step-3.cc index 93e06010aa..25178f6044 100644 --- a/deal.II/deal.II/Attic/examples/step-by-step/step-3/step-3.cc +++ b/deal.II/deal.II/Attic/examples/step-by-step/step-3/step-3.cc @@ -1,3 +1,5 @@ +/* $Id$ */ + // These include files are already // known to you. They declare the // classes which handle @@ -75,29 +77,65 @@ #include + // Instead of the procedural + // programming of previous examples, + // we encapsulate everything into a + // class for this program. The class + // consists of functions which do + // certain aspects of a finite + // element program, a `main' function + // which controls what is done first + // and what is done next, and a list + // of member variables. class LaplaceProblem { public: + // This is the constructor: LaplaceProblem (); + + // And the top-level function, + // which is called from the + // outside to start the whole + // program (see the `main' + // function at the bottom of this + // file): + void run (); + private: + // Then there are some member + // functions that mostly do what + // their names suggest. Since + // they do not need to be called + // from outside, they are made + // private to this class. + private: void make_grid_and_dofs (); void assemble_system (); void solve (); void output_results (); - void run (); - - private: - Triangulation<2> triangulation; - FEQ1<2> fe; - DoFHandler<2> dof_handler; - + // And then we have the member + // variables. There are variables + // describing the triangulation + // and the numbering of the + // degrees of freedom... + Triangulation<2> triangulation; + DoFHandler<2> dof_handler; + FEQ1<2> fe; + + // ...variables for the sparsity + // pattern and values of the + // system matrix resulting from + // the discretization of the + // Laplace equation... SparseMatrixStruct sparsity_pattern; SparseMatrix system_matrix; - Vector system_rhs; - + // ...and variables which will + // hold the right hand side and + // solution vectors. Vector solution; + Vector system_rhs; }; @@ -153,8 +191,8 @@ void LaplaceProblem::make_grid_and_dofs () // the one cell which made up the // initial grid. Of course, on the // next coarser level, the number - // of cells is one quarter of the - // cells on the finest level, + // of cells is one quarter that of + // the cells on the finest level, // i.e. 256, then 64, 16, 4, and // 1. We can get the total number // of cells like this: diff --git a/deal.II/examples/step-3/step-3.cc b/deal.II/examples/step-3/step-3.cc index 93e06010aa..25178f6044 100644 --- a/deal.II/examples/step-3/step-3.cc +++ b/deal.II/examples/step-3/step-3.cc @@ -1,3 +1,5 @@ +/* $Id$ */ + // These include files are already // known to you. They declare the // classes which handle @@ -75,29 +77,65 @@ #include + // Instead of the procedural + // programming of previous examples, + // we encapsulate everything into a + // class for this program. The class + // consists of functions which do + // certain aspects of a finite + // element program, a `main' function + // which controls what is done first + // and what is done next, and a list + // of member variables. class LaplaceProblem { public: + // This is the constructor: LaplaceProblem (); + + // And the top-level function, + // which is called from the + // outside to start the whole + // program (see the `main' + // function at the bottom of this + // file): + void run (); + private: + // Then there are some member + // functions that mostly do what + // their names suggest. Since + // they do not need to be called + // from outside, they are made + // private to this class. + private: void make_grid_and_dofs (); void assemble_system (); void solve (); void output_results (); - void run (); - - private: - Triangulation<2> triangulation; - FEQ1<2> fe; - DoFHandler<2> dof_handler; - + // And then we have the member + // variables. There are variables + // describing the triangulation + // and the numbering of the + // degrees of freedom... + Triangulation<2> triangulation; + DoFHandler<2> dof_handler; + FEQ1<2> fe; + + // ...variables for the sparsity + // pattern and values of the + // system matrix resulting from + // the discretization of the + // Laplace equation... SparseMatrixStruct sparsity_pattern; SparseMatrix system_matrix; - Vector system_rhs; - + // ...and variables which will + // hold the right hand side and + // solution vectors. Vector solution; + Vector system_rhs; }; @@ -153,8 +191,8 @@ void LaplaceProblem::make_grid_and_dofs () // the one cell which made up the // initial grid. Of course, on the // next coarser level, the number - // of cells is one quarter of the - // cells on the finest level, + // of cells is one quarter that of + // the cells on the finest level, // i.e. 256, then 64, 16, 4, and // 1. We can get the total number // of cells like this: -- 2.39.5