]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make serial case compile. Disable case without p4est. 5125/head
authorRene Gassmoeller <rene.gassmoeller@mailbox.org>
Wed, 15 Nov 2017 21:04:13 +0000 (14:04 -0700)
committerRene Gassmoeller <rene.gassmoeller@mailbox.org>
Thu, 16 Nov 2017 17:11:52 +0000 (10:11 -0700)
13 files changed:
include/deal.II/particles/particle.h
include/deal.II/particles/particle_handler.h
source/particles/particle_handler.cc
tests/particles/particle_handler_01.with_p4est=true.output [moved from tests/particles/particle_handler_01.output with 100% similarity]
tests/particles/particle_handler_02.with_p4est=true.output [moved from tests/particles/particle_handler_02.output with 100% similarity]
tests/particles/particle_handler_03.with_p4est=true.output [moved from tests/particles/particle_handler_03.output with 100% similarity]
tests/particles/particle_handler_04.with_p4est=true.mpirun=2.output [moved from tests/particles/particle_handler_04.mpirun=2.output with 100% similarity]
tests/particles/particle_handler_05.with_p4est=true.output [moved from tests/particles/particle_handler_05.output with 100% similarity]
tests/particles/particle_handler_06.with_p4est=true.mpirun=2.output [moved from tests/particles/particle_handler_06.mpirun=2.output with 100% similarity]
tests/particles/particle_handler_07.cc
tests/particles/particle_handler_07.output [deleted file]
tests/particles/particle_handler_07.with_p4est=true.output [new file with mode: 0644]
tests/serialization/particle_handler_01.with_p4est=true.output [moved from tests/serialization/particle_handler_01.output with 100% similarity]

index 61bffd17faff5c0305648ec07adcc417cc978eea..693822f1cc96678dddd8014e91db16ec38fdb335 100644 (file)
@@ -42,11 +42,13 @@ namespace types
    */
   typedef unsigned long long int particle_index;
 
+#ifdef DEAL_II_WITH_MPI
   /**
    * An identifier that denotes the MPI type associated with
    * types::global_dof_index.
    */
 #  define PARTICLE_INDEX_MPI_TYPE MPI_UNSIGNED_LONG_LONG
+#endif
 #else
   /**
    * The type used for indices of particles. While in
@@ -61,12 +63,14 @@ namespace types
    */
   typedef unsigned int particle_index;
 
+#ifdef DEAL_II_WITH_MPI
   /**
    * An identifier that denotes the MPI type associated with
    * types::global_dof_index.
    */
 #  define PARTICLE_INDEX_MPI_TYPE MPI_UNSIGNED
 #endif
+#endif
 }
 
 /**
index c93c6d64d86a8d3436afc64a110a337172840fde..b5a8320c2888b5a8f0896904f74ea1c49763a580 100644 (file)
@@ -32,6 +32,8 @@
 
 DEAL_II_NAMESPACE_OPEN
 
+#ifdef DEAL_II_WITH_P4EST
+
 namespace Particles
 {
   /**
@@ -196,7 +198,7 @@ namespace Particles
                      Particle<dim,spacedim> > &particles);
 
     /**
-     * Insert a number of particles into the collection of particles.
+     * Create and insert a number of particles into the collection of particles.
      * This function takes a list of positions and creates a set of particles
      * at these positions, which are then added to the local particle
      * collection. Note that this function currently uses
@@ -300,7 +302,6 @@ namespace Particles
     void
     sort_particles_into_subdomains_and_cells();
 
-
     /**
      * Exchanges all particles that live in cells that are ghost cells to
      * other processes. Clears and re-populates the ghost_neighbors
@@ -429,6 +430,7 @@ namespace Particles
      */
     unsigned int data_offset;
 
