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