xref: /libCEED/gallery/scale/ceed-scale.c (revision 990fdeb6bb8fc9af2da4472bdc0d1f57da5da0e5)
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/ceed.h>
9 #include <ceed/backend.h>
10 #include <string.h>
11 #include <ceed/jit-source/gallery/ceed-scale.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,
17                                    CeedQFunction qf) {
18   // Check QFunction name
19   const char *name = "Scale";
20   if (strcmp(name, requested))
21     // LCOV_EXCL_START
22     return CeedError(ceed, CEED_ERROR_UNSUPPORTED,
23                      "QFunction '%s' does not match requested name: %s",
24                      name, requested);
25   // LCOV_EXCL_STOP
26 
27   // QFunction fields 'input' and 'output' with requested emodes added
28   //   by the library rather than being added here
29 
30   return CEED_ERROR_SUCCESS;
31 }
32 
33 /**
34   @brief Register scaling QFunction
35 **/
36 CEED_INTERN int CeedQFunctionRegister_Scale(void) {
37   return CeedQFunctionRegister("Scale", Scale_loc, 1, Scale,
38                                CeedQFunctionInit_Scale);
39 }
40