+#ifdef DEAL_II_WITH_MPI
     /**
      * Transfer particles that have crossed subdomain boundaries to other
      * processors.
@@ -455,6 +457,7 @@ namespace Particles
                         std::multimap<internal::LevelInd,Particle <dim,spacedim> > &received_particles,
                         const std::map<types::subdomain_id, std::vector<typename Triangulation<dim,spacedim>::active_cell_iterator> > &new_cells_for_particles =
                           std::map<types::subdomain_id, std::vector<typename Triangulation<dim,spacedim>::active_cell_iterator> > ());
+#endif
 
     /**
      * Called by listener functions from Triangulation for every cell
@@ -493,6 +496,8 @@ namespace Particles
   }
 }
 
+#endif // DEAL_II_WITH_P4EST
+
 DEAL_II_NAMESPACE_CLOSE
 
 #endif
index fe7cfd4a3c21cea332e1264dbc135d36acbebefb..3b9c588459c23ce1b09dea5d70ed9a2bca678bd7 100644 (file)
@@ -22,6 +22,8 @@
 
 DEAL_II_NAMESPACE_OPEN
 
+#ifdef DEAL_II_WITH_P4EST
+
 namespace Particles
 {
   template <int dim,int spacedim>
@@ -289,17 +291,19 @@ namespace Particles
   {
     update_cached_numbers();
 
-    const types::particle_index local_next_particle_index = get_next_free_particle_index();
-    types::particle_index particles_to_add_locally = positions.size();
-
     // Determine the starting particle index of this process, which
     // is the highest currently existing particle index plus the sum
     // of the number of newly generated particles of all
-    // processes with a lower rank.
+    // processes with a lower rank if in a parallel computation.
+    const types::particle_index local_next_particle_index = get_next_free_particle_index();
     types::particle_index local_start_index = 0;
-    MPI_Scan(&particles_to_add_locally, &local_start_index, 1, PARTICLE_INDEX_MPI_TYPE, MPI_SUM, triangulation->get_communicator());
 
+#ifdef DEAL_II_WITH_MPI
+    types::particle_index particles_to_add_locally = positions.size();
+    MPI_Scan(&particles_to_add_locally, &local_start_index, 1, PARTICLE_INDEX_MPI_TYPE, MPI_SUM, triangulation->get_communicator());
     local_start_index -= particles_to_add_locally;
+#endif
+
     local_start_index += local_next_particle_index;
 
     GridTools::Cache<dim,spacedim> cache(*triangulation, *mapping);
@@ -612,8 +616,10 @@ namespace Particles
     std::multimap<internal::LevelInd,Particle <dim,spacedim> > sorted_particles_map;
 
     // Exchange particles between processors if we have more than one process
+#ifdef DEAL_II_WITH_MPI
     if (dealii::Utilities::MPI::n_mpi_processes(triangulation->get_communicator()) > 1)
       send_recv_particles(moved_particles,sorted_particles_map,moved_cells);
+#endif
 
     sorted_particles_map.insert(sorted_particles.begin(),sorted_particles.end());
 
@@ -634,6 +640,7 @@ namespace Particles
     if (dealii::Utilities::MPI::n_mpi_processes(triangulation->get_communicator()) == 1)
       return;
 
+#ifdef DEAL_II_WITH_MPI
     // First clear the current ghost_particle information
     ghost_particles.clear();
 
@@ -683,10 +690,12 @@ namespace Particles
 
     send_recv_particles(ghost_particles_by_domain,
                         ghost_particles);
+#endif
   }
 
 
 
+#ifdef DEAL_II_WITH_MPI
   template <int dim, int spacedim>
   void
   ParticleHandler<dim,spacedim>::send_recv_particles(const std::map<types::subdomain_id, std::vector<particle_iterator> > &particles_to_send,
@@ -831,6 +840,8 @@ namespace Particles
                 ExcMessage("The amount of data that was read into new particles "
                            "does not match the amount of data sent around."));
   }
+#endif
+
 
 
   template <int dim, int spacedim>
@@ -1130,10 +1141,14 @@ namespace Particles
   }
 }
 
+#endif
+
 DEAL_II_NAMESPACE_CLOSE
 
 DEAL_II_NAMESPACE_OPEN
 
+#ifdef DEAL_II_WITH_P4EST
 #include "particle_handler.inst"
+#endif
 
 DEAL_II_NAMESPACE_CLOSE
index 336b4f964a8c4053bc3dbbc0e500c7dd90956812..f97f96822e693d6d25dd856de1b234c4a93665b5 100644 (file)
@@ -44,7 +44,7 @@ void test ()
       {
         const double coordinate = static_cast<double> (i)/10.0;
         for (unsigned int j=0; j<spacedim; ++j)
-          points[i][j] = coordinate;
+          points[i][j] = 0.05 + coordinate;
       }
 
     particle_handler.insert_particles(points);
diff --git a/tests/particles/particle_handler_07.output b/tests/particles/particle_handler_07.output
deleted file mode 100644 (file)
index cbfa261..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-
-DEAL::Particle location: 0.00000 0.00000
-DEAL::Particle location: 1.00000 0.00000
-DEAL::OK
-DEAL::Particle location: 0.00000 0.00000 0.00000
-DEAL::Particle location: 1.00000 0.00000 0.00000
-DEAL::OK
diff --git a/tests/particles/particle_handler_07.with_p4est=true.output b/tests/particles/particle_handler_07.with_p4est=true.output
new file mode 100644 (file)
index 0000000..066bf60
--- /dev/null
@@ -0,0 +1,97 @@
+
+DEAL:2d/2d::Particle number: 10
+DEAL:2d/2d::Particle id 3 is in cell 2.0
+DEAL:2d/2d::     at location 0.250000 0.250000
+DEAL:2d/2d::     at reference location 1.00000 1.00000
+DEAL:2d/2d::Particle id 2 is in cell 2.0
+DEAL:2d/2d::     at location 0.150000 0.150000
+DEAL:2d/2d::     at reference location 0.600000 0.600000
+DEAL:2d/2d::Particle id 1 is in cell 2.0
+DEAL:2d/2d::     at location 0.0500000 0.0500000
+DEAL:2d/2d::     at reference location 0.200000 0.200000
+DEAL:2d/2d::Particle id 5 is in cell 2.3
+DEAL:2d/2d::     at location 0.450000 0.450000
+DEAL:2d/2d::     at reference location 0.800000 0.800000
+DEAL:2d/2d::Particle id 4 is in cell 2.3
+DEAL:2d/2d::     at location 0.350000 0.350000
+DEAL:2d/2d::     at reference location 0.400000 0.400000
+DEAL:2d/2d::Particle id 8 is in cell 2.12
+DEAL:2d/2d::     at location 0.750000 0.750000
+DEAL:2d/2d::     at reference location 1.00000 1.00000
+DEAL:2d/2d::Particle id 7 is in cell 2.12
+DEAL:2d/2d::     at location 0.650000 0.650000
+DEAL:2d/2d::     at reference location 0.600000 0.600000
+DEAL:2d/2d::Particle id 6 is in cell 2.12
+DEAL:2d/2d::     at location 0.550000 0.550000
+DEAL:2d/2d::     at reference location 0.200000 0.200000
+DEAL:2d/2d::Particle id 10 is in cell 2.15
+DEAL:2d/2d::     at location 0.950000 0.950000
+DEAL:2d/2d::     at reference location 0.800000 0.800000
+DEAL:2d/2d::Particle id 9 is in cell 2.15
+DEAL:2d/2d::     at location 0.850000 0.850000
+DEAL:2d/2d::     at reference location 0.400000 0.400000
+DEAL:2d/2d::OK
+DEAL:2d/3d::Particle number: 10
+DEAL:2d/3d::Particle id 3 is in cell 2.0
+DEAL:2d/3d::     at location 0.250000 0.250000 0.250000
+DEAL:2d/3d::     at reference location 1.00000 1.00000
+DEAL:2d/3d::Particle id 2 is in cell 2.0
+DEAL:2d/3d::     at location 0.150000 0.150000 0.150000
+DEAL:2d/3d::     at reference location 0.600000 0.600000
+DEAL:2d/3d::Particle id 1 is in cell 2.0
+DEAL:2d/3d::     at location 0.0500000 0.0500000 0.0500000
+DEAL:2d/3d::     at reference location 0.200000 0.200000
+DEAL:2d/3d::Particle id 5 is in cell 2.3
+DEAL:2d/3d::     at location 0.450000 0.450000 0.450000
+DEAL:2d/3d::     at reference location 0.800000 0.800000
+DEAL:2d/3d::Particle id 4 is in cell 2.3
+DEAL:2d/3d::     at location 0.350000 0.350000 0.350000
+DEAL:2d/3d::     at reference location 0.400000 0.400000
+DEAL:2d/3d::Particle id 8 is in cell 2.12
+DEAL:2d/3d::     at location 0.750000 0.750000 0.750000
+DEAL:2d/3d::     at reference location 1.00000 1.00000
+DEAL:2d/3d::Particle id 7 is in cell 2.12
+DEAL:2d/3d::     at location 0.650000 0.650000 0.650000
+DEAL:2d/3d::     at reference location 0.600000 0.600000
+DEAL:2d/3d::Particle id 6 is in cell 2.12
+DEAL:2d/3d::     at location 0.550000 0.550000 0.550000
+DEAL:2d/3d::     at reference location 0.200000 0.200000
+DEAL:2d/3d::Particle id 10 is in cell 2.15
+DEAL:2d/3d::     at location 0.950000 0.950000 0.950000
+DEAL:2d/3d::     at reference location 0.800000 0.800000
+DEAL:2d/3d::Particle id 9 is in cell 2.15
+DEAL:2d/3d::     at location 0.850000 0.850000 0.850000
+DEAL:2d/3d::     at reference location 0.400000 0.400000
+DEAL:2d/3d::OK
+DEAL:3d/3d::Particle number: 10
+DEAL:3d/3d::Particle id 3 is in cell 2.0
+DEAL:3d/3d::     at location 0.250000 0.250000 0.250000
+DEAL:3d/3d::     at reference location 1.00000 1.00000 1.00000
+DEAL:3d/3d::Particle id 2 is in cell 2.0
+DEAL:3d/3d::     at location 0.150000 0.150000 0.150000
+DEAL:3d/3d::     at reference location 0.600000 0.600000 0.600000
+DEAL:3d/3d::Particle id 1 is in cell 2.0
+DEAL:3d/3d::     at location 0.0500000 0.0500000 0.0500000
+DEAL:3d/3d::     at reference location 0.200000 0.200000 0.200000
+DEAL:3d/3d::Particle id 5 is in cell 2.7
+DEAL:3d/3d::     at location 0.450000 0.450000 0.450000
+DEAL:3d/3d::     at reference location 0.800000 0.800000 0.800000
+DEAL:3d/3d::Particle id 4 is in cell 2.7
+DEAL:3d/3d::     at location 0.350000 0.350000 0.350000
+DEAL:3d/3d::     at reference location 0.400000 0.400000 0.400000
+DEAL:3d/3d::Particle id 8 is in cell 2.56
+DEAL:3d/3d::     at location 0.750000 0.750000 0.750000
+DEAL:3d/3d::     at reference location 1.00000 1.00000 1.00000
+DEAL:3d/3d::Particle id 7 is in cell 2.56
+DEAL:3d/3d::     at location 0.650000 0.650000 0.650000
+DEAL:3d/3d::     at reference location 0.600000 0.600000 0.600000
+DEAL:3d/3d::Particle id 6 is in cell 2.56
+DEAL:3d/3d::     at location 0.550000 0.550000 0.550000
+DEAL:3d/3d::     at reference location 0.200000 0.200000 0.200000
+DEAL:3d/3d::Particle id 10 is in cell 2.63
+DEAL:3d/3d::     at location 0.950000 0.950000 0.950000
+DEAL:3d/3d::     at reference location 0.800000 0.800000 0.800000
+DEAL:3d/3d::Particle id 9 is in cell 2.63
+DEAL:3d/3d::     at location 0.850000 0.850000 0.850000
+DEAL:3d/3d::     at reference location 0.400000 0.400000 0.400000
+DEAL:3d/3d::OK

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.