]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Make clang++ happy by ensuring that operator== is actually declared in the same names...
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 6 Sep 2012 21:02:37 +0000 (21:02 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 6 Sep 2012 21:02:37 +0000 (21:02 +0000)
git-svn-id: https://svn.dealii.org/trunk@26244 0785d39b-7218-0410-832d-ea1e28bc413d

tests/serialization/dof_handler_01.cc
tests/serialization/triangulation_01.cc
tests/serialization/triangulation_02.cc

index 842eff65ef082aa45f45caa90bc6cf404659ab45..a3fadf7552970d69a0fb1f5f2c4c6910c45891fe 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2010, 2011 by the deal.II authors
+//    Copyright (C) 2010, 2011, 2012 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
 #include <deal.II/fe/fe_q.h>
 #include <deal.II/fe/fe_system.h>
 
-template <int dim, int spacedim>
-bool operator == (const DoFHandler<dim,spacedim> &t1,
-                 const DoFHandler<dim,spacedim> &t2)
+namespace dealii
 {
-                                  // test a few attributes, though we can't
-                                  // test everything unfortunately...
-  typename DoFHandler<dim,spacedim>::cell_iterator
-    c1 = t1.begin(),
-    c2 = t2.begin();
-  for (; (c1 != t1.end()) && (c2 != t2.end()); ++c1, ++c2)
-    {
-      for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
-       {
-         if (c1->vertex(v) != c2->vertex(v))
-           return false;
-         if (c1->vertex_index(v) != c2->vertex_index(v))
-           return false;
-       }
-
-      for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
-       {
-         if (c1->face(f)->at_boundary() != c2->face(f)->at_boundary())
-           return false;
-
-         if (c1->face(f)->at_boundary())
-           {
-             if (c1->face(f)->boundary_indicator() !=
-                 c2->face(f)->boundary_indicator())
-               return false;
-           }
-         else
-           {
-             if (c1->neighbor(f)->level() != c2->neighbor(f)->level())
-               return false;
-             if (c1->neighbor(f)->index() != c2->neighbor(f)->index())
-               return false;
-           }
-       }
-
-      if (c1->subdomain_id() != c2->subdomain_id())
-       return false;
-
-      if (c1->material_id() != c2->material_id())
-       return false;
-
-      if (c1->user_index() != c2->user_index())
-       return false;
-
-      if (c1->user_flag_set() != c2->user_flag_set())
-       return false;
-
-      if (c1->get_fe().get_name() != c2->get_fe().get_name())
-       return false;
-
-      if (c1->active_fe_index() != c2->active_fe_index())
-       return false;
-
-      // compare dofs on this cell and then on the faces
-      if (c1->has_children() == false)
+  template <int dim, int spacedim>
+  bool operator == (const DoFHandler<dim,spacedim> &t1,
+                   const DoFHandler<dim,spacedim> &t2)
+  {
+                                    // test a few attributes, though we can't
+                                    // test everything unfortunately...
+    typename DoFHandler<dim,spacedim>::cell_iterator
+      c1 = t1.begin(),
+      c2 = t2.begin();
+    for (; (c1 != t1.end()) && (c2 != t2.end()); ++c1, ++c2)
       {
-       std::vector<unsigned int> local_dofs_1 (c1->get_fe().dofs_per_cell);
-       std::vector<unsigned int> local_dofs_2 (c2->get_fe().dofs_per_cell);
+       for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
+         {
+           if (c1->vertex(v) != c2->vertex(v))
+             return false;
+           if (c1->vertex_index(v) != c2->vertex_index(v))
+             return false;
+         }
+
+       for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+         {
+           if (c1->face(f)->at_boundary() != c2->face(f)->at_boundary())
+             return false;
+
+           if (c1->face(f)->at_boundary())
+             {
+               if (c1->face(f)->boundary_indicator() !=
+                   c2->face(f)->boundary_indicator())
+                 return false;
+             }
+           else
+             {
+               if (c1->neighbor(f)->level() != c2->neighbor(f)->level())
+                 return false;
+               if (c1->neighbor(f)->index() != c2->neighbor(f)->index())
+                 return false;
+             }
+         }
+
+       if (c1->subdomain_id() != c2->subdomain_id())
+         return false;
 
-       c1->get_dof_indices (local_dofs_1);
-       c2->get_dof_indices (local_dofs_2);
-       if (local_dofs_1 != local_dofs_2)
+       if (c1->material_id() != c2->material_id())
          return false;
 
-       for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
-       {
-         std::vector<unsigned int> local_dofs_1 (c1->get_fe().dofs_per_face);
-         std::vector<unsigned int> local_dofs_2 (c2->get_fe().dofs_per_face);
-
-         c1->face(f)->get_dof_indices (local_dofs_1);
-         c2->face(f)->get_dof_indices (local_dofs_2);
-         if (local_dofs_1 != local_dofs_2)
-           return false;
-       }
+       if (c1->user_index() != c2->user_index())
+         return false;
+
+       if (c1->user_flag_set() != c2->user_flag_set())
+         return false;
+
+       if (c1->get_fe().get_name() != c2->get_fe().get_name())
+         return false;
+
+       if (c1->active_fe_index() != c2->active_fe_index())
+         return false;
+
+                                        // compare dofs on this cell and then on the faces
+       if (c1->has_children() == false)
+         {
+           std::vector<unsigned int> local_dofs_1 (c1->get_fe().dofs_per_cell);
+           std::vector<unsigned int> local_dofs_2 (c2->get_fe().dofs_per_cell);
+
+           c1->get_dof_indices (local_dofs_1);
+           c2->get_dof_indices (local_dofs_2);
+           if (local_dofs_1 != local_dofs_2)
+             return false;
+
+           for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+             {
+               std::vector<unsigned int> local_dofs_1 (c1->get_fe().dofs_per_face);
+               std::vector<unsigned int> local_dofs_2 (c2->get_fe().dofs_per_face);
+
+               c1->face(f)->get_dof_indices (local_dofs_1);
+               c2->face(f)->get_dof_indices (local_dofs_2);
+               if (local_dofs_1 != local_dofs_2)
+                 return false;
+             }
+         }
       }
-    }
-
-  // also check the order of raw iterators as they contain
-  // something about the history of the triangulation
-  typename DoFHandler<dim,spacedim>::cell_iterator
-    r1 = t1.begin_raw(),
-    r2 = t2.begin_raw();
-  for (; (r1 != t1.end()) && (r2 != t2.end()); ++r1, ++r2)
-  {
-    if (r1->level() != r2->level())
-      return false;
-    if (r1->index() != r2->index())
-      return false;
-  }
 
-  return true;
+                                    // also check the order of raw iterators as they contain
+                                    // something about the history of the triangulation
+    typename DoFHandler<dim,spacedim>::cell_iterator
+      r1 = t1.begin_raw(),
+      r2 = t2.begin_raw();
+    for (; (r1 != t1.end()) && (r2 != t2.end()); ++r1, ++r2)
+      {
+       if (r1->level() != r2->level())
+         return false;
+       if (r1->index() != r2->index())
+         return false;
+      }
+
+    return true;
+  }
 }
 
 template <int dim, int spacedim>
index 7ad05ca620c5e36ab9bd34b98a30388099ec43e8..48c7e1c725a410e32b0bd509f4f7f46af4218df8 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2010, 2011 by the deal.II authors
+//    Copyright (C) 2010, 2011, 2012 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
 #include <deal.II/grid/tria_iterator.h>
 #include <deal.II/grid/grid_generator.h>
 
-template <int dim, int spacedim>
-bool operator == (const Triangulation<dim,spacedim> &t1,
-                 const Triangulation<dim,spacedim> &t2)
+namespace dealii
 {
-                                  // test a few attributes, though we can't
-                                  // test everything unfortunately...
-  if (t1.n_active_cells() != t2.n_active_cells())
-    return false;
-  
-  if (t1.n_cells() != t2.n_cells())
-    return false;
-
-  if (t1.n_faces() != t2.n_faces())
-    return false;
-
-  typename Triangulation<dim,spacedim>::cell_iterator
-    c1 = t1.begin(),
-    c2 = t2.begin();
-  for (; (c1 != t1.end()) && (c2 != t2.end()); ++c1, ++c2)
-    {
-      for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
-       {
-         if (c1->vertex(v) != c2->vertex(v))
-           return false;
-         if (c1->vertex_index(v) != c2->vertex_index(v))
-           return false;
-       }
-
-      for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
-       {
-         if (c1->face(f)->at_boundary() != c2->face(f)->at_boundary())
-           return false;
-
-         if (c1->face(f)->at_boundary())
-           {
-             if (c1->face(f)->boundary_indicator() !=
-                 c2->face(f)->boundary_indicator())
-               return false;
-           }
-         else
-           {
-             if (c1->neighbor(f)->level() != c2->neighbor(f)->level())
-               return false;
-             if (c1->neighbor(f)->index() != c2->neighbor(f)->index())
-               return false;
-           }    
-       }
-      
-      if (c1->subdomain_id() != c2->subdomain_id())
-       return false;
-      
-      if (c1->material_id() != c2->material_id())
-       return false;
-
-      if (c1->user_index() != c2->user_index())
-       return false;
-
-      if (c1->user_flag_set() != c2->user_flag_set())
-       return false;
-    }
-
-  // also check the order of raw iterators as they contain
-  // something about the history of the triangulation
-  typename Triangulation<dim,spacedim>::cell_iterator
-    r1 = t1.begin_raw(),
-    r2 = t2.begin_raw();
-  for (; (r1 != t1.end()) && (r2 != t2.end()); ++r1, ++r2)
+  template <int dim, int spacedim>
+  bool operator == (const Triangulation<dim,spacedim> &t1,
+                   const Triangulation<dim,spacedim> &t2)
   {
-    if (r1->level() != r2->level())
+                                    // test a few attributes, though we can't
+                                    // test everything unfortunately...
+    if (t1.n_active_cells() != t2.n_active_cells())
       return false;
-    if (r1->index() != r2->index())
+
+    if (t1.n_cells() != t2.n_cells())
       return false;
-  }
 
-  return true;
+    if (t1.n_faces() != t2.n_faces())
+      return false;
+
+    typename Triangulation<dim,spacedim>::cell_iterator
+      c1 = t1.begin(),
+      c2 = t2.begin();
+    for (; (c1 != t1.end()) && (c2 != t2.end()); ++c1, ++c2)
+      {
+       for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
+         {
+           if (c1->vertex(v) != c2->vertex(v))
+             return false;
+           if (c1->vertex_index(v) != c2->vertex_index(v))
+             return false;
+         }
+
+       for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+         {
+           if (c1->face(f)->at_boundary() != c2->face(f)->at_boundary())
+             return false;
+
+           if (c1->face(f)->at_boundary())
+             {
+               if (c1->face(f)->boundary_indicator() !=
+                   c2->face(f)->boundary_indicator())
+                 return false;
+             }
+           else
+             {
+               if (c1->neighbor(f)->level() != c2->neighbor(f)->level())
+                 return false;
+               if (c1->neighbor(f)->index() != c2->neighbor(f)->index())
+                 return false;
+             }
+         }
+
+       if (c1->subdomain_id() != c2->subdomain_id())
+         return false;
+
+       if (c1->material_id() != c2->material_id())
+         return false;
+
+       if (c1->user_index() != c2->user_index())
+         return false;
+
+       if (c1->user_flag_set() != c2->user_flag_set())
+         return false;
+      }
+
+                                    // also check the order of raw iterators as they contain
+                                    // something about the history of the triangulation
+    typename Triangulation<dim,spacedim>::cell_iterator
+      r1 = t1.begin_raw(),
+      r2 = t2.begin_raw();
+    for (; (r1 != t1.end()) && (r2 != t2.end()); ++r1, ++r2)
+      {
+       if (r1->level() != r2->level())
+         return false;
+       if (r1->index() != r2->index())
+         return false;
+      }
+
+    return true;
+  }
 }
 
