Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <array> 7 : #include <cstddef> 8 : #include <unordered_map> 9 : #include <vector> 10 : 11 : /// \cond 12 : namespace amr { 13 : enum class Flag; 14 : template <size_t> 15 : struct Info; 16 : } // namespace amr 17 : template <size_t> 18 : class Element; 19 : template <size_t> 20 : class ElementId; 21 : template <size_t> 22 : class Mesh; 23 : /// \endcond 24 : 25 : namespace amr::projectors { 26 : /// Given `old_mesh` returns a new Mesh based on the refinement `flags` 27 : template <size_t Dim> 28 1 : Mesh<Dim> mesh(const Mesh<Dim>& old_mesh, 29 : const std::array<amr::Flag, Dim>& flags); 30 : 31 : /// Given the Mesh%es for a set of joining Element%s, returns the Mesh 32 : /// for the newly created parent Element. 33 : /// 34 : /// \details In each dimension the extent of the parent Mesh will be the 35 : /// maximum over the extents of each child Mesh 36 : template <size_t Dim> 37 1 : Mesh<Dim> parent_mesh(const std::vector<Mesh<Dim>>& children_meshes); 38 : 39 : /// \brief Computes the new Mesh of an Element after AMR 40 : /// 41 : /// \details The returned Mesh will be that of either `element` or its parent or 42 : /// children depending upon the `flags`. If an Element is joining, the returned 43 : /// Mesh will be that given by amr::projectors::parent_mesh; otherwise it will 44 : /// be given by amr::projectors::mesh 45 : template <size_t Dim> 46 1 : Mesh<Dim> new_mesh( 47 : const Mesh<Dim>& current_mesh, const std::array<Flag, Dim>& flags, 48 : const Element<Dim>& element, 49 : const std::unordered_map<ElementId<Dim>, Info<Dim>>& neighbors_info); 50 : } // namespace amr::projectors