Skip to content

Commit

Permalink
Add option to disable Cajita deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
streeve committed Sep 15, 2023
1 parent 535d282 commit 81c7a5b
Show file tree
Hide file tree
Showing 35 changed files with 277 additions and 341 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,11 @@ add_subdirectory(core)
option(Cabana_ENABLE_GRID "Build grid and particle-grid capabilities" ${Cabana_ENABLE_MPI})
### FIXME: remove in next release.
option(Cabana_ENABLE_CAJITA "Build grid and particle-grid capabilities" OFF)
option(Cabana_DISABLE_CAJITA_DEPRECATION_WARNINGS "Do not warn about Cajita deprecation." OFF)
if (Cabana_ENABLE_CAJITA)
message(DEPRECATION "Option Cabana_ENABLE_CAJITA is deprecated, replaced by Cabana_ENABLE_GRID")
if (NOT Cabana_DISABLE_CAJITA_DEPRECATION_WARNINGS)
message(DEPRECATION "Option Cabana_ENABLE_CAJITA is deprecated, replaced by Cabana_ENABLE_GRID")
endif()
set(Cabana_ENABLE_GRID ON)
endif()

Expand Down
4 changes: 3 additions & 1 deletion core/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ add_library(Cabana::Core ALIAS cabanacore)
### FIXME: remove cabanacore in next release.
add_library(Cabana::cabanacore ALIAS cabanacore)
if(CMAKE_VERSION VERSION_GREATER 3.17)
set_property(TARGET cabanacore PROPERTY DEPRECATION "NOTE: cabanacore subpackage is now Core. Link to Cabana::Core. Cabana::cabanacore will be removed in a future release.")
if(NOT Cabana_DISABLE_CAJITA_DEPRECATION_WARNINGS)
set_property(TARGET cabanacore PROPERTY DEPRECATION "NOTE: cabanacore subpackage is now Core. Link to Cabana::Core. Cabana::cabanacore will be removed in a future release.")
endif()
endif()

# Require minimum of C++17
Expand Down
2 changes: 1 addition & 1 deletion core/src/CabanaCore_config.hpp.cmakein
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#cmakedefine Cabana_ENABLE_GRID

#cmakedefine Cabana_ENABLE_CAJITA // FIXME: remove in the next release.
#cmakedefine Cabana_DISABLE_CAJITA_WARNINGS // FIXME: remove in the next release.
#cmakedefine Cabana_DISABLE_CAJITA_DEPRECATION_WARNINGS // FIXME: remove in the next release.

#cmakedefine Cabana_ENABLE_MPI

Expand Down
10 changes: 10 additions & 0 deletions core/src/Cabana_Utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ deprecated( std::true_type )
{
return true;
}

// Custom warning for switch from Cajita to Grid.
#if Cabana_DISABLE_CAJITA_WARNINGS
#define CAJITA_DEPRECATED
#else
#define CAJITA_DEPRECATED \
[[deprecated( "Cajita is now Cabana::Grid. The Cajita namespace will be " \
"removed in a future release." )]]
#endif

//! \endcond

} // namespace Impl
Expand Down
4 changes: 3 additions & 1 deletion grid/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ set_target_properties(Cajita PROPERTIES INTERFACE_COMPILE_FEATURES cxx_std_17)
### FIXME: remove Cajita in next release.
add_library(Cabana::Cajita ALIAS Cajita)
if(CMAKE_VERSION VERSION_GREATER 3.17)
set_property(TARGET Cajita PROPERTY DEPRECATION "NOTE: Cajita subpackage is now Grid. Link to Cabana::Grid. Cabana::Cajita will be removed in a future release.")
if(NOT Cabana_DISABLE_CAJITA_DEPRECATION_WARNINGS)
set_property(TARGET Cajita PROPERTY DEPRECATION "NOTE: Cajita subpackage is now Grid. Link to Cabana::Grid. Cabana::Cajita will be removed in a future release.")
endif()
endif()
add_library(Grid ALIAS Cajita)
add_library(Cabana::Grid ALIAS Cajita)
Expand Down
48 changes: 22 additions & 26 deletions grid/src/Cabana_Grid_Array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <Cabana_Grid_LocalGrid.hpp>
#include <Cabana_Grid_MpiTraits.hpp>
#include <Cabana_Grid_Types.hpp>
#include <Cabana_Utils.hpp> // FIXME: remove after next release.

#include <Kokkos_Core.hpp>

