Skip to content
Snippets Groups Projects
Commit 091c56e1 authored by Christoph Rettinger's avatar Christoph Rettinger
Browse files

[API] changed return type to std array for improved usability

parent e0d9fe90
Branches
Tags
No related merge requests found
......@@ -25,7 +25,7 @@
#include "core/debug/Debug.h"
#include "stencil/Directions.h"
#include <array>
namespace walberla {
namespace blockforest {
......@@ -94,31 +94,28 @@ inline uint_t getBlockMaxNeighborhoodSectionSize( const uint_t sectionIndex )
inline const uint_t * getFaceNeighborhoodSectionIndices()
inline const std::array<uint_t, 6> & getFaceNeighborhoodSectionIndices()
{
static const uint_t faces[] = { uint_t(4), uint_t(10), uint_t(12), uint_t(13), uint_t(15), uint_t(21) };
static std::array<uint_t, 6> faces{ { uint_t(4), uint_t(10), uint_t(12), uint_t(13), uint_t(15), uint_t(21) } };
return faces;
}
inline const uint_t * getEdgeNeighborhoodSectionIndices()
inline const std::array<uint_t,12> & getEdgeNeighborhoodSectionIndices()
{
static const uint_t edges[] = { uint_t( 1), uint_t( 3), uint_t( 5), uint_t( 7), uint_t( 9), uint_t(11),
uint_t(14), uint_t(16), uint_t(18), uint_t(20), uint_t(22), uint_t(24) };
static std::array<uint_t,12> edges{{ uint_t( 1), uint_t( 3), uint_t( 5), uint_t( 7), uint_t( 9), uint_t(11),
uint_t(14), uint_t(16), uint_t(18), uint_t(20), uint_t(22), uint_t(24) }};
return edges;
}
inline const uint_t * getCornerNeighborhoodSectionIndices()
inline const std::array<uint_t, 8> & getCornerNeighborhoodSectionIndices()
{
static const uint_t corners[] = { uint_t( 0), uint_t( 2), uint_t( 6), uint_t( 8),
uint_t(17), uint_t(19), uint_t(23), uint_t(25) };
static std::array<uint_t, 8> corners {{ uint_t( 0), uint_t( 2), uint_t( 6), uint_t( 8),
uint_t(17), uint_t(19), uint_t(23), uint_t(25) }};
return corners;
}
} // namespace blockforest
} // namespace walberla
......@@ -409,8 +409,8 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
const uint_t level = levelwise_ ? block->getLevel() : uint_t(0);
if( level == l && targetProcess[i].second == blockforest.getProcess() )
{
const uint_t * faces = blockforest::getFaceNeighborhoodSectionIndices();
for( uint_t j = uint_t(0); j != uint_t(6); ++j )
auto faces = blockforest::getFaceNeighborhoodSectionIndices();
for( uint_t j = uint_t(0); j != faces.size(); ++j )
{
const uint_t sectionIndex = faces[j];
const uint_t sectionSize = block->getNeighborhoodSectionSize( sectionIndex );
......@@ -427,8 +427,8 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
}
}
}
const uint_t * edges = blockforest::getEdgeNeighborhoodSectionIndices();
for( uint_t j = uint_t(0); j != uint_t(12); ++j )
auto edges = blockforest::getEdgeNeighborhoodSectionIndices();
for( uint_t j = uint_t(0); j != edges.size(); ++j )
{
const uint_t sectionIndex = edges[j];
const uint_t sectionSize = block->getNeighborhoodSectionSize( sectionIndex );
......@@ -445,8 +445,8 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
}
}
}
const uint_t * corners = blockforest::getCornerNeighborhoodSectionIndices();
for( uint_t j = uint_t(0); j != uint_t(8); ++j )
auto corners = blockforest::getCornerNeighborhoodSectionIndices();
for( uint_t j = uint_t(0); j != corners.size(); ++j )
{
const uint_t sectionIndex = corners[j];
const uint_t sectionSize = block->getNeighborhoodSectionSize( sectionIndex );
......@@ -655,8 +655,8 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
{
if( regardConnectivity_ && iteration < disregardConnectivityStart_ )
{
const uint_t * faces = blockforest::getFaceNeighborhoodSectionIndices();
for( uint_t j = uint_t(0); j != uint_t(6); ++j )
auto faces = blockforest::getFaceNeighborhoodSectionIndices();
for( uint_t j = uint_t(0); j != faces.size(); ++j )
{
const uint_t sectionIndex = faces[j];
const uint_t sectionSize = block->getNeighborhoodSectionSize( sectionIndex );
......@@ -675,8 +675,8 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
}
}
}
const uint_t * edges = blockforest::getEdgeNeighborhoodSectionIndices();
for( uint_t j = uint_t(0); j != uint_t(12); ++j )
auto edges = blockforest::getEdgeNeighborhoodSectionIndices();
for( uint_t j = uint_t(0); j != edges.size(); ++j )
{
const uint_t sectionIndex = edges[j];
const uint_t sectionSize = block->getNeighborhoodSectionSize( sectionIndex );
......@@ -695,8 +695,8 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
}
}
}
const uint_t * corners = blockforest::getCornerNeighborhoodSectionIndices();
for( uint_t j = uint_t(0); j != uint_t(8); ++j )
auto corners = blockforest::getCornerNeighborhoodSectionIndices();
for( uint_t j = uint_t(0); j != corners.size(); ++j )
{
const uint_t sectionIndex = corners[j];
const uint_t sectionSize = block->getNeighborhoodSectionSize( sectionIndex );
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment