xref: /libCEED/rust/libceed-sys/c-src/gallery/scale/ceed-scale-scalar.c (revision becbf5cd1f8a17165b4b35b6aeb0ea66cbe89550)
1*becbf5cdSJeremy L Thompson // Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors.
2*becbf5cdSJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3*becbf5cdSJeremy L Thompson //
4*becbf5cdSJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
5*becbf5cdSJeremy L Thompson //
6*becbf5cdSJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
7*becbf5cdSJeremy L Thompson 
8*becbf5cdSJeremy L Thompson #include <ceed.h>
9*becbf5cdSJeremy L Thompson #include <ceed/backend.h>
10*becbf5cdSJeremy L Thompson #include <ceed/jit-source/gallery/ceed-scale-scalar.h>
11*becbf5cdSJeremy L Thompson #include <string.h>
12*becbf5cdSJeremy L Thompson 
13*becbf5cdSJeremy L Thompson /**
14*becbf5cdSJeremy L Thompson   @brief  Set fields for vector scaling `CeedQFunction` that scales inputs
15*becbf5cdSJeremy L Thompson **/
16*becbf5cdSJeremy L Thompson static int CeedQFunctionInit_ScaleScalar(Ceed ceed, const char *requested, CeedQFunction qf) {
17*becbf5cdSJeremy L Thompson   // Check QFunction name
18*becbf5cdSJeremy L Thompson   const char *name = "Scale (scalar)";
19*becbf5cdSJeremy L Thompson   CeedCheck(!strcmp(name, requested), ceed, CEED_ERROR_UNSUPPORTED, "QFunction '%s' does not match requested name: %s", name, requested);
20*becbf5cdSJeremy L Thompson 
21*becbf5cdSJeremy L Thompson   // QFunction fields 'input' and 'output' with requested emodes added by the library rather than being added here
22*becbf5cdSJeremy L Thompson   return CEED_ERROR_SUCCESS;
23*becbf5cdSJeremy L Thompson }
24*becbf5cdSJeremy L Thompson 
25*becbf5cdSJeremy L Thompson /**
26*becbf5cdSJeremy L Thompson   @brief Register scaling `CeedQFunction`
27*becbf5cdSJeremy L Thompson **/
28*becbf5cdSJeremy L Thompson CEED_INTERN int CeedQFunctionRegister_ScaleScalar(void) {
29*becbf5cdSJeremy L Thompson   return CeedQFunctionRegister("Scale (scalar)", ScaleScalar_loc, 1, ScaleScalar, CeedQFunctionInit_ScaleScalar);
30*becbf5cdSJeremy L Thompson }
31