get_coarse_cell_to_p4est_tree_permutation() const;
/**
- * Join faces in the p4est forest for periodic boundary conditions. As a
+ * In addition to the action in the base class Triangulation, this function
+ * joins faces in the p4est forest for periodic boundary conditions. As a
* result, each pair of faces will differ by at most one refinement
* level and ghost neighbors will be available across these faces.
*
* once is possible, but not recommended: The function destroys and
* rebuilds the p4est forest each time it is called.
*/
- void
+ virtual void
add_periodicity
(const std::vector<GridTools::PeriodicFacePair<cell_iterator> > &);
distorted_cells;
};
+ /**
+ * If add_periodicity() is called, this variable stores the given
+ * periodic face pairs on level 0 for later access during the
+ * identification of ghost cells for the multigrid hierarchy.
+ */
+ std::vector<GridTools::PeriodicFacePair<cell_iterator> > periodic_face_pairs_level_0;
+
+ /**
+ * If add_periodicity() is called, this variable stores the active periodic face pairs.
+ * The variable is updated on refinement.
+ */
+ std::map<GridTools::PeriodicFacePair<cell_iterator>, GridTools::PeriodicFacePair<cell_iterator> > periodic_face_map;
/**
* Make the dimension available in function templates.
void load (Archive &ar,
const unsigned int version);
+
+ /**
+ * Declare the (coarse) face pairs given in the argument of this function
+ * as periodic. This way it it possible to obtain neighbors across periodic
+ * boundaries.
+ * This function initializes ActivePeriodicFacePairs and on refinement this
+ *
+ * The vector can be filled by the function
+ * GridTools::collect_periodic_faces.
+ *
+ * For more information on periodic boundary conditions see
+ * GridTools::collect_periodic_faces,
+ * DoFTools::make_periodicity_constraints and step-45.
+ *
+ * @note Before this function can be used the Triangulation has to be
+ * initialized and must not be refined.
+ */
+ virtual void
+ add_periodicity
+ (const std::vector<GridTools::PeriodicFacePair<cell_iterator> > &);
+
+
BOOST_SERIALIZATION_SPLIT_MEMBER()
/**
AssertThrow (false, ExcInternalError());
}
- periodic_face_pairs_level_0.insert(periodic_face_pairs_level_0.end(),
- periodicity_vector.begin(),
- periodicity_vector.end());
-
+ //finally call the base class for storing the periodicity information
+ Triangulation<dim, spacedim>::add_periodicity(periodicity_vector);
#else
Assert(false, ExcMessage ("Need p4est version >= 0.3.4.1!"));
#endif
}
+template <int dim, int spacedim>
+virtual void
+Triangulation<dim, spacedim>::add_periodicity()
+{
+ periodic_face_pairs_level_0.insert(periodic_face_pairs_level_0.end(),
+ periodicity_vector.begin(),
+ periodicity_vector.end());
+}
template <int dim, int spacedim>
void