Skip to content

Commit

Permalink
Merge pull request #58 from sslattery/remove_cabana_macros
Browse files Browse the repository at this point in the history
Remove use of Kokkos macro aliases
  • Loading branch information
sslattery authored Jan 4, 2019
2 parents ce733cd + 88e2313 commit a87790d
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 69 deletions.
15 changes: 7 additions & 8 deletions core/src/Cabana_AoSoA.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <Cabana_Slice.hpp>
#include <Cabana_Tuple.hpp>
#include <Cabana_Types.hpp>
#include <Cabana_Macros.hpp>
#include <Cabana_SoA.hpp>
#include <impl/Cabana_Index.hpp>
#include <impl/Cabana_PerformanceTraits.hpp>
Expand Down Expand Up @@ -147,7 +146,7 @@ class AoSoA
This is the number of actual objects held in the container, which is not
necessarily equal to its storage capacity.
*/
CABANA_FUNCTION
KOKKOS_FUNCTION
std::size_t size() const { return _size; }

/*!
Expand All @@ -167,7 +166,7 @@ class AoSoA
The capacity of a container can be explicitly altered by calling member
reserve.
*/
CABANA_FUNCTION
KOKKOS_FUNCTION
std::size_t capacity() const { return _capacity; }

/*!
Expand Down Expand Up @@ -236,7 +235,7 @@ class AoSoA
\return The number of structs-of-arrays in the container.
*/
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
std::size_t numSoA() const { return _num_soa; }

