]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Purge the Vector::clear function.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 10 May 2004 15:32:53 +0000 (15:32 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 10 May 2004 15:32:53 +0000 (15:32 +0000)
git-svn-id: https://svn.dealii.org/trunk@9221 0785d39b-7218-0410-832d-ea1e28bc413d

39 files changed:
deal.II/base/include/base/tensor.h
deal.II/base/include/base/tensor_base.h
deal.II/base/source/function_lib_cutoff.cc
deal.II/deal.II/include/multigrid/mg_level_object.h
deal.II/deal.II/source/dofs/dof_accessor.cc
deal.II/deal.II/source/dofs/dof_tools.cc
deal.II/deal.II/source/fe/fe_tools.cc
deal.II/deal.II/source/numerics/error_estimator.cc
deal.II/deal.II/source/numerics/matrices.cc
deal.II/deal.II/source/numerics/vectors.cc
deal.II/doc/news/c-4-0.html
deal.II/examples/step-12/step-12.cc
deal.II/examples/step-13/step-13.cc
deal.II/examples/step-14/step-14.cc
deal.II/examples/step-15/step-15.cc
deal.II/examples/step-16/step-16.cc
deal.II/examples/step-17/step-17.cc
deal.II/examples/step-3/step-3.cc
deal.II/examples/step-4/step-4.cc
deal.II/examples/step-5/step-5.cc
deal.II/examples/step-6/step-6.cc
deal.II/examples/step-7/step-7.cc
deal.II/examples/step-8/step-8.cc
deal.II/examples/step-9/step-9.cc
deal.II/lac/include/lac/block_vector.h
deal.II/lac/include/lac/block_vector.templates.h
deal.II/lac/include/lac/petsc_vector_base.h
deal.II/lac/include/lac/sparse_matrix.templates.h
deal.II/lac/include/lac/sparse_vanka.templates.h
deal.II/lac/include/lac/vector.h
deal.II/lac/source/petsc_vector_base.cc
tests/bits/anna_6.cc
tests/bits/dof_constraints_02.cc
tests/bits/petsc_24.cc
tests/bits/vector_24.cc
tests/deal.II/block_matrices.cc
tests/deal.II/gradients.cc
tests/deal.II/second_derivatives.cc
tests/deal.II/wave-test-3.cc

index 752c7a1ba53a17f40d391af2945f31ed850ea335..be4266a21b13c9baeaf96baf04c1e5cad47a9984 100644 (file)
@@ -168,6 +168,21 @@ class Tensor
 
                                     /**
                                      * Reset all values to zero.
+                                     *
+                                     * Note that this is partly inconsistent
+                                     * with the semantics of the @p clear()
+                                     * member functions of the STL and of
+                                     * several other classes within deal.II
+                                     * which not only reset the values of
+                                     * stored elements to zero, but release
+                                     * all memory and return the object into
+                                     * a virginial state. However, since the
+                                     * size of objects of the present type is
+                                     * determined by its template parameters,
+                                     * resizing is not an option, and indeed
+                                     * the state where all elements have a
+                                     * zero value is the state right after
+                                     * construction of such an object.
                                      */
     void clear ();
 
index 336848bf1298e4134e27ac893a6715a580b3a07a..ddb91e092beb59dd13ad5cb66823f39e5be2bf8a 100644 (file)
@@ -212,6 +212,21 @@ class Tensor<1,dim>
     
                                     /**
                                      * Reset all values to zero.
+                                     *
+                                     * Note that this is partly inconsistent
+                                     * with the semantics of the @p clear()
+                                     * member functions of the STL and of
+                                     * several other classes within deal.II
+                                     * which not only reset the values of
+                                     * stored elements to zero, but release
+                                     * all memory and return the object into
+                                     * a virginial state. However, since the
+                                     * size of objects of the present type is
+                                     * determined by its template parameters,
+                                     * resizing is not an option, and indeed
+                                     * the state where all elements have a
+                                     * zero value is the state right after
+                                     * construction of such an object.
                                      */
     void clear ();
 
index 8010871e32c26d2d2b5669b64c6e6f30d63eaea3..18023aa2afc0783080414c1579154967cdb06a4d 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -120,7 +120,7 @@ namespace Functions
          values[k] = val;
        else
          {
-           values[k].clear ();
+           values[k] = 0;
            values[k](this->selected) = val;
          }
       }
