https://mooseframework.inl.gov
Public Member Functions | Protected Attributes | List of all members
Moose::Kokkos::MaterialPropertyBase Class Referenceabstract

The base class for Kokkos material properties. More...

#include <KokkosMaterialPropertyDecl.h>

Inheritance diagram for Moose::Kokkos::MaterialPropertyBase:
[legend]

Public Member Functions

 MaterialPropertyBase ()=default
 Default constructor. More...
 
virtual ~MaterialPropertyBase ()
 Desturctor. More...
 
unsigned int id () const
 Get the property ID. More...
 
std::string name () const
 Get the property name. More...
 
std::string type () const
 Get the data type. More...
 
unsigned int dim () const
 Get the dimension. More...
 
unsigned int dim (unsigned int i) const
 Get the size of a dimension. More...
 
virtual std::type_index propertyType ()=0
 Get the property type index for load/store functions. More...
 
virtual void init (const PropRecord &record, const StorageKey &)
 Initialize this property. More...
 
virtual void allocate (const MooseMesh &mesh, const Assembly &assembly, const std::set< SubdomainID > &subdomains, const bool bnd, StorageKey)=0
 Allocate the data storage. More...
 
virtual void copy (const MaterialPropertyBase &prop, StorageKey)=0
 Deep copy another property. More...
 
virtual void swap (MaterialPropertyBase &prop, StorageKey)=0
 Swap with another property. More...
 
KOKKOS_FUNCTION operator bool () const
 Get whether this property is valid. More...
 

Protected Attributes

const PropRecord_record = nullptr
 Pointer to the record of this property. More...
 
unsigned int _id = libMesh::invalid_uint
 Property ID. More...
 
bool _default = false
 Flag whether this property has a default value. More...
 

Detailed Description

The base class for Kokkos material properties.

Definition at line 76 of file KokkosMaterialPropertyDecl.h.

Constructor & Destructor Documentation

◆ MaterialPropertyBase()

Moose::Kokkos::MaterialPropertyBase::MaterialPropertyBase ( )
default

Default constructor.

◆ ~MaterialPropertyBase()

virtual Moose::Kokkos::MaterialPropertyBase::~MaterialPropertyBase ( )
inlinevirtual

Desturctor.

Definition at line 86 of file KokkosMaterialPropertyDecl.h.

86 {}

Member Function Documentation

◆ allocate()

virtual void Moose::Kokkos::MaterialPropertyBase::allocate ( const MooseMesh mesh,
const Assembly assembly,
const std::set< SubdomainID > &  subdomains,
const bool  bnd,
StorageKey   
)
pure virtual

Allocate the data storage.

Parameters
meshThe MOOSE mesh
assemblyThe Kokkos assembly
subdomainsThe MOOSE subdomain IDs
bndWhether this property is a face property

Implemented in Moose::Kokkos::MaterialProperty< T, dimension >.

◆ copy()

virtual void Moose::Kokkos::MaterialPropertyBase::copy ( const MaterialPropertyBase prop,
StorageKey   
)
pure virtual

Deep copy another property.

Parameters
propThe property to copy

Implemented in Moose::Kokkos::MaterialProperty< T, dimension >.

◆ dim() [1/2]

unsigned int Moose::Kokkos::MaterialPropertyBase::dim ( ) const
inline

Get the dimension.

Returns
The dimension

Definition at line 107 of file KokkosMaterialPropertyDecl.h.

Referenced by dim().

107 { return _record->dims.size(); }
const PropRecord * _record
Pointer to the record of this property.
std::vector< unsigned int > dims
Size of each dimension.

◆ dim() [2/2]

unsigned int Moose::Kokkos::MaterialPropertyBase::dim ( unsigned int  i) const
inline

Get the size of a dimension.

Parameters
iThe dimension index
Returns
The size of the dimension

Definition at line 113 of file KokkosMaterialPropertyDecl.h.

114  {
115  if (i >= dim())
116  mooseError("Cannot query the size of ",
117  i,
118  "-th dimension for the ",
119  dim(),
120  "D material property '",
121  name(),
122  "'.");
123 
124  return _record->dims.at(i);
125  }
const PropRecord * _record
Pointer to the record of this property.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:323
std::vector< unsigned int > dims
Size of each dimension.
unsigned int dim() const
Get the dimension.
std::string name() const
Get the property name.

◆ id()

unsigned int Moose::Kokkos::MaterialPropertyBase::id ( ) const
inline

Get the property ID.

Returns
The property ID assigned by the MOOSE registry

Definition at line 92 of file KokkosMaterialPropertyDecl.h.

92 { return _id; }

◆ init()

void MaterialPropertyBase< T, is_ad >::init ( const PropRecord record,
const StorageKey  
)
inlinevirtual

Initialize this property.

Parameters
recordThe record of this property

Reimplemented in Moose::Kokkos::MaterialProperty< T, dimension >.

Definition at line 28 of file KokkosMaterialProperty.h.

Referenced by Moose::Kokkos::MaterialProperty< T, dimension >::init().

29 {
30  _record = &record;
31  _id = record.id;
32 }
const PropRecord * _record
Pointer to the record of this property.

◆ name()

std::string Moose::Kokkos::MaterialPropertyBase::name ( ) const
inline

Get the property name.

Returns
The property name

Definition at line 97 of file KokkosMaterialPropertyDecl.h.

Referenced by dim().

97 { return _record->name; }
const PropRecord * _record
Pointer to the record of this property.
std::string name
Property name.

◆ operator bool()

KOKKOS_FUNCTION Moose::Kokkos::MaterialPropertyBase::operator bool ( ) const
inline

Get whether this property is valid.

Returns
Whether this property is valid

Definition at line 167 of file KokkosMaterialPropertyDecl.h.

167 { return _id != libMesh::invalid_uint || _default; }
const unsigned int invalid_uint
bool _default
Flag whether this property has a default value.

◆ propertyType()

virtual std::type_index Moose::Kokkos::MaterialPropertyBase::propertyType ( )
pure virtual

Get the property type index for load/store functions.

Returns
The property type index for the load/store function pointer map lookup

Implemented in Moose::Kokkos::MaterialProperty< T, dimension >.

◆ swap()

virtual void Moose::Kokkos::MaterialPropertyBase::swap ( MaterialPropertyBase prop,
StorageKey   
)
pure virtual

Swap with another property.

Parameters
propThe property to swap

Implemented in Moose::Kokkos::MaterialProperty< T, dimension >.

◆ type()

std::string Moose::Kokkos::MaterialPropertyBase::type ( ) const
inline

Get the data type.

Returns
The demangled data type name

Definition at line 102 of file KokkosMaterialPropertyDecl.h.

Referenced by Moose::Kokkos::MaterialProperty< T, dimension >::propertyType().

102 { return _record->type; }
const PropRecord * _record
Pointer to the record of this property.
std::string type
Demangled data type name.

Member Data Documentation

◆ _default

bool Moose::Kokkos::MaterialPropertyBase::_default = false
protected

Flag whether this property has a default value.

Definition at line 182 of file KokkosMaterialPropertyDecl.h.

Referenced by operator bool().

◆ _id

unsigned int Moose::Kokkos::MaterialPropertyBase::_id = libMesh::invalid_uint
protected

Property ID.

Definition at line 178 of file KokkosMaterialPropertyDecl.h.

Referenced by id(), init(), and operator bool().

◆ _record

const PropRecord* Moose::Kokkos::MaterialPropertyBase::_record = nullptr
protected

Pointer to the record of this property.

Definition at line 174 of file KokkosMaterialPropertyDecl.h.

Referenced by dim(), init(), name(), and type().


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