1*0b6847a6SJeremy L Thompson // Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors. 2*0b6847a6SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3*0b6847a6SJeremy L Thompson // 4*0b6847a6SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause 5*0b6847a6SJeremy L Thompson // 6*0b6847a6SJeremy L Thompson // This file is part of CEED: http://github.com/ceed 7*0b6847a6SJeremy L Thompson 8*0b6847a6SJeremy L Thompson #include <ceed.h> 9*0b6847a6SJeremy L Thompson #include <ceed/backend.h> 10*0b6847a6SJeremy L Thompson #include <ceed/jit-source/gallery/ceed-identity-to-scalar.h> 11*0b6847a6SJeremy L Thompson #include <stddef.h> 12*0b6847a6SJeremy L Thompson #include <string.h> 13*0b6847a6SJeremy L Thompson 14*0b6847a6SJeremy L Thompson /** 15*0b6847a6SJeremy L Thompson @brief Set fields identity `CeedQFunction` that copies first input component directly into output 16*0b6847a6SJeremy L Thompson **/ 17*0b6847a6SJeremy L Thompson static int CeedQFunctionInit_IdentityScalar(Ceed ceed, const char *requested, CeedQFunction qf) { 18*0b6847a6SJeremy L Thompson // Check QFunction name 19*0b6847a6SJeremy L Thompson const char *name = "Identity to scalar"; 20*0b6847a6SJeremy L Thompson CeedCheck(!strcmp(name, requested), ceed, CEED_ERROR_UNSUPPORTED, "QFunction '%s' does not match requested name: %s", name, requested); 21*0b6847a6SJeremy L Thompson 22*0b6847a6SJeremy L Thompson // QFunction fields 'input' and 'output' with requested emodes added by the library rather than being added here 23*0b6847a6SJeremy L Thompson 24*0b6847a6SJeremy L Thompson CeedCall(CeedQFunctionSetUserFlopsEstimate(qf, 0)); 25*0b6847a6SJeremy L Thompson return CEED_ERROR_SUCCESS; 26*0b6847a6SJeremy L Thompson } 27*0b6847a6SJeremy L Thompson 28*0b6847a6SJeremy L Thompson /** 29*0b6847a6SJeremy L Thompson @brief Register identity `CeedQFunction` that copies first input component directly into output 30*0b6847a6SJeremy L Thompson **/ 31*0b6847a6SJeremy L Thompson CEED_INTERN int CeedQFunctionRegister_IdentityScalar(void) { 32*0b6847a6SJeremy L Thompson return CeedQFunctionRegister("Identity to scalar", IdentityScalar_loc, 1, IdentityScalar, CeedQFunctionInit_IdentityScalar); 33*0b6847a6SJeremy L Thompson } 34