]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix compilation without MPI. 1747/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 13 Oct 2015 13:05:42 +0000 (08:05 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 13 Oct 2015 15:30:14 +0000 (10:30 -0500)
This also fixes an issue where using std_cxx11::tuple did not work because
BOOST does not provide an operator< for it (C++11 appears to do so).

source/grid/grid_tools.cc

index 5ebdd7d29ec632bc6717eac5e01ef6379022b349..72ecb6e84ccbd09202e086fd75958a8973a5a0e2 100644 (file)
@@ -1643,6 +1643,18 @@ next_cell:
   {
     std::map<unsigned int,types::global_vertex_index> local_to_global_vertex_index;
 
+#ifndef DEAL_II_WITH_MPI
+
+    // without MPI, this function doesn't make sense because on cannot
+    // use parallel::distributed::Triangulation in any meaninful
+    // way
+    (void)triangulation;
+    Assert (false, ExcMessage ("This function does not make any sense "
+                               "for parallel::distributed::Triangulation "
+                               "objects if you do not have MPI enabled."));
+
+#else
+
     typedef typename Triangulation<dim,spacedim>::active_cell_iterator active_cell_iterator;
     const std::vector<std::set<active_cell_iterator> > vertex_to_cell =
       vertex_to_cell_map(triangulation);
@@ -1650,7 +1662,7 @@ next_cell:
     // Create a local index for the locally "owned" vertices
     types::global_vertex_index next_index = 0;
     unsigned int max_cellid_size = 0;
-    std::set<std_cxx11::tuple<types::subdomain_id,types::global_vertex_index> > vertices_added;
+    std::set<std::pair<types::subdomain_id,types::global_vertex_index> > vertices_added;
     std::map<types::subdomain_id,std::set<unsigned int> > vertices_to_recv;
     std::map<types::subdomain_id,std::vector<std_cxx11::tuple<types::global_vertex_index,
         types::global_vertex_index,std::string> > > vertices_to_send;
@@ -1689,7 +1701,7 @@ next_cell:
                         for (; adjacent_cell!=end_adj_cell; ++adjacent_cell)
                           if ((*adjacent_cell)->subdomain_id()!=cell->subdomain_id())
                             {
-                              std_cxx11::tuple<types::subdomain_id,types::global_vertex_index>
+                              std::pair<types::subdomain_id,types::global_vertex_index>
                               tmp((*adjacent_cell)->subdomain_id(), cell->vertex_index(i));
                               if (vertices_added.find(tmp)==vertices_added.end())
                                 {
@@ -1741,6 +1753,7 @@ next_cell:
               }
           }
       }
+
     // Get the size of the largest CellID string
     max_cellid_size = Utilities::MPI::max(max_cellid_size, triangulation.get_communicator());
 
@@ -1783,9 +1796,9 @@ next_cell:
         // fill the buffer
         for (unsigned int j=0; j<n_vertices; ++j)
           {
-            vertices_send_buffers[i][2*j] = std::get<0>(vert_to_send_it->second[j]);
+            vertices_send_buffers[i][2*j] = std_cxx11::get<0>(vert_to_send_it->second[j]);
             vertices_send_buffers[i][2*j+1] =
-              local_to_global_vertex_index[std::get<1>(vert_to_send_it->second[j])];
+              local_to_global_vertex_index[std_cxx11::get<1>(vert_to_send_it->second[j])];
           }
 
         // Send the message
@@ -1828,7 +1841,7 @@ next_cell:
         unsigned int pos = 0;
         for (unsigned int j=0; j<n_vertices; ++j)
           {
-            std::string cell_id = std::get<2>(vert_to_send_it->second[j]);
+            std::string cell_id = std_cxx11::get<2>(vert_to_send_it->second[j]);
             for (unsigned int k=0; k<max_cellid_size; ++k, ++pos)
               {
                 if (k<cell_id.size())
@@ -1896,6 +1909,7 @@ next_cell:
               }
           }
       }
+#endif
 
     return local_to_global_vertex_index;
   }

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.