# PhasicFlow: src/phasicFlow/Kokkos/KokkosTypes.hpp Source File
PhasicFlow is an open-source parallel DEM (discrete element method) package for simulating granular flow. It is developed in C++ and can be exectued on both GPU (like CUDA) and CPU.

KokkosTypes.hpp
Go to the documentation of this file.
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __KokkosTypes_hpp__
#define __KokkosTypes_hpp__
#include <Kokkos_Core.hpp>
#include <Kokkos_DualView.hpp>
#include <Kokkos_UnorderedMap.hpp>
#include "builtinTypes.hpp"
namespace pFlow
{
using HostSpace = Kokkos::HostSpace;
using Serial = Kokkos::Serial;
#ifdef _OPENMP
using OpenMP = Kokkos::OpenMP;
#endif
#ifdef __CUDACC__
using Cuda = Kokkos::Cuda;
#endif
using DefaultHostExecutionSpace = Kokkos::DefaultHostExecutionSpace;
using DefaultExecutionSpace = Kokkos::DefaultExecutionSpace;
using deviceRPolicyStatic = Kokkos::RangePolicy<
Kokkos::DefaultExecutionSpace,
Kokkos::Schedule<Kokkos::Static>,
Kokkos::IndexType<pFlow::uint32>>;
using hostRPolicyStatic = Kokkos::RangePolicy<
Kokkos::DefaultExecutionSpace,
Kokkos::Schedule<Kokkos::Static>,
Kokkos::IndexType<pFlow::uint32>>;
using deviceRPolicyDynamic = Kokkos::RangePolicy<
Kokkos::DefaultExecutionSpace,
Kokkos::Schedule<Kokkos::Dynamic>,
Kokkos::IndexType<pFlow::uint32>>;
using hostRPolicyDynamic = Kokkos::RangePolicy<
Kokkos::DefaultExecutionSpace,
Kokkos::Schedule<Kokkos::Dynamic>,
Kokkos::IndexType<pFlow::uint32>>;
template<typename T1, typename T2>
using Pair = Kokkos::pair<T1, T2>;
template<typename T, typename... properties>
using ViewTypeScalar = Kokkos::View<T, properties...>;
template<typename T, typename... properties>
using ViewType1D = Kokkos::View<T*, properties...>;
template<typename T, typename... properties>
using ViewType2D = Kokkos::View<T**, properties...>;
template<typename T, typename... properties>
using ViewType3D = Kokkos::View<T***, properties...>;
template<typename T, typename... properties>
using DualViewType1D = Kokkos::DualView<T*, properties...>;
template<typename Key, typename Value, typename... properties>
using unorderedMap = Kokkos::UnorderedMap<Key, Value, properties...>;
template<typename Key, typename... properties>
using unorderedSet = Kokkos::UnorderedMap<Key, void, properties...>;
template<typename T>
using deviceViewTypeScalar = Kokkos::View<T>;
template<typename T>
using deviceViewType1D = Kokkos::View<T*>;
template<typename T, typename Layout = void>
using deviceViewType2D = Kokkos::View<T**, Layout, void>;
template<typename T, typename Layout = void>
using deviceViewType3D = Kokkos::View<T***, Layout, void>;
template<typename T>
using hostViewTypeScalar = Kokkos::View<T, Kokkos::HostSpace>;
template<typename T>
using hostViewType1D = Kokkos::View<T*, Kokkos::HostSpace>;
template<typename T, typename Layout = void>
using hostViewType2D = Kokkos::View<T**, Layout, Kokkos::HostSpace>;
template<typename T, typename Layout = void>
using hostViewType3D = Kokkos::View<T***, Layout, Kokkos::HostSpace>;
template<typename T>
using deviceAtomicViewType1D = Kokkos::View<
T*,
Kokkos::MemoryTraits<
std::is_same_v<DefaultExecutionSpace, Serial> ? 0 : Kokkos::Atomic>>;
template<typename T>
using deviceAtomicViewType3D = Kokkos::View<
T***,
Kokkos::MemoryTraits<
std::is_same_v<DefaultExecutionSpace, Serial> ? 0 : Kokkos::Atomic>>;
} // pFlow
#endif //__KokkosTypes_hpp__
pFlow::hostViewType2D
Kokkos::View< T **, Layout, Kokkos::HostSpace > hostViewType2D
2D array on host
Definition: KokkosTypes.hpp:140
pFlow::DefaultHostExecutionSpace
Kokkos::DefaultHostExecutionSpace DefaultHostExecutionSpace
Default Host execution space, on top of all host execution spaces.
Definition: KokkosTypes.hpp:57
pFlow::Serial
Kokkos::Serial Serial
Serial execution space.
Definition: KokkosTypes.hpp:44
pFlow::Pair
Kokkos::pair< T1, T2 > Pair
Pair of two variables.
Definition: KokkosTypes.hpp:85
pFlow::ViewType2D
Kokkos::View< T **, properties... > ViewType2D
2D view as an array
Definition: KokkosTypes.hpp:97
pFlow::deviceViewTypeScalar
Kokkos::View< T > deviceViewTypeScalar
Scalar on device.
Definition: KokkosTypes.hpp:117
pFlow::hostRPolicyDynamic
Kokkos::RangePolicy< Kokkos::DefaultExecutionSpace, Kokkos::Schedule< Kokkos::Dynamic >, Kokkos::IndexType< pFlow::uint32 > > hostRPolicyDynamic
Definition: KokkosTypes.hpp:81
pFlow::DefaultExecutionSpace
Kokkos::DefaultExecutionSpace DefaultExecutionSpace
Default execution space, it can be device exe.
Definition: KokkosTypes.hpp:61
pFlow::deviceViewType2D
Kokkos::View< T **, Layout, void > deviceViewType2D
2D view on device as an array on device
Definition: KokkosTypes.hpp:125
pFlow::DualViewType1D
Kokkos::DualView< T *, properties... > DualViewType1D
1D dual view as a vector
Definition: KokkosTypes.hpp:105
pFlow::HostSpace
Kokkos::HostSpace HostSpace
Host memory space.
Definition: KokkosTypes.hpp:41
pFlow::deviceViewType1D
Kokkos::View< T * > deviceViewType1D
1D array (vector) with default device (memory space and execution space)
Definition: KokkosTypes.hpp:121
pFlow::deviceAtomicViewType1D
Kokkos::View< T *, Kokkos::MemoryTraits< std::is_same_v< DefaultExecutionSpace, Serial > ? 0 :Kokkos::Atomic > > deviceAtomicViewType1D
1D vector on device with atomic capabilities
Definition: KokkosTypes.hpp:151
pFlow
Definition: demGeometry.hpp:27
pFlow::unorderedSet
Kokkos::UnorderedMap< Key, void, properties... > unorderedSet
unordered set
Definition: KokkosTypes.hpp:113
pFlow::deviceViewType3D
Kokkos::View< T ***, Layout, void > deviceViewType3D
3D view on device as an array on device
Definition: KokkosTypes.hpp:129
pFlow::hostViewType3D
Kokkos::View< T ***, Layout, Kokkos::HostSpace > hostViewType3D
3D array on host
Definition: KokkosTypes.hpp:144
pFlow::ViewTypeScalar
Kokkos::View< T, properties... > ViewTypeScalar
View for a scalar.
Definition: KokkosTypes.hpp:89
pFlow::unorderedMap
Kokkos::UnorderedMap< Key, Value, properties... > unorderedMap
unordered map
Definition: KokkosTypes.hpp:109
pFlow::hostRPolicyStatic
Kokkos::RangePolicy< Kokkos::DefaultExecutionSpace, Kokkos::Schedule< Kokkos::Static >, Kokkos::IndexType< pFlow::uint32 > > hostRPolicyStatic
Definition: KokkosTypes.hpp:71
pFlow::ViewType1D
Kokkos::View< T *, properties... > ViewType1D
1D veiw as a vector
Definition: KokkosTypes.hpp:93
pFlow::hostViewTypeScalar
Kokkos::View< T, Kokkos::HostSpace > hostViewTypeScalar
Definition: KokkosTypes.hpp:132
pFlow::ViewType3D
Kokkos::View< T ***, properties... > ViewType3D
3D view as an array
Definition: KokkosTypes.hpp:101
pFlow::hostViewType1D
Kokkos::View< T *, Kokkos::HostSpace > hostViewType1D
1D array (vector with host memeory space)
Definition: KokkosTypes.hpp:136
pFlow::deviceRPolicyDynamic
Kokkos::RangePolicy< Kokkos::DefaultExecutionSpace, Kokkos::Schedule< Kokkos::Dynamic >, Kokkos::IndexType< pFlow::uint32 > > deviceRPolicyDynamic
Definition: KokkosTypes.hpp:76
pFlow::deviceRPolicyStatic
Kokkos::RangePolicy< Kokkos::DefaultExecutionSpace, Kokkos::Schedule< Kokkos::Static >, Kokkos::IndexType< pFlow::uint32 > > deviceRPolicyStatic
Definition: KokkosTypes.hpp:66
builtinTypes.hpp
pFlow::deviceAtomicViewType3D
Kokkos::View< T ***, Kokkos::MemoryTraits< std::is_same_v< DefaultExecutionSpace, Serial > ? 0 :Kokkos::Atomic > > deviceAtomicViewType3D
3D array on device with atomic capabilities
Definition: KokkosTypes.hpp:158