Phalanx Development
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Friends | List of all members
PHX::MDField< Scalar, Props > Class Template Reference

#include <Phalanx_MDField.hpp>

Public Types

using traits = FieldTraits< Scalar, Props... >
 
using layout_type = typename traits::layout
 
using device_type = typename traits::device
 
using data_type = typename traits::data_type
 
using array_type = typename traits::array_type
 
using size_type = typename device_type::size_type
 
using execution_space = typename array_type::execution_space
 
typedef Scalar value_type
 
typedef Scalar & reference_type
 

Public Member Functions

template<typename... Extents>
 MDField (const std::string name, const std::string layout_name, Extents... e)
 ONLY USE THIS CTOR FOR UNMANAGED FIELDS!!!! It will allocate memory unassociated with the DAG!
 
 MDField (const std::string &name, const Teuchos::RCP< PHX::DataLayout > &dl)
 
 MDField (const PHX::FieldTag &t)
 
 MDField (const Teuchos::RCP< const PHX::FieldTag > &t)
 
 MDField ()
 Default empty constructor.
 
KOKKOS_FUNCTION MDField (const MDField &source)
 Copy ctor.
 
template<typename SourceScalar , typename... SourceProps>
KOKKOS_FUNCTION MDField (const MDField< SourceScalar, SourceProps... > &source)
 Templated copy ctor.
 
constexpr bool is_static () const
 
constexpr bool is_dynamic () const
 
KOKKOS_INLINE_FUNCTION constexpr size_type rank () const
 
KOKKOS_INLINE_FUNCTION constexpr size_t size () const
 
KOKKOS_INLINE_FUNCTION constexpr size_t span () const
 
const PHX::FieldTagfieldTag () const
 
Teuchos::RCP< const PHX::FieldTagfieldTagPtr () const
 
PHX::MDField< Scalar, Props... > & operator= (const MDField< Scalar, Props... > &source)
 
template<typename SrcScalar , typename... SrcProps>
PHX::MDField< Scalar, Props... > & operator= (const MDField< SrcScalar, SrcProps... > &source)
 
template<typename... index_pack>
KOKKOS_FORCEINLINE_FUNCTION PHX::MDFieldReturnType< array_type >::return_type operator() (const index_pack &... indices) const
 
template<typename... index_pack>
KOKKOS_FORCEINLINE_FUNCTION PHX::MDFieldReturnType< array_type >::return_type access (const index_pack &... indices) const
 
template<typename iType0 >
KOKKOS_FORCEINLINE_FUNCTION PHX::MDFieldReturnType< array_type >::return_type operator[] (iType0 index0) const
 
template<typename iType >
KOKKOS_INLINE_FUNCTION constexpr std::enable_if< std::is_integral< iType >::value, size_t >::type extent (const iType &r) const
 
template<typename iType >
KOKKOS_INLINE_FUNCTION constexpr std::enable_if< std::is_integral< iType >::value, int >::type extent_int (const iType &r) const
 
KOKKOS_FORCEINLINE_FUNCTION constexpr size_type dimension_0 () const
 
KOKKOS_FORCEINLINE_FUNCTION constexpr size_type dimension_1 () const
 
KOKKOS_FORCEINLINE_FUNCTION constexpr size_type dimension_2 () const
 
KOKKOS_FORCEINLINE_FUNCTION constexpr size_type dimension_3 () const
 
KOKKOS_FORCEINLINE_FUNCTION constexpr size_type dimension_4 () const
 
KOKKOS_FORCEINLINE_FUNCTION constexpr size_type dimension_5 () const
 
KOKKOS_FORCEINLINE_FUNCTION constexpr size_type dimension_6 () const
 
KOKKOS_FORCEINLINE_FUNCTION constexpr size_type dimension_7 () const
 
template<typename iType >
KOKKOS_FORCEINLINE_FUNCTION constexpr size_type dimension (const iType &ord) const
 
void setFieldTag (const PHX::FieldTag &t)
 
void setFieldTag (const Teuchos::RCP< const PHX::FieldTag > &t)
 
void setFieldData (const std::any &a)
 
void print (std::ostream &os, bool printValues=false) const
 
template<typename iType >
void dimensions (std::vector< iType > &dims)
 
KOKKOS_FORCEINLINE_FUNCTION operator array_type () const
 
KOKKOS_FORCEINLINE_FUNCTION Kokkos::DynRankView< Scalar, typename PHX::DevLayout< Scalar >::type, PHX::Device > get_view ()
 
KOKKOS_FORCEINLINE_FUNCTION const Kokkos::DynRankView< Scalar, typename PHX::DevLayout< Scalar >::type, PHX::Device > get_view () const
 
KOKKOS_FORCEINLINE_FUNCTION array_type get_static_view ()
 Returns a static view of the underlying kokkos static view.
 
KOKKOS_FORCEINLINE_FUNCTION const array_type get_static_view () const
 Returns a static view of the underlying kokkos static view.
 
template<typename SrcScalar , typename... SrcProps>
void deep_copy (const PHX::MDField< SrcScalar, SrcProps... > &source)
 
void deep_copy (const Scalar &source)
 
std::any get_static_view_as_any () const
 
void releaseFieldData ()
 Resets the underlying view ptr to null.
 

Friends

template<typename FScalar , typename... FProps>
class PHX::MDField
 

Detailed Description

template<typename Scalar, typename... Props>
class PHX::MDField< Scalar, Props >

A multidimensional array with optional compile time rank tags for self documentation.

This class currently wraps a Kokkos::View as the underlying data structure for performance portability. It also carries along a field tag with identifier and a data layout for sizing the multidimensional array.

Design Notes:

Constructor & Destructor Documentation

◆ MDField()

template<typename Scalar , typename... Props>
template<typename SourceScalar , typename... SourceProps>
KOKKOS_FUNCTION PHX::MDField< Scalar, Props >::MDField ( const MDField< SourceScalar, SourceProps... > &  source)
inline

Templated copy ctor.

The templated version allows for different extra template parameters/dimension tags. For example, one evaluator could a use "Point" dim tag and be copied to an evaluator that uses a "QuadraturePoint" dim tag for the same field in a different evaluator. Another example is for assigning a compiletime MDFields to runtime MDFields and vice versa. Examples:

MDField<double,Cell,Point> a("a",data_layout); a.setFieldData(memory); MDField<double,Cell,QuadPoint> b; b = a;

MDField<double> c; // dynamic rank c = a;

Another example could be for atomic access flags.

Member Function Documentation

◆ dimensions()

template<typename Scalar , typename... Props>
template<typename iType >
void PHX::MDField< Scalar, Props >::dimensions ( std::vector< iType > &  dims)
inline

WARNING: The vector data in this method should be a "size_type" to be consistent with Kokkos, but for backwards compatibility during the transition, needs to be templated in the index type.

void dimensions(std::vector<size_type>& dims);


The documentation for this class was generated from the following files: