]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Use the cell->is_locally_owned() predicate introduced in the previous patch.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 11 Sep 2011 05:44:26 +0000 (05:44 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 11 Sep 2011 05:44:26 +0000 (05:44 +0000)
git-svn-id: https://svn.dealii.org/trunk@24304 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-32/step-32.cc
deal.II/examples/step-40/step-40.cc
deal.II/include/deal.II/numerics/vectors.templates.h
deal.II/source/dofs/dof_renumbering.cc
deal.II/source/dofs/dof_tools.cc
deal.II/source/grid/grid_tools.cc
deal.II/source/grid/tria.cc
deal.II/source/numerics/data_out.cc
deal.II/source/numerics/data_out_faces.cc
deal.II/source/numerics/data_out_rotation.cc
deal.II/source/numerics/data_out_stack.cc

index c96c0db93bee3ad635eee01d6b7d55ae1a75eb62..b000b0c1853124771c4b5966d7ed82530a621a1b 100644 (file)
@@ -1673,7 +1673,7 @@ compute_viscosity (const std::vector<double>          &old_temperature,
       max_velocity = std::max (std::sqrt (u*u), max_velocity);
     }
 
-  const double max_viscosity = (parameters.stabilization_beta * 
+  const double max_viscosity = (parameters.stabilization_beta *
                                max_velocity * cell_diameter);
   if (timestep_number == 0)
     return max_viscosity;
@@ -3614,7 +3614,7 @@ void BoussinesqFlowProblem<dim>::output_results ()
       temperature_cell = temperature_dof_handler.begin_active();
     for (; joint_cell!=joint_endc;
         ++joint_cell, ++stokes_cell, ++temperature_cell)
-      if (!joint_cell->is_artificial() && !joint_cell->is_ghost())
+      if (joint_cell->is_locally_owned())
        {
          joint_cell->get_dof_indices (local_joint_dof_indices);
          stokes_cell->get_dof_indices (local_stokes_dof_indices);
@@ -3817,7 +3817,7 @@ void BoussinesqFlowProblem<dim>::refine_mesh (const unsigned int max_grid_level)
     // for (typename Triangulation<dim>::active_cell_iterator
     //            cell = triangulation.begin_active();
     //          cell != triangulation.end(); ++cell)
-    //   if (!cell->is_ghost() && !cell->is_artificial())
+    //   if (cell->is_locally_owned())
     //         if ((cell->center()[1] > 0)
     //             &&
     //             (cell->center()[2] > 0))
index 732097b0d9ceaccd6b4e572821c761fb13e6b14d..bb22eb8796ae38bd112e94ce24ad5a60d5b4b275 100644 (file)
@@ -432,14 +432,19 @@ namespace Step40
                                   // being almost exactly what we've seen
                                   // before. The points to watch out for are:
                                   // - Assembly must only loop over locally
-                                  //   owned cells. We test this by comparing
+                                  //   owned cells. There are multiple ways to
+                                  //   test that; for example, we could
+                                  //   compare
                                   //   a cell's subdomain_id against
                                   //   information from the triangulation
-                                  //   but an equally valid condition would
-                                  //   have been to skip all cells for which
+                                  //   as in <code>cell->subdomain_id() ==
+                                  //   triangulation.locally_owned_subdomain()</code>,
+                                  //   or skip all cells for which
                                   //   the condition <code>cell->is_ghost()
                                   //   || cell->is_artificial()</code> is
-                                  //   true.
+                                  //   true. The simplest way, however, is
+                                  //   to simply ask the cell whether it is
+                                  //   owned by the local processor.
                                   // - Copying local contributions into the
                                   //   global matrix must include distributing
                                   //   constraints and boundary values. In
@@ -483,7 +488,7 @@ namespace Step40
       cell = dof_handler.begin_active(),
       endc = dof_handler.end();
     for (; cell!=endc; ++cell)
-      if (cell->subdomain_id() == triangulation.locally_owned_subdomain())
+      if (cell->is_locally_owned())
        {
          cell_matrix = 0;
          cell_rhs = 0;
index 78a23c855a89bf8ea3f7889694587c21d194d5bd..854b3b97213004b06389ba4ba454265eeaf40e87 100644 (file)
@@ -190,7 +190,7 @@ void VectorTools::interpolate (const Mapping<DH::dimension,DH::space_dimension>
                               fe, support_quadrature, update_quadrature_points);
 
   for (; cell!=endc; ++cell)
-    if (!cell->is_artificial() && !cell->is_ghost())
+    if (cell->is_locally_owned())
     {
       const unsigned int fe_index = cell->active_fe_index();
 
@@ -4346,7 +4346,7 @@ compute_no_normal_flux_constraints (const DH<dim,spacedim>         &dof_handler,
                                                   // length of the vector
                                                   // back to one, just to be
                                                   // on the safe side
-                 Point<dim> normal_vector 
+                 Point<dim> normal_vector
                  = (cell->face(face_no)->get_boundary()
                     .normal_vector (cell->face(face_no),
                                     fe_values.quadrature_point(i)));
@@ -4928,7 +4928,7 @@ namespace internal
       typename DH::active_cell_iterator cell = dof.begin_active(),
                                         endc = dof.end();
       for (unsigned int index=0; cell != endc; ++cell, ++index)
-       if (!cell->is_artificial() && !cell->is_ghost())
+       if (cell->is_locally_owned())
          {
            double diff=0;
                                             // initialize for this cell
@@ -5480,7 +5480,7 @@ VectorTools::compute_mean_value (const Mapping<dim, spacedim>    &mapping,
   double area = 0.;
                                   // Compute mean value
   for (cell = dof.begin_active(); cell != dof.end(); ++cell)
-    if (!cell->is_artificial() && !cell->is_ghost())
+    if (cell->is_locally_owned())
       {
        fe.reinit (cell);
        fe.get_function_values(v, values);
index 9f306b1a53a5215352c7aa77c1cfeb59340adad3..dfa196c5cafb94fb437db34bb02ce8c2866181a6 100644 (file)
@@ -765,7 +765,7 @@ namespace DoFRenumbering
     std::vector<std::vector<unsigned int> >
       component_to_dof_map (fe_collection.n_components());
     for (ITERATOR cell=start; cell!=end; ++cell)
-      if (!cell->is_artificial() && !cell->is_ghost())
+      if (cell->is_locally_owned())
        {
                                         // on each cell: get dof indices
                                         // and insert them into the global
@@ -922,7 +922,7 @@ namespace DoFRenumbering
         }
       else
         {
-          if (!cell->is_artificial() && !cell->is_ghost())
+          if (cell->is_locally_owned())
             {
               const unsigned int dofs_per_cell = cell->get_fe().dofs_per_cell;
               std::vector<unsigned int> local_dof_indices (dofs_per_cell);
@@ -1017,7 +1017,7 @@ namespace DoFRenumbering
                       numbers::invalid_unsigned_int)
            == renumbering.end(),
            ExcInternalError());
-       
+
        dof_handler.renumber_dofs(renumbering);
   }
 
index 591a4303d33fe63ad5f0e155210122a723f0beed..62792b03209bb0368486cf3ec5805bddf83257a5 100644 (file)
@@ -96,9 +96,7 @@ namespace DoFTools
           ||
           (subdomain_id == cell->subdomain_id()))
          &&
-         !cell->is_artificial()
-         &&
-         !cell->is_ghost())
+         cell->is_locally_owned())
        {
          const unsigned int dofs_per_cell = cell->get_fe().dofs_per_cell;
          dofs_on_this_cell.resize (dofs_per_cell);
@@ -225,9 +223,7 @@ namespace DoFTools
           ||
           (subdomain_id == cell->subdomain_id()))
          &&
-         !cell->is_artificial()
-         &&
-         !cell->is_ghost())
+         cell->is_locally_owned())
        {
          const unsigned int fe_index = cell->active_fe_index();
          const unsigned int dofs_per_cell =fe_collection[fe_index].dofs_per_cell;
@@ -568,9 +564,7 @@ namespace DoFTools
           ||
           (subdomain_id == cell->subdomain_id()))
           &&
-          !cell->is_artificial()
-          &&
-          !cell->is_ghost())
+          cell->is_locally_owned())
        {
          const unsigned int n_dofs_on_this_cell = cell->get_fe().dofs_per_cell;
          dofs_on_this_cell.resize (n_dofs_on_this_cell);
@@ -768,7 +762,7 @@ namespace DoFTools
        typename DH::active_cell_iterator cell = dof.begin_active(),
                                          endc = dof.end();
        for (; cell!=endc; ++cell)
-          if (!cell->is_ghost() && !cell->is_artificial())
+          if (cell->is_locally_owned())
            {
              cell->get_dof_indices (dofs_on_this_cell);
                                               // make sparsity pattern for this cell
@@ -3383,7 +3377,7 @@ namespace DoFTools
       std::vector<unsigned int> indices;
       for (typename DH::active_cell_iterator c=dof.begin_active();
           c!=dof.end(); ++ c)
-       if (!c->is_artificial() && !c->is_ghost())
+       if (c->is_locally_owned())
          {
            const unsigned int fe_index = c->active_fe_index();
            const unsigned int dofs_per_cell = c->get_fe().dofs_per_cell;
@@ -4161,7 +4155,7 @@ namespace DoFTools
     typename DH::active_cell_iterator cell = dof_handler.begin_active(),
                                      endc = dof_handler.end();
     for (; cell!=endc; ++cell)
-      if (!cell->is_ghost() && !cell->is_artificial())
+      if (cell->is_locally_owned())
        {
          dof_indices.resize(cell->get_fe().dofs_per_cell);
          cell->get_dof_indices(dof_indices);
@@ -4670,7 +4664,7 @@ namespace DoFTools
 #ifdef DEAL_II_COMPILER_SUPPORTS_MPI
     const unsigned int dim = DH::dimension;
     const unsigned int spacedim = DH::space_dimension;
-    
+
     if (const parallel::distributed::Triangulation<dim,spacedim> * tria
        = (dynamic_cast<const parallel::distributed::Triangulation<dim,spacedim>*>
           (&dof_handler.get_tria())))
@@ -5021,7 +5015,7 @@ namespace DoFTools
        tasks.join_all ();
       }
 
-      
+
 
                                       /**
                                        * This is a helper function that
index 79ea68df191cfe65df18a5817bc64e2d66aea90e..b987daf18feb88ff8916e0c235be75af02d4478b 100644 (file)
@@ -83,7 +83,7 @@ GridTools::diameter (const Triangulation<dim, spacedim> &tria)
   Assert ((dynamic_cast<const parallel::distributed::Triangulation<dim,spacedim>*>(&tria)
            == 0),
          ExcNotImplemented());
-  
+
                                   // the algorithm used simply
                                   // traverses all cells and picks
                                   // out the boundary vertices. it
@@ -142,7 +142,7 @@ GridTools::volume (const Triangulation<dim, spacedim> &triangulation,
   = (dynamic_cast<const MappingQ<dim,spacedim>*>(&mapping) != 0 ?
      dynamic_cast<const MappingQ<dim,spacedim>*>(&mapping)->get_degree() :
      1);
-  
+
   // then initialize an appropriate quadrature formula
   const QGauss<dim> quadrature_formula (mapping_degree + 1);
   const unsigned int n_q_points = quadrature_formula.size();
@@ -159,7 +159,7 @@ GridTools::volume (const Triangulation<dim, spacedim> &triangulation,
 
                                   // compute the integral quantities by quadrature
   for (; cell!=endc; ++cell)
-    if (!cell->is_ghost() && !cell->is_artificial())
+    if (cell->is_locally_owned())
       {
        fe_values.reinit (cell);
        for (unsigned int q=0; q<n_q_points; ++q)
@@ -180,7 +180,7 @@ GridTools::volume (const Triangulation<dim, spacedim> &triangulation,
   global_volume = local_volume;
 #endif
 
-  return global_volume;  
+  return global_volume;
 }
 
 
index 705431cefed8a5db7b2ad1b8e307a0a2700b5f67..e39dc92d7158fe3f310d52eacb30bc5175965de8 100644 (file)
@@ -13470,8 +13470,7 @@ bool Triangulation<dim,spacedim>::prepare_coarsening_and_refinement ()
            if (!cell->active() ||
                (cell->active() &&
                 cell->refine_flag_set() &&
-                !cell->is_ghost() &&
-                !cell->is_artificial()))
+                cell->is_locally_owned()))
              {
                                                 // check whether all
                                                 // children are
index f5bd839985e19a432e3432122adf75cbc43ad73a..bf829e08634dd0fc05180a88d940e99fe0bbc143 100644 (file)
@@ -1143,7 +1143,7 @@ DataOut<dim,DH>::first_locally_owned_cell ()
                                   // is a ghost or artificial cell
   while ((cell != this->dofs->end()) &&
         (cell->has_children() == false) &&
-        (cell->is_ghost() || cell->is_artificial()))
+        !cell->is_locally_owned())
     cell = next_cell(cell);
 
   return cell;
@@ -1159,7 +1159,7 @@ DataOut<dim,DH>::next_locally_owned_cell (const typename DataOut<dim,DH>::cell_i
     cell = next_cell(old_cell);
   while ((cell != this->dofs->end()) &&
         (cell->has_children() == false) &&
-        (cell->is_ghost() || cell->is_artificial()))
+        !cell->is_locally_owned())
     cell = next_cell(cell);
   return cell;
 }
index f051172aff44a9c0018e5a91fa63915842aa4c7a..f9b6f376094bd7c08830f77ad0221add8ad26454 100644 (file)
@@ -93,10 +93,9 @@ build_one_patch (const FaceDescriptor *cell_and_face,
                 internal::DataOutFaces::ParallelData<DH::dimension, DH::dimension> &data,
                 DataOutBase::Patch<DH::dimension-1,DH::space_dimension>  &patch)
 {
-  Assert (!cell_and_face->first->is_ghost() &&
-         !cell_and_face->first->is_artificial(),
+  Assert (cell_and_face->first->is_locally_owned(),
          ExcNotImplemented());
-  
+
                                   // we use the mapping to transform the
                                   // vertices. However, the mapping works on
                                   // cells, not faces, so transform the face
@@ -180,10 +179,10 @@ build_one_patch (const FaceDescriptor *cell_and_face,
                  if (update_flags & update_hessians)
                    this->dof_data[dataset]->get_function_hessians (fe_patch_values,
                                                                    data.patch_hessians);
-                 
+
                  if (update_flags & update_quadrature_points)
-                   data.patch_evaluation_points = fe_patch_values.get_quadrature_points();                                                
-                                                                   
+                   data.patch_evaluation_points = fe_patch_values.get_quadrature_points();
+
                  postprocessor->
                    compute_derived_quantities_scalar(data.patch_values,
                                                      data.patch_gradients,
@@ -207,10 +206,10 @@ build_one_patch (const FaceDescriptor *cell_and_face,
                  if (update_flags & update_hessians)
                    this->dof_data[dataset]->get_function_hessians (fe_patch_values,
                                                                    data.patch_hessians_system);
-                                                                   
+
                  if (update_flags & update_quadrature_points)
                    data.patch_evaluation_points = fe_patch_values.get_quadrature_points();
-                   
+
                  postprocessor->
                    compute_derived_quantities_vector(data.patch_values_system,
                                                      data.patch_gradients_system,
index a9523cc64e88625cb7b8a3b374294b0a90e04434..f7dba804c10d04d97b66eb411b432df91304e626 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
+//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -112,8 +112,7 @@ build_one_patch (const cell_iterator *cell,
       return;
     }
 
-  Assert (!(*cell)->is_ghost() &&
-         !(*cell)->is_artificial(),
+  Assert ((*cell)->is_locally_owned(),
          ExcNotImplemented());
 
   const unsigned int n_patches_per_circle = data.n_patches_per_circle;
index d671e72bb1f59ec3d1824173b1bc6ba48daeb3cf..685c0db07ef9beb00b5966011396f16e09694e8c 100644 (file)
@@ -65,17 +65,17 @@ void DataOutStack<dim,spacedim,DH>::new_parameter_value (const double p,
        i!=cell_data.end(); ++i)
     Assert (i->data.size() == 0,
            ExcDataNotCleared ());
-  
+
 }
 
 
 template <int dim, int spacedim, class DH>
-void DataOutStack<dim,spacedim,DH>::attach_dof_handler (const DH& dof) 
+void DataOutStack<dim,spacedim,DH>::attach_dof_handler (const DH& dof)
 {
                                   // Check consistency of redundant
                                   // template parameter
   Assert (dim==DH::dimension, ExcDimensionMismatch(dim, DH::dimension));
-  
+
   dof_handler = &dof;
 }
 
@@ -114,7 +114,7 @@ void DataOutStack<dim,spacedim,DH>::declare_data_vector (const std::vector<std::
        for (unsigned int i=0; i<data_set->names.size(); ++i)
          Assert (*name != data_set->names[i], ExcNameAlreadyUsed(*name));
     };
-  
+
   switch (vector_type)
     {
       case dof_vector:
@@ -185,7 +185,7 @@ void DataOutStack<dim,spacedim,DH>::add_data_vector (const Vector<number> &vec,
                                 names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz"
                                                            "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                                                            "0123456789_<>()")));
-  
+
   if (vec.size() == dof_handler->n_dofs())
     {
       typename std::vector<DataVector>::iterator data_vector=dof_data.begin();
@@ -231,22 +231,22 @@ void DataOutStack<dim,spacedim,DH>::add_data_vector (const Vector<number> &vec,
 
 
 template <int dim, int spacedim, class DH>
-void DataOutStack<dim,spacedim,DH>::build_patches (const unsigned int nnnn_subdivisions) 
+void DataOutStack<dim,spacedim,DH>::build_patches (const unsigned int nnnn_subdivisions)
 {
                                   // this is mostly copied from the
                                   // DataOut class
   unsigned int n_subdivisions = (nnnn_subdivisions != 0)
                                ? nnnn_subdivisions
                                : this->default_subdivisions;
-  
+
   Assert (n_subdivisions >= 1,
-         ExcInvalidNumberOfSubdivisions(n_subdivisions));  
+         ExcInvalidNumberOfSubdivisions(n_subdivisions));
   Assert (dof_handler != 0, ExcNoDoFHandlerSelected());
-  
+
   const unsigned int n_components   = dof_handler->get_fe().n_components();
   const unsigned int n_datasets     = dof_data.size() * n_components +
                                      cell_data.size();
-  
+
                                   // first count the cells we want to
                                   // create patches of and make sure
                                   // there is enough memory for that
@@ -265,7 +265,7 @@ void DataOutStack<dim,spacedim,DH>::build_patches (const unsigned int nnnn_subdi
                                   // cell to these points
   QTrapez<1>     q_trapez;
   QIterated<dim> patch_points (q_trapez, n_subdivisions);
-  
+
                                   // create collection objects from
                                   // single quadratures,
                                   // and finite elements. if we have
@@ -275,7 +275,7 @@ void DataOutStack<dim,spacedim,DH>::build_patches (const unsigned int nnnn_subdi
                                   // shallow copy instead
   const hp::QCollection<dim>       q_collection (patch_points);
   const hp::FECollection<dim>      fe_collection(dof_handler->get_fe());
-  
+
   hp::FEValues<dim> x_fe_patch_values (fe_collection, q_collection,
                                        update_values);
 
@@ -302,8 +302,7 @@ void DataOutStack<dim,spacedim,DH>::build_patches (const unsigned int nnnn_subdi
   for (typename DH::active_cell_iterator cell=dof_handler->begin_active();
        cell != dof_handler->end(); ++cell, ++patch, ++cell_number)
     {
-      Assert (!cell->is_ghost() &&
-             !cell->is_artificial(),
+      Assert (cell->is_locally_owned(),
              ExcNotImplemented());
 
       Assert (patch != patches.end(), ExcInternalError());
@@ -329,7 +328,7 @@ void DataOutStack<dim,spacedim,DH>::build_patches (const unsigned int nnnn_subdi
                patch->vertices[3] = Point<dim+1>(cell->vertex(1)(0),
                                                  parameter);
                break;
-               
+
           case 2:
                patch->vertices[0] = Point<dim+1>(cell->vertex(0)(0),
                                                  cell->vertex(0)(1),
@@ -356,7 +355,7 @@ void DataOutStack<dim,spacedim,DH>::build_patches (const unsigned int nnnn_subdi
                                                  cell->vertex(3)(1),
                                                  parameter);
                break;
-       
+
          default:
                Assert (false, ExcNotImplemented());
        };
@@ -373,7 +372,7 @@ void DataOutStack<dim,spacedim,DH>::build_patches (const unsigned int nnnn_subdi
          x_fe_patch_values.reinit (cell);
           const FEValues<dim> &fe_patch_values
             = x_fe_patch_values.get_present_fe_values ();
-         
+
                                           // first fill dof_data
          for (unsigned int dataset=0; dataset<dof_data.size(); ++dataset)
            {
@@ -421,7 +420,7 @@ void DataOutStack<dim,spacedim,DH>::finish_parameter_value ()
   for (typename std::vector<DataVector>::iterator i=dof_data.begin();
        i!=dof_data.end(); ++i)
     i->data.reinit (0);
-  
+
   for (typename std::vector<DataVector>::iterator i=cell_data.begin();
        i!=cell_data.end(); ++i)
     i->data.reinit (0);
@@ -463,7 +462,7 @@ std::vector<std::string> DataOutStack<dim,spacedim,DH>::get_dataset_names () con
   for (typename std::vector<DataVector>::const_iterator dataset=cell_data.begin();
        dataset!=cell_data.end(); ++dataset)
     names.insert (names.end(), dataset->names.begin(), dataset->names.end());
-  
+
   return names;
 }
 

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.