// ---------------------------------------------------------------------
#ifndef dealii_grid_tools_h
-# define dealii_grid_tools_h
+#define dealii_grid_tools_h
-# include <deal.II/base/config.h>
+#include <deal.II/base/config.h>
-# include <deal.II/base/bounding_box.h>
-# include <deal.II/base/geometry_info.h>
-# include <deal.II/base/std_cxx17/optional.h>
+#include <deal.II/base/bounding_box.h>
+#include <deal.II/base/geometry_info.h>
+#include <deal.II/base/point.h>
+#include <deal.II/base/std_cxx17/optional.h>
-# include <deal.II/boost_adaptors/bounding_box.h>
+#include <deal.II/boost_adaptors/bounding_box.h>
-# include <deal.II/distributed/shared_tria.h>
+#include <deal.II/distributed/shared_tria.h>
-# include <deal.II/dofs/dof_handler.h>
+#include <deal.II/dofs/dof_handler.h>
-# include <deal.II/fe/fe_values.h>
-# include <deal.II/fe/mapping.h>
-# include <deal.II/fe/mapping_q1.h>
+#include <deal.II/fe/fe_values.h>
+#include <deal.II/fe/mapping.h>
+#include <deal.II/fe/mapping_q1.h>
-# include <deal.II/grid/manifold.h>
-# include <deal.II/grid/tria.h>
-# include <deal.II/grid/tria_accessor.h>
-# include <deal.II/grid/tria_iterator.h>
+#include <deal.II/grid/manifold.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
-# include <deal.II/hp/dof_handler.h>
+#include <deal.II/hp/dof_handler.h>
-# include <deal.II/lac/la_parallel_vector.h>
-# include <deal.II/lac/la_vector.h>
-# include <deal.II/lac/petsc_vector.h>
-# include <deal.II/lac/sparsity_tools.h>
-# include <deal.II/lac/trilinos_vector.h>
+#include <deal.II/lac/la_parallel_vector.h>
+#include <deal.II/lac/la_vector.h>
+#include <deal.II/lac/petsc_vector.h>
+#include <deal.II/lac/sparsity_tools.h>
+#include <deal.II/lac/trilinos_vector.h>
-# include <deal.II/numerics/rtree.h>
+#include <deal.II/numerics/rtree.h>
DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
-# include <boost/archive/binary_iarchive.hpp>
-# include <boost/archive/binary_oarchive.hpp>
-# include <boost/geometry/index/rtree.hpp>
-# include <boost/random/mersenne_twister.hpp>
-# include <boost/serialization/array.hpp>
-# include <boost/serialization/vector.hpp>
-
-# ifdef DEAL_II_WITH_ZLIB
-# include <boost/iostreams/device/back_inserter.hpp>
-# include <boost/iostreams/filter/gzip.hpp>
-# include <boost/iostreams/filtering_stream.hpp>
-# include <boost/iostreams/stream.hpp>
-# endif
+#include <boost/archive/binary_iarchive.hpp>
+#include <boost/archive/binary_oarchive.hpp>
+#include <boost/geometry/index/rtree.hpp>
+#include <boost/random/mersenne_twister.hpp>
+#include <boost/serialization/array.hpp>
+#include <boost/serialization/vector.hpp>
+
+#ifdef DEAL_II_WITH_ZLIB
+# include <boost/iostreams/device/back_inserter.hpp>
+# include <boost/iostreams/filter/gzip.hpp>
+# include <boost/iostreams/filtering_stream.hpp>
+# include <boost/iostreams/stream.hpp>
+#endif
DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
-# include <bitset>
-# include <list>
-# include <set>
+#include <bitset>
+#include <list>
+#include <set>
DEAL_II_NAMESPACE_OPEN
// Forward declarations
-# ifndef DOXYGEN
+#ifndef DOXYGEN
namespace parallel
{
namespace distributed
}
class SparsityPattern;
-# endif
+#endif
namespace internal
{
class ActiveCellIterator
{
public:
-# ifndef _MSC_VER
+#ifndef _MSC_VER
using type = typename MeshType::active_cell_iterator;
-# else
+#else
using type = TriaActiveIterator<dealii::CellAccessor<dim, spacedim>>;
-# endif
+#endif
};
-# ifdef _MSC_VER
+#ifdef _MSC_VER
template <int dim, int spacedim>
class ActiveCellIterator<dim, spacedim, dealii::DoFHandler<dim, spacedim>>
{
using type =
TriaActiveIterator<dealii::DoFCellAccessor<dim, spacedim, false>>;
};
-# endif
+#endif
} // namespace internal
/**
void
rotate(const double angle, Triangulation<dim> &triangulation);
+ /**
+ * Rotate all vertices of the given @p triangulation in counter-clockwise
+ * direction around the @p axis described by a unit vector. Otherwise like the
+ * function above.
+ *
+ * @param[in] angle Angle in radians to rotate the Triangulation by.
+ * @param[in] axis A unit vector that defines the axis of rotation.
+ * @param[in,out] triangulation The Triangulation object to rotate.
+ *
+ * @note Implemented for spacedim=3 and dim=1, 2, and 3.
+ */
+ template <int dim>
+ void
+ rotate(const double angle,
+ const Point<3, double> &axis,
+ Triangulation<dim, 3> & triangulation);
+
/**
* Rotate all vertices of the given @p triangulation in counter-clockwise
* direction around the axis with the given index. Otherwise like the
* @param[in,out] triangulation The Triangulation object to rotate.
*
* @note Implemented for dim=1, 2, and 3.
+ *
+ * @deprecated Use the alternative with the unit vector instead.
*/
template <int dim>
- void
+ DEAL_II_DEPRECATED_EARLY void
rotate(const double angle,
const unsigned int axis,
Triangulation<dim, 3> &triangulation);
* the performance if the function is called only once on few points.
*/
template <int dim, int spacedim>
-# ifndef DOXYGEN
+#ifndef DOXYGEN
std::tuple<
std::vector<typename Triangulation<dim, spacedim>::active_cell_iterator>,
std::vector<std::vector<Point<dim>>>,
std::vector<std::vector<unsigned int>>>
-# else
+#else
return_type
-# endif
+#endif
compute_point_locations(
const Cache<dim, spacedim> & cache,
const std::vector<Point<spacedim>> &points,
* GridTools::compute_point_locations().
*/
template <int dim, int spacedim>
-# ifndef DOXYGEN
+#ifndef DOXYGEN
std::tuple<
std::vector<typename Triangulation<dim, spacedim>::active_cell_iterator>,
std::vector<std::vector<Point<dim>>>,
std::vector<std::vector<unsigned int>>,
std::vector<unsigned int>>
-# else
+#else
return_type
-# endif
+#endif
compute_point_locations_try_all(
const Cache<dim, spacedim> & cache,
const std::vector<Point<spacedim>> &points,
* of this page.
*/
template <int dim, int spacedim>
-# ifndef DOXYGEN
+#ifndef DOXYGEN
std::tuple<
std::vector<typename Triangulation<dim, spacedim>::active_cell_iterator>,
std::vector<std::vector<Point<dim>>>,
std::vector<std::vector<unsigned int>>,
std::vector<std::vector<Point<spacedim>>>,
std::vector<std::vector<unsigned int>>>
-# else
+#else
return_type
-# endif
+#endif
distributed_compute_point_locations(
const GridTools::Cache<dim, spacedim> & cache,
const std::vector<Point<spacedim>> & local_points,
* for this case.
*/
template <int dim, template <int, int> class MeshType, int spacedim>
-# ifndef _MSC_VER
+#ifndef _MSC_VER
std::vector<typename MeshType<dim, spacedim>::active_cell_iterator>
-# else
+#else
std::vector<
typename dealii::internal::
ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type>
-# endif
+#endif
find_cells_adjacent_to_vertex(const MeshType<dim, spacedim> &container,
const unsigned int vertex_index);
* processor will return a locally owned cell and the other one a ghost cell.
*/
template <int dim, template <int, int> class MeshType, int spacedim>
-# ifndef _MSC_VER
+#ifndef _MSC_VER
std::pair<typename MeshType<dim, spacedim>::active_cell_iterator, Point<dim>>
-# else
+#else
std::pair<typename dealii::internal::
ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type,
Point<dim>>
-# endif
+#endif
find_active_cell_around_point(const Mapping<dim, spacedim> & mapping,
const MeshType<dim, spacedim> &mesh,
const Point<spacedim> & p,
* @return An iterator into the mesh that points to the surrounding cell.
*/
template <int dim, template <int, int> class MeshType, int spacedim>
-# ifndef _MSC_VER
+#ifndef _MSC_VER
typename MeshType<dim, spacedim>::active_cell_iterator
-# else
+#else
typename dealii::internal::
ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type
-# endif
+#endif
find_active_cell_around_point(const MeshType<dim, spacedim> &mesh,
const Point<spacedim> & p,
const std::vector<bool> &marked_vertices = {},
* call the function above with argument `cache` in this case.
*/
template <int dim, template <int, int> class MeshType, int spacedim>
-# ifndef _MSC_VER
+#ifndef _MSC_VER
std::pair<typename MeshType<dim, spacedim>::active_cell_iterator, Point<dim>>
-# else
+#else
std::pair<typename dealii::internal::
ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type,
Point<dim>>
-# endif
+#endif
find_active_cell_around_point(
const Mapping<dim, spacedim> & mapping,
const MeshType<dim, spacedim> &mesh,
* @endcode
*/
template <int dim, template <int, int> class MeshType, int spacedim>
-# ifndef _MSC_VER
+#ifndef _MSC_VER
std::vector<std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
Point<dim>>>
-# else
+#else
std::vector<std::pair<
typename dealii::internal::
ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type,
Point<dim>>>
-# endif
+#endif
find_all_active_cells_around_point(
const Mapping<dim, spacedim> & mapping,
const MeshType<dim, spacedim> &mesh,
* function find_all_active_cells_around_point() above.
*/
template <int dim, template <int, int> class MeshType, int spacedim>
-# ifndef _MSC_VER
+#ifndef _MSC_VER
std::vector<std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
Point<dim>>>
-# else
+#else
std::vector<std::pair<
typename dealii::internal::
ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type,
Point<dim>>>
-# endif
+#endif
find_all_active_cells_around_point(
const Mapping<dim, spacedim> & mapping,
const MeshType<dim, spacedim> &mesh,
* of this page.
*/
template <int spacedim>
-# ifndef DOXYGEN
+#ifndef DOXYGEN
std::tuple<std::vector<std::vector<unsigned int>>,
std::map<unsigned int, unsigned int>,
std::map<unsigned int, std::vector<unsigned int>>>
-# else
+#else
return_type
-# endif
+#endif
guess_point_owner(
const std::vector<std::vector<BoundingBox<spacedim>>> &global_bboxes,
const std::vector<Point<spacedim>> & points);
* of this page.
*/
template <int spacedim>
-# ifndef DOXYGEN
+#ifndef DOXYGEN
std::tuple<std::map<unsigned int, std::vector<unsigned int>>,
std::map<unsigned int, unsigned int>,
std::map<unsigned int, std::vector<unsigned int>>>
-# else
+#else
return_type
-# endif
+#endif
guess_point_owner(
const RTree<std::pair<BoundingBox<spacedim>, unsigned int>> &covering_rtree,
const std::vector<Point<spacedim>> & points);
void
load(Archive &ar, const unsigned int version);
-# ifdef DOXYGEN
+#ifdef DOXYGEN
/**
* Read or write the data of this object to or from a stream for the
* purpose of serialization using the [BOOST serialization
template <class Archive>
void
serialize(Archive &archive, const unsigned int version);
-# else
+#else
// This macro defines the serialize() method that is compatible with
// the templated save() and load() method that have been implemented.
BOOST_SERIALIZATION_SPLIT_MEMBER()
-# endif
+#endif
};
/* ----------------- Template function --------------- */
-# ifndef DOXYGEN
+#ifndef DOXYGEN
namespace GridTools
{
MeshType::space_dimension> &)>
&compute_ghost_owners)
{
-# ifndef DEAL_II_WITH_MPI
+# ifndef DEAL_II_WITH_MPI
(void)mesh;
(void)pack;
(void)unpack;
(void)process_cells;
(void)compute_ghost_owners;
Assert(false, ExcNeedsMPI());
-# else
+# else
constexpr int dim = MeshType::dimension;
constexpr int spacedim = MeshType::space_dimension;
auto tria =
}
-# endif // DEAL_II_WITH_MPI
+# endif // DEAL_II_WITH_MPI
}
} // namespace internal
const std::function<bool(const typename MeshType::active_cell_iterator &)>
&cell_filter)
{
-# ifndef DEAL_II_WITH_MPI
+# ifndef DEAL_II_WITH_MPI
(void)mesh;
(void)pack;
(void)unpack;
(void)cell_filter;
Assert(false, ExcNeedsMPI());
-# else
+# else
internal::exchange_cell_data<DataType,
MeshType,
typename MeshType::active_cell_iterator>(
process(cell, cell->subdomain_id());
},
[](const auto &tria) { return tria.ghost_owners(); });
-# endif
+# endif
}
const std::function<bool(const typename MeshType::level_cell_iterator &)>
&cell_filter)
{
-# ifndef DEAL_II_WITH_MPI
+# ifndef DEAL_II_WITH_MPI
(void)mesh;
(void)pack;
(void)unpack;
(void)cell_filter;
Assert(false, ExcNeedsMPI());
-# else
+# else
internal::exchange_cell_data<DataType,
MeshType,
typename MeshType::level_cell_iterator>(
process(cell, cell->level_subdomain_id());
},
[](const auto &tria) { return tria.level_ghost_owners(); });
-# endif
+# endif
}
} // namespace GridTools
-# endif
+#endif // DOXYGEN
DEAL_II_NAMESPACE_CLOSE
-/*---------------------------- grid_tools.h ---------------------------*/
-/* end of #ifndef dealii_grid_tools_h */
#endif
-/*---------------------------- grid_tools.h ---------------------------*/