From: Rene Gassmoeller Date: Wed, 15 Nov 2017 21:04:13 +0000 (-0700) Subject: Make serial case compile. Disable case without p4est. X-Git-Tag: v9.0.0-rc1~763^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F5125%2Fhead;p=dealii.git Make serial case compile. Disable case without p4est. --- diff --git a/include/deal.II/particles/particle.h b/include/deal.II/particles/particle.h index 61bffd17fa..693822f1cc 100644 --- a/include/deal.II/particles/particle.h +++ b/include/deal.II/particles/particle.h @@ -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 } /** diff --git a/include/deal.II/particles/particle_handler.h b/include/deal.II/particles/particle_handler.h index c93c6d64d8..b5a8320c28 100644 --- a/include/deal.II/particles/particle_handler.h +++ b/include/deal.II/particles/particle_handler.h @@ -32,6 +32,8 @@ DEAL_II_NAMESPACE_OPEN +#ifdef DEAL_II_WITH_P4EST + namespace Particles { /** @@ -196,7 +198,7 @@ namespace Particles Particle > &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 > &received_particles, const std::map::active_cell_iterator> > &new_cells_for_particles = std::map::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 diff --git a/source/particles/particle_handler.cc b/source/particles/particle_handler.cc index fe7cfd4a3c..3b9c588459 100644 --- a/source/particles/particle_handler.cc +++ b/source/particles/particle_handler.cc @@ -22,6 +22,8 @@ DEAL_II_NAMESPACE_OPEN +#ifdef DEAL_II_WITH_P4EST + namespace Particles { template @@ -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 cache(*triangulation, *mapping); @@ -612,8 +616,10 @@ namespace Particles std::multimap > 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 void ParticleHandler::send_recv_particles(const std::map > &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 @@ -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 diff --git a/tests/particles/particle_handler_01.output b/tests/particles/particle_handler_01.with_p4est=true.output similarity index 100% rename from tests/particles/particle_handler_01.output rename to tests/particles/particle_handler_01.with_p4est=true.output diff --git a/tests/particles/particle_handler_02.output b/tests/particles/particle_handler_02.with_p4est=true.output similarity index 100% rename from tests/particles/particle_handler_02.output rename to tests/particles/particle_handler_02.with_p4est=true.output diff --git a/tests/particles/particle_handler_03.output b/tests/particles/particle_handler_03.with_p4est=true.output similarity index 100% rename from tests/particles/particle_handler_03.output rename to tests/particles/particle_handler_03.with_p4est=true.output diff --git a/tests/particles/particle_handler_04.mpirun=2.output b/tests/particles/particle_handler_04.with_p4est=true.mpirun=2.output similarity index 100% rename from tests/particles/particle_handler_04.mpirun=2.output rename to tests/particles/particle_handler_04.with_p4est=true.mpirun=2.output diff --git a/tests/particles/particle_handler_05.output b/tests/particles/particle_handler_05.with_p4est=true.output similarity index 100% rename from tests/particles/particle_handler_05.output rename to tests/particles/particle_handler_05.with_p4est=true.output diff --git a/tests/particles/particle_handler_06.mpirun=2.output b/tests/particles/particle_handler_06.with_p4est=true.mpirun=2.output similarity index 100% rename from tests/particles/particle_handler_06.mpirun=2.output rename to tests/particles/particle_handler_06.with_p4est=true.mpirun=2.output diff --git a/tests/particles/particle_handler_07.cc b/tests/particles/particle_handler_07.cc index 336b4f964a..f97f96822e 100644 --- a/tests/particles/particle_handler_07.cc +++ b/tests/particles/particle_handler_07.cc @@ -44,7 +44,7 @@ void test () { const double coordinate = static_cast (i)/10.0; for (unsigned int j=0; j