Expand Down Expand Up @@ -1126,108 +1127,103 @@ namespace Cajita
{
//! \cond Deprecated
template <class EntityType, class MeshType>
using ArrayLayout [[deprecated( "Cajita is now Cabana::Grid." )]] =
using ArrayLayout CAJITA_DEPRECATED =
Cabana::Grid::ArrayLayout<EntityType, MeshType>;

template <class T>
using is_array_layout [[deprecated( "Cajita is now Cabana::Grid." )]] =
Cabana::Grid::is_array_layout<T>;
using is_array_layout CAJITA_DEPRECATED = Cabana::Grid::is_array_layout<T>;

template <class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] auto
createArrayLayout( Args&&... args )
CAJITA_DEPRECATED auto createArrayLayout( Args&&... args )
{
return Cabana::Grid::createArrayLayout( std::forward<Args>( args )... );
}

template <class Scalar, class EntityType, class MeshType, class... Params>
using Array [[deprecated( "Cajita is now Cabana::Grid." )]] =
using Array CAJITA_DEPRECATED =
Cabana::Grid::Array<Scalar, EntityType, MeshType, Params...>;

template <class T>
using is_array [[deprecated( "Cajita is now Cabana::Grid." )]] =
Cabana::Grid::is_array<T>;
using is_array CAJITA_DEPRECATED = Cabana::Grid::is_array<T>;

template <class Scalar, class... Params, class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] auto
createArray( Args&&... args )
CAJITA_DEPRECATED auto createArray( Args&&... args )
{
return Cabana::Grid::createArray<Scalar, Params...>(
std::forward<Args>( args )... );
}

template <class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] auto
createSubarray( Args&&... args )
CAJITA_DEPRECATED auto createSubarray( Args&&... args )
{
return Cabana::Grid::createSubarray( std::forward<Args>( args )... );
}

namespace ArrayOp
{
template <class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] auto clone( Args&&... args )
CAJITA_DEPRECATED auto clone( Args&&... args )
{
return Cabana::Grid::ArrayOp::clone( std::forward<Args>( args )... );
}
template <class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] auto assign( Args&&... args )
CAJITA_DEPRECATED auto assign( Args&&... args )
{
return Cabana::Grid::ArrayOp::assign( std::forward<Args>( args )... );
}
template <class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] void scale( Args&&... args )
CAJITA_DEPRECATED void scale( Args&&... args )
{
return Cabana::Grid::ArrayOp::scale( std::forward<Args>( args )... );
}
template <class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] void copy( Args&&... args )
CAJITA_DEPRECATED void copy( Args&&... args )
{
return Cabana::Grid::ArrayOp::copy( std::forward<Args>( args )... );
}
template <class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] auto cloneCopy( Args&&... args )
CAJITA_DEPRECATED auto cloneCopy( Args&&... args )
{
return Cabana::Grid::ArrayOp::cloneCopy( std::forward<Args>( args )... );
}
template <class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] void update( Args&&... args )
CAJITA_DEPRECATED void update( Args&&... args )
{
return Cabana::Grid::ArrayOp::update( std::forward<Args>( args )... );
}

template <class ViewType, std::size_t NumSpaceDim>
using DotFunctor [[deprecated( "Cajita is now Cabana::Grid." )]] =
using DotFunctor CAJITA_DEPRECATED =
Cabana::Grid::ArrayOp::DotFunctor<ViewType, NumSpaceDim>;
template <class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] void dot( Args&&... args )
CAJITA_DEPRECATED void dot( Args&&... args )
{
return Cabana::Grid::ArrayOp::dot( std::forward<Args>( args )... );
}

template <class ViewType, std::size_t NumSpaceDim>
using NormInfFunctor [[deprecated( "Cajita is now Cabana::Grid." )]] =
using NormInfFunctor CAJITA_DEPRECATED =
Cabana::Grid::ArrayOp::NormInfFunctor<ViewType, NumSpaceDim>;
template <class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] void normInf( Args&&... args )
CAJITA_DEPRECATED void normInf( Args&&... args )
{
return Cabana::Grid::ArrayOp::normInf( std::forward<Args>( args )... );
}

template <class ViewType, std::size_t NumSpaceDim>
using Norm1Functor [[deprecated( "Cajita is now Cabana::Grid." )]] =
using Norm1Functor CAJITA_DEPRECATED =
Cabana::Grid::ArrayOp::Norm1Functor<ViewType, NumSpaceDim>;
template <class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] void norm1( Args&&... args )
CAJITA_DEPRECATED void norm1( Args&&... args )
{
return Cabana::Grid::ArrayOp::norm1( std::forward<Args>( args )... );
}