+
 template <int dim, int spacedim>
 void do_boundary (Triangulation<dim,spacedim> &t1)
 {
@@ -127,7 +131,7 @@ void test ()
   tria_1.begin_active()->set_refine_flag (RefinementCase<dim>::cut_x);
 
   do_boundary (tria_1);
-  
+
   verify (tria_1, tria_2);
 }
 
@@ -145,6 +149,6 @@ int main ()
   test<2,2> ();
   test<2,3> ();
   test<3,3> ();
-    
+
   deallog << "OK" << std::endl;
 }
index b4312be84948376e40f1f2c5fd1161857921695e..ddd53dff5e273b5cea4cf3392ae4e50633896d38 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2010, 2011 by the deal.II authors
+//    Copyright (C) 2010, 2011, 2012 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
 #include "../../include/deal.II/grid/tria.h"
 
 
-template <int dim, int spacedim>
-bool operator == (const Triangulation<dim,spacedim> &t1,
-                 const Triangulation<dim,spacedim> &t2)
+namespace dealii
 {
-                                  // test a few attributes, though we can't
-                                  // test everything unfortunately...
-  if (t1.n_active_cells() != t2.n_active_cells())
-    return false;
-  
-  if (t1.n_cells() != t2.n_cells())
-    return false;
-
-  if (t1.n_faces() != t2.n_faces())
-    return false;
-
-  typename Triangulation<dim,spacedim>::cell_iterator
-    c1 = t1.begin(),
-    c2 = t2.begin();
-  for (; (c1 != t1.end()) && (c2 != t2.end()); ++c1, ++c2)
-    {
-      for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
-       {
-         if (c1->vertex(v) != c2->vertex(v))
-           return false;
-         if (c1->vertex_index(v) != c2->vertex_index(v))
-           return false;
-       }
-
-      for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
-       {
-         if (c1->face(f)->at_boundary() != c2->face(f)->at_boundary())
-           return false;
-
-         if (c1->face(f)->at_boundary())
-           {
-             if (c1->face(f)->boundary_indicator() !=
-                 c2->face(f)->boundary_indicator())
-               return false;
-           }
-         else
-           {
-             if (c1->neighbor(f)->level() != c2->neighbor(f)->level())
-               return false;
-             if (c1->neighbor(f)->index() != c2->neighbor(f)->index())
-               return false;
-           }    
-       }
-      
-      if (c1->subdomain_id() != c2->subdomain_id())
-       return false;
-      
-      if (c1->material_id() != c2->material_id())
-       return false;
-
-      if (c1->user_index() != c2->user_index())
-       return false;
-
-      if (c1->user_flag_set() != c2->user_flag_set())
-       return false;
-    }
-
-  // also check the order of raw iterators as they contain
-  // something about the history of the triangulation
-  typename Triangulation<dim,spacedim>::cell_iterator
-    r1 = t1.begin_raw(),
-    r2 = t2.begin_raw();
-  for (; (r1 != t1.end()) && (r2 != t2.end()); ++r1, ++r2)
+  template <int dim, int spacedim>
+  bool operator == (const Triangulation<dim,spacedim> &t1,
+                   const Triangulation<dim,spacedim> &t2)
   {
-    if (r1->level() != r2->level())
+                                    // test a few attributes, though we can't
+                                    // test everything unfortunately...
+    if (t1.n_active_cells() != t2.n_active_cells())
       return false;
-    if (r1->index() != r2->index())
+
+    if (t1.n_cells() != t2.n_cells())
       return false;
-  }
 
-  return true;
+    if (t1.n_faces() != t2.n_faces())
+      return false;
+
+    typename Triangulation<dim,spacedim>::cell_iterator
+      c1 = t1.begin(),
+      c2 = t2.begin();
+    for (; (c1 != t1.end()) && (c2 != t2.end()); ++c1, ++c2)
+      {
+       for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
+         {
+           if (c1->vertex(v) != c2->vertex(v))
+             return false;
+           if (c1->vertex_index(v) != c2->vertex_index(v))
+             return false;
+         }
+
+       for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+         {
+           if (c1->face(f)->at_boundary() != c2->face(f)->at_boundary())
+             return false;
+
+           if (c1->face(f)->at_boundary())
+             {
+               if (c1->face(f)->boundary_indicator() !=
+                   c2->face(f)->boundary_indicator())
+                 return false;
+             }
+           else
+             {
+               if (c1->neighbor(f)->level() != c2->neighbor(f)->level())
+                 return false;
+               if (c1->neighbor(f)->index() != c2->neighbor(f)->index())
+                 return false;
+             }
+         }
+
+       if (c1->subdomain_id() != c2->subdomain_id())
+         return false;
+
+       if (c1->material_id() != c2->material_id())
+         return false;
+
+       if (c1->user_index() != c2->user_index())
+         return false;
+
+       if (c1->user_flag_set() != c2->user_flag_set())
+         return false;
+      }
+
+                                    // also check the order of raw iterators as they contain
+                                    // something about the history of the triangulation
+    typename Triangulation<dim,spacedim>::cell_iterator
+      r1 = t1.begin_raw(),
+      r2 = t2.begin_raw();
+    for (; (r1 != t1.end()) && (r2 != t2.end()); ++r1, ++r2)
+      {
+       if (r1->level() != r2->level())
+         return false;
+       if (r1->index() != r2->index())
+         return false;
+      }
+
+    return true;
+  }
 }
 
+
 template <int dim, int spacedim>
 void do_boundary (Triangulation<dim,spacedim> &t1)
 {
@@ -132,7 +136,7 @@ void test ()
   // now add one cell again
   tria_1.begin_active()->set_refine_flag ();
   tria_1.execute_coarsening_and_refinement();
-  
+
   tria_1.begin_active()->set_subdomain_id (1);
   tria_1.begin_active()->set_material_id (2);
   tria_1.begin_active()->set_user_index (3);
@@ -140,7 +144,7 @@ void test ()
   tria_1.begin_active()->set_refine_flag (RefinementCase<dim>::cut_x);
 
   do_boundary (tria_1);
-  
+
   verify (tria_1, tria_2);
 }
 
@@ -158,6 +162,6 @@ int main ()
   test<2,2> ();
   test<2,3> ();
   test<3,3> ();
-    
+
   deallog << "OK" << std::endl;
 }

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.