From 36b6c5a106790d55988f45bad6b32846e056a465 Mon Sep 17 00:00:00 2001 From: schrage Date: Wed, 5 May 1999 17:19:12 +0000 Subject: [PATCH] Wolfs suggestions + various additions and corrections. git-svn-id: https://svn.dealii.org/trunk@1280 0785d39b-7218-0410-832d-ea1e28bc413d --- .../tutorial/chapter-1.elements/boundary.html | 6 ++++-- .../tutorial/chapter-1.elements/condense.html | 4 ++-- .../doc/tutorial/chapter-1.elements/dofs.html | 6 +++--- .../chapter-1.elements/grid_creation.html | 6 +++--- .../chapter-1.elements/matrix_generation.html | 17 +++++++++++------ .../chapter-1.elements/matrix_structure.html | 5 ++++- .../doc/tutorial/chapter-1.elements/rhs.html | 18 +++++++++++------- 7 files changed, 38 insertions(+), 24 deletions(-) diff --git a/deal.II/doc/tutorial/chapter-1.elements/boundary.html b/deal.II/doc/tutorial/chapter-1.elements/boundary.html index 9d19bc392f..7151dd2933 100644 --- a/deal.II/doc/tutorial/chapter-1.elements/boundary.html +++ b/deal.II/doc/tutorial/chapter-1.elements/boundary.html @@ -58,7 +58,7 @@ DoFHandler<2>::FunctionMap dirichlet_bc; BoundaryFct bfct; dirichlet_bc[0]=&bfct; VectorTools<2>::interpolate_boundary_values(dof,dirichlet_bc,fe,boundary,boundary_values); -u.reinit(f); +u.reinit(f.size()); MatrixTools<2>::apply_boundary_values(boundary_values,A,u,f);