template <class ViewType, std::size_t NumSpaceDim>
using Norm2Functor [[deprecated( "Cajita is now Cabana::Grid." )]] =
using Norm2Functor CAJITA_DEPRECATED =
Cabana::Grid::ArrayOp::Norm2Functor<ViewType, NumSpaceDim>;
template <class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] void norm2( Args&&... args )
CAJITA_DEPRECATED void norm2( Args&&... args )
{
return Cabana::Grid::ArrayOp::norm2( std::forward<Args>( args )... );
}
Expand Down
14 changes: 6 additions & 8 deletions grid/src/Cabana_Grid_BovWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <Cabana_Grid_IndexSpace.hpp>
#include <Cabana_Grid_MpiTraits.hpp>
#include <Cabana_Grid_Types.hpp>
#include <Cabana_Utils.hpp> // FIXME: remove after next release.

#include <Kokkos_Core.hpp>

Expand Down Expand Up @@ -421,31 +422,28 @@ namespace BovWriter
{
//! \cond Deprecated
template <typename T>
using BovFormat [[deprecated( "Cajita is now Cabana::Grid." )]] =
using BovFormat CAJITA_DEPRECATED =
Cabana::Grid::Experimental::BovWriter::BovFormat<T>;
template <typename T>
using BovCentering [[deprecated( "Cajita is now Cabana::Grid." )]] =
using BovCentering CAJITA_DEPRECATED =
Cabana::Grid::Experimental::BovWriter::BovCentering<T>;

template <class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] void
createSubarray( Args&&... args )
CAJITA_DEPRECATED void createSubarray( Args&&... args )
{
return Cabana::Grid::Experimental::BovWriter::createSubarray(
std::forward<Args>( args )... );
}

template <class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] auto
reorderView( Args&&... args )
CAJITA_DEPRECATED auto reorderView( Args&&... args )
{
return Cabana::Grid::Experimental::BovWriter::reorderView(
std::forward<Args>( args )... );
}

