--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2017 - 2018 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+
+// check the particle generation using the
+// Particles::Generator::regular_reference_locations function.
+
+#include <deal.II/distributed/tria.h>
+
+#include <deal.II/fe/mapping_q.h>
+
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/grid_tools.h>
+
+#include <deal.II/particles/particle_generator.h>
+#include <deal.II/particles/particle_handler.h>
+
+#include "../tests.h"
+
+template <int dim, int spacedim>
+void
+test()
+{
+ {
+ parallel::distributed::Triangulation<dim, spacedim> tr(MPI_COMM_WORLD);
+
+ GridGenerator::hyper_cube(tr);
+ tr.refine_global(1);
+ MappingQ<dim, spacedim> mapping(1);
+
+ Particles::ParticleHandler<dim, spacedim> particle_handler(tr, mapping);
+
+ std::vector<Point<dim>> particle_reference_locations(1, Point<dim>());
+
+ for (unsigned int i = 0; i < dim; ++i)
+ particle_reference_locations[0](i) = 0.5;
+
+ Particles::Generator::regular_reference_locations(
+ tr, particle_reference_locations, particle_handler);
+
+ deallog << "Particle number: " << particle_handler.n_global_particles()
+ << std::endl;
+
+ for (const auto &particle : particle_handler)
+ {
+ deallog << "Particle location: " << particle.get_location()
+ << std::endl;
+ deallog << "Particle reference location: "
+ << particle.get_reference_location() << std::endl;
+ }
+ }
+
+ deallog << "OK" << std::endl;
+}
+
+
+
+int
+main(int argc, char *argv[])
+{
+ Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
+
+ initlog();
+
+ deallog.push("2d/2d");
+ test<2, 2>();
+ deallog.pop();
+ deallog.push("2d/3d");
+ test<2, 3>();
+ deallog.pop();
+ deallog.push("3d/3d");
+ test<3, 3>();
+ deallog.pop();
+}
--- /dev/null
+
+DEAL:2d/2d::Particle number: 4
+DEAL:2d/2d::Particle location: 0.250000 0.250000
+DEAL:2d/2d::Particle reference location: 0.500000 0.500000
+DEAL:2d/2d::Particle location: 0.750000 0.250000
+DEAL:2d/2d::Particle reference location: 0.500000 0.500000
+DEAL:2d/2d::Particle location: 0.250000 0.750000
+DEAL:2d/2d::Particle reference location: 0.500000 0.500000
+DEAL:2d/2d::Particle location: 0.750000 0.750000
+DEAL:2d/2d::Particle reference location: 0.500000 0.500000
+DEAL:2d/2d::OK
+DEAL:2d/3d::Particle number: 4
+DEAL:2d/3d::Particle location: 0.250000 0.250000 0.00000
+DEAL:2d/3d::Particle reference location: 0.500000 0.500000
+DEAL:2d/3d::Particle location: 0.750000 0.250000 0.00000
+DEAL:2d/3d::Particle reference location: 0.500000 0.500000
+DEAL:2d/3d::Particle location: 0.250000 0.750000 0.00000
+DEAL:2d/3d::Particle reference location: 0.500000 0.500000
+DEAL:2d/3d::Particle location: 0.750000 0.750000 0.00000
+DEAL:2d/3d::Particle reference location: 0.500000 0.500000
+DEAL:2d/3d::OK
+DEAL:3d/3d::Particle number: 8
+DEAL:3d/3d::Particle location: 0.250000 0.250000 0.250000
+DEAL:3d/3d::Particle reference location: 0.500000 0.500000 0.500000
+DEAL:3d/3d::Particle location: 0.750000 0.250000 0.250000
+DEAL:3d/3d::Particle reference location: 0.500000 0.500000 0.500000
+DEAL:3d/3d::Particle location: 0.250000 0.750000 0.250000
+DEAL:3d/3d::Particle reference location: 0.500000 0.500000 0.500000
+DEAL:3d/3d::Particle location: 0.750000 0.750000 0.250000
+DEAL:3d/3d::Particle reference location: 0.500000 0.500000 0.500000
+DEAL:3d/3d::Particle location: 0.250000 0.250000 0.750000
+DEAL:3d/3d::Particle reference location: 0.500000 0.500000 0.500000
+DEAL:3d/3d::Particle location: 0.750000 0.250000 0.750000
+DEAL:3d/3d::Particle reference location: 0.500000 0.500000 0.500000
+DEAL:3d/3d::Particle location: 0.250000 0.750000 0.750000
+DEAL:3d/3d::Particle reference location: 0.500000 0.500000 0.500000
+DEAL:3d/3d::Particle location: 0.750000 0.750000 0.750000
+DEAL:3d/3d::Particle reference location: 0.500000 0.500000 0.500000
+DEAL:3d/3d::OK