//
// ---------------------------------------------------------------------
-#ifndef dealii__particle_particle_h
-#define dealii__particle_particle_h
+#ifndef dealii__particles_particle_h
+#define dealii__particles_particle_h
-#include <deal.II/particle/property_pool.h>
+#include <deal.II/particles/property_pool.h>
#include <deal.II/base/point.h>
#include <deal.II/base/types.h>
DEAL_II_NAMESPACE_OPEN
-namespace Particle
+/**
+ * A namespace that contains all classes that are related to the particle
+ * implementation, in particular the fundamental <code>Particle</code> class.
+ */
+namespace Particles
{
/**
* A namespace for all type definitions related to particles.
* An identifier that denotes the MPI type associated with
* types::global_dof_index.
*/
-# define ASPECT_PARTICLE_INDEX_MPI_TYPE MPI_UNSIGNED_LONG_LONG
+# define PARTICLE_INDEX_MPI_TYPE MPI_UNSIGNED_LONG_LONG
#else
/**
* The type used for indices of particles. While in
* An identifier that denotes the MPI type associated with
* types::global_dof_index.
*/
-# define ASPECT_PARTICLE_INDEX_MPI_TYPE MPI_UNSIGNED
+# define PARTICLE_INDEX_MPI_TYPE MPI_UNSIGNED
#endif
}
/**
* Constructor for Particle, creates a particle with the specified
- * ID at the specified location. Note that Aspect
- * does not check for duplicate particle IDs so the generator must
+ * ID at the specified location. Note that deal.II
+ * does not check for duplicate particle IDs so the user must
* make sure the IDs are unique over all processes.
*
- * @param[in] new_location Initial location of particle.
- * @param[in] new_reference_location Initial location of the particle
+ * @param new_location Initial location of particle.
+ * @param new_reference_location Initial location of the particle
* in the coordinate system of the reference cell.
- * @param[in] new_id Globally unique ID number of particle.
+ * @param new_id Globally unique ID number of particle.
*/
Particle (const Point<dim> &new_location,
const Point<dim> &new_reference_location,
get_location () const;
/**
- * Set the reference location of this particle. Note that this does not
- * check whether this is a valid location in the simulation domain.
+ * Set the reference location of this particle.
*
* @param [in] new_loc The new reference location for this particle.
*/
set_reference_location (const Point<dim> &new_loc);
/**
- * Get the reference location of this particle in its current cell.
- *
- * @return The reference location of this particle.
+ * Return the reference location of this particle in its current cell.
*/
const Point<dim> &
get_reference_location () const;
/**
- * Get the ID number of this particle.
- *
- * @return The id of this particle.
+ * Return the ID number of this particle.
*/
types::particle_index
get_id () const;
/**
* Current particle location in the reference cell.
- * Storing this reduces the number of times we need to compute this
- * location, which takes a significant amount of computing time.
*/
Point<dim> reference_location;
//
// ---------------------------------------------------------------------
-#ifndef dealii__particle_property_pool_h
-#define dealii__particle_property_pool_h
+#ifndef dealii__particles_property_pool_h
+#define dealii__particles_property_pool_h
#include <deal.II/base/array_view.h>
DEAL_II_NAMESPACE_OPEN
-namespace Particle
+namespace Particles
{
/**
* This class manages the memory space in which particles store their
ADD_SUBDIRECTORY(matrix_free)
ADD_SUBDIRECTORY(meshworker)
ADD_SUBDIRECTORY(opencascade)
-ADD_SUBDIRECTORY(particle)
+ADD_SUBDIRECTORY(particles)
ADD_SUBDIRECTORY(physics)
ADD_SUBDIRECTORY(non_matching)
ADD_SUBDIRECTORY(sundials)
## ---------------------------------------------------------------------
##
-## Copyright (C) 2016 by the deal.II authors
+## Copyright (C) 2017 by the deal.II authors
##
## This file is part of the deal.II library.
##
)
FILE(GLOB _header
- ${CMAKE_SOURCE_DIR}/include/deal.II/particle/*.h
+ ${CMAKE_SOURCE_DIR}/include/deal.II/particles/*.h
)
DEAL_II_ADD_LIBRARY(obj_particle OBJECT ${_src} ${_header} ${_inst})
//
// ---------------------------------------------------------------------
-#include <deal.II/particle/particle.h>
+#include <deal.II/particles/particle.h>
DEAL_II_NAMESPACE_OPEN
-namespace Particle
+namespace Particles
{
template <int dim>
Particle<dim>::Particle ()
data = static_cast<const void *> (pdata);
}
-#ifdef DEAL_II_WITH_CXX11
-
template <int dim>
Particle<dim>::Particle (Particle<dim> &&particle)
:
}
return *this;
}
-#endif
template <int dim>
Particle<dim>::~Particle ()
for (deal_II_dimension : DIMENSIONS)
{
- namespace Particle
+ namespace Particles
\{
template
class Particle <deal_II_dimension>;
// ---------------------------------------------------------------------
-#include <deal.II/particle/property_pool.h>
-#include <deal.II/particle/particle.h>
+#include <deal.II/particles/property_pool.h>
DEAL_II_NAMESPACE_OPEN
-namespace Particle
+namespace Particles
{
- const PropertyPool::Handle PropertyPool::invalid_handle = NULL;
+ const typename PropertyPool::Handle PropertyPool::invalid_handle = NULL;
PropertyPool::PropertyPool (const unsigned int n_properties_per_slot)
}
+
void
PropertyPool::reserve(const std::size_t size)
{
// check the creation and destruction of particles
#include "../tests.h"
-#include <deal.II/particle/particle.h>
+#include <deal.II/particles/particle.h>
#include <fstream>
#include <iomanip>
void test ()
{
{
- Particle::Particle<dim> particle;
+ Particles::Particle<dim> particle;
deallog << "Particle location: " << particle.get_location() << std::endl;
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2017 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 at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+
+// check Particle constructors, copy, and move operations.
+
+#include "../tests.h"
+#include <deal.II/particles/particle.h>
+#include <fstream>
+#include <iomanip>
+
+
+template <int dim>
+void test ()
+{
+ {
+ Point<2> position;
+ position(0) = 0.3;
+ position(1) = 0.5;
+
+ Point<2> reference_position;
+ reference_position(0) = 0.2;
+ reference_position(1) = 0.4;
+
+ const Particles::types::particle_index index(7);
+
+ Particles::Particle<2> particle(position,reference_position,index);
+
+ deallog << "Particle location: " << particle.get_location() << std::endl
+ << "Particle reference location: " << particle.get_reference_location() << std::endl
+ << "Particle index: " << particle.get_id() << std::endl;
+
+ const Particles::Particle<2> copy(particle);
+
+ deallog << "Copy particle location: " << copy.get_location() << std::endl
+ << "Copy particle reference location: " << copy.get_reference_location() << std::endl
+ << "Copy particle index: " << copy.get_id() << std::endl;
+
+ const Particles::Particle<2> moved_particle(std::move(particle));
+
+ deallog << "Moved particle location: " << moved_particle.get_location() << std::endl
+ << "Moved particle reference location: " << moved_particle.get_reference_location() << std::endl
+ << "Moved particle index: " << moved_particle.get_id() << std::endl;
+
+ deallog << "Original particle location: " << particle.get_location() << std::endl
+ << "Original particle reference location: " << particle.get_reference_location() << std::endl
+ << "Original particle index: " << particle.get_id() << std::endl;
+ }
+
+ deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+ initlog();
+ test<2>();
+}
--- /dev/null
+
+DEAL::Particle location: 0.300000 0.500000
+DEAL::Particle reference location: 0.200000 0.400000
+DEAL::Particle index: 7
+DEAL::Copy particle location: 0.300000 0.500000
+DEAL::Copy particle reference location: 0.200000 0.400000
+DEAL::Copy particle index: 7
+DEAL::Moved particle location: 0.300000 0.500000
+DEAL::Moved particle reference location: 0.200000 0.400000
+DEAL::Moved particle index: 7
+DEAL::Original particle location: 0.300000 0.500000
+DEAL::Original particle reference location: 0.200000 0.400000
+DEAL::Original particle index: 7
+DEAL::OK
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2017 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 at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+
+// Like particle_02, but with particle properties.
+
+#include "../tests.h"
+#include <deal.II/particles/particle.h>
+#include <fstream>
+#include <iomanip>
+
+
+template <int dim>
+void test ()
+{
+ {
+ const unsigned int n_properties_per_particle = 3;
+ Particles::PropertyPool pool(n_properties_per_particle);
+
+ Point<2> position;
+ position(0) = 0.3;
+ position(1) = 0.5;
+
+ Point<2> reference_position;
+ reference_position(0) = 0.2;
+ reference_position(1) = 0.4;
+
+ const Particles::types::particle_index index(7);
+
+ std::vector<double> properties = {0.15,0.45,0.75};
+
+ Particles::Particle<2> particle(position,reference_position,index);
+ particle.set_property_pool(pool);
+ particle.set_properties(properties);
+
+ deallog << "Particle properties: "
+ << std::vector<double>(particle.get_properties().begin(),particle.get_properties().end())
+ << std::endl;
+
+ const Particles::Particle<2> copy(particle);
+
+ deallog << "Copy particle properties: "
+ << std::vector<double>(copy.get_properties().begin(),copy.get_properties().end())
+ << std::endl;
+
+ const Particles::Particle<2> moved_particle(std::move(particle));
+
+ deallog << "Moved particle properties: "
+ << std::vector<double>(moved_particle.get_properties().begin(),moved_particle.get_properties().end())
+ << std::endl;
+ }
+
+ deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+ initlog();
+ test<2>();
+}
--- /dev/null
+
+DEAL::Particle properties: 0.150000 0.450000 0.750000
+DEAL::Copy particle properties: 0.150000 0.450000 0.750000
+DEAL::Moved particle properties: 0.150000 0.450000 0.750000
+DEAL::OK