template <class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] auto
writeTimeStep( Args&&... args )
CAJITA_DEPRECATED auto writeTimeStep( Args&&... args )
{
return Cabana::Grid::Experimental::BovWriter::writeTimeStep(
std::forward<Args>( args )... );
Expand Down
40 changes: 17 additions & 23 deletions grid/src/Cabana_Grid_FastFourierTransform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <Cabana_Grid_Array.hpp>
#include <Cabana_Grid_Types.hpp>

#include <Cabana_Utils.hpp>
#include <Cabana_Utils.hpp> // FIXME: remove after next release.

#include <Kokkos_Core.hpp>

Expand Down Expand Up @@ -792,63 +792,57 @@ namespace Cajita
namespace Experimental
{
//! \cond Deprecated
using FFTScaleFull [[deprecated( "Cajita is now Cabana::Grid." )]] =
Cabana::Grid::Experimental::FFTScaleFull;
using FFTScaleNone [[deprecated( "Cajita is now Cabana::Grid." )]] =
Cabana::Grid::Experimental::FFTScaleNone;
using FFTScaleSymmetric [[deprecated( "Cajita is now Cabana::Grid." )]] =
using FFTScaleFull CAJITA_DEPRECATED = Cabana::Grid::Experimental::FFTScaleFull;
using FFTScaleNone CAJITA_DEPRECATED = Cabana::Grid::Experimental::FFTScaleNone;
using FFTScaleSymmetric CAJITA_DEPRECATED =
Cabana::Grid::Experimental::FFTScaleSymmetric;
using FFTBackendFFTW [[deprecated( "Cajita is now Cabana::Grid." )]] =
using FFTBackendFFTW CAJITA_DEPRECATED =
Cabana::Grid::Experimental::FFTBackendFFTW;
using FFTBackendMKL [[deprecated( "Cajita is now Cabana::Grid." )]] =
using FFTBackendMKL CAJITA_DEPRECATED =
Cabana::Grid::Experimental::FFTBackendMKL;
namespace Impl
{
using FFTBackendDefault [[deprecated( "Cajita is now Cabana::Grid." )]] =
using FFTBackendDefault CAJITA_DEPRECATED =
Cabana::Grid::Experimental::Impl::FFTBackendDefault;
}

template <class ArrayEntity, class ArrayMesh, class ArrayDevice,
class ArrayScalar, class Entity, class Mesh, class Device,
class Scalar, typename SFINAE = void>
using is_matching_array [[deprecated( "Cajita is now Cabana::Grid." )]] =
using is_matching_array CAJITA_DEPRECATED =
Cabana::Grid::Experimental::is_matching_array<
ArrayEntity, ArrayMesh, ArrayDevice, ArrayScalar, Entity, Mesh, Device,
Scalar, SFINAE>;

template <class EntityType, class MeshType, class Scalar, class DeviceType,
class Derived>
using FastFourierTransform [[deprecated( "Cajita is now Cabana::Grid." )]] =
using FastFourierTransform CAJITA_DEPRECATED =
Cabana::Grid::Experimental::FastFourierTransform<
EntityType, MeshType, Scalar, DeviceType, Derived>;

using FastFourierTransformParams
[[deprecated( "Cajita is now Cabana::Grid." )]] =
Cabana::Grid::Experimental::FastFourierTransformParams;
using FastFourierTransformParams CAJITA_DEPRECATED =
Cabana::Grid::Experimental::FastFourierTransformParams;

template <class EntityType, class MeshType, class Scalar, class DeviceType,
class Derived>
using FastFourierTransform [[deprecated( "Cajita is now Cabana::Grid." )]] =
using FastFourierTransform CAJITA_DEPRECATED =
Cabana::Grid::Experimental::FastFourierTransform<
EntityType, MeshType, Scalar, DeviceType, Derived>;

template <class EntityType, class MeshType, class Scalar, class MemorySpace,
class ExecSpace, class BackendType>
using HeffteFastFourierTransform
[[deprecated( "Cajita is now Cabana::Grid." )]] =
Cabana::Grid::Experimental::HeffteFastFourierTransform<
EntityType, MeshType, Scalar, MemorySpace, ExecSpace, BackendType>;
using HeffteFastFourierTransform CAJITA_DEPRECATED =
Cabana::Grid::Experimental::HeffteFastFourierTransform<
EntityType, MeshType, Scalar, MemorySpace, ExecSpace, BackendType>;

template <class Scalar, class MemorySpace, class BackendType, class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] auto
createHeffteFastFourierTransform( Args&&... args )
CAJITA_DEPRECATED auto createHeffteFastFourierTransform( Args&&... args )
{
return Cabana::Grid::Experimental::createHeffteFastFourierTransform<
Scalar, MemorySpace, BackendType>( std::forward<Args>( args )... );
}
template <class Scalar, class MemorySpace, class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] auto
createHeffteFastFourierTransform( Args&&... args )
CAJITA_DEPRECATED auto createHeffteFastFourierTransform( Args&&... args )
{
return Cabana::Grid::Experimental::createHeffteFastFourierTransform<
Scalar, MemorySpace>( std::forward<Args>( args )... );
Expand Down
7 changes: 3 additions & 4 deletions grid/src/Cabana_Grid_GlobalGrid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <Cabana_Grid_GlobalMesh.hpp>
#include <Cabana_Grid_Partitioner.hpp>
#include <Cabana_Grid_Types.hpp>
#include <Cabana_Utils.hpp> // FIXME: remove after next release.

#include <array>
#include <memory>
Expand Down Expand Up @@ -240,12 +241,10 @@ namespace Cajita
{
//! \cond Deprecated
template <class MeshType>
using GlobalGrid [[deprecated( "Cajita is now Cabana::Grid." )]] =
Cabana::Grid::GlobalGrid<MeshType>;
using GlobalGrid CAJITA_DEPRECATED = Cabana::Grid::GlobalGrid<MeshType>;

template <class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] auto
createGlobalGrid( Args&&... args )
CAJITA_DEPRECATED auto createGlobalGrid( Args&&... args )
{
return Cabana::Grid::createGlobalGrid( std::forward<Args>( args )... );
}
Expand Down
13 changes: 5 additions & 8 deletions grid/src/Cabana_Grid_GlobalMesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define CABANA_GRID_GLOBALMESH_HPP

#include <Cabana_Grid_Types.hpp>
#include <Cabana_Utils.hpp> // FIXME: remove after next release.

#include <array>
#include <cmath>
Expand Down Expand Up @@ -491,28 +492,24 @@ namespace Cajita
{
//! \cond Deprecated
template <class MeshType>
using GlobalMesh [[deprecated( "Cajita is now Cabana::Grid." )]] =
Cabana::Grid::GlobalMesh<MeshType>;
using GlobalMesh CAJITA_DEPRECATED = Cabana::Grid::GlobalMesh<MeshType>;

template <class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] auto
createUniformGlobalMesh( Args&&... args )
CAJITA_DEPRECATED auto createUniformGlobalMesh( Args&&... args )
{
return Cabana::Grid::createUniformGlobalMesh(
std::forward<Args>( args )... );
}

template <class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] auto
createNonUniformGlobalMesh( Args&&... args )
CAJITA_DEPRECATED auto createNonUniformGlobalMesh( Args&&... args )
{
return Cabana::Grid::createNonUniformGlobalMesh(
std::forward<Args>( args )... );
}

template <class... Args>
[[deprecated( "Cajita is now Cabana::Grid." )]] auto
createSparseGlobalMesh( Args&&... args )
CAJITA_DEPRECATED auto createSparseGlobalMesh( Args&&... args )
{
return Cabana::Grid::createSparseGlobalMesh(
std::forward<Args>( args )... );
Expand Down
Loading

0 comments on commit 81c7a5b

Please sign in to comment.