Intrepid2
Intrepid2_OrientationOperator.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Intrepid2 Package
4//
5// Copyright 2007 NTESS and the Intrepid2 contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
15#ifndef __INTREPID2_ORIENTATION_OPERATOR_HPP__
16#define __INTREPID2_ORIENTATION_OPERATOR_HPP__
17
18#include "Intrepid2_ConfigDefs.hpp"
19#include "Intrepid2_Types.hpp"
20#include "Intrepid2_Utils.hpp"
21
22#include "Shards_CellTopology.hpp"
23
24namespace Intrepid2 {
25
37 template<class DeviceType>
39 public:
40 template<class ValueType>
41 struct RawView1D {
42 ValueType* ptr;
43 size_type extent0;
44
45 KOKKOS_INLINE_FUNCTION
46 RawView1D()
47 : ptr(nullptr), extent0(0)
48 {}
49
50 KOKKOS_INLINE_FUNCTION
51 RawView1D(ValueType* ptr_, const size_type extent0_)
52 : ptr(ptr_), extent0(extent0_)
53 {}
54
55 KOKKOS_INLINE_FUNCTION
56 ValueType& operator()(const ordinal_type i) const {
57 return ptr[i];
58 }
59
60 KOKKOS_INLINE_FUNCTION
61 ValueType& operator[](const ordinal_type i) const {
62 return ptr[i];
63 }
64
65 KOKKOS_INLINE_FUNCTION
66 ordinal_type extent_int(const ordinal_type i) const {
67 return (i == 0) ? static_cast<ordinal_type>(extent0) : 1;
68 }
69
70 KOKKOS_INLINE_FUNCTION
71 size_type extent(const ordinal_type i) const {
72 return (i == 0) ? extent0 : 1;
73 }
74
75 KOKKOS_INLINE_FUNCTION
76 ValueType* data() const {
77 return ptr;
78 }
79 };
80
83
84 // only stores deviations from the identity
85 UnmanagedOrdinalView rowIndices; // index in basis (the field ordinal)
86 UnmanagedOrdinalView offsetsForRowOrdinal; // argument is same as _rowIndices; offset gives index for _packedColumnIndices and _packedWeights
87 UnmanagedOrdinalView packedColumnIndices; // ordinal is the index from offsets
88 UnmanagedDoubleView packedWeights; // ordinal is the index from offsets
89
90 // offsetsForRowOrdinal may be empty; if it is, isPermutation is set to true; otherwise it is false
91 // if isWeightedPermutation is true, the offsets are all unit-spaced (0,1,…), and packedColumnIndices and packedWeights have the same length as rowIndices
92 bool isWeightedPermutation;
93 public:
95 KOKKOS_INLINE_FUNCTION
97 UnmanagedOrdinalView offsetsForRowOrdinal_,
98 UnmanagedOrdinalView packedColumnIndices_,
99 UnmanagedDoubleView packedWeights_);
100
102 KOKKOS_INLINE_FUNCTION
104 UnmanagedOrdinalView packedColumnIndices_,
105 UnmanagedDoubleView packedWeights_);
106
107 KOKKOS_INLINE_FUNCTION
109 };
110}
111
112// include templated function definitions
114
115#endif
Definition file for the Intrepid2::OrientationOperator class.
Contains definitions of custom data types in Intrepid2.
Header function for Intrepid2::Util class and other utility functions.
KOKKOS_INLINE_FUNCTION OrientationOperator(UnmanagedOrdinalView rowIndices_, UnmanagedOrdinalView packedColumnIndices_, UnmanagedDoubleView packedWeights_)
weighted-permutation constructor. Sets isWeightedPermutation to true.
KOKKOS_INLINE_FUNCTION OrientationOperator(UnmanagedOrdinalView rowIndices_, UnmanagedOrdinalView offsetsForRowOrdinal_, UnmanagedOrdinalView packedColumnIndices_, UnmanagedDoubleView packedWeights_)
general constructor. Sets isWeightedPermutation to false.