10#include <kernel/adjacency/adjactor.hpp> 
   34      template<
typename FineMesh_, 
typename CoarseMesh_=FineMesh_, 
bool is_structured_=FineMesh_::is_structured>
 
   87      template<
typename FineMesh_, 
typename CoarseMesh_=FineMesh_, 
bool is_structured=FineMesh_::is_structured>
 
   96      template<
typename FineMesh_, 
typename CoarseMesh_>
 
   97      class CoarseFineCellMapping<FineMesh_, CoarseMesh_, true>
 
   99        static_assert(FineMesh_::is_structured == 
true, 
"Do not provide the third template parameter manually!");
 
  103        Index _dim[3]={1,1,1}; 
 
  106        explicit CoarseFineCellMapping(
const FineMesh_& fine_mesh, 
const CoarseMesh_& coarse_mesh) :
 
  107          _num_elements(coarse_mesh.get_num_entities(CoarseMesh_::ShapeType::dimension)),
 
  108          _num_children(fine_mesh.get_num_entities(FineMesh_::ShapeType::dimension) / _num_elements)
 
  110          for (
int d(0); d < FineMesh_::ShapeType::dimension; ++d)
 
  112            _dim[d] = fine_mesh.get_num_slices(d);
 
  119          Index xy_plane_size = _dim[0]/2;
 
  120          if (FineMesh_::shape_dim > 1)
 
  122            xy_plane_size *= _dim[1]/2;
 
  124          Index zpos = ccell / xy_plane_size; 
 
  126          Index ypos = (ccell - zpos * xy_plane_size) / (_dim[0]/2);
 
  127          Index xpos = ccell - zpos * xy_plane_size - ypos * (_dim[0]/2);
 
  130          zpos = 2*zpos + (
child / 4);
 
  132          if (child == 2 || child == 3 || child == 6 || child == 7) { ++ypos; }
 
  133          xpos = 2*xpos + (
child % 2);
 
  135          return zpos * _dim[1] * _dim[0] + ypos * _dim[0] + xpos;
 
  140          return _num_children;
 
  149          Index _dim[3]={1,1,1};
 
  166            _index(
other._index),
 
  173            _index = 
other._index;
 
  174            _dim[0] = 
other._dim[0];
 
  175            _dim[1] = 
other._dim[1];
 
  176            _dim[2] = 
other._dim[2];
 
  183            Index zpos = _index / (_dim[0] * _dim[1]);
 
  184            Index ypos = (_index - zpos * _dim[0] * _dim[1]) / _dim[0];
 
  185            Index xpos = _index - zpos * _dim[0] * _dim[1] - ypos * _dim[0];
 
  196              if (FineMesh_::ShapeType::dimension > 1 && ypos % 2 == 0)
 
  203                if (FineMesh_::ShapeType::dimension > 1) --ypos;
 
  204                if (FineMesh_::ShapeType::dimension > 2 && zpos % 2 == 0)
 
  212                  if (FineMesh_::ShapeType::dimension > 2) --zpos; 
 
  213                  if (xpos + 2 < _dim[0])
 
  217                  else if (ypos + 2 < _dim[1])
 
  233            _index = zpos * _dim[0] * _dim[1] + ypos * _dim[0] + xpos;
 
  244            return _index != 
other._index;
 
  250          return _num_elements;
 
  255          return _num_elements * _num_children;
 
  270      template<
typename FineMesh_, 
typename CoarseMesh_>
 
  271      class CoarseFineCellMapping<FineMesh_, CoarseMesh_, false>
 
  273        static_assert(FineMesh_::is_structured == 
false, 
"Do not provide the third template parameter manually!");
 
  280          _num_elements(coarse_mesh.get_num_entities(CoarseMesh_::ShapeType::dimension)),
 
  281          _num_children(fine_mesh.get_num_entities(FineMesh_::ShapeType::dimension) / _num_elements)
 
  287          return ccell*_num_children + 
child;
 
  292          return _num_children;
 
  295        typedef Adjacency::Adjactor::IndexImageIterator 
ImageIterator;
 
  299          return _num_elements;
 
  304          return _num_elements * _num_children;
 
Adjactor image node iterator class.
A coarse cell to fine cell mapping class.
Index calc_fcell(Index ccell, Index child=0) const
Calculates the fine mesh cell index.
Adjacency::Adjactor::ImageIterator ImageIterator
Adjactor image node iterator class.
CoarseFineCellMapping(const FineMesh_ &fine_mesh, const CoarseMesh_ &coarse_mesh)
Constructor.
ImageIterator image_end(Index domain_node) const
Returns an iterator for the first position past the last adjacent image node.
ImageIterator image_begin(Index domain_node) const
Returns an iterator for the first adjacent image node.
Index get_num_nodes_image() const
Returns the number of image nodes.
Index get_num_children() const
Returns the number of fine mesh cells per coarse mesh cell.
Index get_num_nodes_domain() const
Returns the number of domain nodes.
@ child
indicates that the level is a child level
@ other
generic/other permutation strategy
static constexpr bool operator*(TrafoTags a)
bool conversion operator
std::uint64_t Index
Index data type.