]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
More conversions to compile only once.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 9 Nov 2010 16:15:01 +0000 (16:15 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 9 Nov 2010 16:15:01 +0000 (16:15 +0000)
git-svn-id: https://svn.dealii.org/trunk@22648 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/grid/persistent_tria.all_dimensions.cc [moved from deal.II/source/grid/persistent_tria.cc with 94% similarity]
deal.II/source/grid/tria_levels.all_dimensions.cc [moved from deal.II/source/grid/tria_levels.cc with 95% similarity]
deal.II/source/grid/tria_objects.all_dimensions.cc
deal.II/source/grid/tria_objects.cc [deleted file]
deal.II/source/grid/tria_objects.inst.in [new file with mode: 0644]

similarity index 94%
rename from deal.II/source/grid/persistent_tria.cc
rename to deal.II/source/grid/persistent_tria.all_dimensions.cc
index c73f84bcdf3b69afc9822bcb4a6d9695d91c3125..c9544f913122a85cc52539267ffad8e0c58e5732 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2009 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2009, 2010 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -29,7 +29,7 @@ template <int dim>
 PersistentTriangulation<dim>::
 PersistentTriangulation (const Triangulation<dim> &coarse_grid)
                 :
-               coarse_grid (&coarse_grid, typeid(*this).name()) 
+               coarse_grid (&coarse_grid, typeid(*this).name())
 {}
 
 
@@ -52,14 +52,14 @@ PersistentTriangulation (const PersistentTriangulation<dim> &old_tria)
 
 
 template <int dim>
-PersistentTriangulation<dim>::~PersistentTriangulation () 
+PersistentTriangulation<dim>::~PersistentTriangulation ()
 {}
 
 
 
 template <int dim>
 void
-PersistentTriangulation<dim>::execute_coarsening_and_refinement () 
+PersistentTriangulation<dim>::execute_coarsening_and_refinement ()
 {
                                   // first save flags
   refine_flags.push_back (std::vector<bool>());
@@ -79,10 +79,10 @@ PersistentTriangulation<dim>::execute_coarsening_and_refinement ()
 template <int dim>
 void
 PersistentTriangulation<dim>::restore ()
-{  
+{
                                   // for each of the previous
                                   // refinement sweeps
-  for (unsigned int i=0; i<refine_flags.size()+1; ++i) 
+  for (unsigned int i=0; i<refine_flags.size()+1; ++i)
     restore(i);
 }
 
@@ -105,7 +105,7 @@ PersistentTriangulation<dim>::restore (const unsigned int step)
     {
       Assert(step<refine_flags.size()+1,
             ExcDimensionMismatch(step, refine_flags.size()+1));
-      
+
       this->load_refine_flags  (refine_flags[step-1]);
       this->load_coarsen_flags (coarsen_flags[step-1]);
 
@@ -126,7 +126,7 @@ PersistentTriangulation<dim>::n_refinement_steps() const
 
 template <int dim>
 void
-PersistentTriangulation<dim>::copy_triangulation (const Triangulation<dim> &old_grid) 
+PersistentTriangulation<dim>::copy_triangulation (const Triangulation<dim> &old_grid)
 {
   this->clear ();
   coarse_grid  = &old_grid;
@@ -164,7 +164,7 @@ void
 PersistentTriangulation<dim>::write_flags(std::ostream &out) const
 {
   const unsigned int n_flag_levels=refine_flags.size();
-  
+
   AssertThrow (out, ExcIO());
 
   out << mn_persistent_tria_flags_begin << ' ' << n_flag_levels << std::endl;
@@ -176,7 +176,7 @@ PersistentTriangulation<dim>::write_flags(std::ostream &out) const
       this->write_bool_vector (mn_tria_coarsen_flags_begin, coarsen_flags[i],
                                mn_tria_coarsen_flags_end, out);
     }
-  
+
   out << mn_persistent_tria_flags_end << std::endl;
 
   AssertThrow (out, ExcIO());
@@ -191,7 +191,7 @@ PersistentTriangulation<dim>::read_flags(std::istream &in)
   Assert(refine_flags.size()==0 && coarsen_flags.size()==0,
         ExcFlagsNotCleared());
   AssertThrow (in, ExcIO());
-  
+
   unsigned int magic_number;
   in >> magic_number;
   AssertThrow(magic_number==mn_persistent_tria_flags_begin,
@@ -208,7 +208,7 @@ PersistentTriangulation<dim>::read_flags(std::istream &in)
       this->read_bool_vector (mn_tria_coarsen_flags_begin, coarsen_flags.back(),
                               mn_tria_coarsen_flags_end, in);
     }
-  
+
   in >> magic_number;
   AssertThrow(magic_number==mn_persistent_tria_flags_end,
              typename Triangulation<dim>::ExcGridReadError());
@@ -240,7 +240,9 @@ PersistentTriangulation<dim>::memory_consumption () const
 
 
 // explicit instantiations
-template class PersistentTriangulation<deal_II_dimension>;
+template class PersistentTriangulation<1>;
+template class PersistentTriangulation<2>;
+template class PersistentTriangulation<3>;
 
 DEAL_II_NAMESPACE_CLOSE
 
similarity index 95%
rename from deal.II/source/grid/tria_levels.cc
rename to deal.II/source/grid/tria_levels.all_dimensions.cc
index c128b113761fba63fdfbeae35291df04d9f9d009..b5f4766605171855b661fa56f3a4c9058f3d2658 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2006, 2007 by the deal.II authors
+//    Copyright (C) 2006, 2007, 2010 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -34,28 +34,28 @@ namespace internal
                                        //
                                        // note that all arrays should have equal
                                        // sizes (checked by @p{monitor_memory}
-      if (total_cells > refine_flags.size()) 
+      if (total_cells > refine_flags.size())
         {
           refine_flags.reserve (total_cells);
           refine_flags.insert (refine_flags.end(),
                                total_cells - refine_flags.size(),
                                RefinementCase<dim>::no_refinement);
-      
+
           coarsen_flags.reserve (total_cells);
           coarsen_flags.insert (coarsen_flags.end(),
                                 total_cells - coarsen_flags.size(),
                                 false);
-      
+
           subdomain_ids.reserve (total_cells);
           subdomain_ids.insert (subdomain_ids.end(),
                                 total_cells - subdomain_ids.size(),
                                 0);
-          
+
           parents.reserve ((int) (total_cells + 1) / 2);
           parents.insert (parents.end (),
                           (total_cells + 1) / 2 - parents.size (),
                           -1);
-      
+
           neighbors.reserve (total_cells*(2*dimension));
           neighbors.insert (neighbors.end(),
                             total_cells*(2*dimension) - neighbors.size(),
@@ -110,8 +110,7 @@ namespace internal
 
 // This specialization should be only temporary, until the TriaObjects
 // classes are straightened out.
-    
-#if deal_II_dimension == 3
+
     void
     TriaLevel<3>::reserve_space (const unsigned int total_cells,
                                 const unsigned int dimension)
@@ -123,28 +122,28 @@ namespace internal
                                        //
                                        // note that all arrays should have equal
                                        // sizes (checked by @p{monitor_memory}
-      if (total_cells > refine_flags.size()) 
+      if (total_cells > refine_flags.size())
         {
           refine_flags.reserve (total_cells);
           refine_flags.insert (refine_flags.end(),
                                total_cells - refine_flags.size(),
                                RefinementCase<3>::no_refinement);
-      
+
           coarsen_flags.reserve (total_cells);
           coarsen_flags.insert (coarsen_flags.end(),
                                 total_cells - coarsen_flags.size(),
                                 false);
-      
+
           subdomain_ids.reserve (total_cells);
           subdomain_ids.insert (subdomain_ids.end(),
                                 total_cells - subdomain_ids.size(),
                                 0);
-          
+
           parents.reserve ((int) (total_cells + 1) / 2);
           parents.insert (parents.end (),
                           (total_cells + 1) / 2 - parents.size (),
                           -1);
-      
+
           neighbors.reserve (total_cells*(2*dimension));
           neighbors.insert (neighbors.end(),
                             total_cells*(2*dimension) - neighbors.size(),
@@ -194,16 +193,12 @@ namespace internal
               MemoryConsumption::memory_consumption (cells) +
               MemoryConsumption::memory_consumption (refine_flags));
     }
-
-#endif
-    
   }
 }
 
-#if deal_II_dimension != 3
-template class internal::Triangulation::TriaLevel<deal_II_dimension>;
-#endif
 
+template class internal::Triangulation::TriaLevel<1>;
+template class internal::Triangulation::TriaLevel<2>;
 
 DEAL_II_NAMESPACE_CLOSE
 
index 4950342b1d88cfddecdafbfecba1ffba43f9ff38..a1301d281fcece1f7d4e017402bcccd3f4b4d071 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2006, 2007 by the deal.II authors
+//    Copyright (C) 2006, 2007, 2010 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
 #include <algorithm>
 #include <functional>
 
-    
+
 
 DEAL_II_NAMESPACE_OPEN
 
 namespace internal
 {
   namespace Triangulation
-  {    
+  {
     template<>
     void
     TriaObjects<TriaObject<1> >::reserve_space (const unsigned int new_lines_in_pairs,
@@ -39,7 +39,7 @@ namespace internal
       next_free_single=0;
       next_free_pair=0;
       reverse_order_next_free_single=false;
-      
+
                                       // count the number of lines, of
                                       // unused single lines and of
                                       // unused pairs of lines
@@ -83,23 +83,23 @@ namespace internal
        new_size+=additional_single_lines;
 
                                        // only allocate space if necessary
-      if (new_size>cells.size()) 
+      if (new_size>cells.size())
         {
           cells.reserve (new_size);
           cells.insert (cells.end(),
                        new_size-cells.size(),
                        TriaObject<1> ());
-  
+
           used.reserve (new_size);
           used.insert (used.end(),
                       new_size-used.size(),
                       false);
-  
+
           user_flags.reserve (new_size);
           user_flags.insert (user_flags.end(),
                             new_size-user_flags.size(),
                             false);
-      
+
           children.reserve (new_size);
           children.insert (children.end(),
                           new_size-children.size(),
@@ -124,13 +124,114 @@ namespace internal
     }
 
 
+    template <>
+    template <int dim, int spacedim>
+    typename dealii::Triangulation<dim,spacedim>::raw_line_iterator
+    TriaObjects<TriaObject<1> >::next_free_single_line (const dealii::Triangulation<dim,spacedim> &tria)
+    {
+                                      // TODO: Think of a way to ensure that we are using the correct triangulation, i.e. the one containing *this.
+
+      int pos=next_free_single,
+        last=used.size()-1;
+      if (!reverse_order_next_free_single)
+       {
+                                          // first sweep forward, only use
+                                          // really single slots, do not use
+                                          // pair slots
+         for (; pos<last; ++pos)
+           if (!used[pos])
+             if (used[++pos])
+               {
+                                                  // this was a single slot
+                 pos-=1;
+                 break;
+               }
+         if (pos>=last)
+           {
+             reverse_order_next_free_single=true;
+             next_free_single=used.size()-1;
+             pos=used.size()-1;
+           }
+         else
+           next_free_single=pos+1;
+       }
+
+      if(reverse_order_next_free_single)
+       {
+                                          // second sweep, use all slots, even
+                                          // in pairs
+         for(;pos>=0;--pos)
+           if (!used[pos])
+             break;
+         if (pos>0)
+           next_free_single=pos-1;
+         else
+                                            // no valid single line anymore
+           return tria.end_line();
+       }
+
+      return typename dealii::Triangulation<dim,spacedim>::raw_line_iterator(&tria,0,pos);
+    }
+
+
+
+    template <>
+    template <int dim, int spacedim>
+    typename dealii::Triangulation<dim,spacedim>::raw_line_iterator
+    TriaObjects<TriaObject<1> >::next_free_pair_line (const dealii::Triangulation<dim,spacedim> &tria)
+    {
+                                      // TODO: Think of a way to ensure that we are using the correct triangulation, i.e. the one containing *this.
+
+      int pos=next_free_pair,
+        last=used.size()-1;
+      for (; pos<last; ++pos)
+       if (!used[pos])
+         if (!used[++pos])
+           {
+                                              // this was a pair slot
+             pos-=1;
+             break;
+           }
+      if (pos>=last)
+                                        // no free slot
+       return tria.end_line();
+      else
+       next_free_pair=pos+2;
+
+      return typename dealii::Triangulation<dim,spacedim>::raw_line_iterator(&tria,0,pos);
+    }
+
+
+
+    template <>
+    template <int dim, int spacedim>
+    typename dealii::Triangulation<dim,spacedim>::raw_quad_iterator
+    TriaObjects<TriaObject<1> >::next_free_single_quad (const dealii::Triangulation<dim,spacedim> &tria)
+    {
+      Assert(false, ExcWrongIterator("quad","line"));
+      return tria.end_quad();
+    }
+
+
+
+    template <>
+    template <int dim, int spacedim>
+    typename dealii::Triangulation<dim,spacedim>::raw_quad_iterator
+    TriaObjects<TriaObject<1> >::next_free_pair_quad (const dealii::Triangulation<dim,spacedim> &tria)
+    {
+      Assert(false, ExcWrongIterator("quad","line"));
+      return tria.end_quad();
+    }
+
+
+
     template<>
     void
     TriaObjects<TriaObject<2> >::reserve_space (const unsigned int new_quads_in_pairs,
                                      const unsigned int new_quads_single)
     {
       Assert(new_quads_in_pairs%2==0, ExcInternalError());
-      
+
       next_free_single=0;
       next_free_pair=0;
       reverse_order_next_free_single=false;
@@ -184,17 +285,17 @@ namespace internal
           cells.insert (cells.end(),
                        new_size-cells.size(),
                        TriaObject<2> ());
-      
+
           used.reserve (new_size);
           used.insert (used.end(),
                       new_size-used.size(),
                       false);
-  
+
           user_flags.reserve (new_size);
           user_flags.insert (user_flags.end(),
                             new_size-user_flags.size(),
                             false);
-  
+
           children.reserve (2*new_size);
           children.insert (children.end(),
                           2*new_size-children.size(),
@@ -204,7 +305,7 @@ namespace internal
          refinement_cases.insert (refinement_cases.end(),
                               new_size - refinement_cases.size(),
                               RefinementCase<2>::no_refinement);
-         
+
 
           material_id.reserve (new_size);
           material_id.insert (material_id.end(),
@@ -225,6 +326,139 @@ namespace internal
     }
 
 
+
+
+    template <>
+    template <int dim, int spacedim>
+    typename dealii::Triangulation<dim,spacedim>::raw_quad_iterator
+    TriaObjects<TriaObject<2> >::next_free_single_quad (const dealii::Triangulation<dim,spacedim> &tria)
+    {
+                                      // TODO: Think of a way to ensure that we are using the correct triangulation, i.e. the one containing *this.
+
+      int pos=next_free_single,
+        last=used.size()-1;
+      if (!reverse_order_next_free_single)
+       {
+                                          // first sweep forward, only use
+                                          // really single slots, do not use
+                                          // pair slots
+         for (; pos<last; ++pos)
+           if (!used[pos])
+             if (used[++pos])
+               {
+                                                  // this was a single slot
+                 pos-=1;
+                 break;
+               }
+         if (pos>=last)
+           {
+             reverse_order_next_free_single=true;
+             next_free_single=used.size()-1;
+             pos=used.size()-1;
+           }
+         else
+           next_free_single=pos+1;
+       }
+
+      if(reverse_order_next_free_single)
+       {
+                                          // second sweep, use all slots, even
+                                          // in pairs
+         for(;pos>=0;--pos)
+           if (!used[pos])
+             break;
+         if (pos>0)
+           next_free_single=pos-1;
+         else
+                                            // no valid single quad anymore
+           return tria.end_quad();
+       }
+
+      return typename dealii::Triangulation<dim,spacedim>::raw_quad_iterator(&tria,0,pos);
+    }
+
+
+
+    template <>
+    template <int dim, int spacedim>
+    typename dealii::Triangulation<dim,spacedim>::raw_quad_iterator
+    TriaObjects<TriaObject<2> >::next_free_pair_quad (const dealii::Triangulation<dim,spacedim> &tria)
+    {
+                                      // TODO: Think of a way to ensure that we are using the correct triangulation, i.e. the one containing *this.
+
+      int pos=next_free_pair,
+        last=used.size()-1;
+      for (; pos<last; ++pos)
+       if (!used[pos])
+         if (!used[++pos])
+           {
+                                              // this was a pair slot
+             pos-=1;
+             break;
+           }
+      if (pos>=last)
+                                        // no free slot
+       return tria.end_quad();
+      else
+       next_free_pair=pos+2;
+
+      return typename dealii::Triangulation<dim,spacedim>::raw_quad_iterator(&tria,0,pos);
+    }
+
+
+    template <>
+    template <int dim, int spacedim>
+    typename dealii::Triangulation<dim,spacedim>::raw_line_iterator
+    TriaObjects<TriaObject<2> >::next_free_single_line (const dealii::Triangulation<dim,spacedim> &tria)
+    {
+      Assert(false, ExcWrongIterator("line","quad"));
+      return tria.end_line();
+    }
+
+
+
+    template <>
+    template <int dim, int spacedim>
+    typename dealii::Triangulation<dim,spacedim>::raw_line_iterator
+    TriaObjects<TriaObject<2> >::next_free_pair_line (const dealii::Triangulation<dim,spacedim> &tria)
+    {
+      Assert(false, ExcWrongIterator("line","quad"));
+      return tria.end_line();
+    }
+
+
+
+
+    template <>
+    template <int dim, int spacedim>
+    typename dealii::Triangulation<dim,spacedim>::raw_hex_iterator
+    TriaObjects<TriaObject<3> >::next_free_hex (const dealii::Triangulation<dim,spacedim> &tria,
+                                           const unsigned int               level)
+    {
+                                      // TODO: Think of a way to ensure that we are using the correct triangulation, i.e. the one containing *this.
+
+      int pos=next_free_pair,
+        last=used.size()-1;
+      for (; pos<last; ++pos)
+       if (!used[pos])
+         {
+                                            // this should be a pair slot
+             Assert(!used[pos+1], ExcInternalError());
+             break;
+           }
+      if (pos>=last)
+                                        // no free slot
+       return tria.end_hex();
+      else
+       next_free_pair=pos+2;
+
+      return typename dealii::Triangulation<dim,spacedim>::raw_hex_iterator(&tria,level,pos);
+    }
+
+
+
+
+
     void
     TriaObjectsHex::reserve_space (const unsigned int new_hexes)
     {
@@ -240,17 +474,17 @@ namespace internal
           cells.insert (cells.end(),
                        new_size-cells.size(),
                        TriaObject<3> ());
-      
+
           used.reserve (new_size);
           used.insert (used.end(),
                       new_size-used.size(),
                       false);
-  
+
           user_flags.reserve (new_size);
           user_flags.insert (user_flags.end(),
                             new_size-user_flags.size(),
                             false);
-  
+
           children.reserve (4*new_size);
           children.insert (children.end(),
                           4*new_size-children.size(),
@@ -343,7 +577,7 @@ namespace internal
        used.size() + new_quads_in_pairs - 2*n_unused_pairs;
       if (additional_single_quads>0)
        new_size+=additional_single_quads;
-      
+
                                        // see above...
       if (new_size>cells.size())
         {
@@ -364,7 +598,7 @@ namespace internal
          reverse_order_next_free_single=true;
        }
     }
-    
+
 
     template<>
     void
@@ -514,7 +748,7 @@ namespace internal
               ExcMemoryInexact (cells.size() * GeometryInfo<2>::lines_per_cell,
                                 line_orientations.size()));
       TriaObjects<TriaObject<2> >::monitor_memory (3);
-      
+
     }
 
 
@@ -531,7 +765,7 @@ namespace internal
       user_data.clear();
       user_data_type = data_unknown;
     }
-    
+
 
     void
     TriaObjectsHex::clear()
@@ -549,8 +783,8 @@ namespace internal
       TriaObjects<TriaObject<2> >::clear();
       line_orientations.clear();
     }
-    
-    
+
+
     template<typename G>
     unsigned int
     TriaObjects<G>::memory_consumption () const
@@ -563,7 +797,7 @@ namespace internal
               MemoryConsumption::memory_consumption (refinement_cases) +
              user_data.capacity() * sizeof(UserData) + sizeof(user_data));
     }
-  
+
 
     unsigned int
     TriaObjectsHex::memory_consumption () const
@@ -582,12 +816,13 @@ namespace internal
              this->TriaObjects<TriaObject<2> >::memory_consumption() );
     }
 
-    
 
-                                    // explicit instantiations
 
+// explicit instantiations
     template class TriaObjects<TriaObject<1> >;
     template class TriaObjects<TriaObject<2> >;
+
+    #include "tria_objects.inst"
   }
 }
 
diff --git a/deal.II/source/grid/tria_objects.cc b/deal.II/source/grid/tria_objects.cc
deleted file mode 100644 (file)
index d284273..0000000
+++ /dev/null
@@ -1,289 +0,0 @@
-//---------------------------------------------------------------------------
-//    $Id$
-//    Version: $Name$
-//
-//    Copyright (C) 2006, 2007 by the deal.II authors
-//
-//    This file is subject to QPL and may not be  distributed
-//    without copyright and license information. Please refer
-//    to the file deal.II/doc/license.html for the  text  and
-//    further information on this license.
-//
-//---------------------------------------------------------------------------
-
-
-#include <base/memory_consumption.h>
-#include <grid/tria.h>
-#include <grid/tria_objects.h>
-#include <grid/tria_iterator.h>
-#include <grid/tria_accessor.h>
-
-    
-
-DEAL_II_NAMESPACE_OPEN
-
-namespace internal
-{
-  namespace Triangulation
-  {    
-    template <>
-    template <int dim, int spacedim>
-    typename dealii::Triangulation<dim,spacedim>::raw_line_iterator
-    TriaObjects<TriaObject<1> >::next_free_single_line (const dealii::Triangulation<dim,spacedim> &tria)
-    {
-                                      // TODO: Think of a way to ensure that we are using the correct triangulation, i.e. the one containing *this.
-      
-      int pos=next_free_single,
-        last=used.size()-1;
-      if (!reverse_order_next_free_single)
-       {
-                                          // first sweep forward, only use
-                                          // really single slots, do not use
-                                          // pair slots
-         for (; pos<last; ++pos)
-           if (!used[pos])
-             if (used[++pos])
-               {
-                                                  // this was a single slot
-                 pos-=1;
-                 break;
-               }
-         if (pos>=last)
-           {
-             reverse_order_next_free_single=true;
-             next_free_single=used.size()-1;
-             pos=used.size()-1;
-           }
-         else
-           next_free_single=pos+1;
-       }
-      
-      if(reverse_order_next_free_single)
-       {
-                                          // second sweep, use all slots, even
-                                          // in pairs
-         for(;pos>=0;--pos)
-           if (!used[pos])
-             break;
-         if (pos>0)
-           next_free_single=pos-1;
-         else
-                                            // no valid single line anymore
-           return tria.end_line();
-       }
-
-      return typename dealii::Triangulation<dim,spacedim>::raw_line_iterator(&tria,0,pos);
-    }
-    
-         
-
-    template <>
-    template <int dim, int spacedim>
-    typename dealii::Triangulation<dim,spacedim>::raw_line_iterator
-    TriaObjects<TriaObject<1> >::next_free_pair_line (const dealii::Triangulation<dim,spacedim> &tria)
-    {
-                                      // TODO: Think of a way to ensure that we are using the correct triangulation, i.e. the one containing *this.
-      
-      int pos=next_free_pair,
-        last=used.size()-1;
-      for (; pos<last; ++pos)
-       if (!used[pos])
-         if (!used[++pos])
-           {
-                                              // this was a pair slot
-             pos-=1;
-             break;
-           }
-      if (pos>=last)
-                                        // no free slot
-       return tria.end_line();
-      else
-       next_free_pair=pos+2;
-      
-      return typename dealii::Triangulation<dim,spacedim>::raw_line_iterator(&tria,0,pos);
-    }
-
-
-    
-    template <>
-    template <int dim, int spacedim>
-    typename dealii::Triangulation<dim,spacedim>::raw_quad_iterator
-    TriaObjects<TriaObject<1> >::next_free_single_quad (const dealii::Triangulation<dim,spacedim> &tria)
-    {
-      Assert(false, ExcWrongIterator("quad","line"));
-      return tria.end_quad();
-    }
-
-
-
-    template <>
-    template <int dim, int spacedim>
-    typename dealii::Triangulation<dim,spacedim>::raw_quad_iterator
-    TriaObjects<TriaObject<1> >::next_free_pair_quad (const dealii::Triangulation<dim,spacedim> &tria)
-    {
-      Assert(false, ExcWrongIterator("quad","line"));
-      return tria.end_quad();
-    }
-
-
-    
-    template <>
-    template <int dim, int spacedim>
-    typename dealii::Triangulation<dim,spacedim>::raw_quad_iterator
-    TriaObjects<TriaObject<2> >::next_free_single_quad (const dealii::Triangulation<dim,spacedim> &tria)
-    {
-                                      // TODO: Think of a way to ensure that we are using the correct triangulation, i.e. the one containing *this.
-      
-      int pos=next_free_single,
-        last=used.size()-1;
-      if (!reverse_order_next_free_single)
-       {
-                                          // first sweep forward, only use
-                                          // really single slots, do not use
-                                          // pair slots
-         for (; pos<last; ++pos)
-           if (!used[pos])
-             if (used[++pos])
-               {
-                                                  // this was a single slot
-                 pos-=1;
-                 break;
-               }
-         if (pos>=last)
-           {
-             reverse_order_next_free_single=true;
-             next_free_single=used.size()-1;
-             pos=used.size()-1;
-           }
-         else
-           next_free_single=pos+1;
-       }
-      
-      if(reverse_order_next_free_single)
-       {
-                                          // second sweep, use all slots, even
-                                          // in pairs
-         for(;pos>=0;--pos)
-           if (!used[pos])
-             break;
-         if (pos>0)
-           next_free_single=pos-1;
-         else
-                                            // no valid single quad anymore
-           return tria.end_quad();
-       }
-
-      return typename dealii::Triangulation<dim,spacedim>::raw_quad_iterator(&tria,0,pos);
-    }
-    
-         
-
-    template <>
-    template <int dim, int spacedim>
-    typename dealii::Triangulation<dim,spacedim>::raw_quad_iterator
-    TriaObjects<TriaObject<2> >::next_free_pair_quad (const dealii::Triangulation<dim,spacedim> &tria)
-    {
-                                      // TODO: Think of a way to ensure that we are using the correct triangulation, i.e. the one containing *this.
-      
-      int pos=next_free_pair,
-        last=used.size()-1;
-      for (; pos<last; ++pos)
-       if (!used[pos])
-         if (!used[++pos])
-           {
-                                              // this was a pair slot
-             pos-=1;
-             break;
-           }
-      if (pos>=last)
-                                        // no free slot
-       return tria.end_quad();
-      else
-       next_free_pair=pos+2;
-      
-      return typename dealii::Triangulation<dim,spacedim>::raw_quad_iterator(&tria,0,pos);
-    }
-
-
-    template <>
-    template <int dim, int spacedim>
-    typename dealii::Triangulation<dim,spacedim>::raw_line_iterator
-    TriaObjects<TriaObject<2> >::next_free_single_line (const dealii::Triangulation<dim,spacedim> &tria)
-    {
-      Assert(false, ExcWrongIterator("line","quad"));
-      return tria.end_line();
-    }
-
-
-
-    template <>
-    template <int dim, int spacedim>
-    typename dealii::Triangulation<dim,spacedim>::raw_line_iterator
-    TriaObjects<TriaObject<2> >::next_free_pair_line (const dealii::Triangulation<dim,spacedim> &tria)
-    {
-      Assert(false, ExcWrongIterator("line","quad"));
-      return tria.end_line();
-    }
-
-
-
-    template <>
-    template <int dim, int spacedim>
-    typename dealii::Triangulation<dim,spacedim>::raw_hex_iterator
-    TriaObjects<TriaObject<3> >::next_free_hex (const dealii::Triangulation<dim,spacedim> &tria,
-                                           const unsigned int               level)
-    {
-                                      // TODO: Think of a way to ensure that we are using the correct triangulation, i.e. the one containing *this.
-      
-      int pos=next_free_pair,
-        last=used.size()-1;
-      for (; pos<last; ++pos)
-       if (!used[pos])
-         {
-                                            // this should be a pair slot
-             Assert(!used[pos+1], ExcInternalError());
-             break;
-           }
-      if (pos>=last)
-                                        // no free slot
-       return tria.end_hex();
-      else
-       next_free_pair=pos+2;
-      
-      return typename dealii::Triangulation<dim,spacedim>::raw_hex_iterator(&tria,level,pos);
-    }
-
-
-    
-
-
-                                    // explicit instantiations
-
-#if deal_II_dimension > 1
-    template dealii::Triangulation<deal_II_dimension>::raw_line_iterator
-    TriaObjects<TriaObject<1> >::next_free_single_line(const dealii::Triangulation<deal_II_dimension> &);
-    template dealii::Triangulation<deal_II_dimension>::raw_line_iterator
-    TriaObjects<TriaObject<1> >::next_free_pair_line(const dealii::Triangulation<deal_II_dimension> &);
-    template dealii::Triangulation<deal_II_dimension>::raw_quad_iterator
-    TriaObjects<TriaObject<1> >::next_free_single_quad(const dealii::Triangulation<deal_II_dimension> &);
-    template dealii::Triangulation<deal_II_dimension>::raw_quad_iterator
-    TriaObjects<TriaObject<1> >::next_free_pair_quad(const dealii::Triangulation<deal_II_dimension> &);
-
-    template dealii::Triangulation<deal_II_dimension>::raw_line_iterator
-    TriaObjects<TriaObject<2> >::next_free_single_line(const dealii::Triangulation<deal_II_dimension> &);
-    template dealii::Triangulation<deal_II_dimension>::raw_line_iterator
-    TriaObjects<TriaObject<2> >::next_free_pair_line(const dealii::Triangulation<deal_II_dimension> &);
-    template dealii::Triangulation<deal_II_dimension>::raw_quad_iterator
-    TriaObjects<TriaObject<2> >::next_free_single_quad(const dealii::Triangulation<deal_II_dimension> &);
-    template dealii::Triangulation<deal_II_dimension>::raw_quad_iterator
-    TriaObjects<TriaObject<2> >::next_free_pair_quad(const dealii::Triangulation<deal_II_dimension> &);
-#endif
-#if deal_II_dimension == 3
-    template dealii::Triangulation<deal_II_dimension>::raw_hex_iterator
-    TriaObjects<TriaObject<3> >::next_free_hex(const dealii::Triangulation<deal_II_dimension> &, const unsigned int);
-#endif
-  }
-}
-
-DEAL_II_NAMESPACE_CLOSE
-
diff --git a/deal.II/source/grid/tria_objects.inst.in b/deal.II/source/grid/tria_objects.inst.in
new file mode 100644 (file)
index 0000000..76fc125
--- /dev/null
@@ -0,0 +1,39 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2006, 2007, 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+for (deal_II_dimension : DIMENSIONS)
+  {
+#if deal_II_dimension > 1
+    template dealii::Triangulation<deal_II_dimension>::raw_line_iterator
+    TriaObjects<TriaObject<1> >::next_free_single_line(const dealii::Triangulation<deal_II_dimension> &);
+    template dealii::Triangulation<deal_II_dimension>::raw_line_iterator
+    TriaObjects<TriaObject<1> >::next_free_pair_line(const dealii::Triangulation<deal_II_dimension> &);
+    template dealii::Triangulation<deal_II_dimension>::raw_quad_iterator
+    TriaObjects<TriaObject<1> >::next_free_single_quad(const dealii::Triangulation<deal_II_dimension> &);
+    template dealii::Triangulation<deal_II_dimension>::raw_quad_iterator
+    TriaObjects<TriaObject<1> >::next_free_pair_quad(const dealii::Triangulation<deal_II_dimension> &);
+
+    template dealii::Triangulation<deal_II_dimension>::raw_line_iterator
+    TriaObjects<TriaObject<2> >::next_free_single_line(const dealii::Triangulation<deal_II_dimension> &);
+    template dealii::Triangulation<deal_II_dimension>::raw_line_iterator
+    TriaObjects<TriaObject<2> >::next_free_pair_line(const dealii::Triangulation<deal_II_dimension> &);
+    template dealii::Triangulation<deal_II_dimension>::raw_quad_iterator
+    TriaObjects<TriaObject<2> >::next_free_single_quad(const dealii::Triangulation<deal_II_dimension> &);
+    template dealii::Triangulation<deal_II_dimension>::raw_quad_iterator
+    TriaObjects<TriaObject<2> >::next_free_pair_quad(const dealii::Triangulation<deal_II_dimension> &);
+#endif
+#if deal_II_dimension == 3
+    template dealii::Triangulation<deal_II_dimension>::raw_hex_iterator
+    TriaObjects<TriaObject<3> >::next_free_hex(const dealii::Triangulation<deal_II_dimension> &, const unsigned int);
+#endif
+  }

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.