DEAL_II_NAMESPACE_OPEN
+#ifdef DEAL_II_WITH_P4EST
+
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
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
*/
unsigned int data_offset;
+#ifdef DEAL_II_WITH_MPI
/**
* Transfer particles that have crossed subdomain boundaries to other
* processors.
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
}
}
+#endif // DEAL_II_WITH_P4EST
+
DEAL_II_NAMESPACE_CLOSE
#endif
DEAL_II_NAMESPACE_OPEN
+#ifdef DEAL_II_WITH_P4EST
+
namespace Particles
{
template <int dim,int spacedim>
{
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);
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());
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();
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,
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>
}
}
+#endif
+
DEAL_II_NAMESPACE_CLOSE
DEAL_II_NAMESPACE_OPEN
+#ifdef DEAL_II_WITH_P4EST
#include "particle_handler.inst"
+#endif
DEAL_II_NAMESPACE_CLOSE
--- /dev/null
+
+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