@@ -194,7 +194,7 @@ namespace Functions
          values[k] = val;
        else
          {
-           values[k].clear ();
+           values[k] = 0;
            values[k](this->selected) = val;
          }
       }
@@ -287,7 +287,7 @@ namespace Functions
          values[k] = val;
        else
          {
-           values[k].clear ();
+           values[k] = 0;
            values[k](this->selected) = val;
          }
       }
index f0a84233950519e1ed59f3548e535eb1cf944d65..4b643df2d36bc084501192b4e025ecf3331d41f7 100644 (file)
@@ -169,7 +169,7 @@ MGLevelObject<Object>::clear ()
 {
   typename std::vector<boost::shared_ptr<Object> >::iterator v;
   for (v = objects.begin(); v != objects.end(); ++v)
-    (*v)->clear();  
+    **v = 0;
 }
 
 
index c5a852c4ac7f4a888a2d9a6e65c53e393b24908b..a3a2f11be78894c97c8b8a0636707846a4b00dcc 100644 (file)
@@ -475,7 +475,7 @@ DoFCellAccessor<dim>::get_interpolated_dof_values (const InputVector &values,
       Vector<number> tmp1(dofs_per_cell);
       Vector<number> tmp2(dofs_per_cell);
       
-      interpolated_values.clear ();
+      interpolated_values = 0;
 
                                        // later on we will have to
                                        // push the values interpolated
index f5ffb0e50aba88f916cecae652ebc960be2d1865..642405234ad28d62dacc510465873bf6ba02f7a6 100644 (file)
@@ -2545,7 +2545,7 @@ DoFTools::compute_intergrid_weights_3 (const DoFHandler<dim>              &coars
            const unsigned int local_parameter_dof
              = coarse_fe.system_to_component_index(local_dof).second;
            
-           global_parameter_representation.clear ();
+           global_parameter_representation = 0;
            
                                             // distribute the representation of
                                             // @p{local_parameter_dof} on the
index f491bcb4702018ced24c896ebbeaafbb17c6a72f..5cf64539cfa99bd9120cd0d4e874c34bd2e4b2f1 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2000, 2001, 2002, 2003 by the deal.II authors
+//    Copyright (C) 2000, 2001, 2002, 2003, 2004 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -456,7 +456,7 @@ void FETools::interpolate(const DoFHandler<dim> &dof1,
 
   std::vector<unsigned int> index_multiplicity(dof2.n_dofs(),0);
   std::vector<unsigned int> dofs (dofs_per_cell2);
-  u2.clear ();
+  u2 = 0;
 
   for (; cell1!=endc1, cell2!=endc2; ++cell1, ++cell2) 
     {
index 1b49f7f761ae8e1a981f508db4b2b93f2bc8397d..e84bdde0ca9a25d74cdc7494ab713128a992d398 100644 (file)
@@ -297,7 +297,7 @@ estimate (const Mapping<1>                    &mapping,
               else
                                                  // fill with zeroes.
                 for (unsigned int s=0; s<n_solution_vectors; ++s)
-                  grad_neighbor[s].clear ();
+                  grad_neighbor[s] = 0;
 
                                              // if there is a
                                              // coefficient, then
index 3e146b28ff00189292f88554f4756cc0707c5f73..a501dbecbf78b8ada3bc2cd493771f2bed50fcc8 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -326,7 +326,7 @@ MatrixCreator::create_mass_matrix_2 (const Mapping<dim>       &mapping,
       fe_values.reinit (cell);
       
       cell_matrix.clear ();
-      local_rhs.clear ();
+      local_rhs = 0;
       cell->get_dof_indices (dof_indices);
       
       rhs.value_list (fe_values.get_quadrature_points(), rhs_values);
@@ -584,7 +584,7 @@ create_boundary_mass_matrix_1 (const Mapping<dim>        &mapping,
          boundary_functions.end())
        {
          cell_matrix.clear ();
-         cell_vector.clear ();
+         cell_vector = 0;
          
          fe_values.reinit (cell, face);
          
@@ -1151,7 +1151,7 @@ MatrixCreator::create_laplace_matrix_2 (const Mapping<dim>       &mapping,
       fe_values.reinit (cell);
       
       cell_matrix.clear ();
-      local_rhs.clear ();
+      local_rhs = 0;
       cell->get_dof_indices (dof_indices);
       
       rhs.value_list (fe_values.get_quadrature_points(), rhs_values);
index 80dbf8dac3c90d0cecec610f957e23ca93a9bd36..cededd77a97cad34684b7de95b7be8d66f5c51b4 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -446,7 +446,7 @@ void VectorTools::create_right_hand_side (const Mapping<dim>    &mapping,
          ExcComponentMismatch());
   Assert (rhs_vector.size() == dof_handler.n_dofs(),
          ExcDimensionMismatch(rhs_vector.size(), dof_handler.n_dofs()));
-  rhs_vector.clear();
+  rhs_vector = 0;
   
   UpdateFlags update_flags = UpdateFlags(update_values   |
                                         update_q_points |
@@ -474,7 +474,7 @@ void VectorTools::create_right_hand_side (const Mapping<dim>    &mapping,
          const std::vector<double> &weights   = fe_values.get_JxW_values ();
          rhs_function.value_list (fe_values.get_quadrature_points(), rhs_values);
          
-         cell_vector.clear();
+         cell_vector = 0;
          for (unsigned int point=0; point<n_q_points; ++point)
            for (unsigned int i=0; i<dofs_per_cell; ++i) 
              cell_vector(i) += rhs_values[point] *
@@ -499,7 +499,7 @@ void VectorTools::create_right_hand_side (const Mapping<dim>    &mapping,
          const std::vector<double> &weights   = fe_values.get_JxW_values ();
          rhs_function.vector_value_list (fe_values.get_quadrature_points(), rhs_values);
          
-         cell_vector.clear();
+         cell_vector = 0;
          for (unsigned int point=0; point<n_q_points; ++point)
            for (unsigned int i=0; i<dofs_per_cell; ++i)
              {
@@ -550,7 +550,8 @@ VectorTools::create_boundary_right_hand_side (const Mapping<dim>      &mapping,
          ExcComponentMismatch());
   Assert (rhs_vector.size() == dof_handler.n_dofs(),
          ExcDimensionMismatch(rhs_vector.size(), dof_handler.n_dofs()));
-  rhs_vector.clear();
+  
+  rhs_vector = 0;
   
   UpdateFlags update_flags = UpdateFlags(update_values   |
                                         update_q_points |
@@ -583,7 +584,7 @@ VectorTools::create_boundary_right_hand_side (const Mapping<dim>      &mapping,
              const std::vector<double> &weights   = fe_values.get_JxW_values ();
              rhs_function.value_list (fe_values.get_quadrature_points(), rhs_values);
              
-             cell_vector.clear();
+             cell_vector = 0;
              for (unsigned int point=0; point<n_q_points; ++point)
                for (unsigned int i=0; i<dofs_per_cell; ++i) 
                  cell_vector(i) += rhs_values[point] *
@@ -612,7 +613,7 @@ VectorTools::create_boundary_right_hand_side (const Mapping<dim>      &mapping,
              const std::vector<double> &weights   = fe_values.get_JxW_values ();
              rhs_function.vector_value_list (fe_values.get_quadrature_points(), rhs_values);
          
-             cell_vector.clear();
+             cell_vector = 0;
              for (unsigned int point=0; point<n_q_points; ++point)
                for (unsigned int i=0; i<dofs_per_cell; ++i)
                  {
index 731b20cd65e57d9fefb2835fb9b617c53682c183..d748d04b809d71f94fadfeb0dec99ef6215891c9 100644 (file)
@@ -32,17 +32,33 @@ contributor's names are abbreviated by WB (Wolfgang Bangerth), GK
 <h3 style="color:red">Incompatibilities</h3>
 
 <ol>
+  <li> <p> Changed: All the vector and block vector classes had a member
+       function <code class="member">clear</code> which simply reset all
+       values of the vector to zero. It did not change the size of the vector,
+       though. This was confusing, since the standard C++ container classes
+       implement the semantics that the <code class="member">clear</code>
+       functions delete all entries of the containers, i.e. resize it to zero,
+       and we implemented similar semantics also for the <code
+       class="class">SparseMatrix</code><code class="class">DoFHandler</code>,
+       <code class="class">ConstraintMatrix</code> and various other
+       classes. To avoid this confusion in the future, the <code
+       class="member">clear</code> function has been dropped from the
+       interface of the vector classes. To set all elements of a vector to
+       zero without changing its size, the recommended way is to use the more
+       obvious notation <code class="member">v=0</code>.  <br> (WB 2004/05/10)
+       </p>
+
   <li> <p> Changed: the template parameter of <code
-  class="class">MGTransferPrebuilt</code> is now the complete vector
-  type, not just the value type of the vector. This allows to operate
-  on <code class="class">Vector</code> as well as on <code
-  class="class">BlockVector</code>. Unfortunately, the untested class
-  <code class="class">MGTransferBlock</code> underwent some more
-  changes without testing, such that it should be used with high
-  caution.
-  <br>
-  (GK 2004/04/01)
-  </p>
+       class="class">MGTransferPrebuilt</code> is now the complete vector
+       type, not just the value type of the vector. This allows to operate
+       on <code class="class">Vector</code> as well as on <code
+       class="class">BlockVector</code>. Unfortunately, the untested class
+       <code class="class">MGTransferBlock</code> underwent some more
+       changes without testing, such that it should be used with high
+       caution.
+       <br>
+       (GK 2004/04/01)
+       </p>
 
   <li> <p> Changed: The <code class="class">FiniteElement</code> classes had a
        function <code class="member">restrict</code> that returns the
index 7d7733f9b38da442ad255f690b6823c5700ffb42..8ef66c88b7184755c170dc8aa43bfa8bd22e155c 100644 (file)
@@ -4,7 +4,7 @@
 /*    $Id$       */
 /*    Version: $Name$                                          */
 /*                                                                */
-/*    Copyright (C) 2001, 2002, 2003 by the deal.II authors */
+/*    Copyright (C) 2001, 2002, 2003, 2004 by the deal.II authors */
 /*                                                                */
 /*    This file is subject to QPL and may not be  distributed     */
 /*    without copyright and license information. Please refer     */
@@ -837,7 +837,7 @@ void DGMethod<dim>::assemble_system1 ()
                                       // ``cell_vector'' to zero,
                                       // before assembling the cell terms.
       u_v_matrix.clear ();
-      cell_vector.clear ();
+      cell_vector = 0;
       
                                       // Now we reinit the ``FEValues''
                                       // object for the current cell
@@ -1271,7 +1271,7 @@ void DGMethod<dim>::assemble_system2 ()
   for (;cell!=endc; ++cell) 
     {
       u_v_matrix.clear ();
-      cell_vector.clear ();
+      cell_vector = 0;
 
       fe_v.reinit (cell);
 
@@ -1625,7 +1625,7 @@ void DGMethod<dim>::run ()
                                       // right hand side vector and
                                       // the Timer object.
       system_matrix.reinit();
-      right_hand_side.clear();
+      right_hand_side = 0;
       assemble_timer.reset();
 
                                       // We start the Timer,
index acab8e761be69e233b699073a590f1b0a10d0daf..4d1c8cc4ca3cd8aa24f9c0b2c368770a98956e1a 100644 (file)
@@ -4,7 +4,7 @@
 /*    $Id$       */
 /*    Version: $Name$                                          */
 /*                                                                */
-/*    Copyright (C) 2001, 2002, 2003 by the deal.II authors */
+/*    Copyright (C) 2001, 2002, 2003, 2004 by the deal.II authors */
 /*                                                                */
 /*    This file is subject to QPL and may not be  distributed     */
 /*    without copyright and license information. Please refer     */
@@ -1623,7 +1623,7 @@ namespace LaplaceSolver
       endc = this->dof_handler.end();
     for (; cell!=endc; ++cell)
       {
-       cell_rhs.clear ();
+       cell_rhs = 0;
        fe_values.reinit (cell);
        rhs_function->value_list (fe_values.get_quadrature_points(),
                                  rhs_values);
index c14b1cb7d6f988e459041b3d021fbd0be11da965..d4cbff01d5c989599b83f99786d9553b7a605674 100644 (file)
@@ -971,7 +971,7 @@ namespace LaplaceSolver
       endc = this->dof_handler.end();
     for (; cell!=endc; ++cell)
       {
-       cell_rhs.clear ();
+       cell_rhs = 0;
 
        fe_values.reinit (cell);
 
@@ -987,7 +987,7 @@ namespace LaplaceSolver
        cell->get_dof_indices (local_dof_indices);
        for (unsigned int i=0; i<dofs_per_cell; ++i)
          rhs(local_dof_indices[i]) += cell_rhs(i);
-      };
+      }
   }
 
 
index 995cc3bf4956660b1c0560fe3b8078dbc1904c14..fa8a5ed0cca76c1d1bda1404ae57e93e07f8e858 100644 (file)
@@ -464,7 +464,7 @@ void MinimizationProblem<dim>::assemble_step ()
                                        // the local matrix and right hand side
                                        // contributions for this cell:
       cell_matrix.clear ();
-      cell_rhs.clear ();
+      cell_rhs = 0;
 
                                        // Then initialize the values and
                                        // gradients of the shape functions at
index 9a359625c8125990d93b28a7523433b7920b7bcf..db9efb23775634f6b2d48ae7f70d38ffe2d24bf7 100644 (file)
@@ -215,7 +215,7 @@ void LaplaceProblem<dim>::assemble_system ()
   for (; cell!=endc; ++cell)
     {
       cell_matrix.clear ();
-      cell_rhs.clear ();
+      cell_rhs = 0;
 
                                       // As before, we want the
                                       // FEValues object to compute
index ff1573209a47f34813ee443dde70961c528eb74c..4eee20ff95f7478da15bc153db19d25bbf96254e 100644 (file)
@@ -565,7 +565,7 @@ void ElasticProblem<dim>::assemble_system ()
     if (cell->subdomain_id() == this_mpi_process)
       {
         cell_matrix.clear ();
-        cell_rhs.clear ();
+        cell_rhs = 0;
 
         fe_values.reinit (cell);
       
index 29c647ed82e1d73b4e19ef6620668651fed801bb..0e6152cbde67c14bd32acba25e010eec2d80f88a 100644 (file)
@@ -4,7 +4,7 @@
 /*    $Id$       */
 /*    Version: $Name$                                          */
 /*                                                                */
-/*    Copyright (C) 1999, 2000, 2001, 2002, 2003 by the deal.II authors */
+/*    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors */
 /*                                                                */
 /*    This file is subject to QPL and may not be  distributed     */
 /*    without copyright and license information. Please refer     */
@@ -482,7 +482,7 @@ void LaplaceProblem::assemble_system ()
                                       // right hand side to zero,
                                       // before we fill them.
       cell_matrix.clear ();
-      cell_rhs.clear ();
+      cell_rhs = 0;
 
                                       // Assemble the matrix: For the
                                       // Laplace problem, the matrix
index 242bc84b12419fc9045362e2ee863821bf33a311..4f9458703fdfa7f894d39b0f0710725a23edad06 100644 (file)
@@ -4,7 +4,7 @@
 /*    $Id$       */
 /*    Version: $Name$                                          */
 /*                                                                */
-/*    Copyright (C) 1999, 2000, 2001, 2002, 2003 by the deal.II authors */
+/*    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors */
 /*                                                                */
 /*    This file is subject to QPL and may not be  distributed     */
 /*    without copyright and license information. Please refer     */
@@ -407,7 +407,7 @@ void LaplaceProblem<dim>::assemble_system ()
     {
       fe_values.reinit (cell);
       cell_matrix.clear ();
-      cell_rhs.clear ();
+      cell_rhs = 0;
 
                                       // Now we have to assemble the
                                       // local matrix and right hand
index 1ac610a46bcbbd91b1e0abe474908bdab8ed29cf..f83be3f3272e47cdc01ffc95b12099264a03305d 100644 (file)
@@ -4,7 +4,7 @@
 /*    $Id$       */
 /*    Version: $Name$                                          */
 /*                                                                */
-/*    Copyright (C) 1999, 2000, 2001, 2002, 2003 by the deal.II authors */
+/*    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors */
 /*                                                                */
 /*    This file is subject to QPL and may not be  distributed     */
 /*    without copyright and license information. Please refer     */
@@ -429,7 +429,7 @@ void LaplaceProblem<dim>::assemble_system ()
   for (; cell!=endc; ++cell)
     {
       cell_matrix.clear ();
-      cell_rhs.clear ();
+      cell_rhs = 0;
 
                                       // As before, we want the
                                       // FEValues object to compute
index 4cfcba56c332dd22cc66c6fbee758713aa833e6a..35f1494a30c81290672f4a5a1bce108d78182cdb 100644 (file)
@@ -4,7 +4,7 @@
 /*    $Id$       */
 /*    Version: $Name$                                          */
 /*                                                                */
-/*    Copyright (C) 2000, 2001, 2002, 2003 by the deal.II authors */
+/*    Copyright (C) 2000, 2001, 2002, 2003, 2004 by the deal.II authors */
 /*                                                                */
 /*    This file is subject to QPL and may not be  distributed     */
 /*    without copyright and license information. Please refer     */
@@ -510,7 +510,7 @@ void LaplaceProblem<dim>::assemble_system ()
   for (; cell!=endc; ++cell)
     {
       cell_matrix.clear ();
-      cell_rhs.clear ();
+      cell_rhs = 0;
 
       fe_values.reinit (cell);
 
index 34174a25fbe6a2562822f15e2dc04742c5b23d5b..c577f0b0a89730e1f558a50f240d378969229a52 100644 (file)
@@ -4,7 +4,7 @@
 /*    $Id$       */
 /*    Version: $Name$                                          */
 /*                                                                */
-/*    Copyright (C) 2000, 2001, 2002, 2003 by the deal.II authors */
+/*    Copyright (C) 2000, 2001, 2002, 2003, 2004 by the deal.II authors */
 /*                                                                */
 /*    This file is subject to QPL and may not be  distributed     */
 /*    without copyright and license information. Please refer     */
@@ -879,7 +879,7 @@ void LaplaceProblem<dim>::assemble_system ()
   for (; cell!=endc; ++cell)
     {
       cell_matrix.clear ();
-      cell_rhs.clear ();
+      cell_rhs = 0;
 
       fe_values.reinit (cell);
 
index 3cb570bff5a92e12e17e3234a1ebd81096f6a766..47461207376fd13f2552a327a5c0f7b61605dad6 100644 (file)
@@ -518,7 +518,7 @@ void ElasticProblem<dim>::assemble_system ()
   for (; cell!=endc; ++cell)
     {
       cell_matrix.clear ();
-      cell_rhs.clear ();
+      cell_rhs = 0;
 
       fe_values.reinit (cell);
       
index 32da47f75fe05338243c5fc7f6e436eef5f2ecec..c48a953381b2acdf066042489c0f28fde4f4b147 100644 (file)
@@ -4,7 +4,7 @@
 /*    $Id$       */
 /*    Version: $Name$                                          */
 /*                                                                */
-/*    Copyright (C) 2000, 2001, 2002, 2003 by the deal.II authors */
+/*    Copyright (C) 2000, 2001, 2002, 2003, 2004 by the deal.II authors */
 /*                                                                */
 /*    This file is subject to QPL and may not be  distributed     */
 /*    without copyright and license information. Please refer     */
@@ -1036,7 +1036,7 @@ assemble_system_interval (const typename DoFHandler<dim>::active_cell_iterator &
                                       // First clear old contents of
                                       // the cell contributions...
       cell_matrix.clear ();
-      cell_rhs.clear ();
+      cell_rhs = 0;
 
                                       // ... then initialize
                                       // the ``FEValues'' object...
index 0ad1e712abf9753b0a9af4d98b728356f1fd78a0..557eb0f4a506f292e0885146f114c9e09b3c241f 100644 (file)
@@ -814,16 +814,6 @@ class BlockVector
     void reinit (const BlockVector<Number2> &V,
                 const bool                 fast=false);
     
-                                    /**
-                                     * Set all entries to zero. Equivalent to
-                                     * <tt>v=0</tt>, but more obvious and
-                                     * faster.  Note that this function does
-                                     * not change the size of the vector,
-                                     * unlike the STL's
-                                     * <tt>vector<>::clear</tt> function.
-                                     */
-    void clear ();
-
                                     /**
                                      * Update internal structures
                                      * after resizing
index 1abfbc6f1b91e9fff3541e188fd25534715dcc7c..ded153a7e11412e0a53143c8a7869ffeeecfe25d 100644 (file)
@@ -137,16 +137,6 @@ void BlockVector<Number>::swap (BlockVector<Number> &v)
 
 
 
-template <typename Number>
-void BlockVector<Number>::clear ()
-{
-  for (unsigned int i=0;i<num_blocks;++i)
-    {
-      components[i].clear();
-    }
-}
-
-
 template <typename Number>
 bool
 BlockVector<Number>::all_zero () const
index cb67fcde13a0a317ad945094a7a2dff45379e44d..ab535eac7bfe49e51f982fbd73782a912df80115 100644 (file)
@@ -246,16 +246,6 @@ namespace PETScWrappers
                                         */
       void compress ();
 
-                                       /**
-                                        * Set all entries to zero. Equivalent
-                                        * to <tt>v = 0</tt>, but more obvious and
-                                        * faster.  Note that this function
-                                        * does not change the size of the
-                                        * vector, unlike the STL's
-                                        * <tt>vector<>::clear</tt> function.
-                                        */
-      void clear ();    
-      
                                        /**
                                         * Set all components of the vector to
                                         * the given number @p s.
index 0a3547f79b035e6e9184fe1ee4d367da837959f5..e24791371eb7c90a8a01e0a7b4595d29cacd6826 100644 (file)
@@ -388,7 +388,7 @@ SparseMatrix<number>::Tvmult (OutVector& dst,
 
   Assert (&src != &dst, ExcSourceEqualsDestination());
 
-  dst.clear ();
+  dst = 0;
 
   for (unsigned int i=0;i<m();i++)
     {
index 21da0ae04ddd6c4f38609cbd9c542c92c5f18e92..296b30c9b9f7560336a66cbd796d4ac7df358128 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -195,7 +195,7 @@ SparseVanka<number>::vmult (Vector<number2>       &dst,
                            const Vector<number2> &src) const
 {
                                   // first set output vector to zero
-  dst.clear ();
+  dst = 0;
                                   // then pass on to the function
                                   // that actually does the work
   apply_preconditioner (dst, src);
@@ -564,7 +564,7 @@ template <typename number2>
 void SparseBlockVanka<number>::vmult (Vector<number2>       &dst,
                                      const Vector<number2> &src) const
 {
-  dst.clear ();
+  dst = 0;
 
                                   // if no blocking is required, pass
                                   // down to the underlying class
index 343809e4816948f8c84ddb7fa3ec9797d27be926..afe374a87214260f6db6dad52d59ba6464768887 100644 (file)
@@ -209,16 +209,6 @@ class Vector
                                       */
     void compress () const;
 
-                                    /**
-                                     * Set all entries to zero. Equivalent to
-                                     * <tt>v = 0</tt>, but more obvious and
-                                     * faster.  Note that this function does
-                                     * not change the size of the vector,
-                                     * unlike the STL's <tt>vector<>::clear</tt>
-                                     * function.
-                                     */
-    void clear ();    
-
                                     /**
                                      * Change the dimension of the vector to
                                      * @p N. The reserved memory for this
@@ -818,17 +808,7 @@ void Vector<Number>::reinit (const unsigned int n, const bool fast)
     };
   dim = n;
   if (fast == false)
-    clear ();
-}
-
-
-
-template <typename Number>
-inline
-void Vector<Number>::clear ()
-{
-  if (dim>0)
-    std::fill (begin(), end(), 0.);
+    *this = 0;
 }
 
 
index 54707fdd8c42c4ddca9be22b2462efbc6212214f..1ddfb78601d178649b7f0254fd47c5499977b700 100644 (file)
@@ -118,16 +118,6 @@ namespace PETScWrappers
 
 
 
-  void
-  VectorBase::clear ()
-  {
-    const PetscScalar zero = 0;
-    const int ierr = VecSet (&zero, vector);
-    AssertThrow (ierr == 0, ExcPETScError(ierr));
-  }
-
-
-
   VectorBase &
   VectorBase::operator = (const PetscScalar s)
   {
index d733c614a95a4ab43533b776ce2d6c22df3d8631..6fdfdd4ab589f5851874676664027c3f1b5634ef 100644 (file)
@@ -126,7 +126,7 @@ void BoundaryFunction<dim>::vector_value (const Point<dim>   &,
   Assert (values.size() == dim+1, 
          ExcDimensionMismatch (values.size(), dim+1));
                                  
-  values.clear ();
+  values = 0;
   values(dim) = 1.;
 }
 
index 1eb0bce2d58f39dac3df6250b6c96f0980dcc124..e8781a47defc636012392077b454f147170adb40 100644 (file)
@@ -81,7 +81,7 @@ void test ()
        cell != dof_handler.end(); ++cell)
     {
       cell->get_dof_indices (local_dofs);
-      local_vector.clear ();
+      local_vector = 0;
       for (unsigned int i=0; i<fe.dofs_per_cell; ++i)
         local_vector(i) = (i+1.)*(local_dofs[i]+1.);
 
index 619c04e9831253ae01c0d49ec7725d2268858265..4c58ca11b7eca51ed2a11d2ce45e78d972d9bc13 100644 (file)
@@ -12,7 +12,9 @@
 //----------------------------  petsc_24.cc  ---------------------------
 
 
-// check PETScWrappers::Vector::clear()
+// this test used to check for PETScWrappers::Vector::clear(). However, this
+// function has since been removed, so we test for v=0 instead, although that
+// may be covered by one of the other tests
 
 #include "../tests.h"
 #include <lac/petsc_vector.h>    
@@ -32,7 +34,7 @@ void test (PETScWrappers::Vector &v)
                                    // then clear it again and make sure the
                                    // vector is really empty
   const unsigned int sz = v.size();
-  v.clear ();
+  v = 0;
   Assert (v.size() == sz, ExcInternalError());
   Assert (v.l2_norm() == 0, ExcInternalError());
 
index 770bff1c5042d3019c358fd967aa19796a0e7fb1..6a50f5ccb4f71536a8cd0657d1c1913bad3393bf 100644 (file)
@@ -12,7 +12,9 @@
 //----------------------------  vector_24.cc  ---------------------------
 
 
-// check Vector<double>::clear()
+// this test used to check for Vector::clear(). However, this
+// function has since been removed, so we test for v=0 instead, although that
+// may be covered by one of the other tests
 
 #include "../tests.h"
 #include <lac/vector.h>    
@@ -32,7 +34,7 @@ void test (Vector<double> &v)
                                    // then clear it again and make sure the
                                    // vector is really empty
   const unsigned int sz = v.size();
-  v.clear ();
+  v = 0;
   Assert (v.size() == sz, ExcInternalError());
   Assert (v.l2_norm() == 0, ExcInternalError());
 
index 78df570253df7f0ec483387cd624022aa85830a0..6c133ef6075b1e9dee55ba14fa13aa2cc3942125 100644 (file)
@@ -277,7 +277,7 @@ void LaplaceProblem<Vector,Matrix,Sparsity>::assemble_system ()
       fe_values.reinit (cell);
 
       cell_matrix.clear ();
-      cell_rhs.clear ();
+      cell_rhs = 0;
 
       for (unsigned int i=0; i<dofs_per_cell; ++i)
        for (unsigned int j=0; j<dofs_per_cell; ++j)
index c31d12675d5cf602619d7fc6dac929b8a950b730..fd46e05dad8c3149bb3c739889082c385c5b36c4 100644 (file)
@@ -60,7 +60,7 @@ int main ()
   bool testcase_succeeded = true;
   for (unsigned int vertex=0; vertex<4; ++vertex)
     {
-      val.clear ();
+      val = 0;
       val(vertex) = 1;
 
       std::vector<Tensor<1,2> > grads(4);
index 4b8c452f4962f3b3dc36d47dde10eb1c0ccb2641..92d0730285a166865556e7a6bd8800d6daa8be83 100644 (file)
@@ -76,7 +76,7 @@ int main ()
       
       for (unsigned int vertex=0; vertex<4; ++vertex)
        {
-         val.clear ();
+         val = 0;
          val(vertex) = 1;
          
          std::vector<Tensor<2,2> > derivs(4);
index f64dd7910ecfac6879f7c0817e59a387644c51e5..b583562704a5bb38fe46de96dbc4cd9f6aacf0e6 100644 (file)
@@ -5381,8 +5381,8 @@ TimeStep_Dual<dim>::collect_from_children (const typename DoFHandler<dim>::cell_
     {
       const typename DoFHandler<dim>::cell_iterator old_child = old_cell->child(c);
 
-      child_rhs1.clear ();
-      child_rhs2.clear ();
+      child_rhs1 = 0;
+      child_rhs2 = 0;
       
       if (old_child->has_children())
        {
@@ -7135,8 +7135,8 @@ FullMatrix<double>   cell_matrix (dofs_per_cell, dofs_per_cell);
     {
       const typename DoFHandler<dim>::cell_iterator old_child = old_cell->child(c);
 
-      child_rhs1.clear ();
-      child_rhs2.clear ();
+      child_rhs1 = 0;
+      child_rhs2 = 0;
       
       if (old_child->has_children())
        {

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.