diff --git a/include/SmartField.h b/include/SmartField.h index 866c5fee2..13423d912 100644 --- a/include/SmartField.h +++ b/include/SmartField.h @@ -62,10 +62,10 @@ class SmartField { }; -// LEGACY implementation, HOST only, data type has to be a reference b/c the +// LEGACY implementation, HOST only, data type has to be a reference b/c the // stk::mesh::field ctor is not public // -// This Type should be used as close to a bucket loop as possible, and not +// This Type should be used as close to a bucket loop as possible, and not // stored as a class member since sync/modify are marked in the ctor/dtor template class SmartField< @@ -108,6 +108,7 @@ class SmartField< // --- Default Accessors template + inline typename std::enable_if_t::value, T>& get(const stk::mesh::Entity& entity) const { @@ -115,6 +116,7 @@ class SmartField< } template + inline typename std::enable_if_t::value, T>& operator()(const stk::mesh::Entity& entity) const { @@ -123,6 +125,7 @@ class SmartField< // --- Const Accessors template + inline const typename std::enable_if_t::value, T>& get(const stk::mesh::Entity& entity) const { @@ -130,6 +133,7 @@ class SmartField< } template + inline const typename std::enable_if_t::value, T>& operator()(const stk::mesh::Entity& entity) const { @@ -153,7 +157,7 @@ class SmartField< // These should always be used as part of lambda/functor captures // using copy by value. // -// SFINAE is used to remove KOKKOS_FUNCTION type decorators for HOST MEMSPACE +// SFINAE is used to remove KOKKOS_INLINE_FUNCTION type decorators for HOST MEMSPACE template class SmartField< FieldType, @@ -212,9 +216,10 @@ class SmartField< } //************************************************************ - // Host functions (Remove KOKKOS_FUNCTION decorators) + // Host functions (Remove KOKKOS_INLINE_FUNCTION decorators) //************************************************************ template + inline std::enable_if_t::value, unsigned> get_ordinal() const { return stkField_.get_ordinal(); @@ -222,6 +227,7 @@ class SmartField< // --- Default Accessors template + inline std::enable_if_t< std::is_same::value && !std::is_same::value, T>& @@ -231,6 +237,7 @@ class SmartField< } template + inline std::enable_if_t< std::is_same::value && !std::is_same::value, T>& @@ -240,6 +247,7 @@ class SmartField< } template + inline std::enable_if_t< std::is_same::value && !std::is_same::value, T>& @@ -249,6 +257,7 @@ class SmartField< } template + inline std::enable_if_t< std::is_same::value && !std::is_same::value, T>& @@ -259,6 +268,7 @@ class SmartField< // --- Const Accessors template + inline const std::enable_if_t< std::is_same::value && std::is_same::value, T>& @@ -268,6 +278,7 @@ class SmartField< } template + inline const std::enable_if_t< std::is_same::value && std::is_same::value, T>& @@ -277,6 +288,7 @@ class SmartField< } template + inline const std::enable_if_t< std::is_same::value && std::is_same::value, T>& @@ -286,6 +298,7 @@ class SmartField< } template + inline const std::enable_if_t< std::is_same::value && std::is_same::value, T>& @@ -298,7 +311,7 @@ class SmartField< // Device functions //************************************************************ template - KOKKOS_FUNCTION std::enable_if_t::value, unsigned> + KOKKOS_INLINE_FUNCTION std::enable_if_t::value, unsigned> get_ordinal() const { return stkField_.get_ordinal(); @@ -306,7 +319,7 @@ class SmartField< // --- Default Accessors template - KOKKOS_FUNCTION std::enable_if_t< + KOKKOS_INLINE_FUNCTION std::enable_if_t< std::is_same::value && !std::is_same::value, T>& get(stk::mesh::FastMeshIndex& index, int component) const @@ -315,7 +328,7 @@ class SmartField< } template - KOKKOS_FUNCTION std::enable_if_t< + KOKKOS_INLINE_FUNCTION std::enable_if_t< std::is_same::value && !std::is_same::value, T>& get(MeshIndex index, int component) const @@ -324,7 +337,7 @@ class SmartField< } template - KOKKOS_FUNCTION std::enable_if_t< + KOKKOS_INLINE_FUNCTION std::enable_if_t< std::is_same::value && !std::is_same::value, T>& operator()(const stk::mesh::FastMeshIndex& index, int component) const @@ -333,7 +346,7 @@ class SmartField< } template - KOKKOS_FUNCTION std::enable_if_t< + KOKKOS_INLINE_FUNCTION std::enable_if_t< std::is_same::value && !std::is_same::value, T>& operator()(const MeshIndex index, int component) const @@ -343,7 +356,7 @@ class SmartField< // --- Const Accessors template - KOKKOS_FUNCTION const std::enable_if_t< + KOKKOS_INLINE_FUNCTION const std::enable_if_t< std::is_same::value && std::is_same::value, T>& get(stk::mesh::FastMeshIndex& index, int component) const @@ -352,7 +365,7 @@ class SmartField< } template - KOKKOS_FUNCTION const std::enable_if_t< + KOKKOS_INLINE_FUNCTION const std::enable_if_t< std::is_same::value && std::is_same::value, T>& get(MeshIndex index, int component) const @@ -361,7 +374,7 @@ class SmartField< } template - KOKKOS_FUNCTION const std::enable_if_t< + KOKKOS_INLINE_FUNCTION const std::enable_if_t< std::is_same::value && std::is_same::value, T>& operator()(const stk::mesh::FastMeshIndex& index, int component) const @@ -370,7 +383,7 @@ class SmartField< } template - KOKKOS_FUNCTION const std::enable_if_t< + KOKKOS_INLINE_FUNCTION const std::enable_if_t< std::is_same::value && std::is_same::value, T>& operator()(const MeshIndex index, int component) const diff --git a/src/SmartField.C b/src/SmartField.C index 246644cda..4fc1948a9 100644 --- a/src/SmartField.C +++ b/src/SmartField.C @@ -26,10 +26,17 @@ using namespace tags; template class SmartField, HOST, WRITE_ALL>; \ template class SmartField, HOST, READ_WRITE> -EXPLICIT_TYPE_INSTANTIATOR_NGP(double); EXPLICIT_TYPE_INSTANTIATOR_NGP(int); +EXPLICIT_TYPE_INSTANTIATOR_NGP(double); EXPLICIT_TYPE_INSTANTIATOR_NGP(stk::mesh::EntityId); -EXPLICIT_TYPE_INSTANTIATOR_NGP(HypreIntType); + +// Hypre Integer types +// What to do about HYPRE int vs long vs long long here? +/* #ifdef NALU_USES_HYPRE */ +/* typedef HYPRE_Int HypreIntType; */ +/* EXPLICIT_TYPE_INSTANTIATOR_NGP(HypreIntType); */ +/* EXPLICIT_TYPE_INSTANTIATOR_LEGACY(HypreIDFieldType); */ +/* #endif */ EXPLICIT_TYPE_INSTANTIATOR_LEGACY(ScalarFieldType); EXPLICIT_TYPE_INSTANTIATOR_LEGACY(VectorFieldType); @@ -39,7 +46,6 @@ EXPLICIT_TYPE_INSTANTIATOR_LEGACY(GenericIntFieldType); EXPLICIT_TYPE_INSTANTIATOR_LEGACY(TpetIDFieldType); EXPLICIT_TYPE_INSTANTIATOR_LEGACY(LocalIdFieldType); EXPLICIT_TYPE_INSTANTIATOR_LEGACY(GlobalIdFieldType); -EXPLICIT_TYPE_INSTANTIATOR_LEGACY(HypreIDFieldType); EXPLICIT_TYPE_INSTANTIATOR_LEGACY(ScalarIntFieldType); } // namespace sierra::nalu diff --git a/unit_tests/UnitTestSmartField.C b/unit_tests/UnitTestSmartField.C index 508fd2d31..09cf68af0 100644 --- a/unit_tests/UnitTestSmartField.C +++ b/unit_tests/UnitTestSmartField.C @@ -88,7 +88,7 @@ TEST_F(TestSmartField, device_write_clear_mod_with_lambda) ASSERT_TRUE(ngpField_->need_sync_to_device()); - auto sPtr = MakeSmartField()(*ngpField_); + auto sPtr = MakeSmartField()(*ngpField_); lambda_ordinal(sPtr); EXPECT_FALSE(ngpField_->need_sync_to_device());