/*!
Expand All @@ -247,7 +246,7 @@ class AoSoA
\return The size of the array at the given struct index.
*/
template<typename S>
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
typename std::enable_if<std::is_integral<S>::value,int>::type
arraySize( const S& s ) const
{
Expand All @@ -263,7 +262,7 @@ class AoSoA
\return The SoA reference at the given index.
*/
template<typename S>
CABANA_FORCEINLINE_FUNCTION
KOKKOS_FORCEINLINE_FUNCTION
typename std::enable_if<std::is_integral<S>::value,soa_type&>::type
access( const S& s ) const
{ return _data(s); }
Expand All @@ -276,7 +275,7 @@ class AoSoA
\return A tuple containing a deep copy of the data at the given index.
*/
template<typename I>
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
typename std::enable_if<std::is_integral<I>::value,tuple_type>::type
getTuple( const I& i ) const
{
Expand All @@ -293,7 +292,7 @@ class AoSoA
\param tuple The tuple to get the data from.
*/
template<typename I>
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
typename std::enable_if<std::is_integral<I>::value,void>::type
setTuple( const I& i,
const tuple_type& tpl ) const
Expand Down
1 change: 0 additions & 1 deletion core/src/Cabana_ExecutionPolicy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#ifndef CABANA_EXECUTIONPOLICY_HPP
#define CABANA_EXECUTIONPOLICY_HPP

#include <Cabana_Macros.hpp>
#include <impl/Cabana_Index.hpp>

#include <Kokkos_Core.hpp>
Expand Down
19 changes: 9 additions & 10 deletions core/src/Cabana_LinkedCellList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#include <Cabana_Sort.hpp>
#include <Cabana_Slice.hpp>
#include <Cabana_Macros.hpp>
#include <impl/Cabana_CartesianGrid.hpp>

#include <Kokkos_Core.hpp>
Expand Down Expand Up @@ -106,7 +105,7 @@ class LinkedCellList
\brief Get the total number of bins.
\return the total number of bins.
*/
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
int totalBins() const
{ return _grid.totalNumCells(); }

Expand All @@ -115,7 +114,7 @@ class LinkedCellList
\param dim The dimension to get the number of bins for.
\return The number of bins.
*/
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
int numBin( const int dim ) const
{ return _grid.numBin(dim); }

Expand All @@ -129,7 +128,7 @@ class LinkedCellList
Note that the Kokkos sort orders the bins such that the i index moves
the slowest and the k index mvoes the fastest.
*/
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
size_type cardinalBinIndex( const int i, const int j, const int k ) const
{ return _grid.cardinalCellIndex(i,j,k); }

Expand All @@ -143,7 +142,7 @@ class LinkedCellList
Note that the Kokkos sort orders the bins such that the i index moves
the slowest and the k index mvoes the fastest.
*/
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
void ijkBinIndex( const int cardinal, int& i, int& j, int& k ) const
{
_grid.ijkBinIndex( cardinal, i, j, k );
Expand All @@ -156,7 +155,7 @@ class LinkedCellList
\param k The k bin index (z).
\return The number of particles in the bin.
*/
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
int binSize( const int i, const int j, const int k ) const
{ return _bin_data.binSize(cardinalBinIndex(i,j,k)); }

Expand All @@ -167,7 +166,7 @@ class LinkedCellList
\param k The k bin index (z).
\return The starting particle index of the bin.
*/
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
size_type binOffset( const int i, const int j, const int k ) const
{ return _bin_data.binOffset(cardinalBinIndex(i,j,k)); }

Expand All @@ -177,21 +176,21 @@ class LinkedCellList
\param particle_id The id of the particle in the binned layout.
\return The particle id in the old (unbinned) layout.
*/
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
size_type permutation( const int particle_id ) const
{ return _bin_data.permutation(particle_id); }

/*!
\brief The beginning particle index binned by the linked cell list.
*/
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
std::size_t rangeBegin() const
{ return _bin_data.rangeBegin(); }

/*!
\brief The ending particle index binned by the linked cell list.
*/
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
std::size_t rangeEnd() const
{ return _bin_data.rangeEnd(); }

Expand Down
6 changes: 2 additions & 4 deletions core/src/Cabana_NeighborList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#ifndef CABANA_NEIGHBORLIST_HPP
#define CABANA_NEIGHBORLIST_HPP

#include <Cabana_Macros.hpp>

#include <Kokkos_Core.hpp>

namespace Cabana
Expand Down Expand Up @@ -59,13 +57,13 @@ class NeighborList
using TypeTag = typename NeighborListType::TypeTag;

// Get the number of neighbors for a given particle index.
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
static int numNeighbor( const NeighborListType& list,
const std::size_t particle_index );

// Get the id for a neighbor for a given particle index and the index of
// the neighbor relative to the particle.
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
static int getNeighbor( const NeighborListType& list,
const std::size_t particle_index,
const int neighbor_index );
Expand Down
31 changes: 15 additions & 16 deletions core/src/Cabana_Slice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#define CABANA_SLICE_HPP

#include <Cabana_Types.hpp>
#include <Cabana_Macros.hpp>
#include <impl/Cabana_Index.hpp>
#include <impl/Cabana_TypeTraits.hpp>

Expand Down Expand Up @@ -540,15 +539,15 @@ class Slice
\brief Returns the total number tuples in the slice.
\return The number of tuples in the slice.
*/
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
std::size_t size() const
{ return _size; }

/*!
\brief Get the number of structs-of-arrays in the container.
\return The number of structs-of-arrays in the container.
*/
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
std::size_t numSoA() const { return _view.extent(0); }

/*!
Expand All @@ -557,7 +556,7 @@ class Slice
\return The size of the array at the given struct index.
*/
template<typename S>
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
typename std::enable_if<std::is_integral<S>::value,int>::type
arraySize( const S& s ) const
{
Expand All @@ -572,7 +571,7 @@ class Slice
template<typename S,
typename A,
typename U = DataType>
CABANA_FORCEINLINE_FUNCTION
KOKKOS_FORCEINLINE_FUNCTION
typename std::enable_if<(0==std::rank<U>::value &&
std::is_integral<S>::value &&
std::is_integral<A>::value &&
Expand All @@ -587,7 +586,7 @@ class Slice
typename A,
typename D0,
typename U = DataType>
CABANA_FORCEINLINE_FUNCTION
KOKKOS_FORCEINLINE_FUNCTION
typename std::enable_if<(1==std::rank<U>::value &&
std::is_integral<S>::value &&
std::is_integral<A>::value &&
Expand All @@ -605,7 +604,7 @@ class Slice
typename D0,
typename D1,
typename U = DataType>
CABANA_FORCEINLINE_FUNCTION
KOKKOS_FORCEINLINE_FUNCTION
typename std::enable_if<(2==std::rank<U>::value &&
std::is_integral<S>::value &&
std::is_integral<A>::value &&
Expand All @@ -626,7 +625,7 @@ class Slice
typename D1,
typename D2,
typename U = DataType>
CABANA_FORCEINLINE_FUNCTION
KOKKOS_FORCEINLINE_FUNCTION
typename std::enable_if<(3==std::rank<U>::value &&
std::is_integral<S>::value &&
std::is_integral<A>::value &&
Expand All @@ -648,7 +647,7 @@ class Slice
// Rank 0
template<typename I,
typename U = DataType>
CABANA_FORCEINLINE_FUNCTION
KOKKOS_FORCEINLINE_FUNCTION
typename std::enable_if<(0==std::rank<U>::value &&
std::is_integral<I>::value &&
std::is_same<U,DataType>::value),
Expand All @@ -660,7 +659,7 @@ class Slice
template<typename I,
typename D0,
typename U = DataType>
CABANA_FORCEINLINE_FUNCTION
KOKKOS_FORCEINLINE_FUNCTION
typename std::enable_if<(1==std::rank<U>::value &&
std::is_integral<I>::value &&
std::is_integral<D0>::value &&
Expand All @@ -675,7 +674,7 @@ class Slice
typename D0,
typename D1,
typename U = DataType>
CABANA_FORCEINLINE_FUNCTION
KOKKOS_FORCEINLINE_FUNCTION
typename std::enable_if<(2==std::rank<U>::value &&
std::is_integral<I>::value &&
std::is_integral<D0>::value &&
Expand All @@ -693,7 +692,7 @@ class Slice
typename D1,
typename D2,
typename U = DataType>
CABANA_FORCEINLINE_FUNCTION
KOKKOS_FORCEINLINE_FUNCTION
typename std::enable_if<(3==std::rank<U>::value &&
std::is_integral<I>::value &&
std::is_integral<D0>::value &&
Expand All @@ -714,7 +713,7 @@ class Slice
\brief Get a raw pointer to the data for this member
\return A raw pointer to the data for this slice.
*/
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
pointer_type data() const
{ return _view.data(); }

Expand All @@ -724,7 +723,7 @@ class Slice
dimensions.
\return The rank of the data for this slice.
*/
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
constexpr int rank() const
{ return _view.Rank; }

Expand All @@ -735,7 +734,7 @@ class Slice
\param d The member data dimension to get the extent for.
\return The extent of the given member data dimension.
*/
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
std::size_t extent( const std::size_t d ) const
{ return _view.extent(d); }

Expand All @@ -745,7 +744,7 @@ class Slice
\param d The member data dimension to get the stride for.
\return The stride of the given member data dimension.
*/
CABANA_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
std::size_t stride( const std::size_t d ) const
{ return _view.stride(d); }

Expand Down
Loading

0 comments on commit a87790d

Please sign in to comment.