@@ -82,7 +82,9 @@ This may seem a bit confusing. What actually happens is the following: bfct, its relation to boundaries dirichlet_bc and the triangulation dof, fe and returns a mapping boundary_values that maps values instead of functions -to our boundaries. The function looks at all the boundaries. All we +to our boundaries. The function looks at all the boundaries the index +of which is listed in dirichlet_bc (in this example, all +the boundaries with indicator 0). All we ever need to do is specify the initial triangulation.

  • apply_boundary_values subsequently takes that mapping and diff --git a/deal.II/doc/tutorial/chapter-1.elements/condense.html b/deal.II/doc/tutorial/chapter-1.elements/condense.html index 49c92e9fd5..af516c5a89 100644 --- a/deal.II/doc/tutorial/chapter-1.elements/condense.html +++ b/deal.II/doc/tutorial/chapter-1.elements/condense.html @@ -66,7 +66,7 @@ function calls needed. Be sure to use them in their appropriate places. #include <lac/sparsematrix.h> #include <grid/dof_constraints.h> -int dim=2; // Work in two dimensions, could also be three +const unsigned int dim=2; // Work in two dimensions, could also be three SparseMatrixStruct<double> sparsity_pattern; DoFHandler<dim> dof; ConstraintMatrix<dim> hanging_nodes; @@ -75,7 +75,7 @@ ConstraintMatrix<dim> hanging_nodes; hanging_nodes.clear(); dof.make_sparsity_pattern(sparsity_pattern); dof.make_hanging_nodes_constraints(hanging_nodes); -dof.constraints.close(); +hanging_nodes.close(); hanging_nodes.condense(matrix_structure); diff --git a/deal.II/doc/tutorial/chapter-1.elements/dofs.html b/deal.II/doc/tutorial/chapter-1.elements/dofs.html index 97872f0c7c..f11c483f50 100644 --- a/deal.II/doc/tutorial/chapter-1.elements/dofs.html +++ b/deal.II/doc/tutorial/chapter-1.elements/dofs.html @@ -88,7 +88,7 @@ offers the function
    void DoFHandler::renumber_dofs(const RenumberingMethod method,const bool use_constraints=false, const vector<int> &starting_points=vector<int>())
    or alternatively, the easier to use
    void DoFHandler::renumber_dofs(const RenumberingMethod method)
    -The methods available are Cuthill_McKey and reverse_Cuthill_McKey. Both algorithms are usually better than the one used +The methods available are Cuthill_McKee and reverse_Cuthill_McKee. Both algorithms are usually better than the one used by distribute_dofs and neither is optimal (there is no algorithm that accomplishes optimal results within a reasonable amount of time). Both algorithms require a good index to start with to achieve good results. @@ -99,11 +99,11 @@ in every other case the second way is more advisable. Example: We use the definitions from the first example given above. We renumber our degrees of freedom with the -Cuthill_McKey method. +Cuthill_McKee method.

     
    -dof.renumber_dofs(Cuthill_McKey);
    +dof.renumber_dofs(Cuthill_McKee);
     
     
    diff --git a/deal.II/doc/tutorial/chapter-1.elements/grid_creation.html b/deal.II/doc/tutorial/chapter-1.elements/grid_creation.html index 2a88d0fdd2..438b358d95 100644 --- a/deal.II/doc/tutorial/chapter-1.elements/grid_creation.html +++ b/deal.II/doc/tutorial/chapter-1.elements/grid_creation.html @@ -54,7 +54,7 @@ function calls needed. Be sure to use them in their appropriate places. #include <grid/tria.h> -int dim=2; // Two dimensions; to create a cube set to three +const unsigned int dim=2; // Two dimensions; to create a cube set to three Triangulation<dim> tr; tr.create_hypercube(-1,1); @@ -87,7 +87,7 @@ This example will create a hyperball with unit radius centred on (1,0). #include <grid/tria.h> #include <base/point.h> -int dim=2; // For example +const unsigned int dim=2; // For example Triangulation<dim> tr; Point<dim> centre(1,0); // Taking (1,0) as the centre of the ball @@ -132,7 +132,7 @@ This example will create the default hyper-L. #include <grid/tria.h> -int dim=2; // For example +const unsigned int dim=2; // For example Triangulation<dim> tr; tr.create_hyper_L(-1,1); diff --git a/deal.II/doc/tutorial/chapter-1.elements/matrix_generation.html b/deal.II/doc/tutorial/chapter-1.elements/matrix_generation.html index d295c36c3d..d41ce8246c 100644 --- a/deal.II/doc/tutorial/chapter-1.elements/matrix_generation.html +++ b/deal.II/doc/tutorial/chapter-1.elements/matrix_generation.html @@ -28,7 +28,7 @@ cells have non-zero values.
  • Sparse matrices, i.e. matrices where the majority of -cells has zero value. +cells has zero value; these zeroes are not stored in order to save memory.
  • @@ -44,8 +44,8 @@ int rows, const unsigned int cols)
    .

    Example: We show the include files you need, the definitions and the function calls. Make sure to use them in their -appropriate places. This example initializes a full matrix of doubles -with 100 rows and 50 columns. +appropriate places. This example initializes two full matrices of doubles +with 100 rows and 50 columns in two different ways.

     
    @@ -55,6 +55,11 @@ with 100 rows and 50 columns.
     FullMatrix<double> A;
     
     A.reinit(100,50);
    +
    +// or, alternatively (important for const objects):
    +
    +FullMatrix<double> B(100,50);
    +
     
     
    @@ -85,9 +90,9 @@ appropriate places. This example initializes a sparse square matrix structure. #include <lac/sparsematrix.h> -int dim=2; // For example +const unsigned int dim=2; // For example SparseMatrixStruct<double> sparsity_pattern; -SparseMatrix<double> sm; +SparseMatrix<double> sparse_matrix; DoFHandler<dim> dof; // Your degrees of freedom must already be distributed @@ -99,7 +104,7 @@ sparsity_pattern.reinit(dof.n_dofs(),dof.n_dofs(),dof.max_couplings_between_dofs sparsity_pattern.compress(); -sm.reinit(sparsity_pattern); +sparse_matrix.reinit(sparsity_pattern);
    diff --git a/deal.II/doc/tutorial/chapter-1.elements/matrix_structure.html b/deal.II/doc/tutorial/chapter-1.elements/matrix_structure.html index f3a21e92cd..b798d0b5eb 100644 --- a/deal.II/doc/tutorial/chapter-1.elements/matrix_structure.html +++ b/deal.II/doc/tutorial/chapter-1.elements/matrix_structure.html @@ -45,6 +45,9 @@ the size of the matrix in question and the maximum number of non-zero elements in one row. This number can be calculated with int DoFHandler::max_couplings_between_dofs(). +Beware: This function was written to cope with refined grids only ! +If your grid consists exclusively of cells next to boundaries its +return value will be wrong. This matrix structure can then be used to generate a matrix using void SparseMatrix::reinit(const SparseMatrixStruct &sparsity). In cases of locally refined grids you will also need to take care of the constraints to your @@ -62,7 +65,7 @@ appropriate places. This example initializes a sparse square matrix structure. #include <lac/sparsematrix.h> -int dim=2; // For example +const unsigned int dim=2; // For example SparseMatrixStruct<double> sparsity_pattern; DoFHandler<dim> dof; ConstraintMatrix hanging_nodes; // Only necessary for locally refined grids diff --git a/deal.II/doc/tutorial/chapter-1.elements/rhs.html b/deal.II/doc/tutorial/chapter-1.elements/rhs.html index 289c6b592e..9490c77f1c 100644 --- a/deal.II/doc/tutorial/chapter-1.elements/rhs.html +++ b/deal.II/doc/tutorial/chapter-1.elements/rhs.html @@ -38,16 +38,20 @@ we shall now discuss how to fill them. You have to:

    Example: The two lines below calculate trial functions for the two-dimensional finite element fe and -for its faces using Gaussian quadrature. The first line calculates the trial -function for the finite element associated with the degree of freedom dof, -updating the values of the gradients and of the Jacobi determinant multiplied by a -weight function given by the quadrature qc. The second line -does the same for the faces of the finite element, updating the JxW -values and the quadrature points. +for its faces using Gaussian quadrature. The first line initializes +an object for the trial function of +function for the finite element associated with the degree of freedom +handler dof, telling it to +update the values of the gradients and of the Jacobi determinant +multiplied by a +weight function given by the quadrature qc +whenever fe_values.reinit(fe) is called. The second line +does the same for the faces of the finite element, telling it to update the +JxW values and the quadrature points.

     
    -// Calculate the trial functions on the cell faces.
    +// Initialize the trial functions on the cell faces.
     FEValues<2> fevalues(fe, qc, UpdateFlags(update_gradients |
     					   update_JxW_values));
     FEFaceValues<2> ffvalues(fe, qf,
    -- 
    2.39.5