13d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 23d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 321617c04Sjeremylt // 43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause 521617c04Sjeremylt // 63d8e8822SJeremy L Thompson // This file is part of CEED: http://github.com/ceed 721617c04Sjeremylt 849aac155SJeremy L Thompson #include <ceed.h> 9ec3da8bcSJed Brown #include <ceed/backend.h> 103d576824SJeremy L Thompson #include <stdbool.h> 11fcbe8c06SSebastian Grimberg #include <stdlib.h> 123d576824SJeremy L Thompson #include <string.h> 132b730f8bSJeremy L Thompson 1421617c04Sjeremylt #include "ceed-ref.h" 1521617c04Sjeremylt 16f10650afSjeremylt //------------------------------------------------------------------------------ 17f10650afSjeremylt // Core ElemRestriction Apply Code 18f10650afSjeremylt //------------------------------------------------------------------------------ 19ad70ee2cSJeremy L Thompson static inline int CeedElemRestrictionApplyStridedNoTranspose_Ref_Core(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, 2094648b7dSSebastian Grimberg CeedInt start, CeedInt stop, CeedInt num_elem, CeedInt elem_size, 2194648b7dSSebastian Grimberg CeedInt v_offset, const CeedScalar *uu, CeedScalar *vv) { 2294648b7dSSebastian Grimberg // No offsets provided, identity restriction 23d1d35e2fSjeremylt bool has_backend_strides; 24ad70ee2cSJeremy L Thompson 252b730f8bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionHasBackendStrides(r, &has_backend_strides)); 26d1d35e2fSjeremylt if (has_backend_strides) { 27d1d35e2fSjeremylt // CPU backend strides are {1, elem_size, elem_size*num_comp} 287f90ec76Sjeremylt // This if branch is left separate to allow better inlining 29ad70ee2cSJeremy L Thompson for (CeedInt e = start * block_size; e < stop * block_size; e += block_size) { 302b730f8bSJeremy L Thompson CeedPragmaSIMD for (CeedInt k = 0; k < num_comp; k++) { 312b730f8bSJeremy L Thompson CeedPragmaSIMD for (CeedInt n = 0; n < elem_size; n++) { 32ad70ee2cSJeremy L Thompson CeedPragmaSIMD for (CeedInt j = 0; j < block_size; j++) { 33ad70ee2cSJeremy L Thompson vv[e * elem_size * num_comp + (k * elem_size + n) * block_size + j - v_offset] = 342b730f8bSJeremy L Thompson uu[n + k * elem_size + CeedIntMin(e + j, num_elem - 1) * elem_size * num_comp]; 352b730f8bSJeremy L Thompson } 362b730f8bSJeremy L Thompson } 372b730f8bSJeremy L Thompson } 382b730f8bSJeremy L Thompson } 397f90ec76Sjeremylt } else { 407f90ec76Sjeremylt // User provided strides 417f90ec76Sjeremylt CeedInt strides[3]; 42ad70ee2cSJeremy L Thompson 432b730f8bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetStrides(r, &strides)); 44ad70ee2cSJeremy L Thompson for (CeedInt e = start * block_size; e < stop * block_size; e += block_size) { 452b730f8bSJeremy L Thompson CeedPragmaSIMD for (CeedInt k = 0; k < num_comp; k++) { 462b730f8bSJeremy L Thompson CeedPragmaSIMD for (CeedInt n = 0; n < elem_size; n++) { 47ad70ee2cSJeremy L Thompson CeedPragmaSIMD for (CeedInt j = 0; j < block_size; j++) { 48ad70ee2cSJeremy L Thompson vv[e * elem_size * num_comp + (k * elem_size + n) * block_size + j - v_offset] = 492b730f8bSJeremy L Thompson uu[n * strides[0] + k * strides[1] + CeedIntMin(e + j, num_elem - 1) * strides[2]]; 502b730f8bSJeremy L Thompson } 512b730f8bSJeremy L Thompson } 522b730f8bSJeremy L Thompson } 532b730f8bSJeremy L Thompson } 547509a596Sjeremylt } 5594648b7dSSebastian Grimberg return CEED_ERROR_SUCCESS; 5694648b7dSSebastian Grimberg } 5794648b7dSSebastian Grimberg 58ad70ee2cSJeremy L Thompson static inline int CeedElemRestrictionApplyStandardNoTranspose_Ref_Core(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, 5994648b7dSSebastian Grimberg const CeedInt comp_stride, CeedInt start, CeedInt stop, CeedInt num_elem, 6094648b7dSSebastian Grimberg CeedInt elem_size, CeedInt v_offset, const CeedScalar *uu, CeedScalar *vv) { 61fcbe8c06SSebastian Grimberg // Default restriction with offsets 6294648b7dSSebastian Grimberg CeedElemRestriction_Ref *impl; 63ad70ee2cSJeremy L Thompson 6494648b7dSSebastian Grimberg CeedCallBackend(CeedElemRestrictionGetData(r, &impl)); 65ad70ee2cSJeremy L Thompson for (CeedInt e = start * block_size; e < stop * block_size; e += block_size) { 662b730f8bSJeremy L Thompson CeedPragmaSIMD for (CeedInt k = 0; k < num_comp; k++) { 67ad70ee2cSJeremy L Thompson CeedPragmaSIMD for (CeedInt i = 0; i < elem_size * block_size; i++) { 68ad70ee2cSJeremy L Thompson vv[elem_size * (k * block_size + e * num_comp) + i - v_offset] = uu[impl->offsets[i + e * elem_size] + k * comp_stride]; 69fcbe8c06SSebastian Grimberg } 70fcbe8c06SSebastian Grimberg } 71fcbe8c06SSebastian Grimberg } 7294648b7dSSebastian Grimberg return CEED_ERROR_SUCCESS; 7394648b7dSSebastian Grimberg } 7494648b7dSSebastian Grimberg 75ad70ee2cSJeremy L Thompson static inline int CeedElemRestrictionApplyOrientedNoTranspose_Ref_Core(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, 7694648b7dSSebastian Grimberg const CeedInt comp_stride, CeedInt start, CeedInt stop, CeedInt num_elem, 7794648b7dSSebastian Grimberg CeedInt elem_size, CeedInt v_offset, const CeedScalar *uu, CeedScalar *vv) { 78fcbe8c06SSebastian Grimberg // Restriction with orientations 7994648b7dSSebastian Grimberg CeedElemRestriction_Ref *impl; 80ad70ee2cSJeremy L Thompson 8194648b7dSSebastian Grimberg CeedCallBackend(CeedElemRestrictionGetData(r, &impl)); 82ad70ee2cSJeremy L Thompson for (CeedInt e = start * block_size; e < stop * block_size; e += block_size) { 83fcbe8c06SSebastian Grimberg CeedPragmaSIMD for (CeedInt k = 0; k < num_comp; k++) { 84ad70ee2cSJeremy L Thompson CeedPragmaSIMD for (CeedInt i = 0; i < elem_size * block_size; i++) { 85ad70ee2cSJeremy L Thompson vv[elem_size * (k * block_size + e * num_comp) + i - v_offset] = 867c1dbaffSSebastian Grimberg uu[impl->offsets[i + e * elem_size] + k * comp_stride] * (impl->orients[i + e * elem_size] ? -1.0 : 1.0); 87fcbe8c06SSebastian Grimberg } 88fcbe8c06SSebastian Grimberg } 89fcbe8c06SSebastian Grimberg } 9094648b7dSSebastian Grimberg return CEED_ERROR_SUCCESS; 9194648b7dSSebastian Grimberg } 9294648b7dSSebastian Grimberg 93ad70ee2cSJeremy L Thompson static inline int CeedElemRestrictionApplyCurlOrientedNoTranspose_Ref_Core(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, 9494648b7dSSebastian Grimberg const CeedInt comp_stride, CeedInt start, CeedInt stop, CeedInt num_elem, 9594648b7dSSebastian Grimberg CeedInt elem_size, CeedInt v_offset, const CeedScalar *uu, 9694648b7dSSebastian Grimberg CeedScalar *vv) { 9777d1c127SSebastian Grimberg // Restriction with tridiagonal transformation 9894648b7dSSebastian Grimberg CeedElemRestriction_Ref *impl; 99ad70ee2cSJeremy L Thompson 10094648b7dSSebastian Grimberg CeedCallBackend(CeedElemRestrictionGetData(r, &impl)); 101ad70ee2cSJeremy L Thompson for (CeedInt e = start * block_size; e < stop * block_size; e += block_size) { 102fcbe8c06SSebastian Grimberg CeedPragmaSIMD for (CeedInt k = 0; k < num_comp; k++) { 1030c73c039SSebastian Grimberg CeedInt n = 0; 104ad70ee2cSJeremy L Thompson CeedPragmaSIMD for (CeedInt j = 0; j < block_size; j++) { 105ad70ee2cSJeremy L Thompson vv[e * elem_size * num_comp + (k * elem_size + n) * block_size + j - v_offset] = 106ad70ee2cSJeremy L Thompson uu[impl->offsets[j + n * block_size + e * elem_size] + k * comp_stride] * 107ad70ee2cSJeremy L Thompson impl->curl_orients[j + (3 * n + 1) * block_size + e * 3 * elem_size] + 108ad70ee2cSJeremy L Thompson uu[impl->offsets[j + (n + 1) * block_size + e * elem_size] + k * comp_stride] * 109ad70ee2cSJeremy L Thompson impl->curl_orients[j + (3 * n + 2) * block_size + e * 3 * elem_size]; 1100c73c039SSebastian Grimberg } 1110c73c039SSebastian Grimberg for (n = 1; n < elem_size - 1; n++) { 112ad70ee2cSJeremy L Thompson CeedPragmaSIMD for (CeedInt j = 0; j < block_size; j++) { 113ad70ee2cSJeremy L Thompson vv[e * elem_size * num_comp + (k * elem_size + n) * block_size + j - v_offset] = 114ad70ee2cSJeremy L Thompson uu[impl->offsets[j + (n - 1) * block_size + e * elem_size] + k * comp_stride] * 115ad70ee2cSJeremy L Thompson impl->curl_orients[j + (3 * n + 0) * block_size + e * 3 * elem_size] + 116ad70ee2cSJeremy L Thompson uu[impl->offsets[j + n * block_size + e * elem_size] + k * comp_stride] * 117ad70ee2cSJeremy L Thompson impl->curl_orients[j + (3 * n + 1) * block_size + e * 3 * elem_size] + 118ad70ee2cSJeremy L Thompson uu[impl->offsets[j + (n + 1) * block_size + e * elem_size] + k * comp_stride] * 119ad70ee2cSJeremy L Thompson impl->curl_orients[j + (3 * n + 2) * block_size + e * 3 * elem_size]; 1200c73c039SSebastian Grimberg } 1210c73c039SSebastian Grimberg } 122ad70ee2cSJeremy L Thompson CeedPragmaSIMD for (CeedInt j = 0; j < block_size; j++) { 123ad70ee2cSJeremy L Thompson vv[e * elem_size * num_comp + (k * elem_size + n) * block_size + j - v_offset] = 124ad70ee2cSJeremy L Thompson uu[impl->offsets[j + (n - 1) * block_size + e * elem_size] + k * comp_stride] * 125ad70ee2cSJeremy L Thompson impl->curl_orients[j + (3 * n + 0) * block_size + e * 3 * elem_size] + 126ad70ee2cSJeremy L Thompson uu[impl->offsets[j + n * block_size + e * elem_size] + k * comp_stride] * 127ad70ee2cSJeremy L Thompson impl->curl_orients[j + (3 * n + 1) * block_size + e * 3 * elem_size]; 1282b730f8bSJeremy L Thompson } 1292b730f8bSJeremy L Thompson } 1302b730f8bSJeremy L Thompson } 1310c73c039SSebastian Grimberg return CEED_ERROR_SUCCESS; 132fcbe8c06SSebastian Grimberg } 1330c73c039SSebastian Grimberg 13494648b7dSSebastian Grimberg static inline int CeedElemRestrictionApplyCurlOrientedUnsignedNoTranspose_Ref_Core(CeedElemRestriction r, const CeedInt num_comp, 135ad70ee2cSJeremy L Thompson const CeedInt block_size, const CeedInt comp_stride, CeedInt start, 13694648b7dSSebastian Grimberg CeedInt stop, CeedInt num_elem, CeedInt elem_size, 13794648b7dSSebastian Grimberg CeedInt v_offset, const CeedScalar *uu, CeedScalar *vv) { 13894648b7dSSebastian Grimberg // Restriction with (unsigned) tridiagonal transformation 1390c73c039SSebastian Grimberg CeedElemRestriction_Ref *impl; 140ad70ee2cSJeremy L Thompson 1410c73c039SSebastian Grimberg CeedCallBackend(CeedElemRestrictionGetData(r, &impl)); 142ad70ee2cSJeremy L Thompson for (CeedInt e = start * block_size; e < stop * block_size; e += block_size) { 1437c1dbaffSSebastian Grimberg CeedPragmaSIMD for (CeedInt k = 0; k < num_comp; k++) { 1447c1dbaffSSebastian Grimberg CeedInt n = 0; 145ad70ee2cSJeremy L Thompson 146ad70ee2cSJeremy L Thompson CeedPragmaSIMD for (CeedInt j = 0; j < block_size; j++) { 147ad70ee2cSJeremy L Thompson vv[e * elem_size * num_comp + (k * elem_size + n) * block_size + j - v_offset] = 148ad70ee2cSJeremy L Thompson uu[impl->offsets[j + n * block_size + e * elem_size] + k * comp_stride] * 149ad70ee2cSJeremy L Thompson abs(impl->curl_orients[j + (3 * n + 1) * block_size + e * 3 * elem_size]) + 150ad70ee2cSJeremy L Thompson uu[impl->offsets[j + (n + 1) * block_size + e * elem_size] + k * comp_stride] * 151ad70ee2cSJeremy L Thompson abs(impl->curl_orients[j + (3 * n + 2) * block_size + e * 3 * elem_size]); 1527c1dbaffSSebastian Grimberg } 1537c1dbaffSSebastian Grimberg for (n = 1; n < elem_size - 1; n++) { 154ad70ee2cSJeremy L Thompson CeedPragmaSIMD for (CeedInt j = 0; j < block_size; j++) { 155ad70ee2cSJeremy L Thompson vv[e * elem_size * num_comp + (k * elem_size + n) * block_size + j - v_offset] = 156ad70ee2cSJeremy L Thompson uu[impl->offsets[j + (n - 1) * block_size + e * elem_size] + k * comp_stride] * 157ad70ee2cSJeremy L Thompson abs(impl->curl_orients[j + (3 * n + 0) * block_size + e * 3 * elem_size]) + 158ad70ee2cSJeremy L Thompson uu[impl->offsets[j + n * block_size + e * elem_size] + k * comp_stride] * 159ad70ee2cSJeremy L Thompson abs(impl->curl_orients[j + (3 * n + 1) * block_size + e * 3 * elem_size]) + 160ad70ee2cSJeremy L Thompson uu[impl->offsets[j + (n + 1) * block_size + e * elem_size] + k * comp_stride] * 161ad70ee2cSJeremy L Thompson abs(impl->curl_orients[j + (3 * n + 2) * block_size + e * 3 * elem_size]); 1627c1dbaffSSebastian Grimberg } 1637c1dbaffSSebastian Grimberg } 164ad70ee2cSJeremy L Thompson CeedPragmaSIMD for (CeedInt j = 0; j < block_size; j++) { 165ad70ee2cSJeremy L Thompson vv[e * elem_size * num_comp + (k * elem_size + n) * block_size + j - v_offset] = 166ad70ee2cSJeremy L Thompson uu[impl->offsets[j + (n - 1) * block_size + e * elem_size] + k * comp_stride] * 167ad70ee2cSJeremy L Thompson abs(impl->curl_orients[j + (3 * n + 0) * block_size + e * 3 * elem_size]) + 168ad70ee2cSJeremy L Thompson uu[impl->offsets[j + n * block_size + e * elem_size] + k * comp_stride] * 169ad70ee2cSJeremy L Thompson abs(impl->curl_orients[j + (3 * n + 1) * block_size + e * 3 * elem_size]); 1707c1dbaffSSebastian Grimberg } 1717c1dbaffSSebastian Grimberg } 1727c1dbaffSSebastian Grimberg } 1737c1dbaffSSebastian Grimberg return CEED_ERROR_SUCCESS; 1747c1dbaffSSebastian Grimberg } 1757c1dbaffSSebastian Grimberg 176ad70ee2cSJeremy L Thompson static inline int CeedElemRestrictionApplyStridedTranspose_Ref_Core(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, 17794648b7dSSebastian Grimberg CeedInt start, CeedInt stop, CeedInt num_elem, CeedInt elem_size, 17894648b7dSSebastian Grimberg CeedInt v_offset, const CeedScalar *uu, CeedScalar *vv) { 17994648b7dSSebastian Grimberg // No offsets provided, identity restriction 180d1d35e2fSjeremylt bool has_backend_strides; 181ad70ee2cSJeremy L Thompson 1822b730f8bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionHasBackendStrides(r, &has_backend_strides)); 183d1d35e2fSjeremylt if (has_backend_strides) { 184d1d35e2fSjeremylt // CPU backend strides are {1, elem_size, elem_size*num_comp} 1857f90ec76Sjeremylt // This if brach is left separate to allow better inlining 186ad70ee2cSJeremy L Thompson for (CeedInt e = start * block_size; e < stop * block_size; e += block_size) { 1872b730f8bSJeremy L Thompson CeedPragmaSIMD for (CeedInt k = 0; k < num_comp; k++) { 1882b730f8bSJeremy L Thompson CeedPragmaSIMD for (CeedInt n = 0; n < elem_size; n++) { 189ad70ee2cSJeremy L Thompson CeedPragmaSIMD for (CeedInt j = 0; j < CeedIntMin(block_size, num_elem - e); j++) { 190ad70ee2cSJeremy L Thompson vv[n + k * elem_size + (e + j) * elem_size * num_comp] += uu[e * elem_size * num_comp + (k * elem_size + n) * block_size + j - v_offset]; 1912b730f8bSJeremy L Thompson } 1922b730f8bSJeremy L Thompson } 1932b730f8bSJeremy L Thompson } 1942b730f8bSJeremy L Thompson } 1957f90ec76Sjeremylt } else { 1967f90ec76Sjeremylt // User provided strides 1977f90ec76Sjeremylt CeedInt strides[3]; 198ad70ee2cSJeremy L Thompson 1992b730f8bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetStrides(r, &strides)); 200ad70ee2cSJeremy L Thompson for (CeedInt e = start * block_size; e < stop * block_size; e += block_size) { 2012b730f8bSJeremy L Thompson CeedPragmaSIMD for (CeedInt k = 0; k < num_comp; k++) { 2022b730f8bSJeremy L Thompson CeedPragmaSIMD for (CeedInt n = 0; n < elem_size; n++) { 203ad70ee2cSJeremy L Thompson CeedPragmaSIMD for (CeedInt j = 0; j < CeedIntMin(block_size, num_elem - e); j++) { 2042b730f8bSJeremy L Thompson vv[n * strides[0] + k * strides[1] + (e + j) * strides[2]] += 205ad70ee2cSJeremy L Thompson uu[e * elem_size * num_comp + (k * elem_size + n) * block_size + j - v_offset]; 2062b730f8bSJeremy L Thompson } 2072b730f8bSJeremy L Thompson } 2082b730f8bSJeremy L Thompson } 2092b730f8bSJeremy L Thompson } 210523b8ea0Sjeremylt } 21194648b7dSSebastian Grimberg return CEED_ERROR_SUCCESS; 21294648b7dSSebastian Grimberg } 21394648b7dSSebastian Grimberg 214ad70ee2cSJeremy L Thompson static inline int CeedElemRestrictionApplyStandardTranspose_Ref_Core(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, 21594648b7dSSebastian Grimberg const CeedInt comp_stride, CeedInt start, CeedInt stop, CeedInt num_elem, 21694648b7dSSebastian Grimberg CeedInt elem_size, CeedInt v_offset, const CeedScalar *uu, CeedScalar *vv) { 217fcbe8c06SSebastian Grimberg // Default restriction with offsets 21894648b7dSSebastian Grimberg CeedElemRestriction_Ref *impl; 219ad70ee2cSJeremy L Thompson 22094648b7dSSebastian Grimberg CeedCallBackend(CeedElemRestrictionGetData(r, &impl)); 221ad70ee2cSJeremy L Thompson for (CeedInt e = start * block_size; e < stop * block_size; e += block_size) { 2222b730f8bSJeremy L Thompson for (CeedInt k = 0; k < num_comp; k++) { 223ad70ee2cSJeremy L Thompson for (CeedInt i = 0; i < elem_size * block_size; i += block_size) { 2248d94b059Sjeremylt // Iteration bound set to discard padding elements 225ad70ee2cSJeremy L Thompson for (CeedInt j = i; j < i + CeedIntMin(block_size, num_elem - e); j++) { 226ad70ee2cSJeremy L Thompson vv[impl->offsets[j + e * elem_size] + k * comp_stride] += uu[elem_size * (k * block_size + e * num_comp) + j - v_offset]; 227fcbe8c06SSebastian Grimberg } 228fcbe8c06SSebastian Grimberg } 229fcbe8c06SSebastian Grimberg } 230fcbe8c06SSebastian Grimberg } 23194648b7dSSebastian Grimberg return CEED_ERROR_SUCCESS; 23294648b7dSSebastian Grimberg } 23394648b7dSSebastian Grimberg 234ad70ee2cSJeremy L Thompson static inline int CeedElemRestrictionApplyOrientedTranspose_Ref_Core(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, 23594648b7dSSebastian Grimberg const CeedInt comp_stride, CeedInt start, CeedInt stop, CeedInt num_elem, 23694648b7dSSebastian Grimberg CeedInt elem_size, CeedInt v_offset, const CeedScalar *uu, CeedScalar *vv) { 237fcbe8c06SSebastian Grimberg // Restriction with orientations 23894648b7dSSebastian Grimberg CeedElemRestriction_Ref *impl; 239ad70ee2cSJeremy L Thompson 24094648b7dSSebastian Grimberg CeedCallBackend(CeedElemRestrictionGetData(r, &impl)); 241ad70ee2cSJeremy L Thompson for (CeedInt e = start * block_size; e < stop * block_size; e += block_size) { 242fcbe8c06SSebastian Grimberg for (CeedInt k = 0; k < num_comp; k++) { 243ad70ee2cSJeremy L Thompson for (CeedInt i = 0; i < elem_size * block_size; i += block_size) { 244fcbe8c06SSebastian Grimberg // Iteration bound set to discard padding elements 245ad70ee2cSJeremy L Thompson for (CeedInt j = i; j < i + CeedIntMin(block_size, num_elem - e); j++) { 246f30b1135SSebastian Grimberg vv[impl->offsets[j + e * elem_size] + k * comp_stride] += 247ad70ee2cSJeremy L Thompson uu[elem_size * (k * block_size + e * num_comp) + j - v_offset] * (impl->orients[j + e * elem_size] ? -1.0 : 1.0); 248fcbe8c06SSebastian Grimberg } 249fcbe8c06SSebastian Grimberg } 250fcbe8c06SSebastian Grimberg } 251fcbe8c06SSebastian Grimberg } 25294648b7dSSebastian Grimberg return CEED_ERROR_SUCCESS; 25394648b7dSSebastian Grimberg } 25494648b7dSSebastian Grimberg 255ad70ee2cSJeremy L Thompson static inline int CeedElemRestrictionApplyCurlOrientedTranspose_Ref_Core(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, 25694648b7dSSebastian Grimberg const CeedInt comp_stride, CeedInt start, CeedInt stop, CeedInt num_elem, 25794648b7dSSebastian Grimberg CeedInt elem_size, CeedInt v_offset, const CeedScalar *uu, CeedScalar *vv) { 25877d1c127SSebastian Grimberg // Restriction with tridiagonal transformation 25994648b7dSSebastian Grimberg CeedElemRestriction_Ref *impl; 260ad70ee2cSJeremy L Thompson 26194648b7dSSebastian Grimberg CeedCallBackend(CeedElemRestrictionGetData(r, &impl)); 262ad70ee2cSJeremy L Thompson for (CeedInt e = start * block_size; e < stop * block_size; e += block_size) { 263fcbe8c06SSebastian Grimberg for (CeedInt k = 0; k < num_comp; k++) { 264fcbe8c06SSebastian Grimberg // Iteration bound set to discard padding elements 265ad70ee2cSJeremy L Thompson CeedInt block_end = CeedIntMin(block_size, num_elem - e), n = 0; 266ad70ee2cSJeremy L Thompson for (CeedInt j = 0; j < block_end; j++) { 267ad70ee2cSJeremy L Thompson vv[impl->offsets[j + n * block_size + e * elem_size] + k * comp_stride] += 268ad70ee2cSJeremy L Thompson uu[e * elem_size * num_comp + (k * elem_size + n) * block_size + j - v_offset] * 269ad70ee2cSJeremy L Thompson impl->curl_orients[j + (3 * n + 1) * block_size + e * 3 * elem_size] + 270ad70ee2cSJeremy L Thompson uu[e * elem_size * num_comp + (k * elem_size + n + 1) * block_size + j - v_offset] * 271ad70ee2cSJeremy L Thompson impl->curl_orients[j + (3 * n + 3) * block_size + e * 3 * elem_size]; 2720c73c039SSebastian Grimberg } 2730c73c039SSebastian Grimberg for (n = 1; n < elem_size - 1; n++) { 274ad70ee2cSJeremy L Thompson for (CeedInt j = 0; j < block_end; j++) { 275ad70ee2cSJeremy L Thompson vv[impl->offsets[j + n * block_size + e * elem_size] + k * comp_stride] += 276ad70ee2cSJeremy L Thompson uu[e * elem_size * num_comp + (k * elem_size + n - 1) * block_size + j - v_offset] * 277ad70ee2cSJeremy L Thompson impl->curl_orients[j + (3 * n - 1) * block_size + e * 3 * elem_size] + 278ad70ee2cSJeremy L Thompson uu[e * elem_size * num_comp + (k * elem_size + n) * block_size + j - v_offset] * 279ad70ee2cSJeremy L Thompson impl->curl_orients[j + (3 * n + 1) * block_size + e * 3 * elem_size] + 280ad70ee2cSJeremy L Thompson uu[e * elem_size * num_comp + (k * elem_size + n + 1) * block_size + j - v_offset] * 281ad70ee2cSJeremy L Thompson impl->curl_orients[j + (3 * n + 3) * block_size + e * 3 * elem_size]; 2820c73c039SSebastian Grimberg } 2830c73c039SSebastian Grimberg } 284ad70ee2cSJeremy L Thompson for (CeedInt j = 0; j < block_end; j++) { 285ad70ee2cSJeremy L Thompson vv[impl->offsets[j + n * block_size + e * elem_size] + k * comp_stride] += 286ad70ee2cSJeremy L Thompson uu[e * elem_size * num_comp + (k * elem_size + n - 1) * block_size + j - v_offset] * 287ad70ee2cSJeremy L Thompson impl->curl_orients[j + (3 * n - 1) * block_size + e * 3 * elem_size] + 288ad70ee2cSJeremy L Thompson uu[e * elem_size * num_comp + (k * elem_size + n) * block_size + j - v_offset] * 289ad70ee2cSJeremy L Thompson impl->curl_orients[j + (3 * n + 1) * block_size + e * 3 * elem_size]; 29021617c04Sjeremylt } 291b435c5a6Srezgarshakeri } 2922b730f8bSJeremy L Thompson } 293e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 29421617c04Sjeremylt } 29521617c04Sjeremylt 29694648b7dSSebastian Grimberg static inline int CeedElemRestrictionApplyCurlOrientedUnsignedTranspose_Ref_Core(CeedElemRestriction r, const CeedInt num_comp, 297ad70ee2cSJeremy L Thompson const CeedInt block_size, const CeedInt comp_stride, CeedInt start, 29894648b7dSSebastian Grimberg CeedInt stop, CeedInt num_elem, CeedInt elem_size, CeedInt v_offset, 29994648b7dSSebastian Grimberg const CeedScalar *uu, CeedScalar *vv) { 30094648b7dSSebastian Grimberg // Restriction with (unsigned) tridiagonal transformation 3017c1dbaffSSebastian Grimberg CeedElemRestriction_Ref *impl; 302ad70ee2cSJeremy L Thompson 3037c1dbaffSSebastian Grimberg CeedCallBackend(CeedElemRestrictionGetData(r, &impl)); 304ad70ee2cSJeremy L Thompson for (CeedInt e = start * block_size; e < stop * block_size; e += block_size) { 3057c1dbaffSSebastian Grimberg for (CeedInt k = 0; k < num_comp; k++) { 3067c1dbaffSSebastian Grimberg // Iteration bound set to discard padding elements 307ad70ee2cSJeremy L Thompson CeedInt n = 0; 308ad70ee2cSJeremy L Thompson const CeedInt block_end = CeedIntMin(block_size, num_elem - e); 309ad70ee2cSJeremy L Thompson 310ad70ee2cSJeremy L Thompson for (CeedInt j = 0; j < block_end; j++) { 311ad70ee2cSJeremy L Thompson vv[impl->offsets[j + n * block_size + e * elem_size] + k * comp_stride] += 312ad70ee2cSJeremy L Thompson uu[e * elem_size * num_comp + (k * elem_size + n) * block_size + j - v_offset] * 313ad70ee2cSJeremy L Thompson abs(impl->curl_orients[j + (3 * n + 1) * block_size + e * 3 * elem_size]) + 314ad70ee2cSJeremy L Thompson uu[e * elem_size * num_comp + (k * elem_size + n + 1) * block_size + j - v_offset] * 315ad70ee2cSJeremy L Thompson abs(impl->curl_orients[j + (3 * n + 3) * block_size + e * 3 * elem_size]); 3167c1dbaffSSebastian Grimberg } 3177c1dbaffSSebastian Grimberg for (n = 1; n < elem_size - 1; n++) { 318ad70ee2cSJeremy L Thompson for (CeedInt j = 0; j < block_end; j++) { 319ad70ee2cSJeremy L Thompson vv[impl->offsets[j + n * block_size + e * elem_size] + k * comp_stride] += 320ad70ee2cSJeremy L Thompson uu[e * elem_size * num_comp + (k * elem_size + n - 1) * block_size + j - v_offset] * 321ad70ee2cSJeremy L Thompson abs(impl->curl_orients[j + (3 * n - 1) * block_size + e * 3 * elem_size]) + 322ad70ee2cSJeremy L Thompson uu[e * elem_size * num_comp + (k * elem_size + n) * block_size + j - v_offset] * 323ad70ee2cSJeremy L Thompson abs(impl->curl_orients[j + (3 * n + 1) * block_size + e * 3 * elem_size]) + 324ad70ee2cSJeremy L Thompson uu[e * elem_size * num_comp + (k * elem_size + n + 1) * block_size + j - v_offset] * 325ad70ee2cSJeremy L Thompson abs(impl->curl_orients[j + (3 * n + 3) * block_size + e * 3 * elem_size]); 3267c1dbaffSSebastian Grimberg } 3277c1dbaffSSebastian Grimberg } 328ad70ee2cSJeremy L Thompson for (CeedInt j = 0; j < block_end; j++) { 329ad70ee2cSJeremy L Thompson vv[impl->offsets[j + n * block_size + e * elem_size] + k * comp_stride] += 330ad70ee2cSJeremy L Thompson uu[e * elem_size * num_comp + (k * elem_size + n - 1) * block_size + j - v_offset] * 331ad70ee2cSJeremy L Thompson abs(impl->curl_orients[j + (3 * n - 1) * block_size + e * 3 * elem_size]) + 332ad70ee2cSJeremy L Thompson uu[e * elem_size * num_comp + (k * elem_size + n) * block_size + j - v_offset] * 333ad70ee2cSJeremy L Thompson abs(impl->curl_orients[j + (3 * n + 1) * block_size + e * 3 * elem_size]); 3347c1dbaffSSebastian Grimberg } 3357c1dbaffSSebastian Grimberg } 3367c1dbaffSSebastian Grimberg } 3377c1dbaffSSebastian Grimberg return CEED_ERROR_SUCCESS; 3387c1dbaffSSebastian Grimberg } 3397c1dbaffSSebastian Grimberg 340ad70ee2cSJeremy L Thompson static inline int CeedElemRestrictionApply_Ref_Core(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, 341ad70ee2cSJeremy L Thompson const CeedInt comp_stride, CeedInt start, CeedInt stop, CeedTransposeMode t_mode, bool use_signs, 342ad70ee2cSJeremy L Thompson bool use_orients, CeedVector u, CeedVector v, CeedRequest *request) { 343ad70ee2cSJeremy L Thompson CeedInt num_elem, elem_size, v_offset; 344ad70ee2cSJeremy L Thompson CeedRestrictionType rstr_type; 3457c1dbaffSSebastian Grimberg const CeedScalar *uu; 3467c1dbaffSSebastian Grimberg CeedScalar *vv; 347ad70ee2cSJeremy L Thompson 3487c1dbaffSSebastian Grimberg CeedCallBackend(CeedElemRestrictionGetNumElements(r, &num_elem)); 3497c1dbaffSSebastian Grimberg CeedCallBackend(CeedElemRestrictionGetElementSize(r, &elem_size)); 350ad70ee2cSJeremy L Thompson v_offset = start * block_size * elem_size * num_comp; 3517c1dbaffSSebastian Grimberg CeedCallBackend(CeedElemRestrictionGetType(r, &rstr_type)); 35294648b7dSSebastian Grimberg CeedCallBackend(CeedVectorGetArrayRead(u, CEED_MEM_HOST, &uu)); 353ad70ee2cSJeremy L Thompson 35494648b7dSSebastian Grimberg if (t_mode == CEED_TRANSPOSE) { 35594648b7dSSebastian Grimberg // Sum into for transpose mode, E-vector to L-vector 35694648b7dSSebastian Grimberg CeedCallBackend(CeedVectorGetArray(v, CEED_MEM_HOST, &vv)); 35794648b7dSSebastian Grimberg } else { 35894648b7dSSebastian Grimberg // Overwrite for notranspose mode, L-vector to E-vector 35994648b7dSSebastian Grimberg CeedCallBackend(CeedVectorGetArrayWrite(v, CEED_MEM_HOST, &vv)); 36094648b7dSSebastian Grimberg } 36194648b7dSSebastian Grimberg if (t_mode == CEED_TRANSPOSE) { 3627c1dbaffSSebastian Grimberg // Restriction from E-vector to L-vector 3637c1dbaffSSebastian Grimberg // Performing v += r^T * u 3647c1dbaffSSebastian Grimberg // uu has shape [elem_size, num_comp, num_elem], row-major 3657c1dbaffSSebastian Grimberg // vv has shape [nnodes, num_comp] 3667c1dbaffSSebastian Grimberg // Sum into for transpose mode 3677c1dbaffSSebastian Grimberg switch (rstr_type) { 3687c1dbaffSSebastian Grimberg case CEED_RESTRICTION_STRIDED: 369*5d10938bSJeremy L Thompson CeedCallBackend( 370*5d10938bSJeremy L Thompson CeedElemRestrictionApplyStridedTranspose_Ref_Core(r, num_comp, block_size, start, stop, num_elem, elem_size, v_offset, uu, vv)); 37194648b7dSSebastian Grimberg break; 37261a27d74SSebastian Grimberg case CEED_RESTRICTION_STANDARD: 373*5d10938bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionApplyStandardTranspose_Ref_Core(r, num_comp, block_size, comp_stride, start, stop, num_elem, elem_size, 374*5d10938bSJeremy L Thompson v_offset, uu, vv)); 37594648b7dSSebastian Grimberg break; 3767c1dbaffSSebastian Grimberg case CEED_RESTRICTION_ORIENTED: 37794648b7dSSebastian Grimberg if (use_signs) { 378*5d10938bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionApplyOrientedTranspose_Ref_Core(r, num_comp, block_size, comp_stride, start, stop, num_elem, elem_size, 379*5d10938bSJeremy L Thompson v_offset, uu, vv)); 38094648b7dSSebastian Grimberg } else { 381*5d10938bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionApplyStandardTranspose_Ref_Core(r, num_comp, block_size, comp_stride, start, stop, num_elem, elem_size, 382*5d10938bSJeremy L Thompson v_offset, uu, vv)); 38394648b7dSSebastian Grimberg } 38494648b7dSSebastian Grimberg break; 38594648b7dSSebastian Grimberg case CEED_RESTRICTION_CURL_ORIENTED: 38694648b7dSSebastian Grimberg if (use_signs && use_orients) { 387*5d10938bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionApplyCurlOrientedTranspose_Ref_Core(r, num_comp, block_size, comp_stride, start, stop, num_elem, 388*5d10938bSJeremy L Thompson elem_size, v_offset, uu, vv)); 38994648b7dSSebastian Grimberg } else if (use_orients) { 390*5d10938bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionApplyCurlOrientedUnsignedTranspose_Ref_Core(r, num_comp, block_size, comp_stride, start, stop, num_elem, 391*5d10938bSJeremy L Thompson elem_size, v_offset, uu, vv)); 39294648b7dSSebastian Grimberg } else { 393*5d10938bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionApplyStandardTranspose_Ref_Core(r, num_comp, block_size, comp_stride, start, stop, num_elem, elem_size, 394*5d10938bSJeremy L Thompson v_offset, uu, vv)); 39594648b7dSSebastian Grimberg } 39694648b7dSSebastian Grimberg break; 39794648b7dSSebastian Grimberg } 39894648b7dSSebastian Grimberg } else { 39994648b7dSSebastian Grimberg // Restriction from L-vector to E-vector 40094648b7dSSebastian Grimberg // Perform: v = r * u 40194648b7dSSebastian Grimberg // vv has shape [elem_size, num_comp, num_elem], row-major 40294648b7dSSebastian Grimberg // uu has shape [nnodes, num_comp] 40394648b7dSSebastian Grimberg // Overwrite for notranspose mode 40494648b7dSSebastian Grimberg switch (rstr_type) { 40594648b7dSSebastian Grimberg case CEED_RESTRICTION_STRIDED: 406*5d10938bSJeremy L Thompson CeedCallBackend( 407*5d10938bSJeremy L Thompson CeedElemRestrictionApplyStridedNoTranspose_Ref_Core(r, num_comp, block_size, start, stop, num_elem, elem_size, v_offset, uu, vv)); 40894648b7dSSebastian Grimberg break; 40961a27d74SSebastian Grimberg case CEED_RESTRICTION_STANDARD: 410*5d10938bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionApplyStandardNoTranspose_Ref_Core(r, num_comp, block_size, comp_stride, start, stop, num_elem, elem_size, 411*5d10938bSJeremy L Thompson v_offset, uu, vv)); 41294648b7dSSebastian Grimberg break; 41394648b7dSSebastian Grimberg case CEED_RESTRICTION_ORIENTED: 41494648b7dSSebastian Grimberg if (use_signs) { 415*5d10938bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionApplyOrientedNoTranspose_Ref_Core(r, num_comp, block_size, comp_stride, start, stop, num_elem, elem_size, 416*5d10938bSJeremy L Thompson v_offset, uu, vv)); 41794648b7dSSebastian Grimberg } else { 418*5d10938bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionApplyStandardNoTranspose_Ref_Core(r, num_comp, block_size, comp_stride, start, stop, num_elem, elem_size, 419*5d10938bSJeremy L Thompson v_offset, uu, vv)); 42094648b7dSSebastian Grimberg } 42194648b7dSSebastian Grimberg break; 42294648b7dSSebastian Grimberg case CEED_RESTRICTION_CURL_ORIENTED: 42394648b7dSSebastian Grimberg if (use_signs && use_orients) { 424*5d10938bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionApplyCurlOrientedNoTranspose_Ref_Core(r, num_comp, block_size, comp_stride, start, stop, num_elem, 425*5d10938bSJeremy L Thompson elem_size, v_offset, uu, vv)); 42694648b7dSSebastian Grimberg } else if (use_orients) { 427*5d10938bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionApplyCurlOrientedUnsignedNoTranspose_Ref_Core(r, num_comp, block_size, comp_stride, start, stop, 428*5d10938bSJeremy L Thompson num_elem, elem_size, v_offset, uu, vv)); 42994648b7dSSebastian Grimberg } else { 430*5d10938bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionApplyStandardNoTranspose_Ref_Core(r, num_comp, block_size, comp_stride, start, stop, num_elem, elem_size, 431*5d10938bSJeremy L Thompson v_offset, uu, vv)); 43294648b7dSSebastian Grimberg } 43394648b7dSSebastian Grimberg break; 43494648b7dSSebastian Grimberg } 4357c1dbaffSSebastian Grimberg } 4367c1dbaffSSebastian Grimberg CeedCallBackend(CeedVectorRestoreArrayRead(u, &uu)); 4377c1dbaffSSebastian Grimberg CeedCallBackend(CeedVectorRestoreArray(v, &vv)); 4387c1dbaffSSebastian Grimberg if (request != CEED_REQUEST_IMMEDIATE && request != CEED_REQUEST_ORDERED) *request = NULL; 4397c1dbaffSSebastian Grimberg return CEED_ERROR_SUCCESS; 4407c1dbaffSSebastian Grimberg } 4417c1dbaffSSebastian Grimberg 4427c1dbaffSSebastian Grimberg //------------------------------------------------------------------------------ 443f10650afSjeremylt // ElemRestriction Apply - Common Sizes 444f10650afSjeremylt //------------------------------------------------------------------------------ 445ad70ee2cSJeremy L Thompson static int CeedElemRestrictionApply_Ref_110(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, const CeedInt comp_stride, 4467c1dbaffSSebastian Grimberg CeedInt start, CeedInt stop, CeedTransposeMode t_mode, bool use_signs, bool use_orients, CeedVector u, 4477c1dbaffSSebastian Grimberg CeedVector v, CeedRequest *request) { 4487c1dbaffSSebastian Grimberg return CeedElemRestrictionApply_Ref_Core(r, 1, 1, comp_stride, start, stop, t_mode, use_signs, use_orients, u, v, request); 449d979a051Sjeremylt } 450d979a051Sjeremylt 451ad70ee2cSJeremy L Thompson static int CeedElemRestrictionApply_Ref_111(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, const CeedInt comp_stride, 4527c1dbaffSSebastian Grimberg CeedInt start, CeedInt stop, CeedTransposeMode t_mode, bool use_signs, bool use_orients, CeedVector u, 4537c1dbaffSSebastian Grimberg CeedVector v, CeedRequest *request) { 4547c1dbaffSSebastian Grimberg return CeedElemRestrictionApply_Ref_Core(r, 1, 1, 1, start, stop, t_mode, use_signs, use_orients, u, v, request); 4554d2a38eeSjeremylt } 4564d2a38eeSjeremylt 457ad70ee2cSJeremy L Thompson static int CeedElemRestrictionApply_Ref_180(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, const CeedInt comp_stride, 4587c1dbaffSSebastian Grimberg CeedInt start, CeedInt stop, CeedTransposeMode t_mode, bool use_signs, bool use_orients, CeedVector u, 4597c1dbaffSSebastian Grimberg CeedVector v, CeedRequest *request) { 4607c1dbaffSSebastian Grimberg return CeedElemRestrictionApply_Ref_Core(r, 1, 8, comp_stride, start, stop, t_mode, use_signs, use_orients, u, v, request); 4619c36149bSjeremylt } 4629c36149bSjeremylt 463ad70ee2cSJeremy L Thompson static int CeedElemRestrictionApply_Ref_181(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, const CeedInt comp_stride, 4647c1dbaffSSebastian Grimberg CeedInt start, CeedInt stop, CeedTransposeMode t_mode, bool use_signs, bool use_orients, CeedVector u, 4657c1dbaffSSebastian Grimberg CeedVector v, CeedRequest *request) { 4667c1dbaffSSebastian Grimberg return CeedElemRestrictionApply_Ref_Core(r, 1, 8, 1, start, stop, t_mode, use_signs, use_orients, u, v, request); 4679c36149bSjeremylt } 4689c36149bSjeremylt 469ad70ee2cSJeremy L Thompson static int CeedElemRestrictionApply_Ref_310(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, const CeedInt comp_stride, 4707c1dbaffSSebastian Grimberg CeedInt start, CeedInt stop, CeedTransposeMode t_mode, bool use_signs, bool use_orients, CeedVector u, 4717c1dbaffSSebastian Grimberg CeedVector v, CeedRequest *request) { 4727c1dbaffSSebastian Grimberg return CeedElemRestrictionApply_Ref_Core(r, 3, 1, comp_stride, start, stop, t_mode, use_signs, use_orients, u, v, request); 473d979a051Sjeremylt } 474d979a051Sjeremylt 475ad70ee2cSJeremy L Thompson static int CeedElemRestrictionApply_Ref_311(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, const CeedInt comp_stride, 4767c1dbaffSSebastian Grimberg CeedInt start, CeedInt stop, CeedTransposeMode t_mode, bool use_signs, bool use_orients, CeedVector u, 4777c1dbaffSSebastian Grimberg CeedVector v, CeedRequest *request) { 4787c1dbaffSSebastian Grimberg return CeedElemRestrictionApply_Ref_Core(r, 3, 1, 1, start, stop, t_mode, use_signs, use_orients, u, v, request); 479d979a051Sjeremylt } 480d979a051Sjeremylt 481ad70ee2cSJeremy L Thompson static int CeedElemRestrictionApply_Ref_380(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, const CeedInt comp_stride, 4827c1dbaffSSebastian Grimberg CeedInt start, CeedInt stop, CeedTransposeMode t_mode, bool use_signs, bool use_orients, CeedVector u, 4837c1dbaffSSebastian Grimberg CeedVector v, CeedRequest *request) { 4847c1dbaffSSebastian Grimberg return CeedElemRestrictionApply_Ref_Core(r, 3, 8, comp_stride, start, stop, t_mode, use_signs, use_orients, u, v, request); 485d979a051Sjeremylt } 486d979a051Sjeremylt 487ad70ee2cSJeremy L Thompson static int CeedElemRestrictionApply_Ref_381(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, const CeedInt comp_stride, 4887c1dbaffSSebastian Grimberg CeedInt start, CeedInt stop, CeedTransposeMode t_mode, bool use_signs, bool use_orients, CeedVector u, 4897c1dbaffSSebastian Grimberg CeedVector v, CeedRequest *request) { 4907c1dbaffSSebastian Grimberg return CeedElemRestrictionApply_Ref_Core(r, 3, 8, 1, start, stop, t_mode, use_signs, use_orients, u, v, request); 491d979a051Sjeremylt } 492d979a051Sjeremylt 493bf4d1581Sjeremylt // LCOV_EXCL_START 494ad70ee2cSJeremy L Thompson static int CeedElemRestrictionApply_Ref_510(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, const CeedInt comp_stride, 4957c1dbaffSSebastian Grimberg CeedInt start, CeedInt stop, CeedTransposeMode t_mode, bool use_signs, bool use_orients, CeedVector u, 4967c1dbaffSSebastian Grimberg CeedVector v, CeedRequest *request) { 4977c1dbaffSSebastian Grimberg return CeedElemRestrictionApply_Ref_Core(r, 5, 1, comp_stride, start, stop, t_mode, use_signs, use_orients, u, v, request); 498d979a051Sjeremylt } 499bf4d1581Sjeremylt // LCOV_EXCL_STOP 500d979a051Sjeremylt 501ad70ee2cSJeremy L Thompson static int CeedElemRestrictionApply_Ref_511(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, const CeedInt comp_stride, 5027c1dbaffSSebastian Grimberg CeedInt start, CeedInt stop, CeedTransposeMode t_mode, bool use_signs, bool use_orients, CeedVector u, 5037c1dbaffSSebastian Grimberg CeedVector v, CeedRequest *request) { 5047c1dbaffSSebastian Grimberg return CeedElemRestrictionApply_Ref_Core(r, 5, 1, 1, start, stop, t_mode, use_signs, use_orients, u, v, request); 505d979a051Sjeremylt } 506d979a051Sjeremylt 507bf4d1581Sjeremylt // LCOV_EXCL_START 508ad70ee2cSJeremy L Thompson static int CeedElemRestrictionApply_Ref_580(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, const CeedInt comp_stride, 5097c1dbaffSSebastian Grimberg CeedInt start, CeedInt stop, CeedTransposeMode t_mode, bool use_signs, bool use_orients, CeedVector u, 5107c1dbaffSSebastian Grimberg CeedVector v, CeedRequest *request) { 5117c1dbaffSSebastian Grimberg return CeedElemRestrictionApply_Ref_Core(r, 5, 8, comp_stride, start, stop, t_mode, use_signs, use_orients, u, v, request); 512d979a051Sjeremylt } 513bf4d1581Sjeremylt // LCOV_EXCL_STOP 514d979a051Sjeremylt 515ad70ee2cSJeremy L Thompson static int CeedElemRestrictionApply_Ref_581(CeedElemRestriction r, const CeedInt num_comp, const CeedInt block_size, const CeedInt comp_stride, 5167c1dbaffSSebastian Grimberg CeedInt start, CeedInt stop, CeedTransposeMode t_mode, bool use_signs, bool use_orients, CeedVector u, 5170c73c039SSebastian Grimberg CeedVector v, CeedRequest *request) { 5187c1dbaffSSebastian Grimberg return CeedElemRestrictionApply_Ref_Core(r, 5, 8, 1, start, stop, t_mode, use_signs, use_orients, u, v, request); 5194d2a38eeSjeremylt } 5204d2a38eeSjeremylt 521f10650afSjeremylt //------------------------------------------------------------------------------ 522f10650afSjeremylt // ElemRestriction Apply 523f10650afSjeremylt //------------------------------------------------------------------------------ 5242b730f8bSJeremy L Thompson static int CeedElemRestrictionApply_Ref(CeedElemRestriction r, CeedTransposeMode t_mode, CeedVector u, CeedVector v, CeedRequest *request) { 525ad70ee2cSJeremy L Thompson CeedInt num_block, block_size, num_comp, comp_stride; 526ad70ee2cSJeremy L Thompson CeedElemRestriction_Ref *impl; 527ad70ee2cSJeremy L Thompson 528ad70ee2cSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetNumBlocks(r, &num_block)); 529ad70ee2cSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetBlockSize(r, &block_size)); 5302b730f8bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetNumComponents(r, &num_comp)); 5312b730f8bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetCompStride(r, &comp_stride)); 5322b730f8bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetData(r, &impl)); 533*5d10938bSJeremy L Thompson CeedCallBackend(impl->Apply(r, num_comp, block_size, comp_stride, 0, num_block, t_mode, true, true, u, v, request)); 534*5d10938bSJeremy L Thompson return CEED_ERROR_SUCCESS; 535f30b1135SSebastian Grimberg } 536f30b1135SSebastian Grimberg 537f30b1135SSebastian Grimberg //------------------------------------------------------------------------------ 538f30b1135SSebastian Grimberg // ElemRestriction Apply Unsigned 539f30b1135SSebastian Grimberg //------------------------------------------------------------------------------ 540f30b1135SSebastian Grimberg static int CeedElemRestrictionApplyUnsigned_Ref(CeedElemRestriction r, CeedTransposeMode t_mode, CeedVector u, CeedVector v, CeedRequest *request) { 541ad70ee2cSJeremy L Thompson CeedInt num_block, block_size, num_comp, comp_stride; 542ad70ee2cSJeremy L Thompson CeedElemRestriction_Ref *impl; 543ad70ee2cSJeremy L Thompson 544ad70ee2cSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetNumBlocks(r, &num_block)); 545ad70ee2cSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetBlockSize(r, &block_size)); 546f30b1135SSebastian Grimberg CeedCallBackend(CeedElemRestrictionGetNumComponents(r, &num_comp)); 547f30b1135SSebastian Grimberg CeedCallBackend(CeedElemRestrictionGetCompStride(r, &comp_stride)); 548f30b1135SSebastian Grimberg CeedCallBackend(CeedElemRestrictionGetData(r, &impl)); 549*5d10938bSJeremy L Thompson CeedCallBackend(impl->Apply(r, num_comp, block_size, comp_stride, 0, num_block, t_mode, false, true, u, v, request)); 550*5d10938bSJeremy L Thompson return CEED_ERROR_SUCCESS; 5517c1dbaffSSebastian Grimberg } 5527c1dbaffSSebastian Grimberg 5537c1dbaffSSebastian Grimberg //------------------------------------------------------------------------------ 5547c1dbaffSSebastian Grimberg // ElemRestriction Apply Unoriented 5557c1dbaffSSebastian Grimberg //------------------------------------------------------------------------------ 5567c1dbaffSSebastian Grimberg static int CeedElemRestrictionApplyUnoriented_Ref(CeedElemRestriction r, CeedTransposeMode t_mode, CeedVector u, CeedVector v, CeedRequest *request) { 557ad70ee2cSJeremy L Thompson CeedInt num_block, block_size, num_comp, comp_stride; 558ad70ee2cSJeremy L Thompson CeedElemRestriction_Ref *impl; 559ad70ee2cSJeremy L Thompson 560ad70ee2cSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetNumBlocks(r, &num_block)); 561ad70ee2cSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetBlockSize(r, &block_size)); 5627c1dbaffSSebastian Grimberg CeedCallBackend(CeedElemRestrictionGetNumComponents(r, &num_comp)); 5637c1dbaffSSebastian Grimberg CeedCallBackend(CeedElemRestrictionGetCompStride(r, &comp_stride)); 5647c1dbaffSSebastian Grimberg CeedCallBackend(CeedElemRestrictionGetData(r, &impl)); 565*5d10938bSJeremy L Thompson CeedCallBackend(impl->Apply(r, num_comp, block_size, comp_stride, 0, num_block, t_mode, false, false, u, v, request)); 566*5d10938bSJeremy L Thompson return CEED_ERROR_SUCCESS; 5679c36149bSjeremylt } 568be9261b7Sjeremylt 569f10650afSjeremylt //------------------------------------------------------------------------------ 570f10650afSjeremylt // ElemRestriction Apply Block 571f10650afSjeremylt //------------------------------------------------------------------------------ 5722b730f8bSJeremy L Thompson static int CeedElemRestrictionApplyBlock_Ref(CeedElemRestriction r, CeedInt block, CeedTransposeMode t_mode, CeedVector u, CeedVector v, 573074cb416Sjeremylt CeedRequest *request) { 574ad70ee2cSJeremy L Thompson CeedInt block_size, num_comp, comp_stride; 575ad70ee2cSJeremy L Thompson CeedElemRestriction_Ref *impl; 576ad70ee2cSJeremy L Thompson 577ad70ee2cSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetBlockSize(r, &block_size)); 5782b730f8bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetNumComponents(r, &num_comp)); 5792b730f8bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetCompStride(r, &comp_stride)); 5802b730f8bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetData(r, &impl)); 581*5d10938bSJeremy L Thompson CeedCallBackend(impl->Apply(r, num_comp, block_size, comp_stride, block, block + 1, t_mode, true, true, u, v, request)); 582*5d10938bSJeremy L Thompson return CEED_ERROR_SUCCESS; 5839c36149bSjeremylt } 584be9261b7Sjeremylt 585f10650afSjeremylt //------------------------------------------------------------------------------ 586bd33150aSjeremylt // ElemRestriction Get Offsets 587bd33150aSjeremylt //------------------------------------------------------------------------------ 5882b730f8bSJeremy L Thompson static int CeedElemRestrictionGetOffsets_Ref(CeedElemRestriction rstr, CeedMemType mem_type, const CeedInt **offsets) { 589bd33150aSjeremylt Ceed ceed; 590ad70ee2cSJeremy L Thompson CeedElemRestriction_Ref *impl; 591ad70ee2cSJeremy L Thompson 592ad70ee2cSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetData(rstr, &impl)); 5932b730f8bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetCeed(rstr, &ceed)); 594bd33150aSjeremylt 5956574a04fSJeremy L Thompson CeedCheck(mem_type == CEED_MEM_HOST, ceed, CEED_ERROR_BACKEND, "Can only provide to HOST memory"); 596bd33150aSjeremylt 597bd33150aSjeremylt *offsets = impl->offsets; 598e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 599bd33150aSjeremylt } 600bd33150aSjeremylt 601bd33150aSjeremylt //------------------------------------------------------------------------------ 60277d1c127SSebastian Grimberg // ElemRestriction Get Orientations 60377d1c127SSebastian Grimberg //------------------------------------------------------------------------------ 60477d1c127SSebastian Grimberg static int CeedElemRestrictionGetOrientations_Ref(CeedElemRestriction rstr, CeedMemType mem_type, const bool **orients) { 60577d1c127SSebastian Grimberg Ceed ceed; 606ad70ee2cSJeremy L Thompson CeedElemRestriction_Ref *impl; 607ad70ee2cSJeremy L Thompson 608ad70ee2cSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetData(rstr, &impl)); 60977d1c127SSebastian Grimberg CeedCallBackend(CeedElemRestrictionGetCeed(rstr, &ceed)); 61077d1c127SSebastian Grimberg 611fcbe8c06SSebastian Grimberg CeedCheck(mem_type == CEED_MEM_HOST, ceed, CEED_ERROR_BACKEND, "Can only provide to HOST memory"); 61277d1c127SSebastian Grimberg 61377d1c127SSebastian Grimberg *orients = impl->orients; 61477d1c127SSebastian Grimberg return CEED_ERROR_SUCCESS; 61577d1c127SSebastian Grimberg } 61677d1c127SSebastian Grimberg 61777d1c127SSebastian Grimberg //------------------------------------------------------------------------------ 61877d1c127SSebastian Grimberg // ElemRestriction Get Curl-Conforming Orientations 61977d1c127SSebastian Grimberg //------------------------------------------------------------------------------ 6200c73c039SSebastian Grimberg static int CeedElemRestrictionGetCurlOrientations_Ref(CeedElemRestriction rstr, CeedMemType mem_type, const CeedInt8 **curl_orients) { 62177d1c127SSebastian Grimberg Ceed ceed; 622ad70ee2cSJeremy L Thompson CeedElemRestriction_Ref *impl; 623ad70ee2cSJeremy L Thompson 624ad70ee2cSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetData(rstr, &impl)); 62577d1c127SSebastian Grimberg CeedCallBackend(CeedElemRestrictionGetCeed(rstr, &ceed)); 62677d1c127SSebastian Grimberg 627fcbe8c06SSebastian Grimberg CeedCheck(mem_type == CEED_MEM_HOST, ceed, CEED_ERROR_BACKEND, "Can only provide to HOST memory"); 62877d1c127SSebastian Grimberg 62977d1c127SSebastian Grimberg *curl_orients = impl->curl_orients; 63077d1c127SSebastian Grimberg return CEED_ERROR_SUCCESS; 63177d1c127SSebastian Grimberg } 63277d1c127SSebastian Grimberg 63377d1c127SSebastian Grimberg //------------------------------------------------------------------------------ 634f10650afSjeremylt // ElemRestriction Destroy 635f10650afSjeremylt //------------------------------------------------------------------------------ 63621617c04Sjeremylt static int CeedElemRestrictionDestroy_Ref(CeedElemRestriction r) { 637fe2413ffSjeremylt CeedElemRestriction_Ref *impl; 63821617c04Sjeremylt 639ad70ee2cSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetData(r, &impl)); 6402b730f8bSJeremy L Thompson CeedCallBackend(CeedFree(&impl->offsets_allocated)); 64177d1c127SSebastian Grimberg CeedCallBackend(CeedFree(&impl->orients_allocated)); 64277d1c127SSebastian Grimberg CeedCallBackend(CeedFree(&impl->curl_orients_allocated)); 6432b730f8bSJeremy L Thompson CeedCallBackend(CeedFree(&impl)); 644e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 64521617c04Sjeremylt } 64621617c04Sjeremylt 647f10650afSjeremylt //------------------------------------------------------------------------------ 648f10650afSjeremylt // ElemRestriction Create 649f10650afSjeremylt //------------------------------------------------------------------------------ 650fcbe8c06SSebastian Grimberg int CeedElemRestrictionCreate_Ref(CeedMemType mem_type, CeedCopyMode copy_mode, const CeedInt *offsets, const bool *orients, 6510c73c039SSebastian Grimberg const CeedInt8 *curl_orients, CeedElemRestriction r) { 652ad70ee2cSJeremy L Thompson Ceed ceed; 653ad70ee2cSJeremy L Thompson CeedInt num_elem, elem_size, num_block, block_size, num_comp, comp_stride; 654ad70ee2cSJeremy L Thompson CeedRestrictionType rstr_type; 65521617c04Sjeremylt CeedElemRestriction_Ref *impl; 656ad70ee2cSJeremy L Thompson 657ad70ee2cSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetCeed(r, &ceed)); 6582b730f8bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetNumElements(r, &num_elem)); 6592b730f8bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetElementSize(r, &elem_size)); 660ad70ee2cSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetNumBlocks(r, &num_block)); 661ad70ee2cSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetBlockSize(r, &block_size)); 6622b730f8bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetNumComponents(r, &num_comp)); 6632b730f8bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetCompStride(r, &comp_stride)); 664ad70ee2cSJeremy L Thompson CeedInt layout[3] = {1, elem_size, elem_size * num_comp}; 66521617c04Sjeremylt 6666574a04fSJeremy L Thompson CeedCheck(mem_type == CEED_MEM_HOST, ceed, CEED_ERROR_BACKEND, "Only MemType = HOST supported"); 6672b730f8bSJeremy L Thompson CeedCallBackend(CeedCalloc(1, &impl)); 6683661185eSjeremylt 66992fe105eSJeremy L Thompson // Offsets data 670fcbe8c06SSebastian Grimberg CeedCallBackend(CeedElemRestrictionGetType(r, &rstr_type)); 671fcbe8c06SSebastian Grimberg if (rstr_type != CEED_RESTRICTION_STRIDED) { 6723661185eSjeremylt const char *resource; 673ad70ee2cSJeremy L Thompson 674ad70ee2cSJeremy L Thompson // Check indices for ref or memcheck backends 675ad70ee2cSJeremy L Thompson CeedCallBackend(CeedGetResource(ceed, &resource)); 6762b730f8bSJeremy L Thompson if (!strcmp(resource, "/cpu/self/ref/serial") || !strcmp(resource, "/cpu/self/ref/blocked") || !strcmp(resource, "/cpu/self/memcheck/serial") || 677d1d35e2fSjeremylt !strcmp(resource, "/cpu/self/memcheck/blocked")) { 678e79b91d9SJeremy L Thompson CeedSize l_size; 6793661185eSjeremylt 680ad70ee2cSJeremy L Thompson CeedCallBackend(CeedElemRestrictionGetLVectorSize(r, &l_size)); 6812b730f8bSJeremy L Thompson for (CeedInt i = 0; i < num_elem * elem_size; i++) { 6826574a04fSJeremy L Thompson CeedCheck(offsets[i] >= 0 && offsets[i] + (num_comp - 1) * comp_stride < l_size, ceed, CEED_ERROR_BACKEND, 6836574a04fSJeremy L Thompson "Restriction offset %" CeedInt_FMT " (%" CeedInt_FMT ") out of range [0, %" CeedInt_FMT "]", i, offsets[i], l_size); 6842b730f8bSJeremy L Thompson } 6852b730f8bSJeremy L Thompson } 6863661185eSjeremylt 68792fe105eSJeremy L Thompson // Copy data 688d1d35e2fSjeremylt switch (copy_mode) { 68921617c04Sjeremylt case CEED_COPY_VALUES: 6902b730f8bSJeremy L Thompson CeedCallBackend(CeedMalloc(num_elem * elem_size, &impl->offsets_allocated)); 6912b730f8bSJeremy L Thompson memcpy(impl->offsets_allocated, offsets, num_elem * elem_size * sizeof(offsets[0])); 692d979a051Sjeremylt impl->offsets = impl->offsets_allocated; 69321617c04Sjeremylt break; 69421617c04Sjeremylt case CEED_OWN_POINTER: 695d979a051Sjeremylt impl->offsets_allocated = (CeedInt *)offsets; 696d979a051Sjeremylt impl->offsets = impl->offsets_allocated; 69721617c04Sjeremylt break; 69821617c04Sjeremylt case CEED_USE_POINTER: 699d979a051Sjeremylt impl->offsets = offsets; 70021617c04Sjeremylt } 701fcbe8c06SSebastian Grimberg 702fcbe8c06SSebastian Grimberg // Orientation data 703fcbe8c06SSebastian Grimberg if (rstr_type == CEED_RESTRICTION_ORIENTED) { 7040305e208SSebastian Grimberg CeedCheck(orients != NULL, ceed, CEED_ERROR_BACKEND, "No orients array provided for oriented restriction"); 705fcbe8c06SSebastian Grimberg switch (copy_mode) { 706fcbe8c06SSebastian Grimberg case CEED_COPY_VALUES: 707fcbe8c06SSebastian Grimberg CeedCallBackend(CeedMalloc(num_elem * elem_size, &impl->orients_allocated)); 708fcbe8c06SSebastian Grimberg memcpy(impl->orients_allocated, orients, num_elem * elem_size * sizeof(orients[0])); 709fcbe8c06SSebastian Grimberg impl->orients = impl->orients_allocated; 710fcbe8c06SSebastian Grimberg break; 711fcbe8c06SSebastian Grimberg case CEED_OWN_POINTER: 712fcbe8c06SSebastian Grimberg impl->orients_allocated = (bool *)orients; 713fcbe8c06SSebastian Grimberg impl->orients = impl->orients_allocated; 714fcbe8c06SSebastian Grimberg break; 715fcbe8c06SSebastian Grimberg case CEED_USE_POINTER: 716fcbe8c06SSebastian Grimberg impl->orients = orients; 717fcbe8c06SSebastian Grimberg } 718fcbe8c06SSebastian Grimberg } else if (rstr_type == CEED_RESTRICTION_CURL_ORIENTED) { 7190305e208SSebastian Grimberg CeedCheck(curl_orients != NULL, ceed, CEED_ERROR_BACKEND, "No curl_orients array provided for oriented restriction"); 720fcbe8c06SSebastian Grimberg switch (copy_mode) { 721fcbe8c06SSebastian Grimberg case CEED_COPY_VALUES: 722fcbe8c06SSebastian Grimberg CeedCallBackend(CeedMalloc(num_elem * 3 * elem_size, &impl->curl_orients_allocated)); 723fcbe8c06SSebastian Grimberg memcpy(impl->curl_orients_allocated, curl_orients, num_elem * 3 * elem_size * sizeof(curl_orients[0])); 724fcbe8c06SSebastian Grimberg impl->curl_orients = impl->curl_orients_allocated; 725fcbe8c06SSebastian Grimberg break; 726fcbe8c06SSebastian Grimberg case CEED_OWN_POINTER: 7270c73c039SSebastian Grimberg impl->curl_orients_allocated = (CeedInt8 *)curl_orients; 728fcbe8c06SSebastian Grimberg impl->curl_orients = impl->curl_orients_allocated; 729fcbe8c06SSebastian Grimberg break; 730fcbe8c06SSebastian Grimberg case CEED_USE_POINTER: 731fcbe8c06SSebastian Grimberg impl->curl_orients = curl_orients; 732fcbe8c06SSebastian Grimberg } 733fcbe8c06SSebastian Grimberg } 73492fe105eSJeremy L Thompson } 735fe2413ffSjeremylt 7362b730f8bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionSetData(r, impl)); 7372b730f8bSJeremy L Thompson CeedCallBackend(CeedElemRestrictionSetELayout(r, layout)); 7382b730f8bSJeremy L Thompson CeedCallBackend(CeedSetBackendFunction(ceed, "ElemRestriction", r, "Apply", CeedElemRestrictionApply_Ref)); 739f30b1135SSebastian Grimberg CeedCallBackend(CeedSetBackendFunction(ceed, "ElemRestriction", r, "ApplyUnsigned", CeedElemRestrictionApplyUnsigned_Ref)); 7407c1dbaffSSebastian Grimberg CeedCallBackend(CeedSetBackendFunction(ceed, "ElemRestriction", r, "ApplyUnoriented", CeedElemRestrictionApplyUnoriented_Ref)); 7412b730f8bSJeremy L Thompson CeedCallBackend(CeedSetBackendFunction(ceed, "ElemRestriction", r, "ApplyBlock", CeedElemRestrictionApplyBlock_Ref)); 7422b730f8bSJeremy L Thompson CeedCallBackend(CeedSetBackendFunction(ceed, "ElemRestriction", r, "GetOffsets", CeedElemRestrictionGetOffsets_Ref)); 74377d1c127SSebastian Grimberg CeedCallBackend(CeedSetBackendFunction(ceed, "ElemRestriction", r, "GetOrientations", CeedElemRestrictionGetOrientations_Ref)); 74477d1c127SSebastian Grimberg CeedCallBackend(CeedSetBackendFunction(ceed, "ElemRestriction", r, "GetCurlOrientations", CeedElemRestrictionGetCurlOrientations_Ref)); 7452b730f8bSJeremy L Thompson CeedCallBackend(CeedSetBackendFunction(ceed, "ElemRestriction", r, "Destroy", CeedElemRestrictionDestroy_Ref)); 746d979a051Sjeremylt 747ad70ee2cSJeremy L Thompson // Set apply function based upon num_comp, block_size, and comp_stride 748ad70ee2cSJeremy L Thompson CeedInt index = -1; 749ad70ee2cSJeremy L Thompson 750ad70ee2cSJeremy L Thompson if (block_size < 10) index = 100 * num_comp + 10 * block_size + (comp_stride == 1); 751ad70ee2cSJeremy L Thompson switch (index) { 752d979a051Sjeremylt case 110: 753d979a051Sjeremylt impl->Apply = CeedElemRestrictionApply_Ref_110; 754d979a051Sjeremylt break; 755d979a051Sjeremylt case 111: 756d979a051Sjeremylt impl->Apply = CeedElemRestrictionApply_Ref_111; 757d979a051Sjeremylt break; 758d979a051Sjeremylt case 180: 759d979a051Sjeremylt impl->Apply = CeedElemRestrictionApply_Ref_180; 760d979a051Sjeremylt break; 761d979a051Sjeremylt case 181: 762d979a051Sjeremylt impl->Apply = CeedElemRestrictionApply_Ref_181; 763d979a051Sjeremylt break; 764d979a051Sjeremylt case 310: 765d979a051Sjeremylt impl->Apply = CeedElemRestrictionApply_Ref_310; 766d979a051Sjeremylt break; 767d979a051Sjeremylt case 311: 768d979a051Sjeremylt impl->Apply = CeedElemRestrictionApply_Ref_311; 769d979a051Sjeremylt break; 770d979a051Sjeremylt case 380: 771d979a051Sjeremylt impl->Apply = CeedElemRestrictionApply_Ref_380; 772d979a051Sjeremylt break; 773d979a051Sjeremylt case 381: 774d979a051Sjeremylt impl->Apply = CeedElemRestrictionApply_Ref_381; 775d979a051Sjeremylt break; 776bf4d1581Sjeremylt // LCOV_EXCL_START 777d979a051Sjeremylt case 510: 778d979a051Sjeremylt impl->Apply = CeedElemRestrictionApply_Ref_510; 779d979a051Sjeremylt break; 780bf4d1581Sjeremylt // LCOV_EXCL_STOP 781d979a051Sjeremylt case 511: 782d979a051Sjeremylt impl->Apply = CeedElemRestrictionApply_Ref_511; 783d979a051Sjeremylt break; 784bf4d1581Sjeremylt // LCOV_EXCL_START 785d979a051Sjeremylt case 580: 786d979a051Sjeremylt impl->Apply = CeedElemRestrictionApply_Ref_580; 787d979a051Sjeremylt break; 788bf4d1581Sjeremylt // LCOV_EXCL_STOP 789d979a051Sjeremylt case 581: 790d979a051Sjeremylt impl->Apply = CeedElemRestrictionApply_Ref_581; 791d979a051Sjeremylt break; 792d979a051Sjeremylt default: 793d979a051Sjeremylt impl->Apply = CeedElemRestrictionApply_Ref_Core; 794d979a051Sjeremylt break; 795d979a051Sjeremylt } 796e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 79721617c04Sjeremylt } 798fc0567d9Srezgarshakeri 799fc0567d9Srezgarshakeri //------------------------------------------------------------------------------ 800