Commit e0173e5a authored by Yury Hayeu's avatar Yury Hayeu Committed by Tomáš Oberhuber
Browse files

Fix compilation for clang

parent 60366414
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ template< typename... DimensionIndex,
          std::enable_if_t< Templates::conjunction_v< std::is_convertible< Index, DimensionIndex >... >, bool >,
          std::enable_if_t< ( sizeof...( DimensionIndex ) > 0 ), bool > >
__cuda_callable__
inline __NDIM_PREFIX__::Container< sizeof...( DimensionIndex ), Index >
inline typename __NDIM_PREFIX__::template Container< sizeof...( DimensionIndex ), Index >
__NDIM_PREFIX__::getDimensions( DimensionIndex... indices ) const noexcept
{
   Container< sizeof...( DimensionIndex ), Index > result{ indices... };
@@ -79,7 +79,7 @@ __NDIM_PREFIX__::getDimensions( DimensionIndex... indices ) const noexcept

__NDIMGRID_TEMPLATE__
__cuda_callable__
inline const typename __NDIM_PREFIX__::Container< Dimension, Index >&
inline const typename __NDIM_PREFIX__::template Container< Dimension, Index >&
__NDIM_PREFIX__::getDimensions() const noexcept
{
   return this->dimensions;
@@ -110,7 +110,7 @@ template< typename... DimensionIndex,
          std::enable_if_t< Templates::conjunction_v< std::is_convertible< Index, DimensionIndex >... >, bool >,
          std::enable_if_t< ( sizeof...( DimensionIndex ) > 0 ), bool > >
__cuda_callable__
inline __NDIM_PREFIX__::Container< sizeof...( DimensionIndex ), Index >
inline typename __NDIM_PREFIX__::template Container< sizeof...( DimensionIndex ), Index >
__NDIM_PREFIX__::getEntitiesCounts( DimensionIndex... indices ) const
{
   Container< sizeof...( DimensionIndex ), Index > result{ indices... };
@@ -276,7 +276,7 @@ __cuda_callable__
inline Real
__NDIM_PREFIX__::getSpaceStepsProducts() const noexcept
{
   constexpr int index = Templates::makeCollapsedIndex< Index, Powers... >( this->spaceStepsPowersSize );
   constexpr int index = Templates::makeCollapsedIndex< Index, Powers... >( spaceStepsPowersSize );

   return this->spaceStepsProducts( index );
}
@@ -565,7 +565,8 @@ __NDIM_PREFIX__::fillBases()

   auto forEachEntityDimension = [ & ]( const auto entityDimension )
   {
      constexpr Index combinationsCount = this->getEntityOrientationsCount( (Index) entityDimension() );
      constexpr Index dimension = entityDimension();
      constexpr Index combinationsCount = getEntityOrientationsCount( dimension );

      auto forEachOrientation = [ & ]( const auto orientation, const auto entityDimension )
      {
+13 −13
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ class GridAccessorsTestCaseInterface {
      void verifyDimensionGetters(const Grid& grid, const typename Grid::Coordinate& coordinates) const { FAIL() << "Expect to be specialized"; }

      template<typename Grid>
      void verifyEntitiesCountGetters(const Grid& grid, const typename Grid::Container<Grid::getMeshDimension() + 1, typename Grid::IndexType>& entitiesCount) const { FAIL() << "Expect to be specialized"; }
      void verifyEntitiesCountGetters(const Grid& grid, const typename Grid::template Container<Grid::getMeshDimension() + 1, typename Grid::IndexType>& entitiesCount) const { FAIL() << "Expect to be specialized"; }

      template<typename Grid>
      void verifyOriginGetters(const Grid& grid, const typename Grid::Point& coordinates) const { FAIL() << "Expect to be specialized"; }
@@ -33,13 +33,13 @@ class GridAccessorsTestCaseInterface {


      template<typename Grid>
      void verifyEntitiesCountByContainerGetter(const Grid& grid, const typename Grid::Container<Grid::getMeshDimension() + 1, Grid::IndexType>& entitiesCounts) const { FAIL() << "Expect to be specialized"; }
      void verifyEntitiesCountByContainerGetter(const Grid& grid, const typename Grid::template Container<Grid::getMeshDimension() + 1, Grid::IndexType>& entitiesCounts) const { FAIL() << "Expect to be specialized"; }

      template<typename Grid>
      void verifyEntitiesCountByIndexGetter(const Grid& grid, const typename Grid::Container<Grid::getMeshDimension() + 1, Grid::IndexType>& entitiesCounts) const { FAIL() << "Expect to be specialized"; }
      void verifyEntitiesCountByIndexGetter(const Grid& grid, const typename Grid::template Container<Grid::getMeshDimension() + 1, Grid::IndexType>& entitiesCounts) const { FAIL() << "Expect to be specialized"; }

      template<typename Grid>
      void verifyEntitiesCountByIndiciesGetter(const Grid& grid, const typename Grid::Container<Grid::getMeshDimension() + 1, Grid::IndexType>& entitiesCounts) const { FAIL() << "Expect to be specialized"; }
      void verifyEntitiesCountByIndiciesGetter(const Grid& grid, const typename Grid::template Container<Grid::getMeshDimension() + 1, Grid::IndexType>& entitiesCounts) const { FAIL() << "Expect to be specialized"; }


      template <typename Grid>
@@ -92,7 +92,7 @@ class GridAccessorsTestCase<TNL::Devices::Host>: public GridAccessorsTestCaseInt
      }

      template<typename Grid>
      void verifyEntitiesCountGetters(const Grid& grid, const typename Grid::Container<Grid::getMeshDimension() + 1, typename Grid::IndexType>& entitiesCounts) const {
      void verifyEntitiesCountGetters(const Grid& grid, const typename Grid::template Container<Grid::getMeshDimension() + 1, typename Grid::IndexType>& entitiesCounts) const {
         this->verifyEntitiesCountByContainerGetter<Grid>(grid, entitiesCounts);
         this->verifyEntitiesCountByIndexGetter<Grid>(grid, entitiesCounts);
         this->verifyEntitiesCountByIndiciesGetter<Grid>(grid, entitiesCounts);
@@ -138,20 +138,20 @@ class GridAccessorsTestCase<TNL::Devices::Host>: public GridAccessorsTestCaseInt
      }

      template<typename Grid>
      void verifyEntitiesCountByContainerGetter(const Grid& grid, const typename Grid::Container<Grid::getMeshDimension() + 1, typename Grid::IndexType>& entitiesCounts) const {
      void verifyEntitiesCountByContainerGetter(const Grid& grid, const typename Grid::template Container<Grid::getMeshDimension() + 1, typename Grid::IndexType>& entitiesCounts) const {
         auto result = grid.getEntitiesCounts();

         EXPECT_EQ(entitiesCounts, result) << "Verify, that returns expected entities counts";
      }

      template<typename Grid>
      void verifyEntitiesCountByIndexGetter(const Grid& grid, const typename Grid::Container<Grid::getMeshDimension() + 1, typename Grid::IndexType>& entitiesCounts) const {
      void verifyEntitiesCountByIndexGetter(const Grid& grid, const typename Grid::template Container<Grid::getMeshDimension() + 1, typename Grid::IndexType>& entitiesCounts) const {
         for (typename Grid::IndexType i = 0; i < entitiesCounts.getSize(); i++)
            EXPECT_EQ(grid.getEntitiesCount(i), entitiesCounts[i]) << "Verify, that index access is correct";
      }

      template<typename Grid>
      void verifyEntitiesCountByIndiciesGetter(const Grid& grid, const typename Grid::Container<Grid::getMeshDimension() + 1, typename Grid::IndexType>& entitiesCounts) const {
      void verifyEntitiesCountByIndiciesGetter(const Grid& grid, const typename Grid::template Container<Grid::getMeshDimension() + 1, typename Grid::IndexType>& entitiesCounts) const {
         for (typename Grid::IndexType i = 0; i < entitiesCounts.getSize(); i++) {
            auto repeated = grid.getEntitiesCounts(i, i, i, i, i, i, i, i, i, i);

@@ -175,7 +175,7 @@ class GridAccessorsTestCase<TNL::Devices::Cuda>: public GridAccessorsTestCaseInt
      }

      template<typename Grid>
      void verifyEntitiesCountGetters(const Grid& grid, const typename Grid::Container<Grid::getMeshDimension() + 1, typename Grid::IndexType>& entitiesCount) const {
      void verifyEntitiesCountGetters(const Grid& grid, const typename Grid::template Container<Grid::getMeshDimension() + 1, typename Grid::IndexType>& entitiesCount) const {
         this->verifyEntitiesCountByContainerGetter<Grid>(grid, entitiesCount);
         this->verifyEntitiesCountByIndexGetter<Grid>(grid, entitiesCount);
         this->verifyEntitiesCountByIndiciesGetter<Grid>(grid, entitiesCount);
@@ -270,7 +270,7 @@ class GridAccessorsTestCase<TNL::Devices::Cuda>: public GridAccessorsTestCaseInt


      template<typename Grid>
      void verifyEntitiesCountByContainerGetter(const Grid& grid, const typename Grid::Container<Grid::getMeshDimension() + 1, typename Grid::IndexType>& entitiesCounts) const {
      void verifyEntitiesCountByContainerGetter(const Grid& grid, const typename Grid::template Container<Grid::getMeshDimension() + 1, typename Grid::IndexType>& entitiesCounts) const {
         auto size = entitiesCounts.getSize();

         auto update = [=] __device__ (const int index, typename Grid::IndexType& reference) mutable {
@@ -285,7 +285,7 @@ class GridAccessorsTestCase<TNL::Devices::Cuda>: public GridAccessorsTestCaseInt
      }

      template<typename Grid>
      void verifyEntitiesCountByIndexGetter(const Grid& grid, const typename Grid::Container<Grid::getMeshDimension() + 1, typename Grid::IndexType>& entitiesCounts) const {
      void verifyEntitiesCountByIndexGetter(const Grid& grid, const typename Grid::template Container<Grid::getMeshDimension() + 1, typename Grid::IndexType>& entitiesCounts) const {
         auto size = entitiesCounts.getSize();

         auto update = [=] __device__ (const int index, typename Grid::IndexType& reference) mutable {
@@ -300,7 +300,7 @@ class GridAccessorsTestCase<TNL::Devices::Cuda>: public GridAccessorsTestCaseInt
      }

      template<typename Grid>
      void verifyEntitiesCountByIndiciesGetter(const Grid& grid, const typename Grid::Container<Grid::getMeshDimension() + 1, typename Grid::IndexType>& entitiesCounts) const {
      void verifyEntitiesCountByIndiciesGetter(const Grid& grid, const typename Grid::template Container<Grid::getMeshDimension() + 1, typename Grid::IndexType>& entitiesCounts) const {
          auto size = entitiesCounts.getSize();

         auto update = [=] __device__ (const int index, typename Grid::IndexType& reference) mutable {
@@ -358,7 +358,7 @@ void testDimensionSetByCoordinate(Grid& grid, const typename Grid::Coordinate& d
template<typename Grid>
void testEntitiesCounts(Grid& grid,
                        const typename Grid::Coordinate& dimensions,
                        const typename Grid::Container<Grid::getMeshDimension() + 1, typename Grid::IndexType>& entitiesCounts) {
                        const typename Grid::template Container<Grid::getMeshDimension() + 1, typename Grid::IndexType>& entitiesCounts) {
   EXPECT_NO_THROW(grid.setDimensions(dimensions)) << "Verify, that the set of" << dimensions << " doesn't cause assert";

   SCOPED_TRACE("Test entities count");
+4 −4
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ class NeighbourGridEntityGetterTestCase {
         constexpr int neighbourOrientationsCount = Grid::getEntityOrientationsCount(NeighbourEntityDimension);

         auto view = store.getView();
         auto update = [=] __cuda_callable__ (const typename Grid::EntityType<EntityDimension>& entity) mutable {
         auto update = [=] __cuda_callable__ (const typename Grid::template EntityType<EntityDimension>& entity) mutable {
            int neighbourEntityOrientation = TNL::min(entity.getOrientation(), neighbourOrientationsCount - 1);
            Coordinate alignedCoordinate = entity.getCoordinates() + Coordinate(Steps...);
            Coordinate boundary = grid.getDimensions() + grid.template getBasis<NeighbourEntityDimension>(neighbourEntityOrientation);
@@ -44,7 +44,7 @@ class NeighbourGridEntityGetterTestCase {
         SCOPED_TRACE("Store using static accessor with orientation");

         auto view = store.getView();
         auto update = [=] __cuda_callable__ (const typename Grid::EntityType<EntityDimension>& entity) mutable {
         auto update = [=] __cuda_callable__ (const typename Grid::template EntityType<EntityDimension>& entity) mutable {
            Coordinate alignedCoordinate = entity.getCoordinates() + Coordinate(Steps...);
            Coordinate boundary = grid.getDimensions() + grid.template getBasis<NeighbourEntityDimension>(NeighbourEntityOrientation);

@@ -66,7 +66,7 @@ class NeighbourGridEntityGetterTestCase {
         constexpr int neighbourOrientationsCount = Grid::getEntityOrientationsCount(NeighbourEntityDimension);

         auto view = store.getView();
         auto update = [=] __cuda_callable__(const typename Grid::EntityType<EntityDimension>& entity) mutable {
         auto update = [=] __cuda_callable__(const typename Grid::template EntityType<EntityDimension>& entity) mutable {
            int neighbourEntityOrientation = TNL::min(entity.getOrientation(), neighbourOrientationsCount - 1);
            Coordinate alignedCoordinate = entity.getCoordinates() + offset;
            Coordinate boundary = grid.getDimensions() + grid.template getBasis<NeighbourEntityDimension>(neighbourEntityOrientation);
@@ -88,7 +88,7 @@ class NeighbourGridEntityGetterTestCase {
         SCOPED_TRACE("Store using dynamic accessor with orientation");

         auto view = store.getView();
         auto update = [=] __cuda_callable__(const typename Grid::EntityType<EntityDimension>& entity) mutable {
         auto update = [=] __cuda_callable__(const typename Grid::template EntityType<EntityDimension>& entity) mutable {
            Coordinate alignedCoordinate = entity.getCoordinates() + offset;
            Coordinate boundary = grid.getDimensions() + grid.template getBasis<NeighbourEntityDimension>(NeighbourEntityOrientation);

+7 −7
Original line number Diff line number Diff line
@@ -163,14 +163,14 @@ class GridTraverseTestCase {
      using Iterator = GridCoordinateIterator<Grid, EntityDimension, Orientation>;

      // NVCC is incapable of deducing generic lambda
      using UpdateFunctionType = std::function<void(const typename Grid::EntityType<EntityDimension>&)>;
      using UpdateFunctionType = std::function<void(const typename Grid::template EntityType<EntityDimension>&)>;

      void storeAll(const Grid& grid, DataStore& store) const {
         SCOPED_TRACE("Store all");

         auto view = store.getView();

         auto update = [=] __cuda_callable__ (const typename Grid::EntityType<EntityDimension>& entity) mutable {
         auto update = [=] __cuda_callable__ (const typename Grid::template EntityType<EntityDimension>& entity) mutable {
            view.store(entity);
         };

@@ -181,7 +181,7 @@ class GridTraverseTestCase {

         auto view = store.getView();

         auto update = [=] __cuda_callable__ (const typename Grid::EntityType<EntityDimension>& entity) mutable {
         auto update = [=] __cuda_callable__ (const typename Grid::template EntityType<EntityDimension>& entity) mutable {
            view.store(entity);
         };

@@ -192,7 +192,7 @@ class GridTraverseTestCase {

         auto view = store.getView();

         auto update = [=] __cuda_callable__ (const typename Grid::EntityType<EntityDimension>& entity) mutable {
         auto update = [=] __cuda_callable__ (const typename Grid::template EntityType<EntityDimension>& entity) mutable {
            view.store(entity);
         };

@@ -203,7 +203,7 @@ class GridTraverseTestCase {

         auto view = store.getView();

         auto update = [=] __cuda_callable__ (const typename Grid::EntityType<EntityDimension>& entity) mutable {
         auto update = [=] __cuda_callable__ (const typename Grid::template EntityType<EntityDimension>& entity) mutable {
            view.clear(entity);
         };

@@ -214,7 +214,7 @@ class GridTraverseTestCase {

         auto view = store.getView();

         auto update = [=] __cuda_callable__ (const typename Grid::EntityType<EntityDimension>& entity) mutable {
         auto update = [=] __cuda_callable__ (const typename Grid::template EntityType<EntityDimension>& entity) mutable {
            view.clear(entity);
         };

@@ -225,7 +225,7 @@ class GridTraverseTestCase {

         auto view = store.getView();

         auto update = [=] __cuda_callable__ (const typename Grid::EntityType<EntityDimension>& entity) mutable {
         auto update = [=] __cuda_callable__ (const typename Grid::template EntityType<EntityDimension>& entity) mutable {
            view.clear(entity);
         };