DASH  0.3.0
dash::halo::RegionSpec< NumDimensions > Class Template Reference

Region specification connecting RegionCoords with an extent. More...

#include <Region.h>

Public Types

using RegionCoords_t = RegionCoords< NumDimensions >
 
using region_extent_t = uint16_t
 

Public Member Functions

 RegionSpec (const RegionCoords_t &coords, const region_extent_t extent)
 Constructor using RegionCoords and the extent. More...
 
 RegionSpec (region_index_t index, const region_extent_t extent)
 Constructor using a region index and an extent. More...
 
constexpr region_index_t index () const
 Returns the region index. More...
 
constexpr const RegionCoords_tcoords () const
 Returns the RegionCoords. More...
 
constexpr region_extent_t extent () const
 Returns the extent. More...
 
constexpr region_coord_t operator[] (const region_index_t index) const
 Returns the RegionCoords for a given region index. More...
 
constexpr bool operator== (const Self_t &other) const
 
constexpr bool operator!= (const Self_t &other) const
 
dim_t relevant_dim () const
 Returns the highest dimension with region values != 1. More...
 
dim_t level () const
 returns the number of coordinates unequal the center (1) for all dimensions More...
 

Static Public Member Functions

template<typename StencilT >
static region_index_t index (const StencilT &stencil)
 Returns the region index for a given StencilPoint. More...
 

Detailed Description

template<dim_t NumDimensions>
class dash::halo::RegionSpec< NumDimensions >

Region specification connecting RegionCoords with an extent.

The region extent applies to all dimensions.

Definition at line 294 of file Region.h.

Constructor & Destructor Documentation

◆ RegionSpec() [1/2]

template<dim_t NumDimensions>
dash::halo::RegionSpec< NumDimensions >::RegionSpec ( const RegionCoords_t coords,
const region_extent_t  extent 
)
inline

Constructor using RegionCoords and the extent.

Definition at line 306 of file Region.h.

307  : _coords(coords), _index(coords.index()), _extent(extent),
309  _level(RegionCoords_t::level(coords.values())) {}
constexpr region_extent_t extent() const
Returns the extent.
Definition: Region.h:359
constexpr const std::array< ElementType, NumDimensions > & values() const
Return value with all dimensions as array of NumDimensions elements.
Definition: Dimensional.h:142
constexpr region_index_t index() const
Definition: Region.h:97
dim_t level()
returns the number of coordinates unequal to the center (1) for all dimensions
Definition: Region.h:231
static dim_t relevant_dim(const Coords_t &coords)
Returns the highest dimension with region values != 1.
Definition: Region.h:197
constexpr const RegionCoords_t & coords() const
Returns the RegionCoords.
Definition: Region.h:354

◆ RegionSpec() [2/2]

template<dim_t NumDimensions>
dash::halo::RegionSpec< NumDimensions >::RegionSpec ( region_index_t  index,
const region_extent_t  extent 
)
inline

Constructor using a region index and an extent.

Definition at line 314 of file Region.h.

315  : _coords(RegionCoords_t(index)), _index(index), _extent(extent),
316  _rel_dim(RegionCoords_t::relevant_dim(_coords.values())),
317  _level(RegionCoords_t::level(_coords.values())) {}
constexpr region_extent_t extent() const
Returns the extent.
Definition: Region.h:359
constexpr const std::array< ElementType, NumDimensions > & values() const
Return value with all dimensions as array of NumDimensions elements.
Definition: Dimensional.h:142
dim_t level()
returns the number of coordinates unequal to the center (1) for all dimensions
Definition: Region.h:231
static dim_t relevant_dim(const Coords_t &coords)
Returns the highest dimension with region values != 1.
Definition: Region.h:197
constexpr region_index_t index() const
Returns the region index.
Definition: Region.h:349

Member Function Documentation

◆ coords()

template<dim_t NumDimensions>
constexpr const RegionCoords_t& dash::halo::RegionSpec< NumDimensions >::coords ( ) const
inline

Returns the RegionCoords.

Definition at line 354 of file Region.h.

354 { return _coords; }

◆ extent()

template<dim_t NumDimensions>
constexpr region_extent_t dash::halo::RegionSpec< NumDimensions >::extent ( ) const
inline

Returns the extent.

Definition at line 359 of file Region.h.

Referenced by dash::halo::RegionSpec< NumDimensions >::level().

359 { return _extent; }

◆ index() [1/2]

template<dim_t NumDimensions>
template<typename StencilT >
static region_index_t dash::halo::RegionSpec< NumDimensions >::index ( const StencilT stencil)
inlinestatic

Returns the region index for a given StencilPoint.

Definition at line 328 of file Region.h.

References dash::index().

328  {
329  region_index_t index = 0;
330  if(stencil[0] == 0)
331  index = 1;
332  else if(stencil[0] > 0)
333  index = 2;
334  for(auto d(1); d < NumDimensions; ++d) {
335  if(stencil[d] < 0)
336  index *= REGION_INDEX_BASE;
337  else if(stencil[d] == 0)
338  index = 1 + index * REGION_INDEX_BASE;
339  else
340  index = 2 + index * REGION_INDEX_BASE;
341  }
342 
343  return index;
344  }
constexpr region_index_t index() const
Returns the region index.
Definition: Region.h:349

◆ index() [2/2]

template<dim_t NumDimensions>
constexpr region_index_t dash::halo::RegionSpec< NumDimensions >::index ( ) const
inline

Returns the region index.

Definition at line 349 of file Region.h.

349 { return _index; }

◆ level()

template<dim_t NumDimensions>
dim_t dash::halo::RegionSpec< NumDimensions >::level ( ) const
inline

returns the number of coordinates unequal the center (1) for all dimensions

Definition at line 385 of file Region.h.

References dash::halo::RegionSpec< NumDimensions >::extent().

385 { return _level; }

◆ operator[]()

template<dim_t NumDimensions>
constexpr region_coord_t dash::halo::RegionSpec< NumDimensions >::operator[] ( const region_index_t  index) const
inline

Returns the RegionCoords for a given region index.

Definition at line 364 of file Region.h.

References dash::index(), and dash::halo::RegionCoords< NumDimensions >::index().

364  {
365  return _coords[index];
366  }
constexpr region_index_t index() const
Returns the region index.
Definition: Region.h:349

◆ relevant_dim()

template<dim_t NumDimensions>
dim_t dash::halo::RegionSpec< NumDimensions >::relevant_dim ( ) const
inline

Returns the highest dimension with region values != 1.

Definition at line 379 of file Region.h.

379 { return _rel_dim; }

The documentation for this class was generated from the following file: