44#ifndef NIMBLE_KOKKOS_DEFS_H
45#define NIMBLE_KOKKOS_DEFS_H
47#define NIMBLE_FUNCTION KOKKOS_FUNCTION
48#define NIMBLE_INLINE_FUNCTION KOKKOS_INLINE_FUNCTION
50#include "Kokkos_Core.hpp"
55#if defined(KOKKOS_ENABLE_QTHREADS)
58#elif defined(KOKKOS_ENABLE_CUDA_UVM)
65using kokkos_host = Kokkos::Device<kokkos_host_execution_space, kokkos_host_mirror_memory_space>;
68#if defined(KOKKOS_ENABLE_QTHREADS)
71#elif defined(KOKKOS_ENABLE_CUDA_UVM)
74#elif defined(KOKKOS_ENABLE_CUDA)
77#elif defined(KOKKOS_ENABLE_OPENMP)
84using kokkos_device = Kokkos::Device<kokkos_device_execution_space, kokkos_device_memory_space>;
147 FieldBase(
const std::string& arg_name,
const FieldType arg_type) : type_{arg_type}, name_{arg_name} {}
169template <FieldType FType>
177 using View = Kokkos::View<double*, kokkos_host>;
200 using View = Kokkos::View<double*, kokkos_layout, kokkos_device>;
201 using AtomicView = Kokkos::View<double*, kokkos_layout, kokkos_device, Kokkos::MemoryTraits<Kokkos::Atomic>>;
202 using GatheredView = Kokkos::View<double* [NUM_NODES_IN_HEX], kokkos_layout, kokkos_device>;
227 using View = Kokkos::View<double* [3], kokkos_layout, kokkos_host>;
250 using View = Kokkos::View<double* [3], kokkos_layout, kokkos_device>;
251 using AtomicView = Kokkos::View<double* [3], kokkos_layout, kokkos_device, Kokkos::MemoryTraits<Kokkos::Atomic>>;
252 using GatheredView = Kokkos::View<double* [NUM_NODES_IN_HEX][3], kokkos_layout, kokkos_device>;
277 using View = Kokkos::View<double* [NUM_INTEGRATION_POINTS_IN_HEX][6], kokkos_layout, kokkos_host>;
301 using View = Kokkos::View<double* [NUM_INTEGRATION_POINTS_IN_HEX][6], kokkos_layout, kokkos_device>;
302 using SubView =
decltype(Kokkos::subview(*(
View*)(0), (
int)(0), Kokkos::ALL, Kokkos::ALL));
327 using View = Kokkos::View<double* [NUM_INTEGRATION_POINTS_IN_HEX][9], kokkos_layout, kokkos_host>;
351 using View = Kokkos::View<double* [NUM_INTEGRATION_POINTS_IN_HEX][9], kokkos_layout, kokkos_device>;
352 using SubView =
decltype(Kokkos::subview(*(
View*)(0), (
int)(0), Kokkos::ALL, Kokkos::ALL));
377 using View = Kokkos::View<double* [NUM_INTEGRATION_POINTS_IN_HEX][1], kokkos_layout, kokkos_device>;
378 using SubView =
decltype(Kokkos::subview(*(
View*)(0), (
int)(0), Kokkos::ALL, Kokkos::ALL));
403 using View = Kokkos::View<double* [NUM_INTEGRATION_POINTS_IN_HEX][3], kokkos_layout, kokkos_device>;
404 using SubView =
decltype(Kokkos::subview(*(
View*)(0), (
int)(0), Kokkos::ALL, Kokkos::ALL));
429 using View = Kokkos::View<double*, kokkos_host>;
452 using View = Kokkos::View<double*, kokkos_layout, kokkos_device>;
477 using View = Kokkos::View<double* [9], kokkos_layout, kokkos_host>;
501 using View = Kokkos::View<double* [9], kokkos_layout, kokkos_device>;
526 using View = Kokkos::View<double* [6], kokkos_layout, kokkos_host>;
550 using View = Kokkos::View<double* [6], kokkos_layout, kokkos_device>;
Field(View const &v)
Definition nimble_kokkos_defs.h:509
Field(const std::string &name, int num_entries)
Definition nimble_kokkos_defs.h:504
decltype(Kokkos::subview(*(View *)(0),(int)(0), Kokkos::ALL)) SingleEntryView
Definition nimble_kokkos_defs.h:502
View data() const noexcept
Definition nimble_kokkos_defs.h:512
Kokkos::View< double *[9], kokkos_layout, kokkos_device > View
Definition nimble_kokkos_defs.h:501
decltype(Kokkos::subview(*(View *)(0),(int)(0), Kokkos::ALL, Kokkos::ALL)) SubView
Definition nimble_kokkos_defs.h:352
Field(View const &v)
Definition nimble_kokkos_defs.h:360
Kokkos::View< double *[NUM_INTEGRATION_POINTS_IN_HEX][9], kokkos_layout, kokkos_device > View
Definition nimble_kokkos_defs.h:351
View data() const noexcept
Definition nimble_kokkos_defs.h:363
Field(const std::string &name, int num_entries)
Definition nimble_kokkos_defs.h:355
decltype(Kokkos::subview(*(View *)(0),(int)(0),(int)(0), Kokkos::ALL)) SingleEntryView
Definition nimble_kokkos_defs.h:353
Kokkos::View< double *, kokkos_layout, kokkos_device > View
Definition nimble_kokkos_defs.h:452
decltype(Kokkos::subview(*(View *)(0),(int)(0))) SingleEntryView
Definition nimble_kokkos_defs.h:453
View data() const noexcept
Definition nimble_kokkos_defs.h:463
Field(View const &v)
Definition nimble_kokkos_defs.h:460
Field(const std::string &name, int num_entries)
Definition nimble_kokkos_defs.h:455
decltype(Kokkos::subview(*(View *)(0),(int)(0), Kokkos::ALL, Kokkos::ALL)) SubView
Definition nimble_kokkos_defs.h:378
View data() const noexcept
Definition nimble_kokkos_defs.h:389
Field(const std::string &name, int num_entries)
Definition nimble_kokkos_defs.h:381
Field(View const &v)
Definition nimble_kokkos_defs.h:386
Kokkos::View< double *[NUM_INTEGRATION_POINTS_IN_HEX][1], kokkos_layout, kokkos_device > View
Definition nimble_kokkos_defs.h:377
decltype(Kokkos::subview(*(View *)(0),(int)(0),(int)(0), Kokkos::ALL)) SingleEntryView
Definition nimble_kokkos_defs.h:379
Field(const std::string &name, int num_entries)
Definition nimble_kokkos_defs.h:205
Field(View const &v)
Definition nimble_kokkos_defs.h:210
View data() const noexcept
Definition nimble_kokkos_defs.h:213
decltype(Kokkos::subview(*(GatheredView *)(0),(int)(0), Kokkos::ALL)) GatheredSubView
Definition nimble_kokkos_defs.h:203
Kokkos::View< double *[NUM_NODES_IN_HEX], kokkos_layout, kokkos_device > GatheredView
Definition nimble_kokkos_defs.h:202
Kokkos::View< double *, kokkos_layout, kokkos_device, Kokkos::MemoryTraits< Kokkos::Atomic > > AtomicView
Definition nimble_kokkos_defs.h:201
Kokkos::View< double *, kokkos_layout, kokkos_device > View
Definition nimble_kokkos_defs.h:200
Field(const std::string &name, int num_entries)
Definition nimble_kokkos_defs.h:553
View data() const noexcept
Definition nimble_kokkos_defs.h:561
Field(View const &v)
Definition nimble_kokkos_defs.h:558
Kokkos::View< double *[6], kokkos_layout, kokkos_device > View
Definition nimble_kokkos_defs.h:550
decltype(Kokkos::subview(*(View *)(0),(int)(0), Kokkos::ALL)) SingleEntryView
Definition nimble_kokkos_defs.h:551
Field(const std::string &name, int num_entries)
Definition nimble_kokkos_defs.h:305
Field(View const &v)
Definition nimble_kokkos_defs.h:310
decltype(Kokkos::subview(*(View *)(0),(int)(0),(int)(0), Kokkos::ALL)) SingleEntryView
Definition nimble_kokkos_defs.h:303
Kokkos::View< double *[NUM_INTEGRATION_POINTS_IN_HEX][6], kokkos_layout, kokkos_device > View
Definition nimble_kokkos_defs.h:301
decltype(Kokkos::subview(*(View *)(0),(int)(0), Kokkos::ALL, Kokkos::ALL)) SubView
Definition nimble_kokkos_defs.h:302
View data() const noexcept
Definition nimble_kokkos_defs.h:313
Field(const std::string &name, int num_entries)
Definition nimble_kokkos_defs.h:407
decltype(Kokkos::subview(*(View *)(0),(int)(0),(int)(0), Kokkos::ALL)) SingleEntryView
Definition nimble_kokkos_defs.h:405
Field(View const &v)
Definition nimble_kokkos_defs.h:412
Kokkos::View< double *[NUM_INTEGRATION_POINTS_IN_HEX][3], kokkos_layout, kokkos_device > View
Definition nimble_kokkos_defs.h:403
View data() const noexcept
Definition nimble_kokkos_defs.h:415
decltype(Kokkos::subview(*(View *)(0),(int)(0), Kokkos::ALL, Kokkos::ALL)) SubView
Definition nimble_kokkos_defs.h:404
View data() const noexcept
Definition nimble_kokkos_defs.h:263
Field(const std::string &name, int num_entries)
Definition nimble_kokkos_defs.h:255
decltype(Kokkos::subview(*(GatheredView *)(0),(int)(0), Kokkos::ALL, Kokkos::ALL)) GatheredSubView
Definition nimble_kokkos_defs.h:253
Kokkos::View< double *[3], kokkos_layout, kokkos_device, Kokkos::MemoryTraits< Kokkos::Atomic > > AtomicView
Definition nimble_kokkos_defs.h:251
Kokkos::View< double *[3], kokkos_layout, kokkos_device > View
Definition nimble_kokkos_defs.h:250
Kokkos::View< double *[NUM_NODES_IN_HEX][3], kokkos_layout, kokkos_device > GatheredView
Definition nimble_kokkos_defs.h:252
Field(View const &v)
Definition nimble_kokkos_defs.h:260
View data() const noexcept
Definition nimble_kokkos_defs.h:487
Field(const std::string &name, int num_entries)
Definition nimble_kokkos_defs.h:479
Field(View const &v)
Definition nimble_kokkos_defs.h:484
Kokkos::View< double *[9], kokkos_layout, kokkos_host > View
Definition nimble_kokkos_defs.h:477
View data() const noexcept
Definition nimble_kokkos_defs.h:337
Field(const std::string &name, int num_entries)
Definition nimble_kokkos_defs.h:329
Field(View const &v)
Definition nimble_kokkos_defs.h:334
Kokkos::View< double *[NUM_INTEGRATION_POINTS_IN_HEX][9], kokkos_layout, kokkos_host > View
Definition nimble_kokkos_defs.h:327
View data() const noexcept
Definition nimble_kokkos_defs.h:438
Field(View const &v)
Definition nimble_kokkos_defs.h:435
Kokkos::View< double *, kokkos_host > View
Definition nimble_kokkos_defs.h:429
Field(const std::string &name, int num_entries)
Definition nimble_kokkos_defs.h:431
Kokkos::View< double *, kokkos_host > View
Definition nimble_kokkos_defs.h:177
Field(View const &v)
Definition nimble_kokkos_defs.h:183
Field(const std::string &name, int num_entries)
Definition nimble_kokkos_defs.h:179
View data() const noexcept
Definition nimble_kokkos_defs.h:186
Field(const std::string &name, int num_entries)
Definition nimble_kokkos_defs.h:528
View data() const noexcept
Definition nimble_kokkos_defs.h:536
Kokkos::View< double *[6], kokkos_layout, kokkos_host > View
Definition nimble_kokkos_defs.h:526
Field(View const &v)
Definition nimble_kokkos_defs.h:533
Kokkos::View< double *[NUM_INTEGRATION_POINTS_IN_HEX][6], kokkos_layout, kokkos_host > View
Definition nimble_kokkos_defs.h:277
Field(View const &v)
Definition nimble_kokkos_defs.h:284
View data() const noexcept
Definition nimble_kokkos_defs.h:287
Field(const std::string &name, int num_entries)
Definition nimble_kokkos_defs.h:279
View data() const noexcept
Definition nimble_kokkos_defs.h:236
Field(const std::string &name, int num_entries)
Definition nimble_kokkos_defs.h:229
Field(View const &v)
Definition nimble_kokkos_defs.h:233
Kokkos::View< double *[3], kokkos_layout, kokkos_host > View
Definition nimble_kokkos_defs.h:227
static constexpr int NUM_NODES_IN_HEX
Definition nimble_kokkos_defs.h:161
const std::string & name() const noexcept
Definition nimble_kokkos_defs.h:142
FieldBase(FieldBase &&)=default
virtual ~FieldBase()=default
FieldBase & operator=(FieldBase &&)=default
FieldType type() const noexcept
Definition nimble_kokkos_defs.h:136
FieldBase & operator=(const FieldBase &)=default
FieldBase(const FieldBase &)=default
FieldBase(const std::string &arg_name, const FieldType arg_type)
Definition nimble_kokkos_defs.h:147
static constexpr int NUM_INTEGRATION_POINTS_IN_HEX
Definition nimble_kokkos_defs.h:162
Definition nimble_kokkos_defs.h:170
Definition nimble_contact_manager.h:68
Field< FieldType::HostScalarElem >::View HostScalarElemView
Definition nimble_kokkos_defs.h:574
Field< FieldType::HostFullTensorElem >::View HostFullTensorElemView
Definition nimble_kokkos_defs.h:575
Field< FieldType::DeviceScalarElem >::SingleEntryView DeviceScalarElemSingleEntryView
Definition nimble_kokkos_defs.h:601
Field< FieldType::DeviceScalarElem >::View DeviceScalarElemView
Definition nimble_kokkos_defs.h:600
Field< FieldType::DeviceFullTensorIntPt >::SubView DeviceFullTensorIntPtSubView
Definition nimble_kokkos_defs.h:589
Kokkos::Device< kokkos_device_execution_space, kokkos_device_memory_space > kokkos_device
Definition nimble_kokkos_defs.h:84
std::ostream & operator<<(std::ostream &out, const FieldType f)
Definition nimble_kokkos_defs.h:109
Field< FieldType::DeviceSymTensorElem >::SingleEntryView DeviceSymTensorElemSingleEntryView
Definition nimble_kokkos_defs.h:605
Field< FieldType::DeviceFullTensorElem >::SingleEntryView DeviceFullTensorElemSingleEntryView
Definition nimble_kokkos_defs.h:603
Field< FieldType::DeviceSymTensorIntPt >::SingleEntryView DeviceSymTensorIntPtSingleEntryView
Definition nimble_kokkos_defs.h:593
Kokkos::Device< kokkos_host_execution_space, kokkos_host_mirror_memory_space > kokkos_host
Definition nimble_kokkos_defs.h:65
Field< FieldType::HostScalarNode >::View HostScalarNodeView
Definition nimble_kokkos_defs.h:570
Field< FieldType::HostVectorNode >::View HostVectorNodeView
Definition nimble_kokkos_defs.h:571
Field< FieldType::DeviceVectorIntPt >::View DeviceVectorIntPtView
Definition nimble_kokkos_defs.h:597
Field< FieldType::DeviceVectorIntPt >::SubView DeviceVectorIntPtSubView
Definition nimble_kokkos_defs.h:598
Field< FieldType::DeviceScalarIntPt >::View DeviceScalarIntPtView
Definition nimble_kokkos_defs.h:594
Field< FieldType::DeviceVectorNode >::View DeviceVectorNodeView
Definition nimble_kokkos_defs.h:585
Field< FieldType::HostSymTensorElem >::View HostSymTensorElemView
Definition nimble_kokkos_defs.h:576
Kokkos::View< int *, kokkos_host > HostElementConnectivityView
Definition nimble_kokkos_defs.h:578
Kokkos::Serial::execution_space kokkos_device_execution_space
Definition nimble_kokkos_defs.h:81
Field< FieldType::DeviceVectorIntPt >::SingleEntryView DeviceVectorIntPtSingleEntryView
Definition nimble_kokkos_defs.h:599
Field< FieldType::DeviceSymTensorIntPt >::View DeviceSymTensorIntPtView
Definition nimble_kokkos_defs.h:591
Field< FieldType::DeviceScalarNode >::GatheredView DeviceScalarNodeGatheredView
Definition nimble_kokkos_defs.h:583
kokkos_device_execution_space::array_layout kokkos_layout
Definition nimble_kokkos_defs.h:86
Field< FieldType::HostFullTensorIntPt >::View HostFullTensorIntPtView
Definition nimble_kokkos_defs.h:572
Kokkos::View< int *, kokkos_device > DeviceElementConnectivityView
Definition nimble_kokkos_defs.h:607
Field< FieldType::DeviceVectorNode >::GatheredSubView DeviceVectorNodeGatheredSubView
Definition nimble_kokkos_defs.h:587
Field< FieldType::DeviceScalarNode >::GatheredSubView DeviceScalarNodeGatheredSubView
Definition nimble_kokkos_defs.h:584
Field< FieldType::DeviceFullTensorElem >::View DeviceFullTensorElemView
Definition nimble_kokkos_defs.h:602
Field< FieldType::DeviceSymTensorIntPt >::SubView DeviceSymTensorIntPtSubView
Definition nimble_kokkos_defs.h:592
Field< FieldType::DeviceScalarIntPt >::SubView DeviceScalarIntPtSubView
Definition nimble_kokkos_defs.h:595
Field< FieldType::DeviceScalarNode >::View DeviceScalarNodeView
Definition nimble_kokkos_defs.h:582
Kokkos::Serial::memory_space kokkos_host_mirror_memory_space
Definition nimble_kokkos_defs.h:63
Field< FieldType::DeviceSymTensorElem >::View DeviceSymTensorElemView
Definition nimble_kokkos_defs.h:604
Kokkos::View< int *, kokkos_device > DeviceIntegerArrayView
Definition nimble_kokkos_defs.h:606
FieldType
Definition nimble_kokkos_defs.h:89
@ DeviceFullTensorIntPt
Definition nimble_kokkos_defs.h:97
@ DeviceFullTensorElem
Definition nimble_kokkos_defs.h:105
@ DeviceScalarElem
Definition nimble_kokkos_defs.h:101
@ DeviceSymTensorElem
Definition nimble_kokkos_defs.h:103
@ DeviceScalarIntPt
Definition nimble_kokkos_defs.h:98
@ DeviceScalarNode
Definition nimble_kokkos_defs.h:91
@ HostSymTensorElem
Definition nimble_kokkos_defs.h:102
@ DeviceVectorNode
Definition nimble_kokkos_defs.h:93
@ DeviceSymTensorIntPt
Definition nimble_kokkos_defs.h:95
@ HostScalarNode
Definition nimble_kokkos_defs.h:90
@ HostVectorNode
Definition nimble_kokkos_defs.h:92
@ HostFullTensorElem
Definition nimble_kokkos_defs.h:104
@ HostSymTensorIntPt
Definition nimble_kokkos_defs.h:94
@ HostScalarElem
Definition nimble_kokkos_defs.h:100
@ HostFullTensorIntPt
Definition nimble_kokkos_defs.h:96
@ DeviceVectorIntPt
Definition nimble_kokkos_defs.h:99
Field< FieldType::DeviceScalarIntPt >::SingleEntryView DeviceScalarIntPtSingleEntryView
Definition nimble_kokkos_defs.h:596
Field< FieldType::DeviceFullTensorIntPt >::SingleEntryView DeviceFullTensorIntPtSingleEntryView
Definition nimble_kokkos_defs.h:590
Field< FieldType::DeviceVectorNode >::GatheredView DeviceVectorNodeGatheredView
Definition nimble_kokkos_defs.h:586
Kokkos::Serial::memory_space kokkos_device_memory_space
Definition nimble_kokkos_defs.h:82
Kokkos::View< int *, kokkos_host > HostIntegerArrayView
Definition nimble_kokkos_defs.h:577
Kokkos::Serial::execution_space kokkos_host_execution_space
Definition nimble_kokkos_defs.h:62
Field< FieldType::DeviceFullTensorIntPt >::View DeviceFullTensorIntPtView
Definition nimble_kokkos_defs.h:588
Field< FieldType::HostSymTensorIntPt >::View HostSymTensorIntPtView
Definition nimble_kokkos_defs.h:573