xref: /libCEED/rust/libceed-sys/c-src/gallery/scale/ceed-scale.c (revision ea61e9ac44808524e4667c1525a05976f536c19c)
1 // Copyright (c) 2017-2022, 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/backend.h>
9 #include <ceed/ceed.h>
10 #include <ceed/jit-source/gallery/ceed-scale.h>
11 #include <string.h>
12 
13 /**
14   @brief  Set fields for vector scaling QFunction that scales inputs
15 **/
16 static int CeedQFunctionInit_Scale(Ceed ceed, const char *requested, CeedQFunction qf) {
17   // Check QFunction name
18   const char *name = "Scale";
19   if (strcmp(name, requested)) {
20     // LCOV_EXCL_START
21     return CeedError(ceed, CEED_ERROR_UNSUPPORTED, "QFunction '%s' does not match requested name: %s", name, requested);
22     // LCOV_EXCL_STOP
23   }
24 
25   // QFunction fields 'input' and 'output' with requested emodes added by the library rather than being added here
26 
27   return CEED_ERROR_SUCCESS;
28 }
29 
30 /**
31   @brief Register scaling QFunction
32 **/
33 CEED_INTERN int CeedQFunctionRegister_Scale(void) { return CeedQFunctionRegister("Scale", Scale_loc, 1, Scale, CeedQFunctionInit_Scale); }
34